From bc20063208d69a86ec7f1b0d22e92810a6d649ab Mon Sep 17 00:00:00 2001 From: Menno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:30:54 +0200 Subject: [PATCH 01/99] Add extra data to template --- data/data_template.xlsx | Bin 9609 -> 6070 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/data_template.xlsx b/data/data_template.xlsx index 82273029565ed715158b10feca0ad49bfb07db5f..46dcc71bb74f3ffc0d2f7ee231af94003535d353 100644 GIT binary patch literal 6070 zcmaKQ2Q-}D`t|71MejxsJvtF0qDBp75RBfL(ME3}y69c>=)DsqdW{w(h+d;dCkXy? z^SkSQk$dyKv*w+3%6`^*_Bpf9bGC{C3Mw%G0JsOR*N)c6Nl`DEMYKea0RU_OF+ktJ z6bk2h^shG(fB-RY_bH8Ox9a4^3EcO>TJ^}T@#B$+)$7Tu=WWC|fHLufa55C@oSpIc zRiepLKxO4_Zx3l|W=9Ow%KN^8peK1nwH+4y7t=zQ7bhQD#;=@fJv#bdgsipam&h}J zlfi$mMGKro^6MvI3R@q$kHKKNMjKO^y>-9N$qV~uY}PCqhz62q zXy$mFAv4fbKPcKxb@)Sq-@Bo01!Lw5hRPjYQ0XU08WFiuAprpQ5xkh#8mlP>xx%3Tiyc^mlC{4$fzl9Gyz14EN4(IIXh~YhMy-w@!I=gRgyx4 z^hfszx4B(yZ;;8VZuv~3DwFU@tUbJ3Y$2nVSpct_LNZ8f%=*OlJ^2dnKD7(Edu^~k zo{v3!al^3xzGIAhMI2 zZXB=abug}xgMXSRxR%)GU07#sZ2gv6`ub5!tvxxm;`=tc`4Kt^bxx_{%06#5SKhCP6-zQI1A0Gh|gD;D^&CtG})D ze-%St=yZ9WOY?YhI>bfx$hG8LbE?`ltRJ1rp!$(dmhGFm7NUb2XHOPGF3nT&m32OU z>}>mtB9^u_QE+O0PbSEc2K{8hTGEk?D4Yf#W=$pP|7{>^4$9;S`W z?V-G+RBr6^!Ln8@VbiC5?((OG_KHW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I~CNQ!*0c+*4{f>Q)4QyN4z zhpGt)`0tPx6quSnYbOiRP$I%=Z>DhQt`#32d-A!nxssnm%BL!(-eU!Uy0k&*812C0 z(JVjKC#1o=W%5CaqZ7Tg_yC`UkNaWj1AI@&Ar;%F;r5#8$c)`heO|&E-V{cMnY}tr zZ5S}_fj#-N(V=$liLq*>fVd<2XlvzwK;!HGD}V@yoNzAm@1K+W=N0|u_%9!qXsG<% z!QU6U|6};`SOo82{<7?S*YNJ*-*3}?xFUCFDe$iG-xpDSn*so>@CW_>FR9%1b5~ja z?dcfv{|50VBl^vS?s~Z^BmVZH3TGDZ(cBdk?>e~K@cnkMLio$U@AmJm>0OHZ+mw^^ z57WDZ_pXP#Jn**%WwN_5_*YhV*Wq1S_1obi_{0eh#~o62_xu;hy6g1sMgF%-xNu7e p0Q{rm-!=dH Date: Thu, 16 Feb 2023 06:48:00 +0000 Subject: [PATCH 02/99] Bump werkzeug from 2.2.2 to 2.2.3 Bumps [werkzeug](https://github.com/pallets/werkzeug) from 2.2.2 to 2.2.3. - [Release notes](https://github.com/pallets/werkzeug/releases) - [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/werkzeug/compare/2.2.2...2.2.3) --- updated-dependencies: - dependency-name: werkzeug dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1f58370..cf3db24 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,6 +23,6 @@ gevent==22.8.0 gevent-websocket==0.10.1 greenlet==1.1.3.post0 eventlet==0.33.1 -werkzeug==2.2.2 +werkzeug==2.2.3 SQLAlchemy==1.4.41 lxml==4.9.1 \ No newline at end of file From d2554aee9e73ccb88657844ef1789f345d5d8bd3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 00:14:29 +0000 Subject: [PATCH 03/99] Bump flask from 2.2.2 to 2.3.2 Bumps [flask](https://github.com/pallets/flask) from 2.2.2 to 2.3.2. - [Release notes](https://github.com/pallets/flask/releases) - [Changelog](https://github.com/pallets/flask/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/flask/compare/2.2.2...2.3.2) --- updated-dependencies: - dependency-name: flask dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cf3db24..3a63327 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ azure-core==1.26.0 azure-cosmos==4.3.0 dnspython==2.2.1 et-xmlfile==1.1.0 -Flask==2.2.2 +Flask==2.3.2 Flask-Cors==3.0.10 Flask-Login==0.6.2 Flask-SocketIO==5.3.1 From 18f22d8d2a1da24b9956e4228437f351e130d588 Mon Sep 17 00:00:00 2001 From: Elwin Schmitz Date: Mon, 6 Nov 2023 16:54:30 +0100 Subject: [PATCH 04/99] Create static.yml --- .github/workflows/static.yml | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..a035af4 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,48 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: + # - "main" + - "feature/#5-app-should-work-offline" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + # Upload entire repository + path: './PWA/public/' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 From 3acd0d0114e7acaf0a6a637e500e8210a2b4d4fe Mon Sep 17 00:00:00 2001 From: Elwin Schmitz Date: Mon, 6 Nov 2023 16:57:54 +0100 Subject: [PATCH 05/99] fix: Comment didn't reflect reality --- .github/workflows/static.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index a035af4..57f1fdd 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -40,7 +40,6 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: - # Upload entire repository path: './PWA/public/' - name: Deploy to GitHub Pages From f56862d6b890f1041b309b1a165029d317caa17e Mon Sep 17 00:00:00 2001 From: Jacopo Margutti Date: Mon, 7 Oct 2024 10:46:17 +0200 Subject: [PATCH 06/99] ci: add Azure Static Web Apps workflow file on-behalf-of: @Azure opensource@microsoft.com --- ...-static-web-apps-black-stone-02fb10f03.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/azure-static-web-apps-black-stone-02fb10f03.yml diff --git a/.github/workflows/azure-static-web-apps-black-stone-02fb10f03.yml b/.github/workflows/azure-static-web-apps-black-stone-02fb10f03.yml new file mode 100644 index 0000000..e48399f --- /dev/null +++ b/.github/workflows/azure-static-web-apps-black-stone-02fb10f03.yml @@ -0,0 +1,46 @@ +name: Azure Static Web Apps CI/CD + +on: + push: + branches: + - develop + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - develop + +jobs: + build_and_deploy_job: + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + runs-on: ubuntu-latest + name: Build and Deploy Job + steps: + - uses: actions/checkout@v3 + with: + submodules: true + lfs: false + - name: Build And Deploy + id: builddeploy + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLACK_STONE_02FB10F03 }} + repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) + action: "upload" + ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### + # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig + app_location: "./templates" # App source code path + api_location: "" # Api source code path - optional + output_location: "." # Built app content directory - optional + ###### End of Repository/Build Configurations ###### + + close_pull_request_job: + if: github.event_name == 'pull_request' && github.event.action == 'closed' + runs-on: ubuntu-latest + name: Close Pull Request Job + steps: + - name: Close Pull Request + id: closepullrequest + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLACK_STONE_02FB10F03 }} + action: "close" From 68b35ca9e96ee1886b0dc6a6bf98379e1d95e69d Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:26:33 +0200 Subject: [PATCH 07/99] Update pipelines so that feature branch also cause release and make sure correct app directory is used --- .../workflows/azure-static-web-apps-black-stone-02fb10f03.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/azure-static-web-apps-black-stone-02fb10f03.yml b/.github/workflows/azure-static-web-apps-black-stone-02fb10f03.yml index e48399f..07d8efb 100644 --- a/.github/workflows/azure-static-web-apps-black-stone-02fb10f03.yml +++ b/.github/workflows/azure-static-web-apps-black-stone-02fb10f03.yml @@ -4,6 +4,7 @@ on: push: branches: - develop + - feature/#5-app-should-work-offline pull_request: types: [opened, synchronize, reopened, closed] branches: @@ -28,7 +29,7 @@ jobs: action: "upload" ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig - app_location: "./templates" # App source code path + app_location: "./PWA/public/" # App source code path api_location: "" # Api source code path - optional output_location: "." # Built app content directory - optional ###### End of Repository/Build Configurations ###### From 5d49df84a530591a29d36449edd885cd8ea5ad5b Mon Sep 17 00:00:00 2001 From: Menno <129762469+rcmenno@users.noreply.github.com> Date: Fri, 28 Apr 2023 15:12:36 +0200 Subject: [PATCH 08/99] #5 make sure app works offline by leveraging service workers (wip -> code input selection screen) --- .gitignore | 1 - LICENSE => POC/LICENSE | 0 POC/README.md | 53 + app.py => POC/app.py | 0 {data => POC/data}/.gitignore | 0 {data => POC/data}/data_template.xlsx | Bin {docs => POC/docs}/Makefile | 0 {docs => POC/docs}/html/_static/ReliefBox.PNG | Bin {docs => POC/docs}/make.bat | 0 {docs => POC/docs}/source/ReliefBox.PNG | Bin {docs => POC/docs}/source/conf.py | 0 {docs => POC/docs}/source/index.rst | 0 {docs => POC/docs}/source/installation.rst | 0 {docs => POC/docs}/source/usage.rst | 0 main.py => POC/main.py | 0 requirements.txt => POC/requirements.txt | 0 {static => POC/static}/510logo.jpg | Bin .../ReliefBox-horizontal-nobackground.png | Bin .../static}/ReliefBox-horizontal.png | Bin {static => POC/static}/ReliefBox.PNG | Bin {static => POC/static}/navbar-burger.js | 0 {templates => POC/templates}/base.html | 0 .../templates}/delete_distrib_confirm.html | 0 .../templates}/duplicate_error.html | 0 {templates => POC/templates}/entry.html | 0 .../templates}/entry_not_found.html | 0 {templates => POC/templates}/index.html | 0 .../templates}/index_distrib.html | 0 {templates => POC/templates}/input.html | 0 {templates => POC/templates}/input_video.html | 0 .../templates}/list_distrib.html | 0 .../templates}/list_distrib_delete.html | 0 {templates => POC/templates}/login.html | 0 .../templates}/name_distrib.html | 0 {templates => POC/templates}/no_data.html | 0 {templates => POC/templates}/no_distrib.html | 0 {templates => POC/templates}/profile.html | 0 {templates => POC/templates}/signup.html | 0 {templates => POC/templates}/test_login.html | 0 {templates => POC/templates}/upload_data.html | 0 .../templates}/upload_error.html | 0 {templates => POC/templates}/view_data.html | 0 utils.py => POC/utils.py | 0 PWA/.gitignore | 2 + PWA/README.MD | 9 + PWA/package.json | 15 + PWA/public/ExternalLibraries/mustache.js | 677 + PWA/public/ExternalLibraries/xlsx.full.min.js | 31969 ++++++++++++++++ .../BeneficiaryDataUploadHandler.js | 19 + ...ChooseBenificiaryCodeInputMethodHandler.js | 10 + .../CreateDistributionRequestHandler.js | 35 + .../DeleteDistribitionPostHandler.js | 14 + .../DeleteDistributionHandler.js | 23 + .../DeleteDistributionPostHandler.js | 14 + .../DeleteDistributionRequestHandler.js | 23 + PWA/public/FetchEventHandlers/FetchEvent.js | 1 + .../FetchEventHandlers/FetchEventHandler.js | 1 + .../FetchEventHandlers/FetchEventHandlers.js | 35 + .../LatestDistributionRequestHandler.js | 37 + .../ListDistributionRequestHandler.js | 24 + .../NameDistributionRequestHandler.js | 10 + .../SelectDistributionHandler.js | 23 + .../SelectDistributionRequestHandler.js | 23 + .../FetchEventHandlers/UploadDataHandler.js | 9 + PWA/public/Interfaces/FetchEvent.js | 1 + PWA/public/Interfaces/FetchEventHandler.js | 1 + .../Models/BenificiarySpreadSheetRow.js | 5 + PWA/public/Models/DeleteDistributionPost.js | 5 + PWA/public/Models/Distribution.js | 16 + PWA/public/Models/FetchEvent.js | 1 + PWA/public/Models/SelectDistributionPost.js | 5 + PWA/public/ResponseTools.js | 70 + PWA/public/RouteEvents.js | 18 + PWA/public/Services/BenificiaryDataParser.js | 23 + PWA/public/Services/BenificiaryInfoService.js | 14 + .../Services/BenificiaryJsonValidator.js | 22 + ...rySpreadSheetRowsDeserializationService.js | 40 + PWA/public/Services/CacheFilePathService.js | 109 + PWA/public/Services/Database.js | 145 + PWA/public/Services/DeserialisationService.js | 6 + PWA/public/Services/FormParser.js | 35 + PWA/public/Services/ResponseTools.js | 30 + PWA/public/Services/SpreadSheetFileParser.js | 15 + PWA/public/app.js | 12 + PWA/public/apple-touch-icon-precomposed.png | Bin 0 -> 24078 bytes PWA/public/apple-touch-icon.png | Bin 0 -> 24078 bytes .../public}/choose_input_method.html | 0 PWA/public/distrib.html | 128 + PWA/public/favicon.ico | Bin 0 -> 15406 bytes PWA/public/images/510logo.jpg | Bin 0 -> 47383 bytes .../ReliefBox-horizontal-nobackground.png | Bin 0 -> 41658 bytes PWA/public/images/ReliefBox-horizontal.png | Bin 0 -> 39473 bytes PWA/public/images/ReliefBox.PNG | Bin 0 -> 649828 bytes PWA/public/images/icons/app-icon-192x192.png | Bin 0 -> 26842 bytes PWA/public/images/icons/app-icon-512x512.png | Bin 0 -> 136808 bytes PWA/public/images/icons/favicon-16x16.png | Bin 0 -> 740 bytes PWA/public/images/icons/favicon-32x32.png | Bin 0 -> 1763 bytes PWA/public/index.html | 108 + PWA/public/list_distrib.html | 129 + PWA/public/list_distrib_delete.html | 129 + PWA/public/manifest.json | 25 + PWA/public/name_distrib.html | 138 + PWA/public/navbar-burger.js | 19 + PWA/public/sw.d.ts | 1 + PWA/public/sw.js | 50 + PWA/public/template.html | 95 + PWA/public/upload_data.html | 109 + PWA/public/upload_error.html | 106 + PWA/src/ExternalLibraries/mustache.js | 764 + PWA/src/ExternalLibraries/xlsx.full.min.js | 27714 ++++++++++++++ .../BeneficiaryDataUploadHandler.ts | 23 + ...ChooseBenificiaryCodeInputMethodHandler.ts | 14 + .../CreateDistributionRequestHandler.ts | 48 + .../DeleteDistributionPostHandler.ts | 21 + .../DeleteDistributionRequestHandler.ts | 27 + .../FetchEventHandlers/FetchEventHandlers.ts | 38 + .../ListDistributionRequestHandler.ts | 28 + .../NameDistributionRequestHandler.ts | 17 + .../SelectDistributionRequestHandler.ts | 32 + .../FetchEventHandlers/UploadDataHandler.ts | 13 + PWA/src/Interfaces/FetchEvent.ts | 4 + PWA/src/Interfaces/FetchEventHandler.ts | 6 + PWA/src/Models/BenificiarySpreadSheetRow.ts | 10 + PWA/src/Models/DeleteDistributionPost.ts | 9 + PWA/src/Models/Distribution.ts | 26 + PWA/src/Models/SelectDistributionPost.ts | 9 + PWA/src/RouteEvents.ts | 18 + PWA/src/Services/BenificiaryInfoService.ts | 15 + PWA/src/Services/BenificiaryJsonValidator.ts | 24 + ...rySpreadSheetRowsDeserializationService.ts | 46 + PWA/src/Services/CacheFilePathService.ts | 121 + PWA/src/Services/Database.ts | 199 + PWA/src/Services/DeserialisationService.ts | 6 + PWA/src/Services/FormParser.ts | 38 + PWA/src/Services/ResponseTools.ts | 40 + PWA/src/Services/SpreadSheetFileParser.ts | 21 + PWA/src/app.ts | 10 + PWA/src/navbar-burger.ts | 25 + PWA/src/sw.ts | 60 + PWA/tsconfig.json | 109 + README.md | 52 +- node_modules/.bin/tsc | 1 + node_modules/.bin/tsserver | 1 + node_modules/.package-lock.json | 26 + node_modules/@types/node/LICENSE | 21 + node_modules/@types/node/README.md | 16 + node_modules/@types/node/assert.d.ts | 972 + node_modules/@types/node/assert/strict.d.ts | 8 + node_modules/@types/node/async_hooks.d.ts | 531 + node_modules/@types/node/buffer.d.ts | 2354 ++ node_modules/@types/node/child_process.d.ts | 1400 + node_modules/@types/node/cluster.d.ts | 414 + node_modules/@types/node/console.d.ts | 412 + node_modules/@types/node/constants.d.ts | 18 + node_modules/@types/node/crypto.d.ts | 3978 ++ node_modules/@types/node/dgram.d.ts | 550 + .../@types/node/diagnostics_channel.d.ts | 191 + node_modules/@types/node/dns.d.ts | 668 + node_modules/@types/node/dns/promises.d.ts | 414 + node_modules/@types/node/dom-events.d.ts | 126 + node_modules/@types/node/domain.d.ts | 170 + node_modules/@types/node/events.d.ts | 788 + node_modules/@types/node/fs.d.ts | 4082 ++ node_modules/@types/node/fs/promises.d.ts | 1202 + node_modules/@types/node/globals.d.ts | 325 + node_modules/@types/node/globals.global.d.ts | 1 + node_modules/@types/node/http.d.ts | 1724 + node_modules/@types/node/http2.d.ts | 2129 + node_modules/@types/node/https.d.ts | 441 + node_modules/@types/node/index.d.ts | 133 + node_modules/@types/node/inspector.d.ts | 2747 ++ node_modules/@types/node/module.d.ts | 232 + node_modules/@types/node/net.d.ts | 893 + node_modules/@types/node/os.d.ts | 477 + node_modules/@types/node/package.json | 232 + node_modules/@types/node/path.d.ts | 191 + node_modules/@types/node/perf_hooks.d.ts | 638 + node_modules/@types/node/process.d.ts | 1494 + node_modules/@types/node/punycode.d.ts | 117 + node_modules/@types/node/querystring.d.ts | 131 + node_modules/@types/node/readline.d.ts | 526 + .../@types/node/readline/promises.d.ts | 145 + node_modules/@types/node/repl.d.ts | 424 + node_modules/@types/node/stream.d.ts | 1568 + .../@types/node/stream/consumers.d.ts | 12 + node_modules/@types/node/stream/promises.d.ts | 42 + node_modules/@types/node/stream/web.d.ts | 330 + node_modules/@types/node/string_decoder.d.ts | 67 + node_modules/@types/node/test.d.ts | 1461 + node_modules/@types/node/timers.d.ts | 225 + node_modules/@types/node/timers/promises.d.ts | 93 + node_modules/@types/node/tls.d.ts | 1130 + node_modules/@types/node/trace_events.d.ts | 182 + node_modules/@types/node/ts4.8/assert.d.ts | 972 + .../@types/node/ts4.8/assert/strict.d.ts | 8 + .../@types/node/ts4.8/async_hooks.d.ts | 531 + node_modules/@types/node/ts4.8/buffer.d.ts | 2354 ++ .../@types/node/ts4.8/child_process.d.ts | 1400 + node_modules/@types/node/ts4.8/cluster.d.ts | 414 + node_modules/@types/node/ts4.8/console.d.ts | 412 + node_modules/@types/node/ts4.8/constants.d.ts | 18 + node_modules/@types/node/ts4.8/crypto.d.ts | 3977 ++ node_modules/@types/node/ts4.8/dgram.d.ts | 550 + .../node/ts4.8/diagnostics_channel.d.ts | 191 + node_modules/@types/node/ts4.8/dns.d.ts | 668 + .../@types/node/ts4.8/dns/promises.d.ts | 414 + .../@types/node/ts4.8/dom-events.d.ts | 126 + node_modules/@types/node/ts4.8/domain.d.ts | 170 + node_modules/@types/node/ts4.8/events.d.ts | 788 + node_modules/@types/node/ts4.8/fs.d.ts | 4082 ++ .../@types/node/ts4.8/fs/promises.d.ts | 1202 + node_modules/@types/node/ts4.8/globals.d.ts | 325 + .../@types/node/ts4.8/globals.global.d.ts | 1 + node_modules/@types/node/ts4.8/http.d.ts | 1724 + node_modules/@types/node/ts4.8/http2.d.ts | 2129 + node_modules/@types/node/ts4.8/https.d.ts | 441 + node_modules/@types/node/ts4.8/index.d.ts | 88 + node_modules/@types/node/ts4.8/inspector.d.ts | 2747 ++ node_modules/@types/node/ts4.8/module.d.ts | 232 + node_modules/@types/node/ts4.8/net.d.ts | 893 + node_modules/@types/node/ts4.8/os.d.ts | 477 + node_modules/@types/node/ts4.8/path.d.ts | 191 + .../@types/node/ts4.8/perf_hooks.d.ts | 638 + node_modules/@types/node/ts4.8/process.d.ts | 1494 + node_modules/@types/node/ts4.8/punycode.d.ts | 117 + .../@types/node/ts4.8/querystring.d.ts | 131 + node_modules/@types/node/ts4.8/readline.d.ts | 526 + .../@types/node/ts4.8/readline/promises.d.ts | 145 + node_modules/@types/node/ts4.8/repl.d.ts | 424 + node_modules/@types/node/ts4.8/stream.d.ts | 1430 + .../@types/node/ts4.8/stream/consumers.d.ts | 12 + .../@types/node/ts4.8/stream/promises.d.ts | 42 + .../@types/node/ts4.8/stream/web.d.ts | 330 + .../@types/node/ts4.8/string_decoder.d.ts | 67 + node_modules/@types/node/ts4.8/test.d.ts | 1461 + node_modules/@types/node/ts4.8/timers.d.ts | 225 + .../@types/node/ts4.8/timers/promises.d.ts | 93 + node_modules/@types/node/ts4.8/tls.d.ts | 1130 + .../@types/node/ts4.8/trace_events.d.ts | 182 + node_modules/@types/node/ts4.8/tty.d.ts | 208 + node_modules/@types/node/ts4.8/url.d.ts | 915 + node_modules/@types/node/ts4.8/util.d.ts | 2116 + node_modules/@types/node/ts4.8/v8.d.ts | 635 + node_modules/@types/node/ts4.8/vm.d.ts | 895 + node_modules/@types/node/ts4.8/wasi.d.ts | 152 + .../@types/node/ts4.8/worker_threads.d.ts | 693 + node_modules/@types/node/ts4.8/zlib.d.ts | 517 + node_modules/@types/node/tty.d.ts | 208 + node_modules/@types/node/url.d.ts | 915 + node_modules/@types/node/util.d.ts | 2116 + node_modules/@types/node/v8.d.ts | 635 + node_modules/@types/node/vm.d.ts | 895 + node_modules/@types/node/wasi.d.ts | 152 + node_modules/@types/node/worker_threads.d.ts | 693 + node_modules/@types/node/zlib.d.ts | 517 + node_modules/typescript/LICENSE.txt | 55 + node_modules/typescript/README.md | 49 + node_modules/typescript/SECURITY.md | 41 + .../typescript/ThirdPartyNoticeText.txt | 193 + node_modules/typescript/bin/tsc | 2 + node_modules/typescript/bin/tsserver | 2 + node_modules/typescript/package.json | 115 + package-lock.json | 32 + package.json | 7 + 264 files changed, 149358 insertions(+), 49 deletions(-) rename LICENSE => POC/LICENSE (100%) create mode 100644 POC/README.md rename app.py => POC/app.py (100%) rename {data => POC/data}/.gitignore (100%) rename {data => POC/data}/data_template.xlsx (100%) rename {docs => POC/docs}/Makefile (100%) rename {docs => POC/docs}/html/_static/ReliefBox.PNG (100%) rename {docs => POC/docs}/make.bat (100%) rename {docs => POC/docs}/source/ReliefBox.PNG (100%) rename {docs => POC/docs}/source/conf.py (100%) rename {docs => POC/docs}/source/index.rst (100%) rename {docs => POC/docs}/source/installation.rst (100%) rename {docs => POC/docs}/source/usage.rst (100%) rename main.py => POC/main.py (100%) rename requirements.txt => POC/requirements.txt (100%) rename {static => POC/static}/510logo.jpg (100%) rename {static => POC/static}/ReliefBox-horizontal-nobackground.png (100%) rename {static => POC/static}/ReliefBox-horizontal.png (100%) rename {static => POC/static}/ReliefBox.PNG (100%) rename {static => POC/static}/navbar-burger.js (100%) rename {templates => POC/templates}/base.html (100%) rename {templates => POC/templates}/delete_distrib_confirm.html (100%) rename {templates => POC/templates}/duplicate_error.html (100%) rename {templates => POC/templates}/entry.html (100%) rename {templates => POC/templates}/entry_not_found.html (100%) rename {templates => POC/templates}/index.html (100%) rename {templates => POC/templates}/index_distrib.html (100%) rename {templates => POC/templates}/input.html (100%) rename {templates => POC/templates}/input_video.html (100%) rename {templates => POC/templates}/list_distrib.html (100%) rename {templates => POC/templates}/list_distrib_delete.html (100%) rename {templates => POC/templates}/login.html (100%) rename {templates => POC/templates}/name_distrib.html (100%) rename {templates => POC/templates}/no_data.html (100%) rename {templates => POC/templates}/no_distrib.html (100%) rename {templates => POC/templates}/profile.html (100%) rename {templates => POC/templates}/signup.html (100%) rename {templates => POC/templates}/test_login.html (100%) rename {templates => POC/templates}/upload_data.html (100%) rename {templates => POC/templates}/upload_error.html (100%) rename {templates => POC/templates}/view_data.html (100%) rename utils.py => POC/utils.py (100%) create mode 100644 PWA/.gitignore create mode 100644 PWA/README.MD create mode 100644 PWA/package.json create mode 100644 PWA/public/ExternalLibraries/mustache.js create mode 100644 PWA/public/ExternalLibraries/xlsx.full.min.js create mode 100644 PWA/public/FetchEventHandlers/BeneficiaryDataUploadHandler.js create mode 100644 PWA/public/FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.js create mode 100644 PWA/public/FetchEventHandlers/CreateDistributionRequestHandler.js create mode 100644 PWA/public/FetchEventHandlers/DeleteDistribitionPostHandler.js create mode 100644 PWA/public/FetchEventHandlers/DeleteDistributionHandler.js create mode 100644 PWA/public/FetchEventHandlers/DeleteDistributionPostHandler.js create mode 100644 PWA/public/FetchEventHandlers/DeleteDistributionRequestHandler.js create mode 100644 PWA/public/FetchEventHandlers/FetchEvent.js create mode 100644 PWA/public/FetchEventHandlers/FetchEventHandler.js create mode 100644 PWA/public/FetchEventHandlers/FetchEventHandlers.js create mode 100644 PWA/public/FetchEventHandlers/LatestDistributionRequestHandler.js create mode 100644 PWA/public/FetchEventHandlers/ListDistributionRequestHandler.js create mode 100644 PWA/public/FetchEventHandlers/NameDistributionRequestHandler.js create mode 100644 PWA/public/FetchEventHandlers/SelectDistributionHandler.js create mode 100644 PWA/public/FetchEventHandlers/SelectDistributionRequestHandler.js create mode 100644 PWA/public/FetchEventHandlers/UploadDataHandler.js create mode 100644 PWA/public/Interfaces/FetchEvent.js create mode 100644 PWA/public/Interfaces/FetchEventHandler.js create mode 100644 PWA/public/Models/BenificiarySpreadSheetRow.js create mode 100644 PWA/public/Models/DeleteDistributionPost.js create mode 100644 PWA/public/Models/Distribution.js create mode 100644 PWA/public/Models/FetchEvent.js create mode 100644 PWA/public/Models/SelectDistributionPost.js create mode 100644 PWA/public/ResponseTools.js create mode 100644 PWA/public/RouteEvents.js create mode 100644 PWA/public/Services/BenificiaryDataParser.js create mode 100644 PWA/public/Services/BenificiaryInfoService.js create mode 100644 PWA/public/Services/BenificiaryJsonValidator.js create mode 100644 PWA/public/Services/BenificiarySpreadSheetRowsDeserializationService.js create mode 100644 PWA/public/Services/CacheFilePathService.js create mode 100644 PWA/public/Services/Database.js create mode 100644 PWA/public/Services/DeserialisationService.js create mode 100644 PWA/public/Services/FormParser.js create mode 100644 PWA/public/Services/ResponseTools.js create mode 100644 PWA/public/Services/SpreadSheetFileParser.js create mode 100644 PWA/public/app.js create mode 100644 PWA/public/apple-touch-icon-precomposed.png create mode 100644 PWA/public/apple-touch-icon.png rename {templates => PWA/public}/choose_input_method.html (100%) create mode 100644 PWA/public/distrib.html create mode 100644 PWA/public/favicon.ico create mode 100644 PWA/public/images/510logo.jpg create mode 100644 PWA/public/images/ReliefBox-horizontal-nobackground.png create mode 100644 PWA/public/images/ReliefBox-horizontal.png create mode 100644 PWA/public/images/ReliefBox.PNG create mode 100644 PWA/public/images/icons/app-icon-192x192.png create mode 100644 PWA/public/images/icons/app-icon-512x512.png create mode 100644 PWA/public/images/icons/favicon-16x16.png create mode 100644 PWA/public/images/icons/favicon-32x32.png create mode 100644 PWA/public/index.html create mode 100644 PWA/public/list_distrib.html create mode 100644 PWA/public/list_distrib_delete.html create mode 100644 PWA/public/manifest.json create mode 100644 PWA/public/name_distrib.html create mode 100644 PWA/public/navbar-burger.js create mode 100644 PWA/public/sw.d.ts create mode 100644 PWA/public/sw.js create mode 100644 PWA/public/template.html create mode 100644 PWA/public/upload_data.html create mode 100644 PWA/public/upload_error.html create mode 100644 PWA/src/ExternalLibraries/mustache.js create mode 100644 PWA/src/ExternalLibraries/xlsx.full.min.js create mode 100644 PWA/src/FetchEventHandlers/BeneficiaryDataUploadHandler.ts create mode 100644 PWA/src/FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.ts create mode 100644 PWA/src/FetchEventHandlers/CreateDistributionRequestHandler.ts create mode 100644 PWA/src/FetchEventHandlers/DeleteDistributionPostHandler.ts create mode 100644 PWA/src/FetchEventHandlers/DeleteDistributionRequestHandler.ts create mode 100644 PWA/src/FetchEventHandlers/FetchEventHandlers.ts create mode 100644 PWA/src/FetchEventHandlers/ListDistributionRequestHandler.ts create mode 100644 PWA/src/FetchEventHandlers/NameDistributionRequestHandler.ts create mode 100644 PWA/src/FetchEventHandlers/SelectDistributionRequestHandler.ts create mode 100644 PWA/src/FetchEventHandlers/UploadDataHandler.ts create mode 100644 PWA/src/Interfaces/FetchEvent.ts create mode 100644 PWA/src/Interfaces/FetchEventHandler.ts create mode 100644 PWA/src/Models/BenificiarySpreadSheetRow.ts create mode 100644 PWA/src/Models/DeleteDistributionPost.ts create mode 100644 PWA/src/Models/Distribution.ts create mode 100644 PWA/src/Models/SelectDistributionPost.ts create mode 100644 PWA/src/RouteEvents.ts create mode 100644 PWA/src/Services/BenificiaryInfoService.ts create mode 100644 PWA/src/Services/BenificiaryJsonValidator.ts create mode 100644 PWA/src/Services/BenificiarySpreadSheetRowsDeserializationService.ts create mode 100644 PWA/src/Services/CacheFilePathService.ts create mode 100644 PWA/src/Services/Database.ts create mode 100644 PWA/src/Services/DeserialisationService.ts create mode 100644 PWA/src/Services/FormParser.ts create mode 100644 PWA/src/Services/ResponseTools.ts create mode 100644 PWA/src/Services/SpreadSheetFileParser.ts create mode 100644 PWA/src/app.ts create mode 100644 PWA/src/navbar-burger.ts create mode 100644 PWA/src/sw.ts create mode 100644 PWA/tsconfig.json create mode 120000 node_modules/.bin/tsc create mode 120000 node_modules/.bin/tsserver create mode 100644 node_modules/.package-lock.json create mode 100755 node_modules/@types/node/LICENSE create mode 100755 node_modules/@types/node/README.md create mode 100755 node_modules/@types/node/assert.d.ts create mode 100755 node_modules/@types/node/assert/strict.d.ts create mode 100755 node_modules/@types/node/async_hooks.d.ts create mode 100755 node_modules/@types/node/buffer.d.ts create mode 100755 node_modules/@types/node/child_process.d.ts create mode 100755 node_modules/@types/node/cluster.d.ts create mode 100755 node_modules/@types/node/console.d.ts create mode 100755 node_modules/@types/node/constants.d.ts create mode 100755 node_modules/@types/node/crypto.d.ts create mode 100755 node_modules/@types/node/dgram.d.ts create mode 100755 node_modules/@types/node/diagnostics_channel.d.ts create mode 100755 node_modules/@types/node/dns.d.ts create mode 100755 node_modules/@types/node/dns/promises.d.ts create mode 100755 node_modules/@types/node/dom-events.d.ts create mode 100755 node_modules/@types/node/domain.d.ts create mode 100755 node_modules/@types/node/events.d.ts create mode 100755 node_modules/@types/node/fs.d.ts create mode 100755 node_modules/@types/node/fs/promises.d.ts create mode 100755 node_modules/@types/node/globals.d.ts create mode 100755 node_modules/@types/node/globals.global.d.ts create mode 100755 node_modules/@types/node/http.d.ts create mode 100755 node_modules/@types/node/http2.d.ts create mode 100755 node_modules/@types/node/https.d.ts create mode 100755 node_modules/@types/node/index.d.ts create mode 100755 node_modules/@types/node/inspector.d.ts create mode 100755 node_modules/@types/node/module.d.ts create mode 100755 node_modules/@types/node/net.d.ts create mode 100755 node_modules/@types/node/os.d.ts create mode 100755 node_modules/@types/node/package.json create mode 100755 node_modules/@types/node/path.d.ts create mode 100755 node_modules/@types/node/perf_hooks.d.ts create mode 100755 node_modules/@types/node/process.d.ts create mode 100755 node_modules/@types/node/punycode.d.ts create mode 100755 node_modules/@types/node/querystring.d.ts create mode 100755 node_modules/@types/node/readline.d.ts create mode 100755 node_modules/@types/node/readline/promises.d.ts create mode 100755 node_modules/@types/node/repl.d.ts create mode 100755 node_modules/@types/node/stream.d.ts create mode 100755 node_modules/@types/node/stream/consumers.d.ts create mode 100755 node_modules/@types/node/stream/promises.d.ts create mode 100755 node_modules/@types/node/stream/web.d.ts create mode 100755 node_modules/@types/node/string_decoder.d.ts create mode 100755 node_modules/@types/node/test.d.ts create mode 100755 node_modules/@types/node/timers.d.ts create mode 100755 node_modules/@types/node/timers/promises.d.ts create mode 100755 node_modules/@types/node/tls.d.ts create mode 100755 node_modules/@types/node/trace_events.d.ts create mode 100755 node_modules/@types/node/ts4.8/assert.d.ts create mode 100755 node_modules/@types/node/ts4.8/assert/strict.d.ts create mode 100755 node_modules/@types/node/ts4.8/async_hooks.d.ts create mode 100755 node_modules/@types/node/ts4.8/buffer.d.ts create mode 100755 node_modules/@types/node/ts4.8/child_process.d.ts create mode 100755 node_modules/@types/node/ts4.8/cluster.d.ts create mode 100755 node_modules/@types/node/ts4.8/console.d.ts create mode 100755 node_modules/@types/node/ts4.8/constants.d.ts create mode 100755 node_modules/@types/node/ts4.8/crypto.d.ts create mode 100755 node_modules/@types/node/ts4.8/dgram.d.ts create mode 100755 node_modules/@types/node/ts4.8/diagnostics_channel.d.ts create mode 100755 node_modules/@types/node/ts4.8/dns.d.ts create mode 100755 node_modules/@types/node/ts4.8/dns/promises.d.ts create mode 100755 node_modules/@types/node/ts4.8/dom-events.d.ts create mode 100755 node_modules/@types/node/ts4.8/domain.d.ts create mode 100755 node_modules/@types/node/ts4.8/events.d.ts create mode 100755 node_modules/@types/node/ts4.8/fs.d.ts create mode 100755 node_modules/@types/node/ts4.8/fs/promises.d.ts create mode 100755 node_modules/@types/node/ts4.8/globals.d.ts create mode 100755 node_modules/@types/node/ts4.8/globals.global.d.ts create mode 100755 node_modules/@types/node/ts4.8/http.d.ts create mode 100755 node_modules/@types/node/ts4.8/http2.d.ts create mode 100755 node_modules/@types/node/ts4.8/https.d.ts create mode 100755 node_modules/@types/node/ts4.8/index.d.ts create mode 100755 node_modules/@types/node/ts4.8/inspector.d.ts create mode 100755 node_modules/@types/node/ts4.8/module.d.ts create mode 100755 node_modules/@types/node/ts4.8/net.d.ts create mode 100755 node_modules/@types/node/ts4.8/os.d.ts create mode 100755 node_modules/@types/node/ts4.8/path.d.ts create mode 100755 node_modules/@types/node/ts4.8/perf_hooks.d.ts create mode 100755 node_modules/@types/node/ts4.8/process.d.ts create mode 100755 node_modules/@types/node/ts4.8/punycode.d.ts create mode 100755 node_modules/@types/node/ts4.8/querystring.d.ts create mode 100755 node_modules/@types/node/ts4.8/readline.d.ts create mode 100755 node_modules/@types/node/ts4.8/readline/promises.d.ts create mode 100755 node_modules/@types/node/ts4.8/repl.d.ts create mode 100755 node_modules/@types/node/ts4.8/stream.d.ts create mode 100755 node_modules/@types/node/ts4.8/stream/consumers.d.ts create mode 100755 node_modules/@types/node/ts4.8/stream/promises.d.ts create mode 100755 node_modules/@types/node/ts4.8/stream/web.d.ts create mode 100755 node_modules/@types/node/ts4.8/string_decoder.d.ts create mode 100755 node_modules/@types/node/ts4.8/test.d.ts create mode 100755 node_modules/@types/node/ts4.8/timers.d.ts create mode 100755 node_modules/@types/node/ts4.8/timers/promises.d.ts create mode 100755 node_modules/@types/node/ts4.8/tls.d.ts create mode 100755 node_modules/@types/node/ts4.8/trace_events.d.ts create mode 100755 node_modules/@types/node/ts4.8/tty.d.ts create mode 100755 node_modules/@types/node/ts4.8/url.d.ts create mode 100755 node_modules/@types/node/ts4.8/util.d.ts create mode 100755 node_modules/@types/node/ts4.8/v8.d.ts create mode 100755 node_modules/@types/node/ts4.8/vm.d.ts create mode 100755 node_modules/@types/node/ts4.8/wasi.d.ts create mode 100755 node_modules/@types/node/ts4.8/worker_threads.d.ts create mode 100755 node_modules/@types/node/ts4.8/zlib.d.ts create mode 100755 node_modules/@types/node/tty.d.ts create mode 100755 node_modules/@types/node/url.d.ts create mode 100755 node_modules/@types/node/util.d.ts create mode 100755 node_modules/@types/node/v8.d.ts create mode 100755 node_modules/@types/node/vm.d.ts create mode 100755 node_modules/@types/node/wasi.d.ts create mode 100755 node_modules/@types/node/worker_threads.d.ts create mode 100755 node_modules/@types/node/zlib.d.ts create mode 100644 node_modules/typescript/LICENSE.txt create mode 100644 node_modules/typescript/README.md create mode 100644 node_modules/typescript/SECURITY.md create mode 100644 node_modules/typescript/ThirdPartyNoticeText.txt create mode 100755 node_modules/typescript/bin/tsc create mode 100755 node_modules/typescript/bin/tsserver create mode 100644 node_modules/typescript/package.json create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 790d52e..61f4e19 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ __pycache__/ *.xlsx *.csv *.pdf -*.json # C extensions *.so diff --git a/LICENSE b/POC/LICENSE similarity index 100% rename from LICENSE rename to POC/LICENSE diff --git a/POC/README.md b/POC/README.md new file mode 100644 index 0000000..59f5a6a --- /dev/null +++ b/POC/README.md @@ -0,0 +1,53 @@ +# ReliefBox + +A simple web app for relief. +https://relief-system-webapp.azurewebsites.net/ + +## Description + +Synopsis: a [flask python app](https://flask.palletsprojects.com/en/2.0.x/). + +Workflow: upload data of beneficiaries, start distribution, check if beneficiaries are eligible, download report. + +## Setup + +### on Azure +1. [Deploy the web app to Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python) +3. Add necessary keys as environmental variables. From Azure Portal, App Service > Configuration > New application setting +``` +SQL_USERNAME=... +SQL_PASSWORD=... +COSMOS_KEY=... +MODE=online +``` + +### build as standalone app +``` +pyinstaller --onefile --add-data 'templates;templates' --add-data 'static;static' --add-data 'data;data' --add-data './*.py;.' app.py +``` + +### on Raspberry Pi 4 +1. [Create wireless access point](https://raspberrypi-guide.github.io/networking/create-wireless-access-point#start-up-the-wireless-access-point) +2. Clone this repository +``` +$ git clone https://github.com/rodekruis/relief-app.git +$ cd relief-app +``` +3. Set offline mode in .env +``` +$ echo -n "MODE=offline" > .env +``` +4. Install app dependencies and run it +``` +$ sudo apt-get update +$ sudo apt-get install libatlas-base-dev libcblas-dev g++ unixodbc-dev +$ pip install -r requirements.txt +$ python app.py +``` +Debug connection issues (to be improved): +``` +$ sudo systemctl stop hostapd +$ sudo systemctl unmask hostapd +$ sudo systemctl enable hostapd +$ sudo systemctl start hostapd +``` diff --git a/app.py b/POC/app.py similarity index 100% rename from app.py rename to POC/app.py diff --git a/data/.gitignore b/POC/data/.gitignore similarity index 100% rename from data/.gitignore rename to POC/data/.gitignore diff --git a/data/data_template.xlsx b/POC/data/data_template.xlsx similarity index 100% rename from data/data_template.xlsx rename to POC/data/data_template.xlsx diff --git a/docs/Makefile b/POC/docs/Makefile similarity index 100% rename from docs/Makefile rename to POC/docs/Makefile diff --git a/docs/html/_static/ReliefBox.PNG b/POC/docs/html/_static/ReliefBox.PNG similarity index 100% rename from docs/html/_static/ReliefBox.PNG rename to POC/docs/html/_static/ReliefBox.PNG diff --git a/docs/make.bat b/POC/docs/make.bat similarity index 100% rename from docs/make.bat rename to POC/docs/make.bat diff --git a/docs/source/ReliefBox.PNG b/POC/docs/source/ReliefBox.PNG similarity index 100% rename from docs/source/ReliefBox.PNG rename to POC/docs/source/ReliefBox.PNG diff --git a/docs/source/conf.py b/POC/docs/source/conf.py similarity index 100% rename from docs/source/conf.py rename to POC/docs/source/conf.py diff --git a/docs/source/index.rst b/POC/docs/source/index.rst similarity index 100% rename from docs/source/index.rst rename to POC/docs/source/index.rst diff --git a/docs/source/installation.rst b/POC/docs/source/installation.rst similarity index 100% rename from docs/source/installation.rst rename to POC/docs/source/installation.rst diff --git a/docs/source/usage.rst b/POC/docs/source/usage.rst similarity index 100% rename from docs/source/usage.rst rename to POC/docs/source/usage.rst diff --git a/main.py b/POC/main.py similarity index 100% rename from main.py rename to POC/main.py diff --git a/requirements.txt b/POC/requirements.txt similarity index 100% rename from requirements.txt rename to POC/requirements.txt diff --git a/static/510logo.jpg b/POC/static/510logo.jpg similarity index 100% rename from static/510logo.jpg rename to POC/static/510logo.jpg diff --git a/static/ReliefBox-horizontal-nobackground.png b/POC/static/ReliefBox-horizontal-nobackground.png similarity index 100% rename from static/ReliefBox-horizontal-nobackground.png rename to POC/static/ReliefBox-horizontal-nobackground.png diff --git a/static/ReliefBox-horizontal.png b/POC/static/ReliefBox-horizontal.png similarity index 100% rename from static/ReliefBox-horizontal.png rename to POC/static/ReliefBox-horizontal.png diff --git a/static/ReliefBox.PNG b/POC/static/ReliefBox.PNG similarity index 100% rename from static/ReliefBox.PNG rename to POC/static/ReliefBox.PNG diff --git a/static/navbar-burger.js b/POC/static/navbar-burger.js similarity index 100% rename from static/navbar-burger.js rename to POC/static/navbar-burger.js diff --git a/templates/base.html b/POC/templates/base.html similarity index 100% rename from templates/base.html rename to POC/templates/base.html diff --git a/templates/delete_distrib_confirm.html b/POC/templates/delete_distrib_confirm.html similarity index 100% rename from templates/delete_distrib_confirm.html rename to POC/templates/delete_distrib_confirm.html diff --git a/templates/duplicate_error.html b/POC/templates/duplicate_error.html similarity index 100% rename from templates/duplicate_error.html rename to POC/templates/duplicate_error.html diff --git a/templates/entry.html b/POC/templates/entry.html similarity index 100% rename from templates/entry.html rename to POC/templates/entry.html diff --git a/templates/entry_not_found.html b/POC/templates/entry_not_found.html similarity index 100% rename from templates/entry_not_found.html rename to POC/templates/entry_not_found.html diff --git a/templates/index.html b/POC/templates/index.html similarity index 100% rename from templates/index.html rename to POC/templates/index.html diff --git a/templates/index_distrib.html b/POC/templates/index_distrib.html similarity index 100% rename from templates/index_distrib.html rename to POC/templates/index_distrib.html diff --git a/templates/input.html b/POC/templates/input.html similarity index 100% rename from templates/input.html rename to POC/templates/input.html diff --git a/templates/input_video.html b/POC/templates/input_video.html similarity index 100% rename from templates/input_video.html rename to POC/templates/input_video.html diff --git a/templates/list_distrib.html b/POC/templates/list_distrib.html similarity index 100% rename from templates/list_distrib.html rename to POC/templates/list_distrib.html diff --git a/templates/list_distrib_delete.html b/POC/templates/list_distrib_delete.html similarity index 100% rename from templates/list_distrib_delete.html rename to POC/templates/list_distrib_delete.html diff --git a/templates/login.html b/POC/templates/login.html similarity index 100% rename from templates/login.html rename to POC/templates/login.html diff --git a/templates/name_distrib.html b/POC/templates/name_distrib.html similarity index 100% rename from templates/name_distrib.html rename to POC/templates/name_distrib.html diff --git a/templates/no_data.html b/POC/templates/no_data.html similarity index 100% rename from templates/no_data.html rename to POC/templates/no_data.html diff --git a/templates/no_distrib.html b/POC/templates/no_distrib.html similarity index 100% rename from templates/no_distrib.html rename to POC/templates/no_distrib.html diff --git a/templates/profile.html b/POC/templates/profile.html similarity index 100% rename from templates/profile.html rename to POC/templates/profile.html diff --git a/templates/signup.html b/POC/templates/signup.html similarity index 100% rename from templates/signup.html rename to POC/templates/signup.html diff --git a/templates/test_login.html b/POC/templates/test_login.html similarity index 100% rename from templates/test_login.html rename to POC/templates/test_login.html diff --git a/templates/upload_data.html b/POC/templates/upload_data.html similarity index 100% rename from templates/upload_data.html rename to POC/templates/upload_data.html diff --git a/templates/upload_error.html b/POC/templates/upload_error.html similarity index 100% rename from templates/upload_error.html rename to POC/templates/upload_error.html diff --git a/templates/view_data.html b/POC/templates/view_data.html similarity index 100% rename from templates/view_data.html rename to POC/templates/view_data.html diff --git a/utils.py b/POC/utils.py similarity index 100% rename from utils.py rename to POC/utils.py diff --git a/PWA/.gitignore b/PWA/.gitignore new file mode 100644 index 0000000..7a1537b --- /dev/null +++ b/PWA/.gitignore @@ -0,0 +1,2 @@ +.idea +node_modules diff --git a/PWA/README.MD b/PWA/README.MD new file mode 100644 index 0000000..e0c60b4 --- /dev/null +++ b/PWA/README.MD @@ -0,0 +1,9 @@ +# Progressive Web Apps - Complete Guide +This source code is part of Maximilian Schwarzmüller's "Progressive Web Apps - Complete Guide" course on udemy.com. + +# How to Use +You need [Node.js](https://nodejs.org) installed on your machine. Simply download the installer from [nodejs.org](https://nodejs.org) and go through the installation steps. + +Once Node.js is installed, open your command prompt or terminal and **navigate into this project folder**. There, run `npm install` to install all required dependencies. + +Finally, run `npm start` to start the development server and visit [localhost:8080](http://localhost:8080) to see the running application. diff --git a/PWA/package.json b/PWA/package.json new file mode 100644 index 0000000..aa169e1 --- /dev/null +++ b/PWA/package.json @@ -0,0 +1,15 @@ +{ + "name": "ReliefBox", + "version": "1.0.0", + "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", + "main": "index.js", + "scripts": { + "start": "http-server -c-1" + }, + "keywords": [], + "author": "Red Cross", + "license": "ISC", + "devDependencies": { + "http-server": "^0.10.0" + } +} diff --git a/PWA/public/ExternalLibraries/mustache.js b/PWA/public/ExternalLibraries/mustache.js new file mode 100644 index 0000000..04a288e --- /dev/null +++ b/PWA/public/ExternalLibraries/mustache.js @@ -0,0 +1,677 @@ +/*! + * mustache.js - Logic-less {{mustache}} templates with JavaScript + * http://github.com/janl/mustache.js + */ +var objectToString = Object.prototype.toString; +var isArray = Array.isArray || function isArrayPolyfill(object) { + return objectToString.call(object) === '[object Array]'; +}; +function isFunction(object) { + return typeof object === 'function'; +} +/** + * More correct typeof string handling array + * which normally returns typeof 'object' + */ +function typeStr(obj) { + return isArray(obj) ? 'array' : typeof obj; +} +function escapeRegExp(string) { + return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&'); +} +/** + * Null safe way of checking whether or not an object, + * including its prototype, has a given property + */ +function hasProperty(obj, propName) { + return obj != null && typeof obj === 'object' && (propName in obj); +} +/** + * Safe way of detecting whether or not the given thing is a primitive and + * whether it has the given property + */ +function primitiveHasOwnProperty(primitive, propName) { + return (primitive != null + && typeof primitive !== 'object' + && primitive.hasOwnProperty + && primitive.hasOwnProperty(propName)); +} +// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577 +// See https://github.com/janl/mustache.js/issues/189 +var regExpTest = RegExp.prototype.test; +function testRegExp(re, string) { + return regExpTest.call(re, string); +} +var nonSpaceRe = /\S/; +function isWhitespace(string) { + return !testRegExp(nonSpaceRe, string); +} +var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' +}; +function escapeHtml(string) { + return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s) { + return entityMap[s]; + }); +} +var whiteRe = /\s*/; +var spaceRe = /\s+/; +var equalsRe = /\s*=/; +var curlyRe = /\s*\}/; +var tagRe = /#|\^|\/|>|\{|&|=|!/; +/** + * Breaks up the given `template` string into a tree of tokens. If the `tags` + * argument is given here it must be an array with two string values: the + * opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of + * course, the default is to use mustaches (i.e. mustache.tags). + * + * A token is an array with at least 4 elements. The first element is the + * mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag + * did not contain a symbol (i.e. {{myValue}}) this element is "name". For + * all text that appears outside a symbol this element is "text". + * + * The second element of a token is its "value". For mustache tags this is + * whatever else was inside the tag besides the opening symbol. For text tokens + * this is the text itself. + * + * The third and fourth elements of the token are the start and end indices, + * respectively, of the token in the original template. + * + * Tokens that are the root node of a subtree contain two more elements: 1) an + * array of tokens in the subtree and 2) the index in the original template at + * which the closing tag for that section begins. + * + * Tokens for partials also contain two more elements: 1) a string value of + * indendation prior to that tag and 2) the index of that tag on that line - + * eg a value of 2 indicates the partial is the third tag on this line. + */ +function parseTemplate(template, tags) { + if (!template) + return []; + var lineHasNonSpace = false; + var sections = []; // Stack to hold section tokens + var tokens = []; // Buffer to hold the tokens + var spaces = []; // Indices of whitespace tokens on the current line + var hasTag = false; // Is there a {{tag}} on the current line? + var nonSpace = false; // Is there a non-space char on the current line? + var indentation = ''; // Tracks indentation for tags that use it + var tagIndex = 0; // Stores a count of number of tags encountered on a line + // Strips all whitespace tokens array for the current line + // if there was a {{#tag}} on it and otherwise only space. + function stripSpace() { + if (hasTag && !nonSpace) { + while (spaces.length) + delete tokens[spaces.pop()]; + } + else { + spaces = []; + } + hasTag = false; + nonSpace = false; + } + var openingTagRe, closingTagRe, closingCurlyRe; + function compileTags(tagsToCompile) { + if (typeof tagsToCompile === 'string') + tagsToCompile = tagsToCompile.split(spaceRe, 2); + if (!isArray(tagsToCompile) || tagsToCompile.length !== 2) + throw new Error('Invalid tags: ' + tagsToCompile); + openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\s*'); + closingTagRe = new RegExp('\\s*' + escapeRegExp(tagsToCompile[1])); + closingCurlyRe = new RegExp('\\s*' + escapeRegExp('}' + tagsToCompile[1])); + } + compileTags(tags || mustache.tags); + var scanner = new Scanner(template); + var start, type, value, chr, token, openSection; + while (!scanner.eos()) { + start = scanner.pos; + // Match any text between tags. + value = scanner.scanUntil(openingTagRe); + if (value) { + for (var i = 0, valueLength = value.length; i < valueLength; ++i) { + chr = value.charAt(i); + if (isWhitespace(chr)) { + spaces.push(tokens.length); + indentation += chr; + } + else { + nonSpace = true; + lineHasNonSpace = true; + indentation += ' '; + } + tokens.push(['text', chr, start, start + 1]); + start += 1; + // Check for whitespace on the current line. + if (chr === '\n') { + stripSpace(); + indentation = ''; + tagIndex = 0; + lineHasNonSpace = false; + } + } + } + // Match the opening tag. + if (!scanner.scan(openingTagRe)) + break; + hasTag = true; + // Get the tag type. + type = scanner.scan(tagRe) || 'name'; + scanner.scan(whiteRe); + // Get the tag value. + if (type === '=') { + value = scanner.scanUntil(equalsRe); + scanner.scan(equalsRe); + scanner.scanUntil(closingTagRe); + } + else if (type === '{') { + value = scanner.scanUntil(closingCurlyRe); + scanner.scan(curlyRe); + scanner.scanUntil(closingTagRe); + type = '&'; + } + else { + value = scanner.scanUntil(closingTagRe); + } + // Match the closing tag. + if (!scanner.scan(closingTagRe)) + throw new Error('Unclosed tag at ' + scanner.pos); + if (type == '>') { + token = [type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace]; + } + else { + token = [type, value, start, scanner.pos]; + } + tagIndex++; + tokens.push(token); + if (type === '#' || type === '^') { + sections.push(token); + } + else if (type === '/') { + // Check section nesting. + openSection = sections.pop(); + if (!openSection) + throw new Error('Unopened section "' + value + '" at ' + start); + if (openSection[1] !== value) + throw new Error('Unclosed section "' + openSection[1] + '" at ' + start); + } + else if (type === 'name' || type === '{' || type === '&') { + nonSpace = true; + } + else if (type === '=') { + // Set the tags for the next time around. + compileTags(value); + } + } + stripSpace(); + // Make sure there are no open sections when we're done. + openSection = sections.pop(); + if (openSection) + throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos); + return nestTokens(squashTokens(tokens)); +} +/** + * Combines the values of consecutive text tokens in the given `tokens` array + * to a single token. + */ +function squashTokens(tokens) { + var squashedTokens = []; + var token, lastToken; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + token = tokens[i]; + if (token) { + if (token[0] === 'text' && lastToken && lastToken[0] === 'text') { + lastToken[1] += token[1]; + lastToken[3] = token[3]; + } + else { + squashedTokens.push(token); + lastToken = token; + } + } + } + return squashedTokens; +} +/** + * Forms the given array of `tokens` into a nested tree structure where + * tokens that represent a section have two additional items: 1) an array of + * all tokens that appear in that section and 2) the index in the original + * template that represents the end of that section. + */ +function nestTokens(tokens) { + var nestedTokens = []; + var collector = nestedTokens; + var sections = []; + var token, section; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + token = tokens[i]; + switch (token[0]) { + case '#': + case '^': + collector.push(token); + sections.push(token); + collector = token[4] = []; + break; + case '/': + section = sections.pop(); + section[5] = token[2]; + collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens; + break; + default: + collector.push(token); + } + } + return nestedTokens; +} +/** + * A simple string scanner that is used by the template parser to find + * tokens in template strings. + */ +function Scanner(string) { + this.string = string; + this.tail = string; + this.pos = 0; +} +/** + * Returns `true` if the tail is empty (end of string). + */ +Scanner.prototype.eos = function eos() { + return this.tail === ''; +}; +/** + * Tries to match the given regular expression at the current position. + * Returns the matched text if it can match, the empty string otherwise. + */ +Scanner.prototype.scan = function scan(re) { + var match = this.tail.match(re); + if (!match || match.index !== 0) + return ''; + var string = match[0]; + this.tail = this.tail.substring(string.length); + this.pos += string.length; + return string; +}; +/** + * Skips all text until the given regular expression can be matched. Returns + * the skipped string, which is the entire tail if no match can be made. + */ +Scanner.prototype.scanUntil = function scanUntil(re) { + var index = this.tail.search(re), match; + switch (index) { + case -1: + match = this.tail; + this.tail = ''; + break; + case 0: + match = ''; + break; + default: + match = this.tail.substring(0, index); + this.tail = this.tail.substring(index); + } + this.pos += match.length; + return match; +}; +/** + * Represents a rendering context by wrapping a view object and + * maintaining a reference to the parent context. + */ +function Context(view, parentContext) { + this.view = view; + this.cache = { '.': this.view }; + this.parent = parentContext; +} +/** + * Creates a new context using the given view with this context + * as the parent. + */ +Context.prototype.push = function push(view) { + return new Context(view, this); +}; +/** + * Returns the value of the given name in this context, traversing + * up the context hierarchy if the value is absent in this context's view. + */ +Context.prototype.lookup = function lookup(name) { + var cache = this.cache; + var value; + if (cache.hasOwnProperty(name)) { + value = cache[name]; + } + else { + var context = this, intermediateValue, names, index, lookupHit = false; + while (context) { + if (name.indexOf('.') > 0) { + intermediateValue = context.view; + names = name.split('.'); + index = 0; + /** + * Using the dot notion path in `name`, we descend through the + * nested objects. + * + * To be certain that the lookup has been successful, we have to + * check if the last object in the path actually has the property + * we are looking for. We store the result in `lookupHit`. + * + * This is specially necessary for when the value has been set to + * `undefined` and we want to avoid looking up parent contexts. + * + * In the case where dot notation is used, we consider the lookup + * to be successful even if the last "object" in the path is + * not actually an object but a primitive (e.g., a string, or an + * integer), because it is sometimes useful to access a property + * of an autoboxed primitive, such as the length of a string. + **/ + while (intermediateValue != null && index < names.length) { + if (index === names.length - 1) + lookupHit = (hasProperty(intermediateValue, names[index]) + || primitiveHasOwnProperty(intermediateValue, names[index])); + intermediateValue = intermediateValue[names[index++]]; + } + } + else { + intermediateValue = context.view[name]; + /** + * Only checking against `hasProperty`, which always returns `false` if + * `context.view` is not an object. Deliberately omitting the check + * against `primitiveHasOwnProperty` if dot notation is not used. + * + * Consider this example: + * ``` + * Mustache.render("The length of a football field is {{#length}}{{length}}{{/length}}.", {length: "100 yards"}) + * ``` + * + * If we were to check also against `primitiveHasOwnProperty`, as we do + * in the dot notation case, then render call would return: + * + * "The length of a football field is 9." + * + * rather than the expected: + * + * "The length of a football field is 100 yards." + **/ + lookupHit = hasProperty(context.view, name); + } + if (lookupHit) { + value = intermediateValue; + break; + } + context = context.parent; + } + cache[name] = value; + } + if (isFunction(value)) + value = value.call(this.view); + return value; +}; +/** + * A Writer knows how to take a stream of tokens and render them to a + * string, given a context. It also maintains a cache of templates to + * avoid the need to parse the same template twice. + */ +function Writer() { + this.templateCache = { + _cache: {}, + set: function set(key, value) { + this._cache[key] = value; + }, + get: function get(key) { + return this._cache[key]; + }, + clear: function clear() { + this._cache = {}; + } + }; +} +/** + * Clears all cached templates in this writer. + */ +Writer.prototype.clearCache = function clearCache() { + if (typeof this.templateCache !== 'undefined') { + this.templateCache.clear(); + } +}; +/** + * Parses and caches the given `template` according to the given `tags` or + * `mustache.tags` if `tags` is omitted, and returns the array of tokens + * that is generated from the parse. + */ +Writer.prototype.parse = function parse(template, tags) { + var cache = this.templateCache; + var cacheKey = template + ':' + (tags || mustache.tags).join(':'); + var isCacheEnabled = typeof cache !== 'undefined'; + var tokens = isCacheEnabled ? cache.get(cacheKey) : undefined; + if (tokens == undefined) { + tokens = parseTemplate(template, tags); + isCacheEnabled && cache.set(cacheKey, tokens); + } + return tokens; +}; +/** + * High-level method that is used to render the given `template` with + * the given `view`. + * + * The optional `partials` argument may be an object that contains the + * names and templates of partials that are used in the template. It may + * also be a function that is used to load partial templates on the fly + * that takes a single argument: the name of the partial. + * + * If the optional `config` argument is given here, then it should be an + * object with a `tags` attribute or an `escape` attribute or both. + * If an array is passed, then it will be interpreted the same way as + * a `tags` attribute on a `config` object. + * + * The `tags` attribute of a `config` object must be an array with two + * string values: the opening and closing tags used in the template (e.g. + * [ "<%", "%>" ]). The default is to mustache.tags. + * + * The `escape` attribute of a `config` object must be a function which + * accepts a string as input and outputs a safely escaped string. + * If an `escape` function is not provided, then an HTML-safe string + * escaping function is used as the default. + */ +Writer.prototype.render = function render(template, view, partials, config) { + var tags = this.getConfigTags(config); + var tokens = this.parse(template, tags); + var context = (view instanceof Context) ? view : new Context(view, undefined); + return this.renderTokens(tokens, context, partials, template, config); +}; +/** + * Low-level method that renders the given array of `tokens` using + * the given `context` and `partials`. + * + * Note: The `originalTemplate` is only ever used to extract the portion + * of the original template that was contained in a higher-order section. + * If the template doesn't use higher-order sections, this argument may + * be omitted. + */ +Writer.prototype.renderTokens = function renderTokens(tokens, context, partials, originalTemplate, config) { + var buffer = ''; + var token, symbol, value; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + value = undefined; + token = tokens[i]; + symbol = token[0]; + if (symbol === '#') + value = this.renderSection(token, context, partials, originalTemplate, config); + else if (symbol === '^') + value = this.renderInverted(token, context, partials, originalTemplate, config); + else if (symbol === '>') + value = this.renderPartial(token, context, partials, config); + else if (symbol === '&') + value = this.unescapedValue(token, context); + else if (symbol === 'name') + value = this.escapedValue(token, context, config); + else if (symbol === 'text') + value = this.rawValue(token); + if (value !== undefined) + buffer += value; + } + return buffer; +}; +Writer.prototype.renderSection = function renderSection(token, context, partials, originalTemplate, config) { + var self = this; + var buffer = ''; + var value = context.lookup(token[1]); + // This function is used to render an arbitrary template + // in the current context by higher-order sections. + function subRender(template) { + return self.render(template, context, partials, config); + } + if (!value) + return; + if (isArray(value)) { + for (var j = 0, valueLength = value.length; j < valueLength; ++j) { + buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate, config); + } + } + else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') { + buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate, config); + } + else if (isFunction(value)) { + if (typeof originalTemplate !== 'string') + throw new Error('Cannot use higher-order sections without the original template'); + // Extract the portion of the original template that the section contains. + value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender); + if (value != null) + buffer += value; + } + else { + buffer += this.renderTokens(token[4], context, partials, originalTemplate, config); + } + return buffer; +}; +Writer.prototype.renderInverted = function renderInverted(token, context, partials, originalTemplate, config) { + var value = context.lookup(token[1]); + // Use JavaScript's definition of falsy. Include empty arrays. + // See https://github.com/janl/mustache.js/issues/186 + if (!value || (isArray(value) && value.length === 0)) + return this.renderTokens(token[4], context, partials, originalTemplate, config); +}; +Writer.prototype.indentPartial = function indentPartial(partial, indentation, lineHasNonSpace) { + var filteredIndentation = indentation.replace(/[^ \t]/g, ''); + var partialByNl = partial.split('\n'); + for (var i = 0; i < partialByNl.length; i++) { + if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) { + partialByNl[i] = filteredIndentation + partialByNl[i]; + } + } + return partialByNl.join('\n'); +}; +Writer.prototype.renderPartial = function renderPartial(token, context, partials, config) { + if (!partials) + return; + var tags = this.getConfigTags(config); + var value = isFunction(partials) ? partials(token[1]) : partials[token[1]]; + if (value != null) { + var lineHasNonSpace = token[6]; + var tagIndex = token[5]; + var indentation = token[4]; + var indentedValue = value; + if (tagIndex == 0 && indentation) { + indentedValue = this.indentPartial(value, indentation, lineHasNonSpace); + } + var tokens = this.parse(indentedValue, tags); + return this.renderTokens(tokens, context, partials, indentedValue, config); + } +}; +Writer.prototype.unescapedValue = function unescapedValue(token, context) { + var value = context.lookup(token[1]); + if (value != null) + return value; +}; +Writer.prototype.escapedValue = function escapedValue(token, context, config) { + var escape = this.getConfigEscape(config) || mustache.escape; + var value = context.lookup(token[1]); + if (value != null) + return (typeof value === 'number' && escape === mustache.escape) ? String(value) : escape(value); +}; +Writer.prototype.rawValue = function rawValue(token) { + return token[1]; +}; +Writer.prototype.getConfigTags = function getConfigTags(config) { + if (isArray(config)) { + return config; + } + else if (config && typeof config === 'object') { + return config.tags; + } + else { + return undefined; + } +}; +Writer.prototype.getConfigEscape = function getConfigEscape(config) { + if (config && typeof config === 'object' && !isArray(config)) { + return config.escape; + } + else { + return undefined; + } +}; +var mustache = { + name: 'mustache.js', + version: '4.2.0', + tags: ['{{', '}}'], + clearCache: undefined, + escape: undefined, + parse: undefined, + render: undefined, + Scanner: undefined, + Context: undefined, + Writer: undefined, + /** + * Allows a user to override the default caching strategy, by providing an + * object with set, get and clear methods. This can also be used to disable + * the cache by setting it to the literal `undefined`. + */ + set templateCache(cache) { + defaultWriter.templateCache = cache; + }, + /** + * Gets the default or overridden caching object from the default writer. + */ + get templateCache() { + return defaultWriter.templateCache; + } +}; +// All high-level mustache.* functions use this writer. +var defaultWriter = new Writer(); +/** + * Clears all cached templates in the default writer. + */ +mustache.clearCache = function clearCache() { + return defaultWriter.clearCache(); +}; +/** + * Parses and caches the given template in the default writer and returns the + * array of tokens it contains. Doing this ahead of time avoids the need to + * parse templates on the fly as they are rendered. + */ +mustache.parse = function parse(template, tags) { + return defaultWriter.parse(template, tags); +}; +/** + * Renders the `template` with the given `view`, `partials`, and `config` + * using the default writer. + */ +mustache.render = function render(template, view, partials, config) { + if (typeof template !== 'string') { + throw new TypeError('Invalid template! Template should be a "string" ' + + 'but "' + typeStr(template) + '" was given as the first ' + + 'argument for mustache#render(template, view, partials)'); + } + return defaultWriter.render(template, view, partials, config); +}; +// Export the escaping function so that the user may override it. +// See https://github.com/janl/mustache.js/issues/244 +mustache.escape = escapeHtml; +// Export these mainly for testing, but also for advanced usage. +mustache.Scanner = Scanner; +mustache.Context = Context; +mustache.Writer = Writer; +export default mustache; diff --git a/PWA/public/ExternalLibraries/xlsx.full.min.js b/PWA/public/ExternalLibraries/xlsx.full.min.js new file mode 100644 index 0000000..bbc2c13 --- /dev/null +++ b/PWA/public/ExternalLibraries/xlsx.full.min.js @@ -0,0 +1,31969 @@ +/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */ +/* vim: set ts=2: */ +/*exported XLSX */ +/*global process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */ +var XLSX = {}; +XLSX.version = '0.20.0'; +var current_codepage = 1200, current_ansi = 1252; +/*:: declare var cptable:any; */ +/*global cptable:true, window */ +var $cptable; +var VALID_ANSI = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000]; +/* ECMA-376 Part I 18.4.1 charset to codepage mapping */ +var CS2CP = ({ + /*::[*/ 0 /*::]*/: 1252, + /*::[*/ 1 /*::]*/: 65001, + /*::[*/ 2 /*::]*/: 65001, + /*::[*/ 77 /*::]*/: 10000, + /*::[*/ 128 /*::]*/: 932, + /*::[*/ 129 /*::]*/: 949, + /*::[*/ 130 /*::]*/: 1361, + /*::[*/ 134 /*::]*/: 936, + /*::[*/ 136 /*::]*/: 950, + /*::[*/ 161 /*::]*/: 1253, + /*::[*/ 162 /*::]*/: 1254, + /*::[*/ 163 /*::]*/: 1258, + /*::[*/ 177 /*::]*/: 1255, + /*::[*/ 178 /*::]*/: 1256, + /*::[*/ 186 /*::]*/: 1257, + /*::[*/ 204 /*::]*/: 1251, + /*::[*/ 222 /*::]*/: 874, + /*::[*/ 238 /*::]*/: 1250, + /*::[*/ 255 /*::]*/: 1252, + /*::[*/ 69 /*::]*/: 6969 /* MISC */ +} /*:any*/); +var set_ansi = function (cp /*:number*/) { if (VALID_ANSI.indexOf(cp) == -1) + return; current_ansi = CS2CP[0] = cp; }; +function reset_ansi() { set_ansi(1252); } +var set_cp = function (cp /*:number*/) { current_codepage = cp; set_ansi(cp); }; +function reset_cp() { set_cp(1200); reset_ansi(); } +function char_codes(data /*:string*/) { var o /*:Array*/ = []; for (var i = 0, len = data.length; i < len; ++i) + o[i] = data.charCodeAt(i); return o; } +function utf16leread(data /*:string*/) { + var o /*:Array*/ = []; + for (var i = 0; i < (data.length >> 1); ++i) + o[i] = String.fromCharCode(data.charCodeAt(2 * i) + (data.charCodeAt(2 * i + 1) << 8)); + return o.join(""); +} +function utf16lereadu(data /*:Uint8Array*/) { + var o /*:Array*/ = []; + for (var i = 0; i < (data.length >> 1); ++i) + o[i] = String.fromCharCode(data[2 * i] + (data[2 * i + 1] << 8)); + return o.join(""); +} +function utf16beread(data /*:string*/) { + var o /*:Array*/ = []; + for (var i = 0; i < (data.length >> 1); ++i) + o[i] = String.fromCharCode(data.charCodeAt(2 * i + 1) + (data.charCodeAt(2 * i) << 8)); + return o.join(""); +} +var debom = function (data /*:string*/) { + var c1 = data.charCodeAt(0), c2 = data.charCodeAt(1); + if (c1 == 0xFF && c2 == 0xFE) + return utf16leread(data.slice(2)); + if (c1 == 0xFE && c2 == 0xFF) + return utf16beread(data.slice(2)); + if (c1 == 0xFEFF) + return data.slice(1); + return data; +}; +var _getchar = function _gc1(x /*:number*/) { return String.fromCharCode(x); }; +var _getansi = function _ga1(x /*:number*/) { return String.fromCharCode(x); }; +function set_cptable(cptable) { + $cptable = cptable; + set_cp = function (cp /*:number*/) { current_codepage = cp; set_ansi(cp); }; + debom = function (data /*:string*/) { + if (data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { + return $cptable.utils.decode(1200, char_codes(data.slice(2))); + } + return data; + }; + _getchar = function _gc2(x /*:number*/) { + if (current_codepage === 1200) + return String.fromCharCode(x); + return $cptable.utils.decode(current_codepage, [x & 255, x >> 8])[0]; + }; + _getansi = function _ga2(x /*:number*/) { + return $cptable.utils.decode(current_ansi, [x])[0]; + }; + cpdoit(); +} +var DENSE = null; +var DIF_XL = true; +var Base64_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; +function Base64_encode(input) { + var o = ""; + var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; + for (var i = 0; i < input.length;) { + c1 = input.charCodeAt(i++); + e1 = c1 >> 2; + c2 = input.charCodeAt(i++); + e2 = (c1 & 3) << 4 | c2 >> 4; + c3 = input.charCodeAt(i++); + e3 = (c2 & 15) << 2 | c3 >> 6; + e4 = c3 & 63; + if (isNaN(c2)) { + e3 = e4 = 64; + } + else if (isNaN(c3)) { + e4 = 64; + } + o += Base64_map.charAt(e1) + Base64_map.charAt(e2) + Base64_map.charAt(e3) + Base64_map.charAt(e4); + } + return o; +} +function Base64_encode_pass(input) { + var o = ""; + var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; + for (var i = 0; i < input.length;) { + c1 = input.charCodeAt(i++); + if (c1 > 255) + c1 = 95; + e1 = c1 >> 2; + c2 = input.charCodeAt(i++); + if (c2 > 255) + c2 = 95; + e2 = (c1 & 3) << 4 | c2 >> 4; + c3 = input.charCodeAt(i++); + if (c3 > 255) + c3 = 95; + e3 = (c2 & 15) << 2 | c3 >> 6; + e4 = c3 & 63; + if (isNaN(c2)) { + e3 = e4 = 64; + } + else if (isNaN(c3)) { + e4 = 64; + } + o += Base64_map.charAt(e1) + Base64_map.charAt(e2) + Base64_map.charAt(e3) + Base64_map.charAt(e4); + } + return o; +} +function Base64_encode_arr(input) { + var o = ""; + var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; + for (var i = 0; i < input.length;) { + c1 = input[i++]; + e1 = c1 >> 2; + c2 = input[i++]; + e2 = (c1 & 3) << 4 | c2 >> 4; + c3 = input[i++]; + e3 = (c2 & 15) << 2 | c3 >> 6; + e4 = c3 & 63; + if (isNaN(c2)) { + e3 = e4 = 64; + } + else if (isNaN(c3)) { + e4 = 64; + } + o += Base64_map.charAt(e1) + Base64_map.charAt(e2) + Base64_map.charAt(e3) + Base64_map.charAt(e4); + } + return o; +} +function Base64_decode(input) { + var o = ""; + var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; + input = input.replace(/^data:([^\/]+\/[^\/]+)?;base64\,/, "").replace(/[^\w\+\/\=]/g, ""); + for (var i = 0; i < input.length;) { + e1 = Base64_map.indexOf(input.charAt(i++)); + e2 = Base64_map.indexOf(input.charAt(i++)); + c1 = e1 << 2 | e2 >> 4; + o += String.fromCharCode(c1); + e3 = Base64_map.indexOf(input.charAt(i++)); + c2 = (e2 & 15) << 4 | e3 >> 2; + if (e3 !== 64) { + o += String.fromCharCode(c2); + } + e4 = Base64_map.indexOf(input.charAt(i++)); + c3 = (e3 & 3) << 6 | e4; + if (e4 !== 64) { + o += String.fromCharCode(c3); + } + } + return o; +} +var has_buf = /*#__PURE__*/ (function () { return typeof Buffer !== 'undefined' && typeof process !== 'undefined' && typeof process.versions !== 'undefined' && !!process.versions.node; })(); +var Buffer_from = /*#__PURE__*/ (function () { + if (typeof Buffer !== 'undefined') { + var nbfs = !Buffer.from; + if (!nbfs) + try { + Buffer.from("foo", "utf8"); + } + catch (e) { + nbfs = true; + } + return nbfs ? function (buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer); + } + return function () { }; +})(); +var buf_utf16le = /*#__PURE__*/ (function () { + if (typeof Buffer === 'undefined') + return false; + var x = Buffer_from([65, 0]); + if (!x) + return false; + var o = x.toString("utf16le"); + return o.length == 1; +})(); +function new_raw_buf(len /*:number*/) { + /* jshint -W056 */ + if (has_buf) + return Buffer.alloc ? Buffer.alloc(len) : new Buffer(len); + return typeof Uint8Array != "undefined" ? new Uint8Array(len) : new Array(len); + /* jshint +W056 */ +} +function new_unsafe_buf(len /*:number*/) { + /* jshint -W056 */ + if (has_buf) + return Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : new Buffer(len); + return typeof Uint8Array != "undefined" ? new Uint8Array(len) : new Array(len); + /* jshint +W056 */ +} +var s2a = function s2a(s /*:string*/) { + if (has_buf) + return Buffer_from(s, "binary"); + return s.split("").map(function (x /*:string*/) { return x.charCodeAt(0) & 0xff; }); +}; +function s2ab(s /*:string*/) { + if (typeof ArrayBuffer === 'undefined') + return s2a(s); + var buf = new ArrayBuffer(s.length), view = new Uint8Array(buf); + for (var i = 0; i != s.length; ++i) + view[i] = s.charCodeAt(i) & 0xFF; + return buf; +} +function a2s(data /*:any*/) { + if (Array.isArray(data)) + return data.map(function (c) { return String.fromCharCode(c); }).join(""); + var o /*:Array*/ = []; + for (var i = 0; i < data.length; ++i) + o[i] = String.fromCharCode(data[i]); + return o.join(""); +} +function a2u(data /*:Array*/) { + if (typeof Uint8Array === 'undefined') + throw new Error("Unsupported"); + return new Uint8Array(data); +} +function ab2a(data /*:ArrayBuffer|Uint8Array*/) { + if (typeof ArrayBuffer == 'undefined') + throw new Error("Unsupported"); + if (data instanceof ArrayBuffer) + return ab2a(new Uint8Array(data)); + /*:: if(data instanceof ArrayBuffer) throw new Error("unreachable"); */ + var o = new Array(data.length); + for (var i = 0; i < data.length; ++i) + o[i] = data[i]; + return o; +} +var bconcat = has_buf ? function (bufs) { return Buffer.concat(bufs.map(function (buf) { return Buffer.isBuffer(buf) ? buf : Buffer_from(buf); })); } : function (bufs) { + if (typeof Uint8Array !== "undefined") { + var i = 0, maxlen = 0; + for (i = 0; i < bufs.length; ++i) + maxlen += bufs[i].length; + var o = new Uint8Array(maxlen); + var len = 0; + for (i = 0, maxlen = 0; i < bufs.length; maxlen += len, ++i) { + len = bufs[i].length; + if (bufs[i] instanceof Uint8Array) + o.set(bufs[i], maxlen); + else if (typeof bufs[i] == "string") + o.set(new Uint8Array(s2a(bufs[i])), maxlen); + else + o.set(new Uint8Array(bufs[i]), maxlen); + } + return o; + } + return [].concat.apply([], bufs.map(function (buf) { return Array.isArray(buf) ? buf : [].slice.call(buf); })); +}; +function utf8decode(content /*:string*/) { + var out = [], widx = 0, L = content.length + 250; + var o = new_raw_buf(content.length + 255); + for (var ridx = 0; ridx < content.length; ++ridx) { + var c = content.charCodeAt(ridx); + if (c < 0x80) + o[widx++] = c; + else if (c < 0x800) { + o[widx++] = (192 | ((c >> 6) & 31)); + o[widx++] = (128 | (c & 63)); + } + else if (c >= 0xD800 && c < 0xE000) { + c = (c & 1023) + 64; + var d = content.charCodeAt(++ridx) & 1023; + o[widx++] = (240 | ((c >> 8) & 7)); + o[widx++] = (128 | ((c >> 2) & 63)); + o[widx++] = (128 | ((d >> 6) & 15) | ((c & 3) << 4)); + o[widx++] = (128 | (d & 63)); + } + else { + o[widx++] = (224 | ((c >> 12) & 15)); + o[widx++] = (128 | ((c >> 6) & 63)); + o[widx++] = (128 | (c & 63)); + } + if (widx > L) { + out.push(o.slice(0, widx)); + widx = 0; + o = new_raw_buf(65535); + L = 65530; + } + } + out.push(o.slice(0, widx)); + return bconcat(out); +} +var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g; +/*:: +declare type Block = any; +declare type BufArray = { + newblk(sz:number):Block; + next(sz:number):Block; + end():any; + push(buf:Block):void; +}; + +type RecordHopperCB = {(d:any, Rn:string, RT:number):?boolean;}; + +type EvertType = {[string]:string}; +type EvertNumType = {[string]:number}; +type EvertArrType = {[string]:Array}; + +type StringConv = {(string):string}; + +*/ +/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */ +/*jshint -W041 */ +function _strrev(x /*:string*/) { var o = "", i = x.length - 1; while (i >= 0) + o += x.charAt(i--); return o; } +function pad0(v /*:any*/, d /*:number*/) { var t = "" + v; return t.length >= d ? t : fill('0', d - t.length) + t; } +function pad_(v /*:any*/, d /*:number*/) { var t = "" + v; return t.length >= d ? t : fill(' ', d - t.length) + t; } +function rpad_(v /*:any*/, d /*:number*/) { var t = "" + v; return t.length >= d ? t : t + fill(' ', d - t.length); } +function pad0r1(v /*:any*/, d /*:number*/) { var t = "" + Math.round(v); return t.length >= d ? t : fill('0', d - t.length) + t; } +function pad0r2(v /*:any*/, d /*:number*/) { var t = "" + v; return t.length >= d ? t : fill('0', d - t.length) + t; } +var p2_32 = /*#__PURE__*/ Math.pow(2, 32); +function pad0r(v /*:any*/, d /*:number*/) { if (v > p2_32 || v < -p2_32) + return pad0r1(v, d); var i = Math.round(v); return pad0r2(i, d); } +/* yes, in 2022 this is still faster than string compare */ +function SSF_isgeneral(s /*:string*/, i /*:?number*/) { i = i || 0; return s.length >= 7 + i && (s.charCodeAt(i) | 32) === 103 && (s.charCodeAt(i + 1) | 32) === 101 && (s.charCodeAt(i + 2) | 32) === 110 && (s.charCodeAt(i + 3) | 32) === 101 && (s.charCodeAt(i + 4) | 32) === 114 && (s.charCodeAt(i + 5) | 32) === 97 && (s.charCodeAt(i + 6) | 32) === 108; } +var days /*:Array >*/ = [ + ['Sun', 'Sunday'], + ['Mon', 'Monday'], + ['Tue', 'Tuesday'], + ['Wed', 'Wednesday'], + ['Thu', 'Thursday'], + ['Fri', 'Friday'], + ['Sat', 'Saturday'] +]; +var months /*:Array >*/ = [ + ['J', 'Jan', 'January'], + ['F', 'Feb', 'February'], + ['M', 'Mar', 'March'], + ['A', 'Apr', 'April'], + ['M', 'May', 'May'], + ['J', 'Jun', 'June'], + ['J', 'Jul', 'July'], + ['A', 'Aug', 'August'], + ['S', 'Sep', 'September'], + ['O', 'Oct', 'October'], + ['N', 'Nov', 'November'], + ['D', 'Dec', 'December'] +]; +function SSF_init_table(t /*:any*/) { + if (!t) + t = {}; + t[0] = 'General'; + t[1] = '0'; + t[2] = '0.00'; + t[3] = '#,##0'; + t[4] = '#,##0.00'; + t[9] = '0%'; + t[10] = '0.00%'; + t[11] = '0.00E+00'; + t[12] = '# ?/?'; + t[13] = '# ??/??'; + t[14] = 'm/d/yy'; + t[15] = 'd-mmm-yy'; + t[16] = 'd-mmm'; + t[17] = 'mmm-yy'; + t[18] = 'h:mm AM/PM'; + t[19] = 'h:mm:ss AM/PM'; + t[20] = 'h:mm'; + t[21] = 'h:mm:ss'; + t[22] = 'm/d/yy h:mm'; + t[37] = '#,##0 ;(#,##0)'; + t[38] = '#,##0 ;[Red](#,##0)'; + t[39] = '#,##0.00;(#,##0.00)'; + t[40] = '#,##0.00;[Red](#,##0.00)'; + t[45] = 'mm:ss'; + t[46] = '[h]:mm:ss'; + t[47] = 'mmss.0'; + t[48] = '##0.0E+0'; + t[49] = '@'; + t[56] = '"上午/下午 "hh"時"mm"分"ss"秒 "'; + return t; +} +/* repeated to satiate webpack */ +var table_fmt = { + 0: 'General', + 1: '0', + 2: '0.00', + 3: '#,##0', + 4: '#,##0.00', + 9: '0%', + 10: '0.00%', + 11: '0.00E+00', + 12: '# ?/?', + 13: '# ??/??', + 14: 'm/d/yy', + 15: 'd-mmm-yy', + 16: 'd-mmm', + 17: 'mmm-yy', + 18: 'h:mm AM/PM', + 19: 'h:mm:ss AM/PM', + 20: 'h:mm', + 21: 'h:mm:ss', + 22: 'm/d/yy h:mm', + 37: '#,##0 ;(#,##0)', + 38: '#,##0 ;[Red](#,##0)', + 39: '#,##0.00;(#,##0.00)', + 40: '#,##0.00;[Red](#,##0.00)', + 45: 'mm:ss', + 46: '[h]:mm:ss', + 47: 'mmss.0', + 48: '##0.0E+0', + 49: '@', + 56: '"上午/下午 "hh"時"mm"分"ss"秒 "' +}; +/* Defaults determined by systematically testing in Excel 2019 */ +/* These formats appear to default to other formats in the table */ +var SSF_default_map = { + 5: 37, 6: 38, 7: 39, 8: 40, + 23: 0, 24: 0, 25: 0, 26: 0, + 27: 14, 28: 14, 29: 14, 30: 14, 31: 14, + 50: 14, 51: 14, 52: 14, 53: 14, 54: 14, + 55: 14, 56: 14, 57: 14, 58: 14, + 59: 1, 60: 2, 61: 3, 62: 4, + 67: 9, 68: 10, + 69: 12, 70: 13, 71: 14, + 72: 14, 73: 15, 74: 16, 75: 17, + 76: 20, 77: 21, 78: 22, + 79: 45, 80: 46, 81: 47, + 82: 0 // 82 -> 0 ... 65536 -> 0 (omitted) +}; +/* These formats technically refer to Accounting formats with no equivalent */ +var SSF_default_str = { + // 5 -- Currency, 0 decimal, black negative + 5: '"$"#,##0_);\\("$"#,##0\\)', + 63: '"$"#,##0_);\\("$"#,##0\\)', + // 6 -- Currency, 0 decimal, red negative + 6: '"$"#,##0_);[Red]\\("$"#,##0\\)', + 64: '"$"#,##0_);[Red]\\("$"#,##0\\)', + // 7 -- Currency, 2 decimal, black negative + 7: '"$"#,##0.00_);\\("$"#,##0.00\\)', + 65: '"$"#,##0.00_);\\("$"#,##0.00\\)', + // 8 -- Currency, 2 decimal, red negative + 8: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + 66: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + // 41 -- Accounting, 0 decimal, No Symbol + 41: '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', + // 42 -- Accounting, 0 decimal, $ Symbol + 42: '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', + // 43 -- Accounting, 2 decimal, No Symbol + 43: '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', + // 44 -- Accounting, 2 decimal, $ Symbol + 44: '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)' +}; +function SSF_frac(x /*:number*/, D /*:number*/, mixed /*:?boolean*/) { + var sgn = x < 0 ? -1 : 1; + var B = x * sgn; + var P_2 = 0, P_1 = 1, P = 0; + var Q_2 = 1, Q_1 = 0, Q = 0; + var A = Math.floor(B); + while (Q_1 < D) { + A = Math.floor(B); + P = A * P_1 + P_2; + Q = A * Q_1 + Q_2; + if ((B - A) < 0.00000005) + break; + B = 1 / (B - A); + P_2 = P_1; + P_1 = P; + Q_2 = Q_1; + Q_1 = Q; + } + if (Q > D) { + if (Q_1 > D) { + Q = Q_2; + P = P_2; + } + else { + Q = Q_1; + P = P_1; + } + } + if (!mixed) + return [0, sgn * P, Q]; + var q = Math.floor(sgn * P / Q); + return [q, sgn * P - q * Q, Q]; +} +function SSF_parse_date_code(v /*:number*/, opts /*:?any*/, b2 /*:?boolean*/) { + if (v > 2958465 || v < 0) + return null; + var date = (v | 0), time = Math.floor(86400 * (v - date)), dow = 0; + var dout = []; + var out = { D: date, T: time, u: 86400 * (v - date) - time, y: 0, m: 0, d: 0, H: 0, M: 0, S: 0, q: 0 }; + if (Math.abs(out.u) < 1e-6) + out.u = 0; + if (opts && opts.date1904) + date += 1462; + if (out.u > 0.9999) { + out.u = 0; + if (++time == 86400) { + out.T = time = 0; + ++date; + ++out.D; + } + } + if (date === 60) { + dout = b2 ? [1317, 10, 29] : [1900, 2, 29]; + dow = 3; + } + else if (date === 0) { + dout = b2 ? [1317, 8, 29] : [1900, 1, 0]; + dow = 6; + } + else { + if (date > 60) + --date; + /* 1 = Jan 1 1900 in Gregorian */ + var d = new Date(1900, 0, 1); + d.setDate(d.getDate() + date - 1); + dout = [d.getFullYear(), d.getMonth() + 1, d.getDate()]; + dow = d.getDay(); + if (date < 60) + dow = (dow + 6) % 7; + if (b2) + dow = SSF_fix_hijri(d, dout); + } + out.y = dout[0]; + out.m = dout[1]; + out.d = dout[2]; + out.S = time % 60; + time = Math.floor(time / 60); + out.M = time % 60; + time = Math.floor(time / 60); + out.H = time; + out.q = dow; + return out; +} +/* ECMA-376 18.8.30 numFmt*/ +/* Note: `toPrecision` uses standard form when prec > E and E >= -6 */ +/* exponent >= -9 and <= 9 */ +function SSF_strip_decimal(o /*:string*/) { + return (o.indexOf(".") == -1) ? o : o.replace(/(?:\.0*|(\.\d*[1-9])0+)$/, "$1"); +} +/* General Exponential always shows 2 digits exp and trims the mantissa */ +function SSF_normalize_exp(o /*:string*/) { + if (o.indexOf("E") == -1) + return o; + return o.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/, "$1E").replace(/(E[+-])(\d)$/, "$10$2"); +} +/* exponent >= -9 and <= 9 */ +function SSF_small_exp(v /*:number*/) { + var w = (v < 0 ? 12 : 11); + var o = SSF_strip_decimal(v.toFixed(12)); + if (o.length <= w) + return o; + o = v.toPrecision(10); + if (o.length <= w) + return o; + return v.toExponential(5); +} +/* exponent >= 11 or <= -10 likely exponential */ +function SSF_large_exp(v /*:number*/) { + var o = SSF_strip_decimal(v.toFixed(11)); + return (o.length > (v < 0 ? 12 : 11) || o === "0" || o === "-0") ? v.toPrecision(6) : o; +} +function SSF_general_num(v /*:number*/) { + var V = Math.floor(Math.log(Math.abs(v)) * Math.LOG10E), o; + if (V >= -4 && V <= -1) + o = v.toPrecision(10 + V); + else if (Math.abs(V) <= 9) + o = SSF_small_exp(v); + else if (V === 10) + o = v.toFixed(10).substr(0, 12); + else + o = SSF_large_exp(v); + return SSF_strip_decimal(SSF_normalize_exp(o.toUpperCase())); +} +/* + "General" rules: + - text is passed through ("@") + - booleans are rendered as TRUE/FALSE + - "up to 11 characters" displayed for numbers + - Default date format (code 14) used for Dates + + The longest 32-bit integer text is "-2147483648", exactly 11 chars + TODO: technically the display depends on the width of the cell +*/ +function SSF_general(v /*:any*/, opts /*:any*/) { + switch (typeof v) { + case 'string': return v; + case 'boolean': return v ? "TRUE" : "FALSE"; + case 'number': return (v | 0) === v ? v.toString(10) : SSF_general_num(v); + case 'undefined': return ""; + case 'object': + if (v == null) + return ""; + if (v instanceof Date) + return SSF_format(14, datenum(v, opts && opts.date1904), opts); + } + throw new Error("unsupported value in General format: " + v); +} +function SSF_fix_hijri(date /*:Date*/, o /*:[number, number, number]*/) { + /* TODO: properly adjust y/m/d and */ + o[0] -= 581; + var dow = date.getDay(); + if (date < 60) + dow = (dow + 6) % 7; + return dow; +} +//var THAI_DIGITS = "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59".split(""); +function SSF_write_date(type /*:number*/, fmt /*:string*/, val, ss0 /*:?number*/) { + var o = "", ss = 0, tt = 0, y = val.y, out, outl = 0; + switch (type) { + case 98: /* 'b' buddhist year */ + y = val.y + 543; + /* falls through */ + case 121: /* 'y' year */ + switch (fmt.length) { + case 1: + case 2: + out = y % 100; + outl = 2; + break; + default: + out = y % 10000; + outl = 4; + break; + } + break; + case 109: /* 'm' month */ + switch (fmt.length) { + case 1: + case 2: + out = val.m; + outl = fmt.length; + break; + case 3: return months[val.m - 1][1]; + case 5: return months[val.m - 1][0]; + default: return months[val.m - 1][2]; + } + break; + case 100: /* 'd' day */ + switch (fmt.length) { + case 1: + case 2: + out = val.d; + outl = fmt.length; + break; + case 3: return days[val.q][0]; + default: return days[val.q][1]; + } + break; + case 104: /* 'h' 12-hour */ + switch (fmt.length) { + case 1: + case 2: + out = 1 + (val.H + 11) % 12; + outl = fmt.length; + break; + default: throw 'bad hour format: ' + fmt; + } + break; + case 72: /* 'H' 24-hour */ + switch (fmt.length) { + case 1: + case 2: + out = val.H; + outl = fmt.length; + break; + default: throw 'bad hour format: ' + fmt; + } + break; + case 77: /* 'M' minutes */ + switch (fmt.length) { + case 1: + case 2: + out = val.M; + outl = fmt.length; + break; + default: throw 'bad minute format: ' + fmt; + } + break; + case 115: /* 's' seconds */ + if (fmt != 's' && fmt != 'ss' && fmt != '.0' && fmt != '.00' && fmt != '.000') + throw 'bad second format: ' + fmt; + if (val.u === 0 && (fmt == "s" || fmt == "ss")) + return pad0(val.S, fmt.length); + /*::if(!ss0) ss0 = 0; */ + if (ss0 >= 2) + tt = ss0 === 3 ? 1000 : 100; + else + tt = ss0 === 1 ? 10 : 1; + ss = Math.round((tt) * (val.S + val.u)); + if (ss >= 60 * tt) + ss = 0; + if (fmt === 's') + return ss === 0 ? "0" : "" + ss / tt; + o = pad0(ss, 2 + ss0); + if (fmt === 'ss') + return o.substr(0, 2); + return "." + o.substr(2, fmt.length - 1); + case 90: /* 'Z' absolute time */ + switch (fmt) { + case '[h]': + case '[hh]': + out = val.D * 24 + val.H; + break; + case '[m]': + case '[mm]': + out = (val.D * 24 + val.H) * 60 + val.M; + break; + case '[s]': + case '[ss]': + out = ((val.D * 24 + val.H) * 60 + val.M) * 60 + Math.round(val.S + val.u); + break; + default: throw 'bad abstime format: ' + fmt; + } + outl = fmt.length === 3 ? 1 : 2; + break; + case 101: /* 'e' era */ + out = y; + outl = 1; + break; + } + var outstr = outl > 0 ? pad0(out, outl) : ""; + return outstr; +} +/*jshint -W086 */ +/*jshint +W086 */ +function commaify(s /*:string*/) { + var w = 3; + if (s.length <= w) + return s; + var j = (s.length % w), o = s.substr(0, j); + for (; j != s.length; j += w) + o += (o.length > 0 ? "," : "") + s.substr(j, w); + return o; +} +var pct1 = /%/g; +function write_num_pct(type /*:string*/, fmt /*:string*/, val /*:number*/) { + var sfmt = fmt.replace(pct1, ""), mul = fmt.length - sfmt.length; + return write_num(type, sfmt, val * Math.pow(10, 2 * mul)) + fill("%", mul); +} +function write_num_cm(type /*:string*/, fmt /*:string*/, val /*:number*/) { + var idx = fmt.length - 1; + while (fmt.charCodeAt(idx - 1) === 44) + --idx; + return write_num(type, fmt.substr(0, idx), val / Math.pow(10, 3 * (fmt.length - idx))); +} +function write_num_exp(fmt /*:string*/, val /*:number*/) { + var o /*:string*/; + var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1; + if (fmt.match(/^#+0.0E\+0$/)) { + if (val == 0) + return "0.0E+0"; + else if (val < 0) + return "-" + write_num_exp(fmt, -val); + var period = fmt.indexOf("."); + if (period === -1) + period = fmt.indexOf('E'); + var ee = Math.floor(Math.log(val) * Math.LOG10E) % period; + if (ee < 0) + ee += period; + o = (val / Math.pow(10, ee)).toPrecision(idx + 1 + (period + ee) % period); + if (o.indexOf("e") === -1) { + var fakee = Math.floor(Math.log(val) * Math.LOG10E); + if (o.indexOf(".") === -1) + o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length + ee); + else + o += "E+" + (fakee - ee); + while (o.substr(0, 2) === "0.") { + o = o.charAt(0) + o.substr(2, period) + "." + o.substr(2 + period); + o = o.replace(/^0+([1-9])/, "$1").replace(/^0+\./, "0."); + } + o = o.replace(/\+-/, "-"); + } + o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function ($$, $1, $2, $3) { return $1 + $2 + $3.substr(0, (period + ee) % period) + "." + $3.substr(ee) + "E"; }); + } + else + o = val.toExponential(idx); + if (fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) + o = o.substr(0, o.length - 1) + "0" + o.charAt(o.length - 1); + if (fmt.match(/E\-/) && o.match(/e\+/)) + o = o.replace(/e\+/, "e"); + return o.replace("e", "E"); +} +var frac1 = /# (\?+)( ?)\/( ?)(\d+)/; +function write_num_f1(r /*:Array*/, aval /*:number*/, sign /*:string*/) { + var den = parseInt(r[4], 10), rr = Math.round(aval * den), base = Math.floor(rr / den); + var myn = (rr - base * den), myd = den; + return sign + (base === 0 ? "" : "" + base) + " " + (myn === 0 ? fill(" ", r[1].length + 1 + r[4].length) : pad_(myn, r[1].length) + r[2] + "/" + r[3] + pad0(myd, r[4].length)); +} +function write_num_f2(r /*:Array*/, aval /*:number*/, sign /*:string*/) { + return sign + (aval === 0 ? "" : "" + aval) + fill(" ", r[1].length + 2 + r[4].length); +} +var dec1 = /^#*0*\.([0#]+)/; +var closeparen = /\).*[0#]/; +var phone = /\(###\) ###\\?-####/; +function hashq(str /*:string*/) { + var o = "", cc; + for (var i = 0; i != str.length; ++i) + switch ((cc = str.charCodeAt(i))) { + case 35: break; + case 63: + o += " "; + break; + case 48: + o += "0"; + break; + default: o += String.fromCharCode(cc); + } + return o; +} +function rnd(val /*:number*/, d /*:number*/) { var dd = Math.pow(10, d); return "" + (Math.round(val * dd) / dd); } +function dec(val /*:number*/, d /*:number*/) { + var _frac = val - Math.floor(val), dd = Math.pow(10, d); + if (d < ('' + Math.round(_frac * dd)).length) + return 0; + return Math.round(_frac * dd); +} +function carry(val /*:number*/, d /*:number*/) { + if (d < ('' + Math.round((val - Math.floor(val)) * Math.pow(10, d))).length) { + return 1; + } + return 0; +} +function flr(val /*:number*/) { + if (val < 2147483647 && val > -2147483648) + return "" + (val >= 0 ? (val | 0) : (val - 1 | 0)); + return "" + Math.floor(val); +} +function write_num_flt(type /*:string*/, fmt /*:string*/, val /*:number*/) { + if (type.charCodeAt(0) === 40 && !fmt.match(closeparen)) { + var ffmt = fmt.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, ""); + if (val >= 0) + return write_num_flt('n', ffmt, val); + return '(' + write_num_flt('n', ffmt, -val) + ')'; + } + if (fmt.charCodeAt(fmt.length - 1) === 44) + return write_num_cm(type, fmt, val); + if (fmt.indexOf('%') !== -1) + return write_num_pct(type, fmt, val); + if (fmt.indexOf('E') !== -1) + return write_num_exp(fmt, val); + if (fmt.charCodeAt(0) === 36) + return "$" + write_num_flt(type, fmt.substr(fmt.charAt(1) == ' ' ? 2 : 1), val); + var o; + var r /*:?Array*/, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : ""; + if (fmt.match(/^00+$/)) + return sign + pad0r(aval, fmt.length); + if (fmt.match(/^[#?]+$/)) { + o = pad0r(val, 0); + if (o === "0") + o = ""; + return o.length > fmt.length ? o : hashq(fmt.substr(0, fmt.length - o.length)) + o; + } + if ((r = fmt.match(frac1))) + return write_num_f1(r, aval, sign); + if (fmt.match(/^#+0+$/)) + return sign + pad0r(aval, fmt.length - fmt.indexOf("0")); + if ((r = fmt.match(dec1))) { + o = rnd(val, r[1].length).replace(/^([^\.]+)$/, "$1." + hashq(r[1])).replace(/\.$/, "." + hashq(r[1])).replace(/\.(\d*)$/, function ($$, $1) { return "." + $1 + fill("0", hashq(/*::(*/ r /*::||[""])*/[1]).length - $1.length); }); + return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./, "."); + } + fmt = fmt.replace(/^#+([0.])/, "$1"); + if ((r = fmt.match(/^(0*)\.(#*)$/))) { + return sign + rnd(aval, r[2].length).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, r[1].length ? "0." : "."); + } + if ((r = fmt.match(/^#{1,3},##0(\.?)$/))) + return sign + commaify(pad0r(aval, 0)); + if ((r = fmt.match(/^#,##0\.([#0]*0)$/))) { + return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify("" + (Math.floor(val) + carry(val, r[1].length))) + "." + pad0(dec(val, r[1].length), r[1].length); + } + if ((r = fmt.match(/^#,#*,#0/))) + return write_num_flt(type, fmt.replace(/^#,#*,/, ""), val); + if ((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) { + o = _strrev(write_num_flt(type, fmt.replace(/[\\-]/g, ""), val)); + ri = 0; + return _strrev(_strrev(fmt.replace(/\\/g, "")).replace(/[0#]/g, function (x) { return ri < o.length ? o.charAt(ri++) : x === '0' ? '0' : ""; })); + } + if (fmt.match(phone)) { + o = write_num_flt(type, "##########", val); + return "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6); + } + var oa = ""; + if ((r = fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))) { + ri = Math.min(/*::String(*/ r[4] /*::)*/.length, 7); + ff = SSF_frac(aval, Math.pow(10, ri) - 1, false); + o = "" + sign; + oa = write_num("n", /*::String(*/ r[1] /*::)*/, ff[1]); + if (oa.charAt(oa.length - 1) == " ") + oa = oa.substr(0, oa.length - 1) + "0"; + o += oa + /*::String(*/ r[2] /*::)*/ + "/" + /*::String(*/ r[3] /*::)*/; + oa = rpad_(ff[2], ri); + if (oa.length < r[4].length) + oa = hashq(r[4].substr(r[4].length - oa.length)) + oa; + o += oa; + return o; + } + if ((r = fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))) { + ri = Math.min(Math.max(r[1].length, r[4].length), 7); + ff = SSF_frac(aval, Math.pow(10, ri) - 1, true); + return sign + (ff[0] || (ff[1] ? "" : "0")) + " " + (ff[1] ? pad_(ff[1], ri) + r[2] + "/" + r[3] + rpad_(ff[2], ri) : fill(" ", 2 * ri + 1 + r[2].length + r[3].length)); + } + if ((r = fmt.match(/^[#0?]+$/))) { + o = pad0r(val, 0); + if (fmt.length <= o.length) + return o; + return hashq(fmt.substr(0, fmt.length - o.length)) + o; + } + if ((r = fmt.match(/^([#0?]+)\.([#0]+)$/))) { + o = "" + val.toFixed(Math.min(r[2].length, 10)).replace(/([^0])0+$/, "$1"); + ri = o.indexOf("."); + var lres = fmt.indexOf(".") - ri, rres = fmt.length - o.length - lres; + return hashq(fmt.substr(0, lres) + o + fmt.substr(fmt.length - rres)); + } + if ((r = fmt.match(/^00,000\.([#0]*0)$/))) { + ri = dec(val, r[1].length); + return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify(flr(val)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function ($$) { return "00," + ($$.length < 3 ? pad0(0, 3 - $$.length) : "") + $$; }) + "." + pad0(ri, r[1].length); + } + switch (fmt) { + case "###,##0.00": return write_num_flt(type, "#,##0.00", val); + case "###,###": + case "##,###": + case "#,###": + var x = commaify(pad0r(aval, 0)); + return x !== "0" ? sign + x : ""; + case "###,###.00": return write_num_flt(type, "###,##0.00", val).replace(/^0\./, "."); + case "#,###.00": return write_num_flt(type, "#,##0.00", val).replace(/^0\./, "."); + default: + } + throw new Error("unsupported format |" + fmt + "|"); +} +function write_num_cm2(type /*:string*/, fmt /*:string*/, val /*:number*/) { + var idx = fmt.length - 1; + while (fmt.charCodeAt(idx - 1) === 44) + --idx; + return write_num(type, fmt.substr(0, idx), val / Math.pow(10, 3 * (fmt.length - idx))); +} +function write_num_pct2(type /*:string*/, fmt /*:string*/, val /*:number*/) { + var sfmt = fmt.replace(pct1, ""), mul = fmt.length - sfmt.length; + return write_num(type, sfmt, val * Math.pow(10, 2 * mul)) + fill("%", mul); +} +function write_num_exp2(fmt /*:string*/, val /*:number*/) { + var o /*:string*/; + var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1; + if (fmt.match(/^#+0.0E\+0$/)) { + if (val == 0) + return "0.0E+0"; + else if (val < 0) + return "-" + write_num_exp2(fmt, -val); + var period = fmt.indexOf("."); + if (period === -1) + period = fmt.indexOf('E'); + var ee = Math.floor(Math.log(val) * Math.LOG10E) % period; + if (ee < 0) + ee += period; + o = (val / Math.pow(10, ee)).toPrecision(idx + 1 + (period + ee) % period); + if (!o.match(/[Ee]/)) { + var fakee = Math.floor(Math.log(val) * Math.LOG10E); + if (o.indexOf(".") === -1) + o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length + ee); + else + o += "E+" + (fakee - ee); + o = o.replace(/\+-/, "-"); + } + o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function ($$, $1, $2, $3) { return $1 + $2 + $3.substr(0, (period + ee) % period) + "." + $3.substr(ee) + "E"; }); + } + else + o = val.toExponential(idx); + if (fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) + o = o.substr(0, o.length - 1) + "0" + o.charAt(o.length - 1); + if (fmt.match(/E\-/) && o.match(/e\+/)) + o = o.replace(/e\+/, "e"); + return o.replace("e", "E"); +} +function write_num_int(type /*:string*/, fmt /*:string*/, val /*:number*/) { + if (type.charCodeAt(0) === 40 && !fmt.match(closeparen)) { + var ffmt = fmt.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, ""); + if (val >= 0) + return write_num_int('n', ffmt, val); + return '(' + write_num_int('n', ffmt, -val) + ')'; + } + if (fmt.charCodeAt(fmt.length - 1) === 44) + return write_num_cm2(type, fmt, val); + if (fmt.indexOf('%') !== -1) + return write_num_pct2(type, fmt, val); + if (fmt.indexOf('E') !== -1) + return write_num_exp2(fmt, val); + if (fmt.charCodeAt(0) === 36) + return "$" + write_num_int(type, fmt.substr(fmt.charAt(1) == ' ' ? 2 : 1), val); + var o; + var r /*:?Array*/, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : ""; + if (fmt.match(/^00+$/)) + return sign + pad0(aval, fmt.length); + if (fmt.match(/^[#?]+$/)) { + o = ("" + val); + if (val === 0) + o = ""; + return o.length > fmt.length ? o : hashq(fmt.substr(0, fmt.length - o.length)) + o; + } + if ((r = fmt.match(frac1))) + return write_num_f2(r, aval, sign); + if (fmt.match(/^#+0+$/)) + return sign + pad0(aval, fmt.length - fmt.indexOf("0")); + if ((r = fmt.match(dec1))) { + /*:: if(!Array.isArray(r)) throw new Error("unreachable"); */ + o = ("" + val).replace(/^([^\.]+)$/, "$1." + hashq(r[1])).replace(/\.$/, "." + hashq(r[1])); + o = o.replace(/\.(\d*)$/, function ($$, $1) { + /*:: if(!Array.isArray(r)) throw new Error("unreachable"); */ + return "." + $1 + fill("0", hashq(r[1]).length - $1.length); + }); + return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./, "."); + } + fmt = fmt.replace(/^#+([0.])/, "$1"); + if ((r = fmt.match(/^(0*)\.(#*)$/))) { + return sign + ("" + aval).replace(/\.(\d*[1-9])0*$/, ".$1").replace(/^(-?\d*)$/, "$1.").replace(/^0\./, r[1].length ? "0." : "."); + } + if ((r = fmt.match(/^#{1,3},##0(\.?)$/))) + return sign + commaify(("" + aval)); + if ((r = fmt.match(/^#,##0\.([#0]*0)$/))) { + return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify(("" + val)) + "." + fill('0', r[1].length); + } + if ((r = fmt.match(/^#,#*,#0/))) + return write_num_int(type, fmt.replace(/^#,#*,/, ""), val); + if ((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) { + o = _strrev(write_num_int(type, fmt.replace(/[\\-]/g, ""), val)); + ri = 0; + return _strrev(_strrev(fmt.replace(/\\/g, "")).replace(/[0#]/g, function (x) { return ri < o.length ? o.charAt(ri++) : x === '0' ? '0' : ""; })); + } + if (fmt.match(phone)) { + o = write_num_int(type, "##########", val); + return "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6); + } + var oa = ""; + if ((r = fmt.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))) { + ri = Math.min(/*::String(*/ r[4] /*::)*/.length, 7); + ff = SSF_frac(aval, Math.pow(10, ri) - 1, false); + o = "" + sign; + oa = write_num("n", /*::String(*/ r[1] /*::)*/, ff[1]); + if (oa.charAt(oa.length - 1) == " ") + oa = oa.substr(0, oa.length - 1) + "0"; + o += oa + /*::String(*/ r[2] /*::)*/ + "/" + /*::String(*/ r[3] /*::)*/; + oa = rpad_(ff[2], ri); + if (oa.length < r[4].length) + oa = hashq(r[4].substr(r[4].length - oa.length)) + oa; + o += oa; + return o; + } + if ((r = fmt.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))) { + ri = Math.min(Math.max(r[1].length, r[4].length), 7); + ff = SSF_frac(aval, Math.pow(10, ri) - 1, true); + return sign + (ff[0] || (ff[1] ? "" : "0")) + " " + (ff[1] ? pad_(ff[1], ri) + r[2] + "/" + r[3] + rpad_(ff[2], ri) : fill(" ", 2 * ri + 1 + r[2].length + r[3].length)); + } + if ((r = fmt.match(/^[#0?]+$/))) { + o = "" + val; + if (fmt.length <= o.length) + return o; + return hashq(fmt.substr(0, fmt.length - o.length)) + o; + } + if ((r = fmt.match(/^([#0]+)\.([#0]+)$/))) { + o = "" + val.toFixed(Math.min(r[2].length, 10)).replace(/([^0])0+$/, "$1"); + ri = o.indexOf("."); + var lres = fmt.indexOf(".") - ri, rres = fmt.length - o.length - lres; + return hashq(fmt.substr(0, lres) + o + fmt.substr(fmt.length - rres)); + } + if ((r = fmt.match(/^00,000\.([#0]*0)$/))) { + return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify("" + val).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function ($$) { return "00," + ($$.length < 3 ? pad0(0, 3 - $$.length) : "") + $$; }) + "." + pad0(0, r[1].length); + } + switch (fmt) { + case "###,###": + case "##,###": + case "#,###": + var x = commaify("" + aval); + return x !== "0" ? sign + x : ""; + default: + if (fmt.match(/\.[0#?]*$/)) + return write_num_int(type, fmt.slice(0, fmt.lastIndexOf(".")), val) + hashq(fmt.slice(fmt.lastIndexOf("."))); + } + throw new Error("unsupported format |" + fmt + "|"); +} +function write_num(type /*:string*/, fmt /*:string*/, val /*:number*/) { + return (val | 0) === val ? write_num_int(type, fmt, val) : write_num_flt(type, fmt, val); +} +function SSF_split_fmt(fmt /*:string*/) { + var out /*:Array*/ = []; + var in_str = false /*, cc*/; + for (var i = 0, j = 0; i < fmt.length; ++i) + switch (( /*cc=*/fmt.charCodeAt(i))) { + case 34: /* '"' */ + in_str = !in_str; + break; + case 95: + case 42: + case 92: /* '_' '*' '\\' */ + ++i; + break; + case 59: /* ';' */ + out[out.length] = fmt.substr(j, i - j); + j = i + 1; + } + out[out.length] = fmt.substr(j); + if (in_str === true) + throw new Error("Format |" + fmt + "| unterminated string "); + return out; +} +var SSF_abstime = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/; +function fmt_is_date(fmt /*:string*/) { + var i = 0, /*cc = 0,*/ c = "", o = ""; + while (i < fmt.length) { + switch ((c = fmt.charAt(i))) { + case 'G': + if (SSF_isgeneral(fmt, i)) + i += 6; + i++; + break; + case '"': + for (; ( /*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) { /*empty*/ } + ++i; + break; + case '\\': + i += 2; + break; + case '_': + i += 2; + break; + case '@': + ++i; + break; + case 'B': + case 'b': + if (fmt.charAt(i + 1) === "1" || fmt.charAt(i + 1) === "2") + return true; + /* falls through */ + case 'M': + case 'D': + case 'Y': + case 'H': + case 'S': + case 'E': + /* falls through */ + case 'm': + case 'd': + case 'y': + case 'h': + case 's': + case 'e': + case 'g': return true; + case 'A': + case 'a': + case '上': + if (fmt.substr(i, 3).toUpperCase() === "A/P") + return true; + if (fmt.substr(i, 5).toUpperCase() === "AM/PM") + return true; + if (fmt.substr(i, 5).toUpperCase() === "上午/下午") + return true; + ++i; + break; + case '[': + o = c; + while (fmt.charAt(i++) !== ']' && i < fmt.length) + o += fmt.charAt(i); + if (o.match(SSF_abstime)) + return true; + break; + case '.': + /* falls through */ + case '0': + case '#': + while (i < fmt.length && ("0#?.,E+-%".indexOf(c = fmt.charAt(++i)) > -1 || (c == '\\' && fmt.charAt(i + 1) == "-" && "0#".indexOf(fmt.charAt(i + 2)) > -1))) { /* empty */ } + break; + case '?': + while (fmt.charAt(++i) === c) { /* empty */ } + break; + case '*': + ++i; + if (fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') + ++i; + break; + case '(': + case ')': + ++i; + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + while (i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) { /* empty */ } + break; + case ' ': + ++i; + break; + default: + ++i; + break; + } + } + return false; +} +function eval_fmt(fmt /*:string*/, v /*:any*/, opts /*:any*/, flen /*:number*/) { + var out = [], o = "", i = 0, c = "", lst = 't', dt, j, cc; + var hr = 'H'; + /* Tokenize */ + while (i < fmt.length) { + switch ((c = fmt.charAt(i))) { + case 'G': /* General */ + if (!SSF_isgeneral(fmt, i)) + throw new Error('unrecognized character ' + c + ' in ' + fmt); + out[out.length] = { t: 'G', v: 'General' }; + i += 7; + break; + case '"': /* Literal text */ + for (o = ""; (cc = fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) + o += String.fromCharCode(cc); + out[out.length] = { t: 't', v: o }; + ++i; + break; + case '\\': + var w = fmt.charAt(++i), t = (w === "(" || w === ")") ? w : 't'; + out[out.length] = { t: t, v: w }; + ++i; + break; + case '_': + out[out.length] = { t: 't', v: " " }; + i += 2; + break; + case '@': /* Text Placeholder */ + out[out.length] = { t: 'T', v: v }; + ++i; + break; + case 'B': + case 'b': + if (fmt.charAt(i + 1) === "1" || fmt.charAt(i + 1) === "2") { + if (dt == null) { + dt = SSF_parse_date_code(v, opts, fmt.charAt(i + 1) === "2"); + if (dt == null) + return ""; + } + out[out.length] = { t: 'X', v: fmt.substr(i, 2) }; + lst = c; + i += 2; + break; + } + /* falls through */ + case 'M': + case 'D': + case 'Y': + case 'H': + case 'S': + case 'E': + c = c.toLowerCase(); + /* falls through */ + case 'm': + case 'd': + case 'y': + case 'h': + case 's': + case 'e': + case 'g': + if (v < 0) + return ""; + if (dt == null) { + dt = SSF_parse_date_code(v, opts); + if (dt == null) + return ""; + } + o = c; + while (++i < fmt.length && fmt.charAt(i).toLowerCase() === c) + o += c; + if (c === 'm' && lst.toLowerCase() === 'h') + c = 'M'; + if (c === 'h') + c = hr; + out[out.length] = { t: c, v: o }; + lst = c; + break; + case 'A': + case 'a': + case '上': + var q = { t: c, v: c }; + if (dt == null) + dt = SSF_parse_date_code(v, opts); + if (fmt.substr(i, 3).toUpperCase() === "A/P") { + if (dt != null) + q.v = dt.H >= 12 ? fmt.charAt(i + 2) : c; + q.t = 'T'; + hr = 'h'; + i += 3; + } + else if (fmt.substr(i, 5).toUpperCase() === "AM/PM") { + if (dt != null) + q.v = dt.H >= 12 ? "PM" : "AM"; + q.t = 'T'; + i += 5; + hr = 'h'; + } + else if (fmt.substr(i, 5).toUpperCase() === "上午/下午") { + if (dt != null) + q.v = dt.H >= 12 ? "下午" : "上午"; + q.t = 'T'; + i += 5; + hr = 'h'; + } + else { + q.t = "t"; + ++i; + } + if (dt == null && q.t === 'T') + return ""; + out[out.length] = q; + lst = c; + break; + case '[': + o = c; + while (fmt.charAt(i++) !== ']' && i < fmt.length) + o += fmt.charAt(i); + if (o.slice(-1) !== ']') + throw 'unterminated "[" block: |' + o + '|'; + if (o.match(SSF_abstime)) { + if (dt == null) { + dt = SSF_parse_date_code(v, opts); + if (dt == null) + return ""; + } + out[out.length] = { t: 'Z', v: o.toLowerCase() }; + lst = o.charAt(1); + } + else if (o.indexOf("$") > -1) { + o = (o.match(/\$([^-\[\]]*)/) || [])[1] || "$"; + if (!fmt_is_date(fmt)) + out[out.length] = { t: 't', v: o }; + } + break; + /* Numbers */ + case '.': + if (dt != null) { + o = c; + while (++i < fmt.length && (c = fmt.charAt(i)) === "0") + o += c; + out[out.length] = { t: 's', v: o }; + break; + } + /* falls through */ + case '0': + case '#': + o = c; + while (++i < fmt.length && "0#?.,E+-%".indexOf(c = fmt.charAt(i)) > -1) + o += c; + out[out.length] = { t: 'n', v: o }; + break; + case '?': + o = c; + while (fmt.charAt(++i) === c) + o += c; + out[out.length] = { t: c, v: o }; + lst = c; + break; + case '*': + ++i; + if (fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') + ++i; + break; // ** + case '(': + case ')': + out[out.length] = { t: (flen === 1 ? 't' : c), v: c }; + ++i; + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + o = c; + while (i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) + o += fmt.charAt(i); + out[out.length] = { t: 'D', v: o }; + break; + case ' ': + out[out.length] = { t: c, v: c }; + ++i; + break; + case '$': + out[out.length] = { t: 't', v: '$' }; + ++i; + break; + default: + if (",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) + throw new Error('unrecognized character ' + c + ' in ' + fmt); + out[out.length] = { t: 't', v: c }; + ++i; + break; + } + } + /* Scan for date/time parts */ + var bt = 0, ss0 = 0, ssm; + for (i = out.length - 1, lst = 't'; i >= 0; --i) { + switch (out[i].t) { + case 'h': + case 'H': + out[i].t = hr; + lst = 'h'; + if (bt < 1) + bt = 1; + break; + case 's': + if ((ssm = out[i].v.match(/\.0+$/))) + ss0 = Math.max(ss0, ssm[0].length - 1); + if (bt < 3) + bt = 3; + /* falls through */ + case 'd': + case 'y': + case 'M': + case 'e': + lst = out[i].t; + break; + case 'm': + if (lst === 's') { + out[i].t = 'M'; + if (bt < 2) + bt = 2; + } + break; + case 'X': /*if(out[i].v === "B2");*/ + break; + case 'Z': + if (bt < 1 && out[i].v.match(/[Hh]/)) + bt = 1; + if (bt < 2 && out[i].v.match(/[Mm]/)) + bt = 2; + if (bt < 3 && out[i].v.match(/[Ss]/)) + bt = 3; + } + } + /* time rounding depends on presence of minute / second / usec fields */ + switch (bt) { + case 0: break; + case 1: + /*::if(!dt) break;*/ + if (dt.u >= 0.5) { + dt.u = 0; + ++dt.S; + } + if (dt.S >= 60) { + dt.S = 0; + ++dt.M; + } + if (dt.M >= 60) { + dt.M = 0; + ++dt.H; + } + break; + case 2: + /*::if(!dt) break;*/ + if (dt.u >= 0.5) { + dt.u = 0; + ++dt.S; + } + if (dt.S >= 60) { + dt.S = 0; + ++dt.M; + } + break; + } + /* replace fields */ + var nstr = "", jj; + for (i = 0; i < out.length; ++i) { + switch (out[i].t) { + case 't': + case 'T': + case ' ': + case 'D': break; + case 'X': + out[i].v = ""; + out[i].t = ";"; + break; + case 'd': + case 'm': + case 'y': + case 'h': + case 'H': + case 'M': + case 's': + case 'e': + case 'b': + case 'Z': + /*::if(!dt) throw "unreachable"; */ + out[i].v = SSF_write_date(out[i].t.charCodeAt(0), out[i].v, dt, ss0); + out[i].t = 't'; + break; + case 'n': + case '?': + jj = i + 1; + while (out[jj] != null && ((c = out[jj].t) === "?" || c === "D" || + ((c === " " || c === "t") && out[jj + 1] != null && (out[jj + 1].t === '?' || out[jj + 1].t === "t" && out[jj + 1].v === '/')) || + (out[i].t === '(' && (c === ' ' || c === 'n' || c === ')')) || + (c === 't' && (out[jj].v === '/' || out[jj].v === ' ' && out[jj + 1] != null && out[jj + 1].t == '?')))) { + out[i].v += out[jj].v; + out[jj] = { v: "", t: ";" }; + ++jj; + } + nstr += out[i].v; + i = jj - 1; + break; + case 'G': + out[i].t = 't'; + out[i].v = SSF_general(v, opts); + break; + } + } + var vv = "", myv, ostr; + if (nstr.length > 0) { + if (nstr.charCodeAt(0) == 40) /* '(' */ { + myv = (v < 0 && nstr.charCodeAt(0) === 45 ? -v : v); + ostr = write_num('n', nstr, myv); + } + else { + myv = (v < 0 && flen > 1 ? -v : v); + ostr = write_num('n', nstr, myv); + if (myv < 0 && out[0] && out[0].t == 't') { + ostr = ostr.substr(1); + out[0].v = "-" + out[0].v; + } + } + jj = ostr.length - 1; + var decpt = out.length; + for (i = 0; i < out.length; ++i) + if (out[i] != null && out[i].t != 't' && out[i].v.indexOf(".") > -1) { + decpt = i; + break; + } + var lasti = out.length; + if (decpt === out.length && ostr.indexOf("E") === -1) { + for (i = out.length - 1; i >= 0; --i) { + if (out[i] == null || 'n?'.indexOf(out[i].t) === -1) + continue; + if (jj >= out[i].v.length - 1) { + jj -= out[i].v.length; + out[i].v = ostr.substr(jj + 1, out[i].v.length); + } + else if (jj < 0) + out[i].v = ""; + else { + out[i].v = ostr.substr(0, jj + 1); + jj = -1; + } + out[i].t = 't'; + lasti = i; + } + if (jj >= 0 && lasti < out.length) + out[lasti].v = ostr.substr(0, jj + 1) + out[lasti].v; + } + else if (decpt !== out.length && ostr.indexOf("E") === -1) { + jj = ostr.indexOf(".") - 1; + for (i = decpt; i >= 0; --i) { + if (out[i] == null || 'n?'.indexOf(out[i].t) === -1) + continue; + j = out[i].v.indexOf(".") > -1 && i === decpt ? out[i].v.indexOf(".") - 1 : out[i].v.length - 1; + vv = out[i].v.substr(j + 1); + for (; j >= 0; --j) { + if (jj >= 0 && (out[i].v.charAt(j) === "0" || out[i].v.charAt(j) === "#")) + vv = ostr.charAt(jj--) + vv; + } + out[i].v = vv; + out[i].t = 't'; + lasti = i; + } + if (jj >= 0 && lasti < out.length) + out[lasti].v = ostr.substr(0, jj + 1) + out[lasti].v; + jj = ostr.indexOf(".") + 1; + for (i = decpt; i < out.length; ++i) { + if (out[i] == null || ('n?('.indexOf(out[i].t) === -1 && i !== decpt)) + continue; + j = out[i].v.indexOf(".") > -1 && i === decpt ? out[i].v.indexOf(".") + 1 : 0; + vv = out[i].v.substr(0, j); + for (; j < out[i].v.length; ++j) { + if (jj < ostr.length) + vv += ostr.charAt(jj++); + } + out[i].v = vv; + out[i].t = 't'; + lasti = i; + } + } + } + for (i = 0; i < out.length; ++i) + if (out[i] != null && 'n?'.indexOf(out[i].t) > -1) { + myv = (flen > 1 && v < 0 && i > 0 && out[i - 1].v === "-" ? -v : v); + out[i].v = write_num(out[i].t, out[i].v, myv); + out[i].t = 't'; + } + var retval = ""; + for (i = 0; i !== out.length; ++i) + if (out[i] != null) + retval += out[i].v; + return retval; +} +var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/; +function chkcond(v, rr) { + if (rr == null) + return false; + var thresh = parseFloat(rr[2]); + switch (rr[1]) { + case "=": + if (v == thresh) + return true; + break; + case ">": + if (v > thresh) + return true; + break; + case "<": + if (v < thresh) + return true; + break; + case "<>": + if (v != thresh) + return true; + break; + case ">=": + if (v >= thresh) + return true; + break; + case "<=": + if (v <= thresh) + return true; + break; + } + return false; +} +function choose_fmt(f /*:string*/, v /*:any*/) { + var fmt = SSF_split_fmt(f); + var l = fmt.length, lat = fmt[l - 1].indexOf("@"); + if (l < 4 && lat > -1) + --l; + if (fmt.length > 4) + throw new Error("cannot find right format for |" + fmt.join("|") + "|"); + if (typeof v !== "number") + return [4, fmt.length === 4 || lat > -1 ? fmt[fmt.length - 1] : "@"]; + switch (fmt.length) { + case 1: + fmt = lat > -1 ? ["General", "General", "General", fmt[0]] : [fmt[0], fmt[0], fmt[0], "@"]; + break; + case 2: + fmt = lat > -1 ? [fmt[0], fmt[0], fmt[0], fmt[1]] : [fmt[0], fmt[1], fmt[0], "@"]; + break; + case 3: + fmt = lat > -1 ? [fmt[0], fmt[1], fmt[0], fmt[2]] : [fmt[0], fmt[1], fmt[2], "@"]; + break; + case 4: break; + } + var ff = v > 0 ? fmt[0] : v < 0 ? fmt[1] : fmt[2]; + if (fmt[0].indexOf("[") === -1 && fmt[1].indexOf("[") === -1) + return [l, ff]; + if (fmt[0].match(/\[[=<>]/) != null || fmt[1].match(/\[[=<>]/) != null) { + var m1 = fmt[0].match(cfregex2); + var m2 = fmt[1].match(cfregex2); + return chkcond(v, m1) ? [l, fmt[0]] : chkcond(v, m2) ? [l, fmt[1]] : [l, fmt[m1 != null && m2 != null ? 2 : 1]]; + } + return [l, ff]; +} +function SSF_format(fmt /*:string|number*/, v /*:any*/, o /*:?any*/) { + if (o == null) + o = {}; + var sfmt = ""; + switch (typeof fmt) { + case "string": + if (fmt == "m/d/yy" && o.dateNF) + sfmt = o.dateNF; + else + sfmt = fmt; + break; + case "number": + if (fmt == 14 && o.dateNF) + sfmt = o.dateNF; + else + sfmt = (o.table != null ? (o.table /*:any*/) : table_fmt)[fmt]; + if (sfmt == null) + sfmt = (o.table && o.table[SSF_default_map[fmt]]) || table_fmt[SSF_default_map[fmt]]; + if (sfmt == null) + sfmt = SSF_default_str[fmt] || "General"; + break; + } + if (SSF_isgeneral(sfmt, 0)) + return SSF_general(v, o); + if (v instanceof Date) + v = datenum(v, o.date1904); + var f = choose_fmt(sfmt, v); + if (SSF_isgeneral(f[1])) + return SSF_general(v, o); + if (v === true) + v = "TRUE"; + else if (v === false) + v = "FALSE"; + else if (v === "" || v == null) + return ""; + return eval_fmt(f[1], v, o, f[0]); +} +function SSF_load(fmt /*:string*/, idx /*:?number*/) { + if (typeof idx != 'number') { + idx = +idx || -1; + /*::if(typeof idx != 'number') return 0x188; */ + for (var i = 0; i < 0x0188; ++i) { + /*::if(typeof idx != 'number') return 0x188; */ + if (table_fmt[i] == undefined) { + if (idx < 0) + idx = i; + continue; + } + if (table_fmt[i] == fmt) { + idx = i; + break; + } + } + /*::if(typeof idx != 'number') return 0x188; */ + if (idx < 0) + idx = 0x187; + } + /*::if(typeof idx != 'number') return 0x188; */ + table_fmt[idx] = fmt; + return idx; +} +function SSF_load_table(tbl /*:SSFTable*/) { + for (var i = 0; i != 0x0188; ++i) + if (tbl[i] !== undefined) + SSF_load(tbl[i], i); +} +function make_ssf() { + table_fmt = SSF_init_table(); +} +var SSF = { + format: SSF_format, + load: SSF_load, + _table: table_fmt, + load_table: SSF_load_table, + parse_date_code: SSF_parse_date_code, + is_date: fmt_is_date, + get_table: function get_table() { return SSF._table = table_fmt; } +}; +var SSFImplicit /*{[number]:string}*/ = ({ + "5": '"$"#,##0_);\\("$"#,##0\\)', + "6": '"$"#,##0_);[Red]\\("$"#,##0\\)', + "7": '"$"#,##0.00_);\\("$"#,##0.00\\)', + "8": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "23": 'General', "24": 'General', "25": 'General', "26": 'General', + "27": 'm/d/yy', "28": 'm/d/yy', "29": 'm/d/yy', "30": 'm/d/yy', "31": 'm/d/yy', + "32": 'h:mm:ss', "33": 'h:mm:ss', "34": 'h:mm:ss', "35": 'h:mm:ss', + "36": 'm/d/yy', + "41": '_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)', + "42": '_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)', + "43": '_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)', + "44": '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)', + "50": 'm/d/yy', "51": 'm/d/yy', "52": 'm/d/yy', "53": 'm/d/yy', "54": 'm/d/yy', + "55": 'm/d/yy', "56": 'm/d/yy', "57": 'm/d/yy', "58": 'm/d/yy', + "59": '0', + "60": '0.00', + "61": '#,##0', + "62": '#,##0.00', + "63": '"$"#,##0_);\\("$"#,##0\\)', + "64": '"$"#,##0_);[Red]\\("$"#,##0\\)', + "65": '"$"#,##0.00_);\\("$"#,##0.00\\)', + "66": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "67": '0%', + "68": '0.00%', + "69": '# ?/?', + "70": '# ??/??', + "71": 'm/d/yy', + "72": 'm/d/yy', + "73": 'd-mmm-yy', + "74": 'd-mmm', + "75": 'mmm-yy', + "76": 'h:mm', + "77": 'h:mm:ss', + "78": 'm/d/yy h:mm', + "79": 'mm:ss', + "80": '[h]:mm:ss', + "81": 'mmss.0' +} /*:any*/); +/* dateNF parse TODO: move to SSF */ +var dateNFregex = /[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g; +function dateNF_regex(dateNF /*:string|number*/) { + var fmt = typeof dateNF == "number" ? table_fmt[dateNF] : dateNF; + fmt = fmt.replace(dateNFregex, "(\\d+)"); + dateNFregex.lastIndex = 0; + return new RegExp("^" + fmt + "$"); +} +function dateNF_fix(str /*:string*/, dateNF /*:string*/, match /*:Array*/) { + var Y = -1, m = -1, d = -1, H = -1, M = -1, S = -1; + (dateNF.match(dateNFregex) || []).forEach(function (n, i) { + var v = parseInt(match[i + 1], 10); + switch (n.toLowerCase().charAt(0)) { + case 'y': + Y = v; + break; + case 'd': + d = v; + break; + case 'h': + H = v; + break; + case 's': + S = v; + break; + case 'm': + if (H >= 0) + M = v; + else + m = v; + break; + } + }); + dateNFregex.lastIndex = 0; + if (S >= 0 && M == -1 && m >= 0) { + M = m; + m = -1; + } + var datestr = (("" + (Y >= 0 ? Y : new Date().getFullYear())).slice(-4) + "-" + ("00" + (m >= 1 ? m : 1)).slice(-2) + "-" + ("00" + (d >= 1 ? d : 1)).slice(-2)); + if (datestr.length == 7) + datestr = "0" + datestr; + if (datestr.length == 8) + datestr = "20" + datestr; + var timestr = (("00" + (H >= 0 ? H : 0)).slice(-2) + ":" + ("00" + (M >= 0 ? M : 0)).slice(-2) + ":" + ("00" + (S >= 0 ? S : 0)).slice(-2)); + if (H == -1 && M == -1 && S == -1) + return datestr; + if (Y == -1 && m == -1 && d == -1) + return timestr; + return datestr + "T" + timestr; +} +/* table of bad formats written by third-party tools */ +var bad_formats = { + "d.m": "d\\.m" // Issue #2571 Google Sheets writes invalid format 'd.m', correct format is 'd"."m' or 'd\\.m' +}; +function SSF__load(fmt, idx) { + return SSF_load(bad_formats[fmt] || fmt, idx); +} +/*:: +declare var ReadShift:any; +declare var CheckField:any; +declare var prep_blob:any; +declare var __readUInt32LE:any; +declare var __readInt32LE:any; +declare var __toBuffer:any; +declare var __utf16le:any; +declare var bconcat:any; +declare var s2a:any; +declare var chr0:any; +declare var chr1:any; +declare var has_buf:boolean; +declare var new_buf:any; +declare var new_raw_buf:any; +declare var new_unsafe_buf:any; +declare var Buffer_from:any; +*/ +/* cfb.js (C) 2013-present SheetJS -- http://sheetjs.com */ +/* vim: set ts=2: */ +/*jshint eqnull:true */ +/*exported CFB */ +/*global Uint8Array:false, Uint16Array:false */ +/*:: +type SectorEntry = { + name?:string; + nodes?:Array; + data:RawBytes; +}; +type SectorList = { + [k:string|number]:SectorEntry; + name:?string; + fat_addrs:Array; + ssz:number; +} +type CFBFiles = {[n:string]:CFBEntry}; +*/ +/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */ +/* vim: set ts=2: */ +/*exported CRC32 */ +var CRC32 = /*#__PURE__*/ (function () { + var CRC32 = {}; + CRC32.version = '1.2.0'; + /* see perf/crc32table.js */ + /*global Int32Array */ + function signed_crc_table() { + var c = 0, table /*:Array*/ = new Array(256); + for (var n = 0; n != 256; ++n) { + c = n; + c = ((c & 1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c & 1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c & 1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c & 1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c & 1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c & 1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c & 1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c & 1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + table[n] = c; + } + return typeof Int32Array !== 'undefined' ? new Int32Array(table) : table; + } + var T0 = signed_crc_table(); + function slice_by_16_tables(T) { + var c = 0, v = 0, n = 0, table /*:Array*/ = typeof Int32Array !== 'undefined' ? new Int32Array(4096) : new Array(4096); + for (n = 0; n != 256; ++n) + table[n] = T[n]; + for (n = 0; n != 256; ++n) { + v = T[n]; + for (c = 256 + n; c < 4096; c += 256) + v = table[c] = (v >>> 8) ^ T[v & 0xFF]; + } + var out = []; + for (n = 1; n != 16; ++n) + out[n - 1] = typeof Int32Array !== 'undefined' && typeof table.subarray == "function" ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256); + return out; + } + var TT = slice_by_16_tables(T0); + var T1 = TT[0], T2 = TT[1], T3 = TT[2], T4 = TT[3], T5 = TT[4]; + var T6 = TT[5], T7 = TT[6], T8 = TT[7], T9 = TT[8], Ta = TT[9]; + var Tb = TT[10], Tc = TT[11], Td = TT[12], Te = TT[13], Tf = TT[14]; + function crc32_bstr(bstr /*:string*/, seed /*:number*/) { + var C = seed /*:: ? 0 : 0 */ ^ -1; + for (var i = 0, L = bstr.length; i < L;) + C = (C >>> 8) ^ T0[(C ^ bstr.charCodeAt(i++)) & 0xFF]; + return ~C; + } + function crc32_buf(B /*:Uint8Array|Array*/, seed /*:number*/) { + var C = seed /*:: ? 0 : 0 */ ^ -1, L = B.length - 15, i = 0; + for (; i < L;) + C = + Tf[B[i++] ^ (C & 255)] ^ + Te[B[i++] ^ ((C >> 8) & 255)] ^ + Td[B[i++] ^ ((C >> 16) & 255)] ^ + Tc[B[i++] ^ (C >>> 24)] ^ + Tb[B[i++]] ^ Ta[B[i++]] ^ T9[B[i++]] ^ T8[B[i++]] ^ + T7[B[i++]] ^ T6[B[i++]] ^ T5[B[i++]] ^ T4[B[i++]] ^ + T3[B[i++]] ^ T2[B[i++]] ^ T1[B[i++]] ^ T0[B[i++]]; + L += 15; + while (i < L) + C = (C >>> 8) ^ T0[(C ^ B[i++]) & 0xFF]; + return ~C; + } + function crc32_str(str /*:string*/, seed /*:number*/) { + var C = seed ^ -1; + for (var i = 0, L = str.length, c = 0, d = 0; i < L;) { + c = str.charCodeAt(i++); + if (c < 0x80) { + C = (C >>> 8) ^ T0[(C ^ c) & 0xFF]; + } + else if (c < 0x800) { + C = (C >>> 8) ^ T0[(C ^ (192 | ((c >> 6) & 31))) & 0xFF]; + C = (C >>> 8) ^ T0[(C ^ (128 | (c & 63))) & 0xFF]; + } + else if (c >= 0xD800 && c < 0xE000) { + c = (c & 1023) + 64; + d = str.charCodeAt(i++) & 1023; + C = (C >>> 8) ^ T0[(C ^ (240 | ((c >> 8) & 7))) & 0xFF]; + C = (C >>> 8) ^ T0[(C ^ (128 | ((c >> 2) & 63))) & 0xFF]; + C = (C >>> 8) ^ T0[(C ^ (128 | ((d >> 6) & 15) | ((c & 3) << 4))) & 0xFF]; + C = (C >>> 8) ^ T0[(C ^ (128 | (d & 63))) & 0xFF]; + } + else { + C = (C >>> 8) ^ T0[(C ^ (224 | ((c >> 12) & 15))) & 0xFF]; + C = (C >>> 8) ^ T0[(C ^ (128 | ((c >> 6) & 63))) & 0xFF]; + C = (C >>> 8) ^ T0[(C ^ (128 | (c & 63))) & 0xFF]; + } + } + return ~C; + } + CRC32.table = T0; + CRC32.bstr = crc32_bstr; + CRC32.buf = crc32_buf; + CRC32.str = crc32_str; + return CRC32; +})(); +/* [MS-CFB] v20171201 */ +var CFB = /*#__PURE__*/ (function _CFB() { + var exports /*:CFBModule*/ = /*::(*/ {} /*:: :any)*/; + exports.version = '1.2.2'; + /* [MS-CFB] 2.6.4 */ + function namecmp(l /*:string*/, r /*:string*/) { + var L = l.split("/"), R = r.split("/"); + for (var i = 0, c = 0, Z = Math.min(L.length, R.length); i < Z; ++i) { + if ((c = L[i].length - R[i].length)) + return c; + if (L[i] != R[i]) + return L[i] < R[i] ? -1 : 1; + } + return L.length - R.length; + } + function dirname(p /*:string*/) { + if (p.charAt(p.length - 1) == "/") + return (p.slice(0, -1).indexOf("/") === -1) ? p : dirname(p.slice(0, -1)); + var c = p.lastIndexOf("/"); + return (c === -1) ? p : p.slice(0, c + 1); + } + function filename(p /*:string*/) { + if (p.charAt(p.length - 1) == "/") + return filename(p.slice(0, -1)); + var c = p.lastIndexOf("/"); + return (c === -1) ? p : p.slice(c + 1); + } + /* -------------------------------------------------------------------------- */ + /* DOS Date format: + high|YYYYYYYm.mmmddddd.HHHHHMMM.MMMSSSSS|low + add 1980 to stored year + stored second should be doubled + */ + /* write JS date to buf as a DOS date */ + function write_dos_date(buf /*:CFBlob*/, date /*:Date|string*/) { + if (typeof date === "string") + date = new Date(date); + var hms /*:number*/ = date.getHours(); + hms = hms << 6 | date.getMinutes(); + hms = hms << 5 | (date.getSeconds() >>> 1); + buf.write_shift(2, hms); + var ymd /*:number*/ = (date.getFullYear() - 1980); + ymd = ymd << 4 | (date.getMonth() + 1); + ymd = ymd << 5 | date.getDate(); + buf.write_shift(2, ymd); + } + /* read four bytes from buf and interpret as a DOS date */ + function parse_dos_date(buf /*:CFBlob*/) { + var hms = buf.read_shift(2) & 0xFFFF; + var ymd = buf.read_shift(2) & 0xFFFF; + var val = new Date(); + var d = ymd & 0x1F; + ymd >>>= 5; + var m = ymd & 0x0F; + ymd >>>= 4; + val.setMilliseconds(0); + val.setFullYear(ymd + 1980); + val.setMonth(m - 1); + val.setDate(d); + var S = hms & 0x1F; + hms >>>= 5; + var M = hms & 0x3F; + hms >>>= 6; + val.setHours(hms); + val.setMinutes(M); + val.setSeconds(S << 1); + return val; + } + function parse_extra_field(blob /*:CFBlob*/) { + prep_blob(blob, 0); + var o = /*::(*/ {} /*:: :any)*/; + var flags = 0; + while (blob.l <= blob.length - 4) { + var type = blob.read_shift(2); + var sz = blob.read_shift(2), tgt = blob.l + sz; + var p = {}; + switch (type) { + /* UNIX-style Timestamps */ + case 0x5455: + { + flags = blob.read_shift(1); + if (flags & 1) + p.mtime = blob.read_shift(4); + /* for some reason, CD flag corresponds to LFH */ + if (sz > 5) { + if (flags & 2) + p.atime = blob.read_shift(4); + if (flags & 4) + p.ctime = blob.read_shift(4); + } + if (p.mtime) + p.mt = new Date(p.mtime * 1000); + } + break; + /* ZIP64 Extended Information Field */ + case 0x0001: + { + var sz1 = blob.read_shift(4), sz2 = blob.read_shift(4); + p.usz = (sz2 * Math.pow(2, 32) + sz1); + sz1 = blob.read_shift(4); + sz2 = blob.read_shift(4); + p.csz = (sz2 * Math.pow(2, 32) + sz1); + // NOTE: volume fields are skipped + } + break; + } + blob.l = tgt; + o[type] = p; + } + return o; + } + var fs /*:: = require('fs'); */; + function get_fs() { return fs || (fs = _fs); } + function parse(file /*:RawBytes*/, options /*:CFBReadOpts*/) { + if (file[0] == 0x50 && file[1] == 0x4b) + return parse_zip(file, options); + if ((file[0] | 0x20) == 0x6d && (file[1] | 0x20) == 0x69) + return parse_mad(file, options); + if (file.length < 512) + throw new Error("CFB file size " + file.length + " < 512"); + var mver = 3; + var ssz = 512; + var nmfs = 0; // number of mini FAT sectors + var difat_sec_cnt = 0; + var dir_start = 0; + var minifat_start = 0; + var difat_start = 0; + var fat_addrs /*:Array*/ = []; // locations of FAT sectors + /* [MS-CFB] 2.2 Compound File Header */ + var blob /*:CFBlob*/ = /*::(*/ file.slice(0, 512) /*:: :any)*/; + prep_blob(blob, 0); + /* major version */ + var mv = check_get_mver(blob); + mver = mv[0]; + switch (mver) { + case 3: + ssz = 512; + break; + case 4: + ssz = 4096; + break; + case 0: if (mv[1] == 0) + return parse_zip(file, options); + /* falls through */ + default: throw new Error("Major Version: Expected 3 or 4 saw " + mver); + } + /* reprocess header */ + if (ssz !== 512) { + blob = /*::(*/ file.slice(0, ssz) /*:: :any)*/; + prep_blob(blob, 28 /* blob.l */); + } + /* Save header for final object */ + var header /*:RawBytes*/ = file.slice(0, ssz); + check_shifts(blob, mver); + // Number of Directory Sectors + var dir_cnt /*:number*/ = blob.read_shift(4, 'i'); + if (mver === 3 && dir_cnt !== 0) + throw new Error('# Directory Sectors: Expected 0 saw ' + dir_cnt); + // Number of FAT Sectors + blob.l += 4; + // First Directory Sector Location + dir_start = blob.read_shift(4, 'i'); + // Transaction Signature + blob.l += 4; + // Mini Stream Cutoff Size + blob.chk('00100000', 'Mini Stream Cutoff Size: '); + // First Mini FAT Sector Location + minifat_start = blob.read_shift(4, 'i'); + // Number of Mini FAT Sectors + nmfs = blob.read_shift(4, 'i'); + // First DIFAT sector location + difat_start = blob.read_shift(4, 'i'); + // Number of DIFAT Sectors + difat_sec_cnt = blob.read_shift(4, 'i'); + // Grab FAT Sector Locations + for (var q = -1, j = 0; j < 109; ++j) { /* 109 = (512 - blob.l)>>>2; */ + q = blob.read_shift(4, 'i'); + if (q < 0) + break; + fat_addrs[j] = q; + } + /** Break the file up into sectors */ + var sectors /*:Array*/ = sectorify(file, ssz); + sleuth_fat(difat_start, difat_sec_cnt, sectors, ssz, fat_addrs); + /** Chains */ + var sector_list /*:SectorList*/ = make_sector_list(sectors, dir_start, fat_addrs, ssz); + if (dir_start < sector_list.length) + sector_list[dir_start].name = "!Directory"; + if (nmfs > 0 && minifat_start !== ENDOFCHAIN) + sector_list[minifat_start].name = "!MiniFAT"; + sector_list[fat_addrs[0]].name = "!FAT"; + sector_list.fat_addrs = fat_addrs; + sector_list.ssz = ssz; + /* [MS-CFB] 2.6.1 Compound File Directory Entry */ + var files /*:CFBFiles*/ = {}, Paths /*:Array*/ = [], FileIndex /*:CFBFileIndex*/ = [], FullPaths /*:Array*/ = []; + read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start); + build_full_paths(FileIndex, FullPaths, Paths); + Paths.shift(); + var o = { + FileIndex: FileIndex, + FullPaths: FullPaths + }; + // $FlowIgnore + if (options && options.raw) + o.raw = { header: header, sectors: sectors }; + return o; + } // parse + /* [MS-CFB] 2.2 Compound File Header -- read up to major version */ + function check_get_mver(blob /*:CFBlob*/) { + if (blob[blob.l] == 0x50 && blob[blob.l + 1] == 0x4b) + return [0, 0]; + // header signature 8 + blob.chk(HEADER_SIGNATURE, 'Header Signature: '); + // clsid 16 + //blob.chk(HEADER_CLSID, 'CLSID: '); + blob.l += 16; + // minor version 2 + var mver /*:number*/ = blob.read_shift(2, 'u'); + return [blob.read_shift(2, 'u'), mver]; + } + function check_shifts(blob /*:CFBlob*/, mver /*:number*/) { + var shift = 0x09; + // Byte Order + //blob.chk('feff', 'Byte Order: '); // note: some writers put 0xffff + blob.l += 2; + // Sector Shift + switch ((shift = blob.read_shift(2))) { + case 0x09: + if (mver != 3) + throw new Error('Sector Shift: Expected 9 saw ' + shift); + break; + case 0x0c: + if (mver != 4) + throw new Error('Sector Shift: Expected 12 saw ' + shift); + break; + default: throw new Error('Sector Shift: Expected 9 or 12 saw ' + shift); + } + // Mini Sector Shift + blob.chk('0600', 'Mini Sector Shift: '); + // Reserved + blob.chk('000000000000', 'Reserved: '); + } + /** Break the file up into sectors */ + function sectorify(file /*:RawBytes*/, ssz /*:number*/) { + var nsectors = Math.ceil(file.length / ssz) - 1; + var sectors /*:Array*/ = []; + for (var i = 1; i < nsectors; ++i) + sectors[i - 1] = file.slice(i * ssz, (i + 1) * ssz); + sectors[nsectors - 1] = file.slice(nsectors * ssz); + return sectors; + } + /* [MS-CFB] 2.6.4 Red-Black Tree */ + function build_full_paths(FI /*:CFBFileIndex*/, FP /*:Array*/, Paths /*:Array*/) { + var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length; + var dad /*:Array*/ = [], q /*:Array*/ = []; + for (; i < pl; ++i) { + dad[i] = q[i] = i; + FP[i] = Paths[i]; + } + for (; j < q.length; ++j) { + i = q[j]; + L = FI[i].L; + R = FI[i].R; + C = FI[i].C; + if (dad[i] === i) { + if (L !== -1 /*NOSTREAM*/ && dad[L] !== L) + dad[i] = dad[L]; + if (R !== -1 && dad[R] !== R) + dad[i] = dad[R]; + } + if (C !== -1 /*NOSTREAM*/) + dad[C] = i; + if (L !== -1 && i != dad[i]) { + dad[L] = dad[i]; + if (q.lastIndexOf(L) < j) + q.push(L); + } + if (R !== -1 && i != dad[i]) { + dad[R] = dad[i]; + if (q.lastIndexOf(R) < j) + q.push(R); + } + } + for (i = 1; i < pl; ++i) + if (dad[i] === i) { + if (R !== -1 /*NOSTREAM*/ && dad[R] !== R) + dad[i] = dad[R]; + else if (L !== -1 && dad[L] !== L) + dad[i] = dad[L]; + } + for (i = 1; i < pl; ++i) { + if (FI[i].type === 0 /* unknown */) + continue; + j = i; + if (j != dad[j]) + do { + j = dad[j]; + FP[i] = FP[j] + "/" + FP[i]; + } while (j !== 0 && -1 !== dad[j] && j != dad[j]); + dad[i] = -1; + } + FP[0] += "/"; + for (i = 1; i < pl; ++i) { + if (FI[i].type !== 2 /* stream */) + FP[i] += "/"; + } + } + function get_mfat_entry(entry /*:CFBEntry*/, payload /*:RawBytes*/, mini /*:?RawBytes*/) { + var start = entry.start, size = entry.size; + //return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/); + var o = []; + var idx = start; + while (mini && size > 0 && idx >= 0) { + o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ)); + size -= MSSZ; + idx = __readInt32LE(mini, idx * 4); + } + if (o.length === 0) + return (new_buf(0) /*:any*/); + return (bconcat(o).slice(0, entry.size) /*:any*/); + } + /** Chase down the rest of the DIFAT chain to build a comprehensive list + DIFAT chains by storing the next sector number as the last 32 bits */ + function sleuth_fat(idx /*:number*/, cnt /*:number*/, sectors /*:Array*/, ssz /*:number*/, fat_addrs) { + var q /*:number*/ = ENDOFCHAIN; + if (idx === ENDOFCHAIN) { + if (cnt !== 0) + throw new Error("DIFAT chain shorter than expected"); + } + else if (idx !== -1 /*FREESECT*/) { + var sector = sectors[idx], m = (ssz >>> 2) - 1; + if (!sector) + return; + for (var i = 0; i < m; ++i) { + if ((q = __readInt32LE(sector, i * 4)) === ENDOFCHAIN) + break; + fat_addrs.push(q); + } + if (cnt >= 1) + sleuth_fat(__readInt32LE(sector, ssz - 4), cnt - 1, sectors, ssz, fat_addrs); + } + } + /** Follow the linked list of sectors for a given starting point */ + function get_sector_list(sectors /*:Array*/, start /*:number*/, fat_addrs /*:Array*/, ssz /*:number*/, chkd /*:?Array*/) { + var buf /*:Array*/ = [], buf_chain /*:Array*/ = []; + if (!chkd) + chkd = []; + var modulus = ssz - 1, j = 0, jj = 0; + for (j = start; j >= 0;) { + chkd[j] = true; + buf[buf.length] = j; + buf_chain.push(sectors[j]); + var addr = fat_addrs[Math.floor(j * 4 / ssz)]; + jj = ((j * 4) & modulus); + if (ssz < 4 + jj) + throw new Error("FAT boundary crossed: " + j + " 4 " + ssz); + if (!sectors[addr]) + break; + j = __readInt32LE(sectors[addr], jj); + } + return { nodes: buf, data: __toBuffer([buf_chain]) }; + } + /** Chase down the sector linked lists */ + function make_sector_list(sectors /*:Array*/, dir_start /*:number*/, fat_addrs /*:Array*/, ssz /*:number*/) { + var sl = sectors.length, sector_list /*:SectorList*/ = ([] /*:any*/); + var chkd /*:Array*/ = [], buf /*:Array*/ = [], buf_chain /*:Array*/ = []; + var modulus = ssz - 1, i = 0, j = 0, k = 0, jj = 0; + for (i = 0; i < sl; ++i) { + buf = ([] /*:Array*/); + k = (i + dir_start); + if (k >= sl) + k -= sl; + if (chkd[k]) + continue; + buf_chain = []; + var seen = []; + for (j = k; j >= 0;) { + seen[j] = true; + chkd[j] = true; + buf[buf.length] = j; + buf_chain.push(sectors[j]); + var addr /*:number*/ = fat_addrs[Math.floor(j * 4 / ssz)]; + jj = ((j * 4) & modulus); + if (ssz < 4 + jj) + throw new Error("FAT boundary crossed: " + j + " 4 " + ssz); + if (!sectors[addr]) + break; + j = __readInt32LE(sectors[addr], jj); + if (seen[j]) + break; + } + sector_list[k] = ({ nodes: buf, data: __toBuffer([buf_chain]) } /*:SectorEntry*/); + } + return sector_list; + } + /* [MS-CFB] 2.6.1 Compound File Directory Entry */ + function read_directory(dir_start /*:number*/, sector_list /*:SectorList*/, sectors /*:Array*/, Paths /*:Array*/, nmfs, files, FileIndex, mini) { + var minifat_store = 0, pl = (Paths.length ? 2 : 0); + var sector = sector_list[dir_start].data; + var i = 0, namelen = 0, name; + for (; i < sector.length; i += 128) { + var blob /*:CFBlob*/ = /*::(*/ sector.slice(i, i + 128) /*:: :any)*/; + prep_blob(blob, 64); + namelen = blob.read_shift(2); + name = __utf16le(blob, 0, namelen - pl); + Paths.push(name); + var o /*:CFBEntry*/ = ({ + name: name, + type: blob.read_shift(1), + color: blob.read_shift(1), + L: blob.read_shift(4, 'i'), + R: blob.read_shift(4, 'i'), + C: blob.read_shift(4, 'i'), + clsid: blob.read_shift(16), + state: blob.read_shift(4, 'i'), + start: 0, + size: 0 + }); + var ctime /*:number*/ = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2); + if (ctime !== 0) + o.ct = read_date(blob, blob.l - 8); + var mtime /*:number*/ = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2); + if (mtime !== 0) + o.mt = read_date(blob, blob.l - 8); + o.start = blob.read_shift(4, 'i'); + o.size = blob.read_shift(4, 'i'); + if (o.size < 0 && o.start < 0) { + o.size = o.type = 0; + o.start = ENDOFCHAIN; + o.name = ""; + } + if (o.type === 5) { /* root */ + minifat_store = o.start; + if (nmfs > 0 && minifat_store !== ENDOFCHAIN) + sector_list[minifat_store].name = "!StreamData"; + /*minifat_size = o.size;*/ + } + else if (o.size >= 4096 /* MSCSZ */) { + o.storage = 'fat'; + if (sector_list[o.start] === undefined) + sector_list[o.start] = get_sector_list(sectors, o.start, sector_list.fat_addrs, sector_list.ssz); + sector_list[o.start].name = o.name; + o.content = (sector_list[o.start].data.slice(0, o.size) /*:any*/); + } + else { + o.storage = 'minifat'; + if (o.size < 0) + o.size = 0; + else if (minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) { + o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini] || {}).data); + } + } + if (o.content) + prep_blob(o.content, 0); + files[name] = o; + FileIndex.push(o); + } + } + function read_date(blob /*:RawBytes|CFBlob*/, offset /*:number*/) { + return new Date((((__readUInt32LE(blob, offset + 4) / 1e7) * Math.pow(2, 32) + __readUInt32LE(blob, offset) / 1e7) - 11644473600) * 1000); + } + function read_file(filename /*:string*/, options /*:CFBReadOpts*/) { + get_fs(); + return parse(fs.readFileSync(filename), options); + } + function read(blob /*:RawBytes|string*/, options /*:CFBReadOpts*/) { + var type = options && options.type; + if (!type) { + if (has_buf && Buffer.isBuffer(blob)) + type = "buffer"; + } + switch (type || "base64") { + case "file": /*:: if(typeof blob !== 'string') throw "Must pass a filename when type='file'"; */ return read_file(blob, options); + case "base64": /*:: if(typeof blob !== 'string') throw "Must pass a base64-encoded binary string when type='file'"; */ return parse(s2a(Base64_decode(blob)), options); + case "binary": /*:: if(typeof blob !== 'string') throw "Must pass a binary string when type='file'"; */ return parse(s2a(blob), options); + } + return parse(/*::typeof blob == 'string' ? new Buffer(blob, 'utf-8') : */ blob, options); + } + function init_cfb(cfb /*:CFBContainer*/, opts /*:?any*/) { + var o = opts || {}, root = o.root || "Root Entry"; + if (!cfb.FullPaths) + cfb.FullPaths = []; + if (!cfb.FileIndex) + cfb.FileIndex = []; + if (cfb.FullPaths.length !== cfb.FileIndex.length) + throw new Error("inconsistent CFB structure"); + if (cfb.FullPaths.length === 0) { + cfb.FullPaths[0] = root + "/"; + cfb.FileIndex[0] = ({ name: root, type: 5 } /*:any*/); + } + if (o.CLSID) + cfb.FileIndex[0].clsid = o.CLSID; + seed_cfb(cfb); + } + function seed_cfb(cfb /*:CFBContainer*/) { + var nm = "\u0001Sh33tJ5"; + if (CFB.find(cfb, "/" + nm)) + return; + var p = new_buf(4); + p[0] = 55; + p[1] = p[3] = 50; + p[2] = 54; + cfb.FileIndex.push(({ name: nm, type: 2, content: p, size: 4, L: 69, R: 69, C: 69 } /*:any*/)); + cfb.FullPaths.push(cfb.FullPaths[0] + nm); + rebuild_cfb(cfb); + } + function rebuild_cfb(cfb /*:CFBContainer*/, f /*:?boolean*/) { + init_cfb(cfb); + var gc = false, s = false; + for (var i = cfb.FullPaths.length - 1; i >= 0; --i) { + var _file = cfb.FileIndex[i]; + switch (_file.type) { + case 0: + if (s) + gc = true; + else { + cfb.FileIndex.pop(); + cfb.FullPaths.pop(); + } + break; + case 1: + case 2: + case 5: + s = true; + if (isNaN(_file.R * _file.L * _file.C)) + gc = true; + if (_file.R > -1 && _file.L > -1 && _file.R == _file.L) + gc = true; + break; + default: + gc = true; + break; + } + } + if (!gc && !f) + return; + var now = new Date(1987, 1, 19), j = 0; + // Track which names exist + var fullPaths = Object.create ? Object.create(null) : {}; + var data /*:Array<[string, CFBEntry]>*/ = []; + for (i = 0; i < cfb.FullPaths.length; ++i) { + fullPaths[cfb.FullPaths[i]] = true; + if (cfb.FileIndex[i].type === 0) + continue; + data.push([cfb.FullPaths[i], cfb.FileIndex[i]]); + } + for (i = 0; i < data.length; ++i) { + var dad = dirname(data[i][0]); + s = fullPaths[dad]; + while (!s) { + while (dirname(dad) && !fullPaths[dirname(dad)]) + dad = dirname(dad); + data.push([dad, ({ + name: filename(dad).replace("/", ""), + type: 1, + clsid: HEADER_CLSID, + ct: now, mt: now, + content: null + } /*:any*/)]); + // Add name to set + fullPaths[dad] = true; + dad = dirname(data[i][0]); + s = fullPaths[dad]; + } + } + data.sort(function (x, y) { return namecmp(x[0], y[0]); }); + cfb.FullPaths = []; + cfb.FileIndex = []; + for (i = 0; i < data.length; ++i) { + cfb.FullPaths[i] = data[i][0]; + cfb.FileIndex[i] = data[i][1]; + } + for (i = 0; i < data.length; ++i) { + var elt = cfb.FileIndex[i]; + var nm = cfb.FullPaths[i]; + elt.name = filename(nm).replace("/", ""); + elt.L = elt.R = elt.C = -(elt.color = 1); + elt.size = elt.content ? elt.content.length : 0; + elt.start = 0; + elt.clsid = (elt.clsid || HEADER_CLSID); + if (i === 0) { + elt.C = data.length > 1 ? 1 : -1; + elt.size = 0; + elt.type = 5; + } + else if (nm.slice(-1) == "/") { + for (j = i + 1; j < data.length; ++j) + if (dirname(cfb.FullPaths[j]) == nm) + break; + elt.C = j >= data.length ? -1 : j; + for (j = i + 1; j < data.length; ++j) + if (dirname(cfb.FullPaths[j]) == dirname(nm)) + break; + elt.R = j >= data.length ? -1 : j; + elt.type = 1; + } + else { + if (dirname(cfb.FullPaths[i + 1] || "") == dirname(nm)) + elt.R = i + 1; + elt.type = 2; + } + } + } + function _write(cfb /*:CFBContainer*/, options /*:CFBWriteOpts*/) { + var _opts = options || {}; + /* MAD is order-sensitive, skip rebuild and sort */ + if (_opts.fileType == 'mad') + return write_mad(cfb, _opts); + rebuild_cfb(cfb); + switch (_opts.fileType) { + case 'zip': return write_zip(cfb, _opts); + //case 'mad': return write_mad(cfb, _opts); + } + var L = (function (cfb /*:CFBContainer*/) { + var mini_size = 0, fat_size = 0; + for (var i = 0; i < cfb.FileIndex.length; ++i) { + var file = cfb.FileIndex[i]; + if (!file.content) + continue; + var flen = file.content.length; + if (flen > 0) { + if (flen < 0x1000) + mini_size += (flen + 0x3F) >> 6; + else + fat_size += (flen + 0x01FF) >> 9; + } + } + var dir_cnt = (cfb.FullPaths.length + 3) >> 2; + var mini_cnt = (mini_size + 7) >> 3; + var mfat_cnt = (mini_size + 0x7F) >> 7; + var fat_base = mini_cnt + fat_size + dir_cnt + mfat_cnt; + var fat_cnt = (fat_base + 0x7F) >> 7; + var difat_cnt = fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt - 109) / 0x7F); + while (((fat_base + fat_cnt + difat_cnt + 0x7F) >> 7) > fat_cnt) + difat_cnt = ++fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt - 109) / 0x7F); + var L = [1, difat_cnt, fat_cnt, mfat_cnt, dir_cnt, fat_size, mini_size, 0]; + cfb.FileIndex[0].size = mini_size << 6; + L[7] = (cfb.FileIndex[0].start = L[0] + L[1] + L[2] + L[3] + L[4] + L[5]) + ((L[6] + 7) >> 3); + return L; + })(cfb); + var o = new_buf(L[7] << 9); + var i = 0, T = 0; + { + for (i = 0; i < 8; ++i) + o.write_shift(1, HEADER_SIG[i]); + for (i = 0; i < 8; ++i) + o.write_shift(2, 0); + o.write_shift(2, 0x003E); + o.write_shift(2, 0x0003); + o.write_shift(2, 0xFFFE); + o.write_shift(2, 0x0009); + o.write_shift(2, 0x0006); + for (i = 0; i < 3; ++i) + o.write_shift(2, 0); + o.write_shift(4, 0); + o.write_shift(4, L[2]); + o.write_shift(4, L[0] + L[1] + L[2] + L[3] - 1); + o.write_shift(4, 0); + o.write_shift(4, 1 << 12); + o.write_shift(4, L[3] ? L[0] + L[1] + L[2] - 1 : ENDOFCHAIN); + o.write_shift(4, L[3]); + o.write_shift(-4, L[1] ? L[0] - 1 : ENDOFCHAIN); + o.write_shift(4, L[1]); + for (i = 0; i < 109; ++i) + o.write_shift(-4, i < L[2] ? L[1] + i : -1); + } + if (L[1]) { + for (T = 0; T < L[1]; ++T) { + for (; i < 236 + T * 127; ++i) + o.write_shift(-4, i < L[2] ? L[1] + i : -1); + o.write_shift(-4, T === L[1] - 1 ? ENDOFCHAIN : T + 1); + } + } + var chainit = function (w /*:number*/) { + for (T += w; i < T - 1; ++i) + o.write_shift(-4, i + 1); + if (w) { + ++i; + o.write_shift(-4, ENDOFCHAIN); + } + }; + T = i = 0; + for (T += L[1]; i < T; ++i) + o.write_shift(-4, consts.DIFSECT); + for (T += L[2]; i < T; ++i) + o.write_shift(-4, consts.FATSECT); + chainit(L[3]); + chainit(L[4]); + var j /*:number*/ = 0, flen /*:number*/ = 0; + var file /*:CFBEntry*/ = cfb.FileIndex[0]; + for (; j < cfb.FileIndex.length; ++j) { + file = cfb.FileIndex[j]; + if (!file.content) + continue; + /*:: if(file.content == null) throw new Error("unreachable"); */ + flen = file.content.length; + if (flen < 0x1000) + continue; + file.start = T; + chainit((flen + 0x01FF) >> 9); + } + chainit((L[6] + 7) >> 3); + while (o.l & 0x1FF) + o.write_shift(-4, consts.ENDOFCHAIN); + T = i = 0; + for (j = 0; j < cfb.FileIndex.length; ++j) { + file = cfb.FileIndex[j]; + if (!file.content) + continue; + /*:: if(file.content == null) throw new Error("unreachable"); */ + flen = file.content.length; + if (!flen || flen >= 0x1000) + continue; + file.start = T; + chainit((flen + 0x3F) >> 6); + } + while (o.l & 0x1FF) + o.write_shift(-4, consts.ENDOFCHAIN); + for (i = 0; i < L[4] << 2; ++i) { + var nm = cfb.FullPaths[i]; + if (!nm || nm.length === 0) { + for (j = 0; j < 17; ++j) + o.write_shift(4, 0); + for (j = 0; j < 3; ++j) + o.write_shift(4, -1); + for (j = 0; j < 12; ++j) + o.write_shift(4, 0); + continue; + } + file = cfb.FileIndex[i]; + if (i === 0) + file.start = file.size ? file.start - 1 : ENDOFCHAIN; + var _nm /*:string*/ = (i === 0 && _opts.root) || file.name; + if (_nm.length > 32) { + console.error("Name " + _nm + " will be truncated to " + _nm.slice(0, 32)); + _nm = _nm.slice(0, 32); + } + flen = 2 * (_nm.length + 1); + o.write_shift(64, _nm, "utf16le"); + o.write_shift(2, flen); + o.write_shift(1, file.type); + o.write_shift(1, file.color); + o.write_shift(-4, file.L); + o.write_shift(-4, file.R); + o.write_shift(-4, file.C); + if (!file.clsid) + for (j = 0; j < 4; ++j) + o.write_shift(4, 0); + else + o.write_shift(16, file.clsid, "hex"); + o.write_shift(4, file.state || 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, file.start); + o.write_shift(4, file.size); + o.write_shift(4, 0); + } + for (i = 1; i < cfb.FileIndex.length; ++i) { + file = cfb.FileIndex[i]; + /*:: if(!file.content) throw new Error("unreachable"); */ + if (file.size >= 0x1000) { + o.l = (file.start + 1) << 9; + if (has_buf && Buffer.isBuffer(file.content)) { + file.content.copy(o, o.l, 0, file.size); + // o is a 0-filled Buffer so just set next offset + o.l += (file.size + 511) & -512; + } + else { + for (j = 0; j < file.size; ++j) + o.write_shift(1, file.content[j]); + for (; j & 0x1FF; ++j) + o.write_shift(1, 0); + } + } + } + for (i = 1; i < cfb.FileIndex.length; ++i) { + file = cfb.FileIndex[i]; + /*:: if(!file.content) throw new Error("unreachable"); */ + if (file.size > 0 && file.size < 0x1000) { + if (has_buf && Buffer.isBuffer(file.content)) { + file.content.copy(o, o.l, 0, file.size); + // o is a 0-filled Buffer so just set next offset + o.l += (file.size + 63) & -64; + } + else { + for (j = 0; j < file.size; ++j) + o.write_shift(1, file.content[j]); + for (; j & 0x3F; ++j) + o.write_shift(1, 0); + } + } + } + if (has_buf) { + o.l = o.length; + } + else { + // When using Buffer, already 0-filled + while (o.l < o.length) + o.write_shift(1, 0); + } + return o; + } + /* [MS-CFB] 2.6.4 (Unicode 3.0.1 case conversion) */ + function find(cfb /*:CFBContainer*/, path /*:string*/) { + var UCFullPaths /*:Array*/ = cfb.FullPaths.map(function (x) { return x.toUpperCase(); }); + var UCPaths /*:Array*/ = UCFullPaths.map(function (x) { var y = x.split("/"); return y[y.length - (x.slice(-1) == "/" ? 2 : 1)]; }); + var k /*:boolean*/ = false; + if (path.charCodeAt(0) === 47 /* "/" */) { + k = true; + path = UCFullPaths[0].slice(0, -1) + path; + } + else + k = path.indexOf("/") !== -1; + var UCPath /*:string*/ = path.toUpperCase(); + var w /*:number*/ = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath); + if (w !== -1) + return cfb.FileIndex[w]; + var m = !UCPath.match(chr1); + UCPath = UCPath.replace(chr0, ''); + if (m) + UCPath = UCPath.replace(chr1, '!'); + for (w = 0; w < UCFullPaths.length; ++w) { + if ((m ? UCFullPaths[w].replace(chr1, '!') : UCFullPaths[w]).replace(chr0, '') == UCPath) + return cfb.FileIndex[w]; + if ((m ? UCPaths[w].replace(chr1, '!') : UCPaths[w]).replace(chr0, '') == UCPath) + return cfb.FileIndex[w]; + } + return null; + } + /** CFB Constants */ + var MSSZ = 64; /* Mini Sector Size = 1<<6 */ + //var MSCSZ = 4096; /* Mini Stream Cutoff Size */ + /* 2.1 Compound File Sector Numbers and Types */ + var ENDOFCHAIN = -2; + /* 2.2 Compound File Header */ + var HEADER_SIGNATURE = 'd0cf11e0a1b11ae1'; + var HEADER_SIG = [0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]; + var HEADER_CLSID = '00000000000000000000000000000000'; + var consts = { + /* 2.1 Compund File Sector Numbers and Types */ + MAXREGSECT: -6, + DIFSECT: -4, + FATSECT: -3, + ENDOFCHAIN: ENDOFCHAIN, + FREESECT: -1, + /* 2.2 Compound File Header */ + HEADER_SIGNATURE: HEADER_SIGNATURE, + HEADER_MINOR_VERSION: '3e00', + MAXREGSID: -6, + NOSTREAM: -1, + HEADER_CLSID: HEADER_CLSID, + /* 2.6.1 Compound File Directory Entry */ + EntryTypes: ['unknown', 'storage', 'stream', 'lockbytes', 'property', 'root'] + }; + function write_file(cfb /*:CFBContainer*/, filename /*:string*/, options /*:CFBWriteOpts*/) { + get_fs(); + var o = _write(cfb, options); + /*:: if(typeof Buffer == 'undefined' || !Buffer.isBuffer(o) || !(o instanceof Buffer)) throw new Error("unreachable"); */ + fs.writeFileSync(filename, o); + } + function a2s(o /*:RawBytes*/) { + var out = new Array(o.length); + for (var i = 0; i < o.length; ++i) + out[i] = String.fromCharCode(o[i]); + return out.join(""); + } + function write(cfb /*:CFBContainer*/, options /*:CFBWriteOpts*/) { + var o = _write(cfb, options); + switch (options && options.type || "buffer") { + case "file": + get_fs(); + fs.writeFileSync(options.filename, (o /*:any*/)); + return o; + case "binary": return typeof o == "string" ? o : a2s(o); + case "base64": return Base64_encode(typeof o == "string" ? o : a2s(o)); + case "buffer": if (has_buf) + return Buffer.isBuffer(o) ? o : Buffer_from(o); + /* falls through */ + case "array": return typeof o == "string" ? s2a(o) : o; + } + return o; + } + /* node < 8.1 zlib does not expose bytesRead, so default to pure JS */ + var _zlib; + function use_zlib(zlib) { + try { + var InflateRaw = zlib.InflateRaw; + var InflRaw = new InflateRaw(); + InflRaw._processChunk(new Uint8Array([3, 0]), InflRaw._finishFlushFlag); + if (InflRaw.bytesRead) + _zlib = zlib; + else + throw new Error("zlib does not expose bytesRead"); + } + catch (e) { + console.error("cannot use native zlib: " + (e.message || e)); + } + } + function _inflateRawSync(payload, usz) { + if (!_zlib) + return _inflate(payload, usz); + var InflateRaw = _zlib.InflateRaw; + var InflRaw = new InflateRaw(); + var out = InflRaw._processChunk(payload.slice(payload.l), InflRaw._finishFlushFlag); + payload.l += InflRaw.bytesRead; + return out; + } + function _deflateRawSync(payload) { + return _zlib ? _zlib.deflateRawSync(payload) : _deflate(payload); + } + var CLEN_ORDER = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; + /* LEN_ID = [ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285 ]; */ + var LEN_LN = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258]; + /* DST_ID = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ]; */ + var DST_LN = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577]; + function bit_swap_8(n) { var t = (((((n << 1) | (n << 11)) & 0x22110) | (((n << 5) | (n << 15)) & 0x88440))); return ((t >> 16) | (t >> 8) | t) & 0xFF; } + var use_typed_arrays = typeof Uint8Array !== 'undefined'; + var bitswap8 = use_typed_arrays ? new Uint8Array(1 << 8) : []; + for (var q = 0; q < (1 << 8); ++q) + bitswap8[q] = bit_swap_8(q); + function bit_swap_n(n, b) { + var rev = bitswap8[n & 0xFF]; + if (b <= 8) + return rev >>> (8 - b); + rev = (rev << 8) | bitswap8[(n >> 8) & 0xFF]; + if (b <= 16) + return rev >>> (16 - b); + rev = (rev << 8) | bitswap8[(n >> 16) & 0xFF]; + return rev >>> (24 - b); + } + /* helpers for unaligned bit reads */ + function read_bits_2(buf, bl) { var w = (bl & 7), h = (bl >>> 3); return ((buf[h] | (w <= 6 ? 0 : buf[h + 1] << 8)) >>> w) & 0x03; } + function read_bits_3(buf, bl) { var w = (bl & 7), h = (bl >>> 3); return ((buf[h] | (w <= 5 ? 0 : buf[h + 1] << 8)) >>> w) & 0x07; } + function read_bits_4(buf, bl) { var w = (bl & 7), h = (bl >>> 3); return ((buf[h] | (w <= 4 ? 0 : buf[h + 1] << 8)) >>> w) & 0x0F; } + function read_bits_5(buf, bl) { var w = (bl & 7), h = (bl >>> 3); return ((buf[h] | (w <= 3 ? 0 : buf[h + 1] << 8)) >>> w) & 0x1F; } + function read_bits_7(buf, bl) { var w = (bl & 7), h = (bl >>> 3); return ((buf[h] | (w <= 1 ? 0 : buf[h + 1] << 8)) >>> w) & 0x7F; } + /* works up to n = 3 * 8 + 1 = 25 */ + function read_bits_n(buf, bl, n) { + var w = (bl & 7), h = (bl >>> 3), f = ((1 << n) - 1); + var v = buf[h] >>> w; + if (n < 8 - w) + return v & f; + v |= buf[h + 1] << (8 - w); + if (n < 16 - w) + return v & f; + v |= buf[h + 2] << (16 - w); + if (n < 24 - w) + return v & f; + v |= buf[h + 3] << (24 - w); + return v & f; + } + /* helpers for unaligned bit writes */ + function write_bits_3(buf, bl, v) { + var w = bl & 7, h = bl >>> 3; + if (w <= 5) + buf[h] |= (v & 7) << w; + else { + buf[h] |= (v << w) & 0xFF; + buf[h + 1] = (v & 7) >> (8 - w); + } + return bl + 3; + } + function write_bits_1(buf, bl, v) { + var w = bl & 7, h = bl >>> 3; + v = (v & 1) << w; + buf[h] |= v; + return bl + 1; + } + function write_bits_8(buf, bl, v) { + var w = bl & 7, h = bl >>> 3; + v <<= w; + buf[h] |= v & 0xFF; + v >>>= 8; + buf[h + 1] = v; + return bl + 8; + } + function write_bits_16(buf, bl, v) { + var w = bl & 7, h = bl >>> 3; + v <<= w; + buf[h] |= v & 0xFF; + v >>>= 8; + buf[h + 1] = v & 0xFF; + buf[h + 2] = v >>> 8; + return bl + 16; + } + /* until ArrayBuffer#realloc is a thing, fake a realloc */ + function realloc(b, sz /*:number*/) { + var L = b.length, M = 2 * L > sz ? 2 * L : sz + 5, i = 0; + if (L >= sz) + return b; + if (has_buf) { + var o = new_unsafe_buf(M); + // $FlowIgnore + if (b.copy) + b.copy(o); + else + for (; i < b.length; ++i) + o[i] = b[i]; + return o; + } + else if (use_typed_arrays) { + var a = new Uint8Array(M); + if (a.set) + a.set(b); + else + for (; i < L; ++i) + a[i] = b[i]; + return a; + } + b.length = M; + return b; + } + /* zero-filled arrays for older browsers */ + function zero_fill_array(n) { + var o = new Array(n); + for (var i = 0; i < n; ++i) + o[i] = 0; + return o; + } + /* build tree (used for literals and lengths) */ + function build_tree(clens, cmap, MAX /*:number*/) { + var maxlen = 1, w = 0, i = 0, j = 0, ccode = 0, L = clens.length; + var bl_count = use_typed_arrays ? new Uint16Array(32) : zero_fill_array(32); + for (i = 0; i < 32; ++i) + bl_count[i] = 0; + for (i = L; i < MAX; ++i) + clens[i] = 0; + L = clens.length; + var ctree = use_typed_arrays ? new Uint16Array(L) : zero_fill_array(L); // [] + /* build code tree */ + for (i = 0; i < L; ++i) { + bl_count[(w = clens[i])]++; + if (maxlen < w) + maxlen = w; + ctree[i] = 0; + } + bl_count[0] = 0; + for (i = 1; i <= maxlen; ++i) + bl_count[i + 16] = (ccode = (ccode + bl_count[i - 1]) << 1); + for (i = 0; i < L; ++i) { + ccode = clens[i]; + if (ccode != 0) + ctree[i] = bl_count[ccode + 16]++; + } + /* cmap[maxlen + 4 bits] = (off&15) + (lit<<4) reverse mapping */ + var cleni = 0; + for (i = 0; i < L; ++i) { + cleni = clens[i]; + if (cleni != 0) { + ccode = bit_swap_n(ctree[i], maxlen) >> (maxlen - cleni); + for (j = (1 << (maxlen + 4 - cleni)) - 1; j >= 0; --j) + cmap[ccode | (j << cleni)] = (cleni & 15) | (i << 4); + } + } + return maxlen; + } + /* Fixed Huffman */ + var fix_lmap = use_typed_arrays ? new Uint16Array(512) : zero_fill_array(512); + var fix_dmap = use_typed_arrays ? new Uint16Array(32) : zero_fill_array(32); + if (!use_typed_arrays) { + for (var i = 0; i < 512; ++i) + fix_lmap[i] = 0; + for (i = 0; i < 32; ++i) + fix_dmap[i] = 0; + } + (function () { + var dlens /*:Array*/ = []; + var i = 0; + for (; i < 32; i++) + dlens.push(5); + build_tree(dlens, fix_dmap, 32); + var clens /*:Array*/ = []; + i = 0; + for (; i <= 143; i++) + clens.push(8); + for (; i <= 255; i++) + clens.push(9); + for (; i <= 279; i++) + clens.push(7); + for (; i <= 287; i++) + clens.push(8); + build_tree(clens, fix_lmap, 288); + })(); + var _deflateRaw = /*#__PURE__*/ (function _deflateRawIIFE() { + var DST_LN_RE = use_typed_arrays ? new Uint8Array(0x8000) : []; + var j = 0, k = 0; + for (; j < DST_LN.length - 1; ++j) { + for (; k < DST_LN[j + 1]; ++k) + DST_LN_RE[k] = j; + } + for (; k < 32768; ++k) + DST_LN_RE[k] = 29; + var LEN_LN_RE = use_typed_arrays ? new Uint8Array(0x103) : []; + for (j = 0, k = 0; j < LEN_LN.length - 1; ++j) { + for (; k < LEN_LN[j + 1]; ++k) + LEN_LN_RE[k] = j; + } + function write_stored(data, out) { + var boff = 0; + while (boff < data.length) { + var L = Math.min(0xFFFF, data.length - boff); + var h = boff + L == data.length; + out.write_shift(1, +h); + out.write_shift(2, L); + out.write_shift(2, (~L) & 0xFFFF); + while (L-- > 0) + out[out.l++] = data[boff++]; + } + return out.l; + } + /* Fixed Huffman */ + function write_huff_fixed(data, out) { + var bl = 0; + var boff = 0; + var addrs = use_typed_arrays ? new Uint16Array(0x8000) : []; + while (boff < data.length) { + var L = /* data.length - boff; */ Math.min(0xFFFF, data.length - boff); + /* write a stored block for short data */ + if (L < 10) { + bl = write_bits_3(out, bl, +!!(boff + L == data.length)); // jshint ignore:line + if (bl & 7) + bl += 8 - (bl & 7); + out.l = (bl / 8) | 0; + out.write_shift(2, L); + out.write_shift(2, (~L) & 0xFFFF); + while (L-- > 0) + out[out.l++] = data[boff++]; + bl = out.l * 8; + continue; + } + bl = write_bits_3(out, bl, +!!(boff + L == data.length) + 2); // jshint ignore:line + var hash = 0; + while (L-- > 0) { + var d = data[boff]; + hash = ((hash << 5) ^ d) & 0x7FFF; + var match = -1, mlen = 0; + if ((match = addrs[hash])) { + match |= boff & ~0x7FFF; + if (match > boff) + match -= 0x8000; + if (match < boff) + while (data[match + mlen] == data[boff + mlen] && mlen < 250) + ++mlen; + } + if (mlen > 2) { + /* Copy Token */ + d = LEN_LN_RE[mlen]; + if (d <= 22) + bl = write_bits_8(out, bl, bitswap8[d + 1] >> 1) - 1; + else { + write_bits_8(out, bl, 3); + bl += 5; + write_bits_8(out, bl, bitswap8[d - 23] >> 5); + bl += 3; + } + var len_eb = (d < 8) ? 0 : ((d - 4) >> 2); + if (len_eb > 0) { + write_bits_16(out, bl, mlen - LEN_LN[d]); + bl += len_eb; + } + d = DST_LN_RE[boff - match]; + bl = write_bits_8(out, bl, bitswap8[d] >> 3); + bl -= 3; + var dst_eb = d < 4 ? 0 : (d - 2) >> 1; + if (dst_eb > 0) { + write_bits_16(out, bl, boff - match - DST_LN[d]); + bl += dst_eb; + } + for (var q = 0; q < mlen; ++q) { + addrs[hash] = boff & 0x7FFF; + hash = ((hash << 5) ^ data[boff]) & 0x7FFF; + ++boff; + } + L -= mlen - 1; + } + else { + /* Literal Token */ + if (d <= 143) + d = d + 48; + else + bl = write_bits_1(out, bl, 1); + bl = write_bits_8(out, bl, bitswap8[d]); + addrs[hash] = boff & 0x7FFF; + ++boff; + } + } + bl = write_bits_8(out, bl, 0) - 1; + } + out.l = ((bl + 7) / 8) | 0; + return out.l; + } + return function _deflateRaw(data, out) { + if (data.length < 8) + return write_stored(data, out); + return write_huff_fixed(data, out); + }; + })(); + function _deflate(data) { + var buf = new_buf(50 + Math.floor(data.length * 1.1)); + var off = _deflateRaw(data, buf); + return buf.slice(0, off); + } + /* modified inflate function also moves original read head */ + var dyn_lmap = use_typed_arrays ? new Uint16Array(32768) : zero_fill_array(32768); + var dyn_dmap = use_typed_arrays ? new Uint16Array(32768) : zero_fill_array(32768); + var dyn_cmap = use_typed_arrays ? new Uint16Array(128) : zero_fill_array(128); + var dyn_len_1 = 1, dyn_len_2 = 1; + /* 5.5.3 Expanding Huffman Codes */ + function dyn(data, boff /*:number*/) { + /* nomenclature from RFC1951 refers to bit values; these are offset by the implicit constant */ + var _HLIT = read_bits_5(data, boff) + 257; + boff += 5; + var _HDIST = read_bits_5(data, boff) + 1; + boff += 5; + var _HCLEN = read_bits_4(data, boff) + 4; + boff += 4; + var w = 0; + /* grab and store code lengths */ + var clens = use_typed_arrays ? new Uint8Array(19) : zero_fill_array(19); + var ctree = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + var maxlen = 1; + var bl_count = use_typed_arrays ? new Uint8Array(8) : zero_fill_array(8); + var next_code = use_typed_arrays ? new Uint8Array(8) : zero_fill_array(8); + var L = clens.length; /* 19 */ + for (var i = 0; i < _HCLEN; ++i) { + clens[CLEN_ORDER[i]] = w = read_bits_3(data, boff); + if (maxlen < w) + maxlen = w; + bl_count[w]++; + boff += 3; + } + /* build code tree */ + var ccode = 0; + bl_count[0] = 0; + for (i = 1; i <= maxlen; ++i) + next_code[i] = ccode = (ccode + bl_count[i - 1]) << 1; + for (i = 0; i < L; ++i) + if ((ccode = clens[i]) != 0) + ctree[i] = next_code[ccode]++; + /* cmap[7 bits from stream] = (off&7) + (lit<<3) */ + var cleni = 0; + for (i = 0; i < L; ++i) { + cleni = clens[i]; + if (cleni != 0) { + ccode = bitswap8[ctree[i]] >> (8 - cleni); + for (var j = (1 << (7 - cleni)) - 1; j >= 0; --j) + dyn_cmap[ccode | (j << cleni)] = (cleni & 7) | (i << 3); + } + } + /* read literal and dist codes at once */ + var hcodes /*:Array*/ = []; + maxlen = 1; + for (; hcodes.length < _HLIT + _HDIST;) { + ccode = dyn_cmap[read_bits_7(data, boff)]; + boff += ccode & 7; + switch ((ccode >>>= 3)) { + case 16: + w = 3 + read_bits_2(data, boff); + boff += 2; + ccode = hcodes[hcodes.length - 1]; + while (w-- > 0) + hcodes.push(ccode); + break; + case 17: + w = 3 + read_bits_3(data, boff); + boff += 3; + while (w-- > 0) + hcodes.push(0); + break; + case 18: + w = 11 + read_bits_7(data, boff); + boff += 7; + while (w-- > 0) + hcodes.push(0); + break; + default: + hcodes.push(ccode); + if (maxlen < ccode) + maxlen = ccode; + break; + } + } + /* build literal / length trees */ + var h1 = hcodes.slice(0, _HLIT), h2 = hcodes.slice(_HLIT); + for (i = _HLIT; i < 286; ++i) + h1[i] = 0; + for (i = _HDIST; i < 30; ++i) + h2[i] = 0; + dyn_len_1 = build_tree(h1, dyn_lmap, 286); + dyn_len_2 = build_tree(h2, dyn_dmap, 30); + return boff; + } + /* return [ data, bytesRead ] */ + function inflate(data, usz /*:number*/) { + /* shortcircuit for empty buffer [0x03, 0x00] */ + if (data[0] == 3 && !(data[1] & 0x3)) { + return [new_raw_buf(usz), 2]; + } + /* bit offset */ + var boff = 0; + /* header includes final bit and type bits */ + var header = 0; + var outbuf = new_unsafe_buf(usz ? usz : (1 << 18)); + var woff = 0; + var OL = outbuf.length >>> 0; + var max_len_1 = 0, max_len_2 = 0; + while ((header & 1) == 0) { + header = read_bits_3(data, boff); + boff += 3; + if ((header >>> 1) == 0) { + /* Stored block */ + if (boff & 7) + boff += 8 - (boff & 7); + /* 2 bytes sz, 2 bytes bit inverse */ + var sz = data[boff >>> 3] | data[(boff >>> 3) + 1] << 8; + boff += 32; + /* push sz bytes */ + if (sz > 0) { + if (!usz && OL < woff + sz) { + outbuf = realloc(outbuf, woff + sz); + OL = outbuf.length; + } + while (sz-- > 0) { + outbuf[woff++] = data[boff >>> 3]; + boff += 8; + } + } + continue; + } + else if ((header >> 1) == 1) { + /* Fixed Huffman */ + max_len_1 = 9; + max_len_2 = 5; + } + else { + /* Dynamic Huffman */ + boff = dyn(data, boff); + max_len_1 = dyn_len_1; + max_len_2 = dyn_len_2; + } + for (;;) { // while(true) is apparently out of vogue in modern JS circles + if (!usz && (OL < woff + 32767)) { + outbuf = realloc(outbuf, woff + 32767); + OL = outbuf.length; + } + /* ingest code and move read head */ + var bits = read_bits_n(data, boff, max_len_1); + var code = (header >>> 1) == 1 ? fix_lmap[bits] : dyn_lmap[bits]; + boff += code & 15; + code >>>= 4; + /* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */ + if (((code >>> 8) & 0xFF) === 0) + outbuf[woff++] = code; + else if (code == 256) + break; + else { + code -= 257; + var len_eb = (code < 8) ? 0 : ((code - 4) >> 2); + if (len_eb > 5) + len_eb = 0; + var tgt = woff + LEN_LN[code]; + /* length extra bits */ + if (len_eb > 0) { + tgt += read_bits_n(data, boff, len_eb); + boff += len_eb; + } + /* dist code */ + bits = read_bits_n(data, boff, max_len_2); + code = (header >>> 1) == 1 ? fix_dmap[bits] : dyn_dmap[bits]; + boff += code & 15; + code >>>= 4; + var dst_eb = (code < 4 ? 0 : (code - 2) >> 1); + var dst = DST_LN[code]; + /* dist extra bits */ + if (dst_eb > 0) { + dst += read_bits_n(data, boff, dst_eb); + boff += dst_eb; + } + /* in the common case, manual byte copy is faster than TA set / Buffer copy */ + if (!usz && OL < tgt) { + outbuf = realloc(outbuf, tgt + 100); + OL = outbuf.length; + } + while (woff < tgt) { + outbuf[woff] = outbuf[woff - dst]; + ++woff; + } + } + } + } + if (usz) + return [outbuf, (boff + 7) >>> 3]; + return [outbuf.slice(0, woff), (boff + 7) >>> 3]; + } + function _inflate(payload, usz) { + var data = payload.slice(payload.l || 0); + var out = inflate(data, usz); + payload.l += out[1]; + return out[0]; + } + function warn_or_throw(wrn, msg) { + if (wrn) { + if (typeof console !== 'undefined') + console.error(msg); + } + else + throw new Error(msg); + } + function parse_zip(file /*:RawBytes*/, options /*:CFBReadOpts*/) { + var blob /*:CFBlob*/ = /*::(*/ file /*:: :any)*/; + prep_blob(blob, 0); + var FileIndex /*:CFBFileIndex*/ = [], FullPaths /*:Array*/ = []; + var o = { + FileIndex: FileIndex, + FullPaths: FullPaths + }; + init_cfb(o, { root: options.root }); + /* find end of central directory, start just after signature */ + var i = blob.length - 4; + while ((blob[i] != 0x50 || blob[i + 1] != 0x4b || blob[i + 2] != 0x05 || blob[i + 3] != 0x06) && i >= 0) + --i; + blob.l = i + 4; + /* parse end of central directory */ + blob.l += 4; + var fcnt = blob.read_shift(2); + blob.l += 6; + var start_cd = blob.read_shift(4); + /* parse central directory */ + blob.l = start_cd; + for (i = 0; i < fcnt; ++i) { + /* trust local file header instead of CD entry */ + blob.l += 20; + var csz = blob.read_shift(4); + var usz = blob.read_shift(4); + var namelen = blob.read_shift(2); + var efsz = blob.read_shift(2); + var fcsz = blob.read_shift(2); + blob.l += 8; + var offset = blob.read_shift(4); + var EF = parse_extra_field(/*::(*/ blob.slice(blob.l + namelen, blob.l + namelen + efsz) /*:: :any)*/); + blob.l += namelen + efsz + fcsz; + var L = blob.l; + blob.l = offset + 4; + /* ZIP64 lengths */ + if (EF && EF[0x0001]) { + if ((EF[0x0001] || {}).usz) + usz = EF[0x0001].usz; + if ((EF[0x0001] || {}).csz) + csz = EF[0x0001].csz; + } + parse_local_file(blob, csz, usz, o, EF); + blob.l = L; + } + return o; + } + /* head starts just after local file header signature */ + function parse_local_file(blob /*:CFBlob*/, csz /*:number*/, usz /*:number*/, o /*:CFBContainer*/, EF) { + /* [local file header] */ + blob.l += 2; + var flags = blob.read_shift(2); + var meth = blob.read_shift(2); + var date = parse_dos_date(blob); + if (flags & 0x2041) + throw new Error("Unsupported ZIP encryption"); + var crc32 = blob.read_shift(4); + var _csz = blob.read_shift(4); + var _usz = blob.read_shift(4); + var namelen = blob.read_shift(2); + var efsz = blob.read_shift(2); + // TODO: flags & (1<<11) // UTF8 + var name = ""; + for (var i = 0; i < namelen; ++i) + name += String.fromCharCode(blob[blob.l++]); + if (efsz) { + var ef = parse_extra_field(/*::(*/ blob.slice(blob.l, blob.l + efsz) /*:: :any)*/); + if ((ef[0x5455] || {}).mt) + date = ef[0x5455].mt; + if ((ef[0x0001] || {}).usz) + _usz = ef[0x0001].usz; + if ((ef[0x0001] || {}).csz) + _csz = ef[0x0001].csz; + if (EF) { + if ((EF[0x5455] || {}).mt) + date = EF[0x5455].mt; + if ((EF[0x0001] || {}).usz) + _usz = ef[0x0001].usz; + if ((EF[0x0001] || {}).csz) + _csz = ef[0x0001].csz; + } + } + blob.l += efsz; + /* [encryption header] */ + /* [file data] */ + var data = blob.slice(blob.l, blob.l + _csz); + switch (meth) { + case 8: + data = _inflateRawSync(blob, _usz); + break; + case 0: break; // TODO: scan for magic number + default: throw new Error("Unsupported ZIP Compression method " + meth); + } + /* [data descriptor] */ + var wrn = false; + if (flags & 8) { + crc32 = blob.read_shift(4); + if (crc32 == 0x08074b50) { + crc32 = blob.read_shift(4); + wrn = true; + } + _csz = blob.read_shift(4); + _usz = blob.read_shift(4); + } + if (_csz != csz) + warn_or_throw(wrn, "Bad compressed size: " + csz + " != " + _csz); + if (_usz != usz) + warn_or_throw(wrn, "Bad uncompressed size: " + usz + " != " + _usz); + //var _crc32 = CRC32.buf(data, 0); + //if((crc32>>0) != (_crc32>>0)) warn_or_throw(wrn, "Bad CRC32 checksum: " + crc32 + " != " + _crc32); + cfb_add(o, name, data, { unsafe: true, mt: date }); + } + function write_zip(cfb /*:CFBContainer*/, options /*:CFBWriteOpts*/) { + var _opts = options || {}; + var out = [], cdirs = []; + var o /*:CFBlob*/ = new_buf(1); + var method = (_opts.compression ? 8 : 0), flags = 0; + var desc = false; + if (desc) + flags |= 8; + var i = 0, j = 0; + var start_cd = 0, fcnt = 0; + var root = cfb.FullPaths[0], fp = root, fi = cfb.FileIndex[0]; + var crcs = []; + var sz_cd = 0; + for (i = 1; i < cfb.FullPaths.length; ++i) { + fp = cfb.FullPaths[i].slice(root.length); + fi = cfb.FileIndex[i]; + if (!fi.size || !fi.content || fp == "\u0001Sh33tJ5") + continue; + var start = start_cd; + /* TODO: CP437 filename */ + var namebuf = new_buf(fp.length); + for (j = 0; j < fp.length; ++j) + namebuf.write_shift(1, fp.charCodeAt(j) & 0x7F); + namebuf = namebuf.slice(0, namebuf.l); + crcs[fcnt] = typeof fi.content == "string" ? CRC32.bstr(fi.content, 0) : CRC32.buf(/*::((*/ fi.content /*::||[]):any)*/, 0); + var outbuf = typeof fi.content == "string" ? s2a(fi.content) : fi.content /*::||[]*/; + if (method == 8) + outbuf = _deflateRawSync(outbuf); + /* local file header */ + o = new_buf(30); + o.write_shift(4, 0x04034b50); + o.write_shift(2, 20); + o.write_shift(2, flags); + o.write_shift(2, method); + /* TODO: last mod file time/date */ + if (fi.mt) + write_dos_date(o, fi.mt); + else + o.write_shift(4, 0); + o.write_shift(-4, (flags & 8) ? 0 : crcs[fcnt]); + o.write_shift(4, (flags & 8) ? 0 : outbuf.length); + o.write_shift(4, (flags & 8) ? 0 : /*::(*/ fi.content /*::||[])*/.length); + o.write_shift(2, namebuf.length); + o.write_shift(2, 0); + start_cd += o.length; + out.push(o); + start_cd += namebuf.length; + out.push(namebuf); + /* TODO: extra fields? */ + /* TODO: encryption header ? */ + start_cd += outbuf.length; + out.push(outbuf); + /* data descriptor */ + if (flags & 8) { + o = new_buf(12); + o.write_shift(-4, crcs[fcnt]); + o.write_shift(4, outbuf.length); + o.write_shift(4, /*::(*/ fi.content /*::||[])*/.length); + start_cd += o.l; + out.push(o); + } + /* central directory */ + o = new_buf(46); + o.write_shift(4, 0x02014b50); + o.write_shift(2, 0); + o.write_shift(2, 20); + o.write_shift(2, flags); + o.write_shift(2, method); + o.write_shift(4, 0); /* TODO: last mod file time/date */ + o.write_shift(-4, crcs[fcnt]); + o.write_shift(4, outbuf.length); + o.write_shift(4, /*::(*/ fi.content /*::||[])*/.length); + o.write_shift(2, namebuf.length); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(4, 0); + o.write_shift(4, start); + sz_cd += o.l; + cdirs.push(o); + sz_cd += namebuf.length; + cdirs.push(namebuf); + ++fcnt; + } + /* end of central directory */ + o = new_buf(22); + o.write_shift(4, 0x06054b50); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, fcnt); + o.write_shift(2, fcnt); + o.write_shift(4, sz_cd); + o.write_shift(4, start_cd); + o.write_shift(2, 0); + return bconcat(([bconcat((out /*:any*/)), bconcat(cdirs), o] /*:any*/)); + } + var ContentTypeMap = ({ + "htm": "text/html", + "xml": "text/xml", + "gif": "image/gif", + "jpg": "image/jpeg", + "png": "image/png", + "mso": "application/x-mso", + "thmx": "application/vnd.ms-officetheme", + "sh33tj5": "application/octet-stream" + } /*:any*/); + function get_content_type(fi /*:CFBEntry*/, fp /*:string*/) { + if (fi.ctype) + return fi.ctype; + var ext = fi.name || "", m = ext.match(/\.([^\.]+)$/); + if (m && ContentTypeMap[m[1]]) + return ContentTypeMap[m[1]]; + if (fp) { + m = (ext = fp).match(/[\.\\]([^\.\\])+$/); + if (m && ContentTypeMap[m[1]]) + return ContentTypeMap[m[1]]; + } + return "application/octet-stream"; + } + /* 76 character chunks TODO: intertwine encoding */ + function write_base64_76(bstr /*:string*/) { + var data = Base64_encode(bstr); + var o = []; + for (var i = 0; i < data.length; i += 76) + o.push(data.slice(i, i + 76)); + return o.join("\r\n") + "\r\n"; + } + /* + Rules for QP: + - escape =## applies for all non-display characters and literal "=" + - space or tab at end of line must be encoded + - \r\n newlines can be preserved, but bare \r and \n must be escaped + - lines must not exceed 76 characters, use soft breaks =\r\n + + TODO: Some files from word appear to write line extensions with bare equals: + + ``` + */ = [], split = encoded.split("\r\n"); + for (var si = 0; si < split.length; ++si) { + var str = split[si]; + if (str.length == 0) { + o.push(""); + continue; + } + for (var i = 0; i < str.length;) { + var end = 76; + var tmp = str.slice(i, i + end); + if (tmp.charAt(end - 1) == "=") + end--; + else if (tmp.charAt(end - 2) == "=") + end -= 2; + else if (tmp.charAt(end - 3) == "=") + end -= 3; + tmp = str.slice(i, i + end); + i += end; + if (i < str.length) + tmp += "="; + o.push(tmp); + } + } + return o.join("\r\n"); + } + function parse_quoted_printable(data /*:Array*/) { + var o = []; + /* unify long lines */ + for (var di = 0; di < data.length; ++di) { + var line = data[di]; + while (di <= data.length && line.charAt(line.length - 1) == "=") + line = line.slice(0, line.length - 1) + data[++di]; + o.push(line); + } + /* decode */ + for (var oi = 0; oi < o.length; ++oi) + o[oi] = o[oi].replace(/[=][0-9A-Fa-f]{2}/g, function ($$) { return String.fromCharCode(parseInt($$.slice(1), 16)); }); + return s2a(o.join("\r\n")); + } + function parse_mime(cfb /*:CFBContainer*/, data /*:Array*/, root /*:string*/) { + var fname = "", cte = "", ctype = "", fdata; + var di = 0; + for (; di < 10; ++di) { + var line = data[di]; + if (!line || line.match(/^\s*$/)) + break; + var m = line.match(/^(.*?):\s*([^\s].*)$/); + if (m) + switch (m[1].toLowerCase()) { + case "content-location": + fname = m[2].trim(); + break; + case "content-type": + ctype = m[2].trim(); + break; + case "content-transfer-encoding": + cte = m[2].trim(); + break; + } + } + ++di; + switch (cte.toLowerCase()) { + case 'base64': + fdata = s2a(Base64_decode(data.slice(di).join(""))); + break; + case 'quoted-printable': + fdata = parse_quoted_printable(data.slice(di)); + break; + default: throw new Error("Unsupported Content-Transfer-Encoding " + cte); + } + var file = cfb_add(cfb, fname.slice(root.length), fdata, { unsafe: true }); + if (ctype) + file.ctype = ctype; + } + function parse_mad(file /*:RawBytes*/, options /*:CFBReadOpts*/) { + if (a2s(file.slice(0, 13)).toLowerCase() != "mime-version:") + throw new Error("Unsupported MAD header"); + var root = (options && options.root || ""); + // $FlowIgnore + var data = (has_buf && Buffer.isBuffer(file) ? file.toString("binary") : a2s(file)).split("\r\n"); + var di = 0, row = ""; + /* if root is not specified, scan for the common prefix */ + for (di = 0; di < data.length; ++di) { + row = data[di]; + if (!/^Content-Location:/i.test(row)) + continue; + row = row.slice(row.indexOf("file")); + if (!root) + root = row.slice(0, row.lastIndexOf("/") + 1); + if (row.slice(0, root.length) == root) + continue; + while (root.length > 0) { + root = root.slice(0, root.length - 1); + root = root.slice(0, root.lastIndexOf("/") + 1); + if (row.slice(0, root.length) == root) + break; + } + } + var mboundary = (data[1] || "").match(/boundary="(.*?)"/); + if (!mboundary) + throw new Error("MAD cannot find boundary"); + var boundary = "--" + (mboundary[1] || ""); + var FileIndex /*:CFBFileIndex*/ = [], FullPaths /*:Array*/ = []; + var o = { + FileIndex: FileIndex, + FullPaths: FullPaths + }; + init_cfb(o); + var start_di, fcnt = 0; + for (di = 0; di < data.length; ++di) { + var line = data[di]; + if (line !== boundary && line !== boundary + "--") + continue; + if (fcnt++) + parse_mime(o, data.slice(start_di, di), root); + start_di = di; + } + return o; + } + function write_mad(cfb /*:CFBContainer*/, options /*:CFBWriteOpts*/) { + var opts = options || {}; + var boundary = opts.boundary || "SheetJS"; + boundary = '------=' + boundary; + var out = [ + 'MIME-Version: 1.0', + 'Content-Type: multipart/related; boundary="' + boundary.slice(2) + '"', + '', + '', + '' + ]; + var root = cfb.FullPaths[0], fp = root, fi = cfb.FileIndex[0]; + for (var i = 1; i < cfb.FullPaths.length; ++i) { + fp = cfb.FullPaths[i].slice(root.length); + fi = cfb.FileIndex[i]; + if (!fi.size || !fi.content || fp == "\u0001Sh33tJ5") + continue; + /* Normalize filename */ + fp = fp.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g, function (c) { + return "_x" + c.charCodeAt(0).toString(16) + "_"; + }).replace(/[\u0080-\uFFFF]/g, function (u) { + return "_u" + u.charCodeAt(0).toString(16) + "_"; + }); + /* Extract content as binary string */ + var ca = fi.content; + // $FlowIgnore + var cstr = has_buf && Buffer.isBuffer(ca) ? ca.toString("binary") : a2s(ca); + /* 4/5 of first 1024 chars ascii -> quoted printable, else base64 */ + var dispcnt = 0, L = Math.min(1024, cstr.length), cc = 0; + for (var csl = 0; csl <= L; ++csl) + if ((cc = cstr.charCodeAt(csl)) >= 0x20 && cc < 0x80) + ++dispcnt; + var qp = dispcnt >= L * 4 / 5; + out.push(boundary); + out.push('Content-Location: ' + (opts.root || 'file:///C:/SheetJS/') + fp); + out.push('Content-Transfer-Encoding: ' + (qp ? 'quoted-printable' : 'base64')); + out.push('Content-Type: ' + get_content_type(fi, fp)); + out.push(''); + out.push(qp ? write_quoted_printable(cstr) : write_base64_76(cstr)); + } + out.push(boundary + '--\r\n'); + return out.join("\r\n"); + } + function cfb_new(opts /*:?any*/) { + var o /*:CFBContainer*/ = ({} /*:any*/); + init_cfb(o, opts); + return o; + } + function cfb_add(cfb /*:CFBContainer*/, name /*:string*/, content /*:?RawBytes*/, opts /*:?any*/) { + var unsafe = opts && opts.unsafe; + if (!unsafe) + init_cfb(cfb); + var file = !unsafe && CFB.find(cfb, name); + if (!file) { + var fpath /*:string*/ = cfb.FullPaths[0]; + if (name.slice(0, fpath.length) == fpath) + fpath = name; + else { + if (fpath.slice(-1) != "/") + fpath += "/"; + fpath = (fpath + name).replace("//", "/"); + } + file = ({ name: filename(name), type: 2 } /*:any*/); + cfb.FileIndex.push(file); + cfb.FullPaths.push(fpath); + if (!unsafe) + CFB.utils.cfb_gc(cfb); + } + /*:: if(!file) throw new Error("unreachable"); */ + file.content = (content /*:any*/); + file.size = content ? content.length : 0; + if (opts) { + if (opts.CLSID) + file.clsid = opts.CLSID; + if (opts.mt) + file.mt = opts.mt; + if (opts.ct) + file.ct = opts.ct; + } + return file; + } + function cfb_del(cfb /*:CFBContainer*/, name /*:string*/) { + init_cfb(cfb); + var file = CFB.find(cfb, name); + if (file) + for (var j = 0; j < cfb.FileIndex.length; ++j) + if (cfb.FileIndex[j] == file) { + cfb.FileIndex.splice(j, 1); + cfb.FullPaths.splice(j, 1); + return true; + } + return false; + } + function cfb_mov(cfb /*:CFBContainer*/, old_name /*:string*/, new_name /*:string*/) { + init_cfb(cfb); + var file = CFB.find(cfb, old_name); + if (file) + for (var j = 0; j < cfb.FileIndex.length; ++j) + if (cfb.FileIndex[j] == file) { + cfb.FileIndex[j].name = filename(new_name); + cfb.FullPaths[j] = new_name; + return true; + } + return false; + } + function cfb_gc(cfb /*:CFBContainer*/) { rebuild_cfb(cfb, true); } + exports.find = find; + exports.read = read; + exports.parse = parse; + exports.write = write; + exports.writeFile = write_file; + exports.utils = { + cfb_new: cfb_new, + cfb_add: cfb_add, + cfb_del: cfb_del, + cfb_mov: cfb_mov, + cfb_gc: cfb_gc, + ReadShift: ReadShift, + CheckField: CheckField, + prep_blob: prep_blob, + bconcat: bconcat, + use_zlib: use_zlib, + _deflateRaw: _deflate, + _inflateRaw: _inflate, + consts: consts + }; + return exports; +})(); +var _fs; +function set_fs(fs) { _fs = fs; } +/* normalize data for blob ctor */ +function blobify(data) { + if (typeof data === "string") + return s2ab(data); + if (Array.isArray(data)) + return a2u(data); + return data; +} +/* write or download file */ +function write_dl(fname /*:string*/, payload /*:any*/, enc /*:?string*/) { + /*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */ + if (typeof _fs !== 'undefined' && _fs.writeFileSync) + return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload); + if (typeof Deno !== 'undefined') { + /* in this spot, it's safe to assume typed arrays and TextEncoder/TextDecoder exist */ + if (enc && typeof payload == "string") + switch (enc) { + case "utf8": + payload = new TextEncoder(enc).encode(payload); + break; + case "binary": + payload = s2ab(payload); + break; + /* TODO: binary equivalent */ + default: throw new Error("Unsupported encoding " + enc); + } + return Deno.writeFileSync(fname, payload); + } + var data = (enc == "utf8") ? utf8write(payload) : payload; + /*:: declare var IE_SaveFile: any; */ + if (typeof IE_SaveFile !== 'undefined') + return IE_SaveFile(data, fname); + if (typeof Blob !== 'undefined') { + var blob = new Blob([blobify(data)], { type: "application/octet-stream" }); + /*:: declare var navigator: any; */ + if (typeof navigator !== 'undefined' && navigator.msSaveBlob) + return navigator.msSaveBlob(blob, fname); + /*:: declare var saveAs: any; */ + if (typeof saveAs !== 'undefined') + return saveAs(blob, fname); + if (typeof URL !== 'undefined' && typeof document !== 'undefined' && document.createElement && URL.createObjectURL) { + var url = URL.createObjectURL(blob); + /*:: declare var chrome: any; */ + if (typeof chrome === 'object' && typeof (chrome.downloads || {}).download == "function") { + if (URL.revokeObjectURL && typeof setTimeout !== 'undefined') + setTimeout(function () { URL.revokeObjectURL(url); }, 60000); + return chrome.downloads.download({ url: url, filename: fname, saveAs: true }); + } + var a = document.createElement("a"); + if (a.download != null) { + /*:: if(document.body == null) throw new Error("unreachable"); */ + a.download = fname; + a.href = url; + document.body.appendChild(a); + a.click(); + /*:: if(document.body == null) throw new Error("unreachable"); */ document.body.removeChild(a); + if (URL.revokeObjectURL && typeof setTimeout !== 'undefined') + setTimeout(function () { URL.revokeObjectURL(url); }, 60000); + return url; + } + } + else if (typeof URL !== 'undefined' && !URL.createObjectURL && typeof chrome === 'object') { + /* manifest v3 extensions -- no URL.createObjectURL */ + var b64 = "data:application/octet-stream;base64," + Base64_encode_arr(new Uint8Array(blobify(data))); + return chrome.downloads.download({ url: b64, filename: fname, saveAs: true }); + } + } + // $FlowIgnore + if (typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') + try { // extendscript + // $FlowIgnore + var out = File(fname); + out.open("w"); + out.encoding = "binary"; + if (Array.isArray(payload)) + payload = a2s(payload); + out.write(payload); + out.close(); + return payload; + } + catch (e) { + if (!e.message || !e.message.match(/onstruct/)) + throw e; + } + throw new Error("cannot save file " + fname); +} +/* read binary data from file */ +function read_binary(path /*:string*/) { + if (typeof _fs !== 'undefined') + return _fs.readFileSync(path); + if (typeof Deno !== 'undefined') + return Deno.readFileSync(path); + // $FlowIgnore + if (typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') + try { // extendscript + // $FlowIgnore + var infile = File(path); + infile.open("r"); + infile.encoding = "binary"; + var data = infile.read(); + infile.close(); + return data; + } + catch (e) { + if (!e.message || !e.message.match(/onstruct/)) + throw e; + } + throw new Error("Cannot access file " + path); +} +function keys(o /*:any*/) { + var ks = Object.keys(o), o2 = []; + for (var i = 0; i < ks.length; ++i) + if (Object.prototype.hasOwnProperty.call(o, ks[i])) + o2.push(ks[i]); + return o2; +} +function evert_key(obj /*:any*/, key /*:string*/) { + var o = ([] /*:any*/), K = keys(obj); + for (var i = 0; i !== K.length; ++i) + if (o[obj[K[i]][key]] == null) + o[obj[K[i]][key]] = K[i]; + return o; +} +function evert(obj /*:any*/) { + var o = ([] /*:any*/), K = keys(obj); + for (var i = 0; i !== K.length; ++i) + o[obj[K[i]]] = K[i]; + return o; +} +function evert_num(obj /*:any*/) { + var o = ([] /*:any*/), K = keys(obj); + for (var i = 0; i !== K.length; ++i) + o[obj[K[i]]] = parseInt(K[i], 10); + return o; +} +function evert_arr(obj /*:any*/) { + var o /*:EvertArrType*/ = ([] /*:any*/), K = keys(obj); + for (var i = 0; i !== K.length; ++i) { + if (o[obj[K[i]]] == null) + o[obj[K[i]]] = []; + o[obj[K[i]]].push(K[i]); + } + return o; +} +var dnthresh = /*#__PURE__*/ Date.UTC(1899, 11, 30, 0, 0, 0); // -2209161600000 +var dnthresh1 = /*#__PURE__*/ Date.UTC(1899, 11, 31, 0, 0, 0); // -2209075200000 +var dnthresh2 = /*#__PURE__*/ Date.UTC(1904, 0, 1, 0, 0, 0); // -2209075200000 +function datenum(v /*:Date*/, date1904 /*:?boolean*/) { + var epoch = /*#__PURE__*/ v.getTime(); + var res = (epoch - dnthresh) / (24 * 60 * 60 * 1000); + if (date1904) { + res -= 1462; + return res < -1402 ? res - 1 : res; + } + return res < 60 ? res - 1 : res; +} +function numdate(v /*:number*/) { + if (v >= 60 && v < 61) + return v; + var out = new Date(); + out.setTime((v > 60 ? v : (v + 1)) * 24 * 60 * 60 * 1000 + dnthresh); + return out; +} +/* ISO 8601 Duration */ +function parse_isodur(s) { + var sec = 0, mt = 0, time = false; + var m = s.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/); + if (!m) + throw new Error("|" + s + "| is not an ISO8601 Duration"); + for (var i = 1; i != m.length; ++i) { + if (!m[i]) + continue; + mt = 1; + if (i > 3) + time = true; + switch (m[i].slice(m[i].length - 1)) { + case 'Y': + throw new Error("Unsupported ISO Duration Field: " + m[i].slice(m[i].length - 1)); + case 'D': mt *= 24; + /* falls through */ + case 'H': mt *= 60; + /* falls through */ + case 'M': + if (!time) + throw new Error("Unsupported ISO Duration Field: M"); + else + mt *= 60; + /* falls through */ + case 'S': break; + } + sec += mt * parseInt(m[i], 10); + } + return sec; +} +/* Blame https://bugs.chromium.org/p/v8/issues/detail?id=7863 for the regexide */ +var pdre1 = /^(\d+):(\d+)(:\d+)?(\.\d+)?$/; // HH:MM[:SS[.UUU]] +var pdre2 = /^(\d+)-(\d+)-(\d+)$/; // YYYY-mm-dd +var pdre3 = /^(\d+)-(\d+)-(\d+)[T ](\d+):(\d+)(:\d+)?(\.\d+)?$/; // YYYY-mm-dd(T or space)HH:MM[:SS[.UUU]], sans "Z" +/* parses a date string as a UTC date */ +function parseDate(str /*:string*/, date1904 /*:boolean*/) { + if (str instanceof Date) + return str; + var m = str.match(pdre1); + if (m) + return new Date((date1904 ? dnthresh2 : dnthresh1) + ((parseInt(m[1], 10) * 60 + parseInt(m[2], 10)) * 60 + (m[3] ? parseInt(m[3].slice(1), 10) : 0)) * 1000 + (m[4] ? parseInt((m[4] + "000").slice(1, 4), 10) : 0)); + m = str.match(pdre2); + if (m) + return new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], 0, 0, 0, 0)); + /* TODO: 1900-02-29T00:00:00.000 should return a flag to treat as a date code (affects xlml) */ + m = str.match(pdre3); + if (m) + return new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], ((m[6] && parseInt(m[6].slice(1), 10)) || 0), ((m[7] && parseInt(m[7].slice(1), 10)) || 0))); + var d = new Date(str); + return d; +} +function cc2str(arr /*:Array*/, debomit) { + if (has_buf && Buffer.isBuffer(arr)) { + if (debomit && buf_utf16le) { + // TODO: temporary patch + if (arr[0] == 0xFF && arr[1] == 0xFE) + return utf8write(arr.slice(2).toString("utf16le")); + if (arr[1] == 0xFE && arr[2] == 0xFF) + return utf8write(utf16beread(arr.slice(2).toString("binary"))); + } + return arr.toString("binary"); + } + if (typeof TextDecoder !== "undefined") + try { + if (debomit) { + if (arr[0] == 0xFF && arr[1] == 0xFE) + return utf8write(new TextDecoder("utf-16le").decode(arr.slice(2))); + if (arr[0] == 0xFE && arr[1] == 0xFF) + return utf8write(new TextDecoder("utf-16be").decode(arr.slice(2))); + } + var rev = { + "\u20ac": "\x80", "\u201a": "\x82", "\u0192": "\x83", "\u201e": "\x84", + "\u2026": "\x85", "\u2020": "\x86", "\u2021": "\x87", "\u02c6": "\x88", + "\u2030": "\x89", "\u0160": "\x8a", "\u2039": "\x8b", "\u0152": "\x8c", + "\u017d": "\x8e", "\u2018": "\x91", "\u2019": "\x92", "\u201c": "\x93", + "\u201d": "\x94", "\u2022": "\x95", "\u2013": "\x96", "\u2014": "\x97", + "\u02dc": "\x98", "\u2122": "\x99", "\u0161": "\x9a", "\u203a": "\x9b", + "\u0153": "\x9c", "\u017e": "\x9e", "\u0178": "\x9f" + }; + if (Array.isArray(arr)) + arr = new Uint8Array(arr); + return new TextDecoder("latin1").decode(arr).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g, function (c) { return rev[c] || c; }); + } + catch (e) { } + var o = [], i = 0; + // this cascade is for the browsers and runtimes of antiquity (and for modern runtimes that lack TextEncoder) + try { + for (i = 0; i < arr.length - 65536; i += 65536) + o.push(String.fromCharCode.apply(0, arr.slice(i, i + 65536))); + o.push(String.fromCharCode.apply(0, arr.slice(i))); + } + catch (e) { + try { + for (; i < arr.length - 16384; i += 16384) + o.push(String.fromCharCode.apply(0, arr.slice(i, i + 16384))); + o.push(String.fromCharCode.apply(0, arr.slice(i))); + } + catch (e) { + for (; i != arr.length; ++i) + o.push(String.fromCharCode(arr[i])); + } + } + return o.join(""); +} +function dup(o /*:any*/) { + if (typeof JSON != 'undefined' && !Array.isArray(o)) + return JSON.parse(JSON.stringify(o)); + if (typeof o != 'object' || o == null) + return o; + if (o instanceof Date) + return new Date(o.getTime()); + var out = {}; + for (var k in o) + if (Object.prototype.hasOwnProperty.call(o, k)) + out[k] = dup(o[k]); + return out; +} +function fill(c /*:string*/, l /*:number*/) { var o = ""; while (o.length < l) + o += c; return o; } +/* TODO: stress test */ +function fuzzynum(s /*:string*/) { + var v /*:number*/ = Number(s); + if (!isNaN(v)) + return isFinite(v) ? v : NaN; + if (!/\d/.test(s)) + return v; + var wt = 1; + var ss = s.replace(/([\d]),([\d])/g, "$1$2").replace(/[$]/g, "").replace(/[%]/g, function () { wt *= 100; return ""; }); + if (!isNaN(v = Number(ss))) + return v / wt; + ss = ss.replace(/[(](.*)[)]/, function ($$, $1) { wt = -wt; return $1; }); + if (!isNaN(v = Number(ss))) + return v / wt; + return v; +} +/* NOTE: Chrome rejects bare times like 1:23 PM */ +var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))\s+([ap])m?$/; +var FDRE2 = /^([01]?\d|2[0-3])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))$/; +var FDISO = /^(\d+)-(\d+)-(\d+)[T ](\d+):(\d+)(:\d+)(\.\d+)?[Z]?$/; // YYYY-mm-dd(T or space)HH:MM:SS[.UUU][Z] +/* TODO: 1904 adjustment */ +var utc_append_works = new Date("6/9/69 00:00 UTC").valueOf() == -17798400000; +function fuzzytime1(M) { + if (!M[2]) + return new Date(Date.UTC(1899, 11, 31, (+M[1] % 12) + (M[7] == "p" ? 12 : 0), 0, 0, 0)); + if (M[3]) { + if (M[4]) + return new Date(Date.UTC(1899, 11, 31, (+M[1] % 12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3]) * 1000)); + else + return new Date(Date.UTC(1899, 11, 31, (M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3]) * 1000)); + } + else if (M[5]) + return new Date(Date.UTC(1899, 11, 31, (+M[1] % 12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0)); + else + return new Date(Date.UTC(1899, 11, 31, (+M[1] % 12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0)); +} +function fuzzytime2(M) { + if (!M[2]) + return new Date(Date.UTC(1899, 11, 31, +M[1], 0, 0, 0)); + if (M[3]) { + if (M[4]) + return new Date(Date.UTC(1899, 11, 31, +M[1], +M[2], +M[4], parseFloat(M[3]) * 1000)); + else + return new Date(Date.UTC(1899, 11, 31, 0, +M[1], +M[2], parseFloat(M[3]) * 1000)); + } + else if (M[5]) + return new Date(Date.UTC(1899, 11, 31, +M[1], +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0)); + else + return new Date(Date.UTC(1899, 11, 31, +M[1], +M[2], 0, 0)); +} +var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; +function fuzzydate(s /*:string*/) { + // See issue 2863 -- this is technically not supported in Excel but is otherwise useful + if (FDISO.test(s)) + return s.indexOf("Z") == -1 ? local_to_utc(new Date(s)) : new Date(s); + var lower = s.toLowerCase(); + var lnos = lower.replace(/\s+/g, " ").trim(); + var M = lnos.match(FDRE1); + if (M) + return fuzzytime1(M); + M = lnos.match(FDRE2); + if (M) + return fuzzytime2(M); + M = lnos.match(pdre3); + if (M) + return new Date(Date.UTC(+M[1], +M[2] - 1, +M[3], +M[4], +M[5], ((M[6] && parseInt(M[6].slice(1), 10)) || 0), ((M[7] && parseInt(M[7].slice(1), 10)) || 0))); + var o = new Date(utc_append_works && s.indexOf("UTC") == -1 ? s + " UTC" : s), n = new Date(NaN); + var y = o.getYear(), m = o.getMonth(), d = o.getDate(); + if (isNaN(d)) + return n; + if (lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) { + lower = lower.replace(/[^a-z]/g, "").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/, ""); + if (lower.length > 3 && lower_months.indexOf(lower) == -1) + return n; + } + else if (lower.replace(/[ap]m?/, "").match(/[a-z]/)) + return n; + if (y < 0 || y > 8099 || s.match(/[^-0-9:,\/\\\ ]/)) + return n; + return o; +} +var split_regex = /*#__PURE__*/ (function () { + var safe_split_regex = "abacaba".split(/(:?b)/i).length == 5; + return function split_regex(str /*:string*/, re, def /*:string*/) { + if (safe_split_regex || typeof re == "string") + return str.split(re); + var p = str.split(re), o = [p[0]]; + for (var i = 1; i < p.length; ++i) { + o.push(def); + o.push(p[i]); + } + return o; + }; +})(); +function utc_to_local(utc) { + return new Date(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate(), utc.getUTCHours(), utc.getUTCMinutes(), utc.getUTCSeconds(), utc.getUTCMilliseconds()); +} +function local_to_utc(local) { + return new Date(Date.UTC(local.getFullYear(), local.getMonth(), local.getDate(), local.getHours(), local.getMinutes(), local.getSeconds(), local.getMilliseconds())); +} +function getdatastr(data) { + if (!data) + return null; + if (data.content && data.type) + return cc2str(data.content, true); + if (data.data) + return debom(data.data); + if (data.asNodeBuffer && has_buf) + return debom(data.asNodeBuffer().toString('binary')); + if (data.asBinary) + return debom(data.asBinary()); + if (data._data && data._data.getContent) + return debom(cc2str(Array.prototype.slice.call(data._data.getContent(), 0))); + return null; +} +function getdatabin(data) { + if (!data) + return null; + if (data.data) + return char_codes(data.data); + if (data.asNodeBuffer && has_buf) + return data.asNodeBuffer(); + if (data._data && data._data.getContent) { + var o = data._data.getContent(); + if (typeof o == "string") + return char_codes(o); + return Array.prototype.slice.call(o); + } + if (data.content && data.type) + return data.content; + return null; +} +function getdata(data) { return (data && data.name.slice(-4) === ".bin") ? getdatabin(data) : getdatastr(data); } +/* Part 2 Section 10.1.2 "Mapping Content Types" Names are case-insensitive */ +/* OASIS does not comment on filename case sensitivity */ +function safegetzipfile(zip, file /*:string*/) { + var k = zip.FullPaths || keys(zip.files); + var f = file.toLowerCase().replace(/[\/]/g, '\\'), g = f.replace(/\\/g, '\/'); + for (var i = 0; i < k.length; ++i) { + var n = k[i].replace(/^Root Entry[\/]/, "").toLowerCase(); + if (f == n || g == n) + return zip.files ? zip.files[k[i]] : zip.FileIndex[i]; + } + return null; +} +function getzipfile(zip, file /*:string*/) { + var o = safegetzipfile(zip, file); + if (o == null) + throw new Error("Cannot find file " + file + " in zip"); + return o; +} +function getzipdata(zip, file /*:string*/, safe /*:?boolean*/) { + if (!safe) + return getdata(getzipfile(zip, file)); + if (!file) + return null; + try { + return getzipdata(zip, file); + } + catch (e) { + return null; + } +} +function getzipstr(zip, file /*:string*/, safe /*:?boolean*/) { + if (!safe) + return getdatastr(getzipfile(zip, file)); + if (!file) + return null; + try { + return getzipstr(zip, file); + } + catch (e) { + return null; + } +} +function getzipbin(zip, file /*:string*/, safe /*:?boolean*/) { + if (!safe) + return getdatabin(getzipfile(zip, file)); + if (!file) + return null; + try { + return getzipbin(zip, file); + } + catch (e) { + return null; + } +} +function zipentries(zip) { + var k = zip.FullPaths || keys(zip.files), o = []; + for (var i = 0; i < k.length; ++i) + if (k[i].slice(-1) != '/') + o.push(k[i].replace(/^Root Entry[\/]/, "")); + return o.sort(); +} +function zip_add_file(zip, path, content) { + if (zip.FullPaths) { + if (typeof content == "string") { + var res; + if (has_buf) + res = Buffer_from(content); + /* TODO: investigate performance in Edge 13 */ + //else if(typeof TextEncoder !== "undefined") res = new TextEncoder().encode(content); + else + res = utf8decode(content); + return CFB.utils.cfb_add(zip, path, res); + } + CFB.utils.cfb_add(zip, path, content); + } + else + zip.file(path, content); +} +function zip_new() { return CFB.utils.cfb_new(); } +function zip_read(d, o) { + switch (o.type) { + case "base64": return CFB.read(d, { type: "base64" }); + case "binary": return CFB.read(d, { type: "binary" }); + case "buffer": + case "array": return CFB.read(d, { type: "buffer" }); + } + throw new Error("Unrecognized type " + o.type); +} +function resolve_path(path /*:string*/, base /*:string*/) { + if (path.charAt(0) == "/") + return path.slice(1); + var result = base.split('/'); + if (base.slice(-1) != "/") + result.pop(); // folder path + var target = path.split('/'); + while (target.length !== 0) { + var step = target.shift(); + if (step === '..') + result.pop(); + else if (step !== '.') + result.push(step); + } + return result.join('/'); +} +var XML_HEADER = '\r\n'; +var attregexg = /([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g; +var tagregex1 = /<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg, tagregex2 = /<[^>]*>/g; +var tagregex = /*#__PURE__*/ XML_HEADER.match(tagregex1) ? tagregex1 : tagregex2; +var nsregex = /<\w*:/, nsregex2 = /<(\/?)\w+:/; +function parsexmltag(tag /*:string*/, skip_root /*:?boolean*/, skip_LC /*:?boolean*/) { + var z = ({} /*:any*/); + var eq = 0, c = 0; + for (; eq !== tag.length; ++eq) + if ((c = tag.charCodeAt(eq)) === 32 || c === 10 || c === 13) + break; + if (!skip_root) + z[0] = tag.slice(0, eq); + if (eq === tag.length) + return z; + var m = tag.match(attregexg), j = 0, v = "", i = 0, q = "", cc = "", quot = 1; + if (m) + for (i = 0; i != m.length; ++i) { + cc = m[i]; + for (c = 0; c != cc.length; ++c) + if (cc.charCodeAt(c) === 61) + break; + q = cc.slice(0, c).trim(); + while (cc.charCodeAt(c + 1) == 32) + ++c; + quot = ((eq = cc.charCodeAt(c + 1)) == 34 || eq == 39) ? 1 : 0; + v = cc.slice(c + 1 + quot, cc.length - quot); + for (j = 0; j != q.length; ++j) + if (q.charCodeAt(j) === 58) + break; + if (j === q.length) { + if (q.indexOf("_") > 0) + q = q.slice(0, q.indexOf("_")); // from ods + z[q] = v; + if (!skip_LC) + z[q.toLowerCase()] = v; + } + else { + var k = (j === 5 && q.slice(0, 5) === "xmlns" ? "xmlns" : "") + q.slice(j + 1); + if (z[k] && q.slice(j - 3, j) == "ext") + continue; // from ods + z[k] = v; + if (!skip_LC) + z[k.toLowerCase()] = v; + } + } + return z; +} +function strip_ns(x /*:string*/) { return x.replace(nsregex2, "<$1"); } +var encodings = { + '"': '"', + ''': "'", + '>': '>', + '<': '<', + '&': '&' +}; +var rencoding = /*#__PURE__*/ evert(encodings); +//var rencstr = "&<>'\"".split(""); +// TODO: CP remap (need to read file version to determine OS) +var unescapexml /*:StringConv*/ = /*#__PURE__*/ (function () { + /* 22.4.2.4 bstr (Basic String) */ + var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig; + function raw_unescapexml(text /*:string*/) { + var s = text + '', i = s.indexOf(" -1 ? 16 : 10)) || $$; }).replace(coderegex, function (m, c) { return String.fromCharCode(parseInt(c, 16)); }); + var j = s.indexOf("]]>"); + return raw_unescapexml(s.slice(0, i)) + s.slice(i + 9, j) + raw_unescapexml(s.slice(j + 3)); + } + return function unescapexml(text /*:string*/, xlsx /*:boolean*/) { + var out = raw_unescapexml(text); + return xlsx ? out.replace(/\r\n/g, "\n") : out; + }; +})(); +var decregex = /[&<>'"]/g, charegex = /[\u0000-\u0008\u000b-\u001f\uFFFE-\uFFFF]/g; +function escapexml(text /*:string*/) { + var s = text + ''; + return s.replace(decregex, function (y) { return rencoding[y]; }).replace(charegex, function (s) { return "_x" + ("000" + s.charCodeAt(0).toString(16)).slice(-4) + "_"; }); +} +function escapexmltag(text /*:string*/) { return escapexml(text).replace(/ /g, "_x0020_"); } +var htmlcharegex = /[\u0000-\u001f]/g; +function escapehtml(text /*:string*/) { + var s = text + ''; + return s.replace(decregex, function (y) { return rencoding[y]; }).replace(/\n/g, "
").replace(htmlcharegex, function (s) { return "&#x" + ("000" + s.charCodeAt(0).toString(16)).slice(-4) + ";"; }); +} +function escapexlml(text /*:string*/) { + var s = text + ''; + return s.replace(decregex, function (y) { return rencoding[y]; }).replace(htmlcharegex, function (s) { return "&#x" + (s.charCodeAt(0).toString(16)).toUpperCase() + ";"; }); +} +/* TODO: handle codepages */ +var xlml_fixstr /*:StringConv*/ = /*#__PURE__*/ (function () { + var entregex = /&#(\d+);/g; + function entrepl($$ /*:string*/, $1 /*:string*/) { return String.fromCharCode(parseInt($1, 10)); } + return function xlml_fixstr(str /*:string*/) { return str.replace(entregex, entrepl); }; +})(); +function xlml_unfixstr(str /*:string*/) { return str.replace(/(\r\n|[\r\n])/g, "\ "); } +/* note: xsd:boolean valid values: true / 1 / false / 0 */ +function parsexmlbool(value /*:any*/) { + switch (value) { + case 1: + case true: + case '1': + case 'true': return true; + case 0: + case false: + case '0': + case 'false': return false; + //default: throw new Error("Invalid xsd:boolean " + value); + } + return false; +} +function utf8reada(orig /*:string*/) { + var out = "", i = 0, c = 0, d = 0, e = 0, f = 0, w = 0; + while (i < orig.length) { + c = orig.charCodeAt(i++); + if (c < 128) { + out += String.fromCharCode(c); + continue; + } + d = orig.charCodeAt(i++); + if (c > 191 && c < 224) { + f = ((c & 31) << 6); + f |= (d & 63); + out += String.fromCharCode(f); + continue; + } + e = orig.charCodeAt(i++); + if (c < 240) { + out += String.fromCharCode(((c & 15) << 12) | ((d & 63) << 6) | (e & 63)); + continue; + } + f = orig.charCodeAt(i++); + w = (((c & 7) << 18) | ((d & 63) << 12) | ((e & 63) << 6) | (f & 63)) - 65536; + out += String.fromCharCode(0xD800 + ((w >>> 10) & 1023)); + out += String.fromCharCode(0xDC00 + (w & 1023)); + } + return out; +} +function utf8readb(data) { + var out = new_raw_buf(2 * data.length), w, i, j = 1, k = 0, ww = 0, c; + for (i = 0; i < data.length; i += j) { + j = 1; + if ((c = data.charCodeAt(i)) < 128) + w = c; + else if (c < 224) { + w = (c & 31) * 64 + (data.charCodeAt(i + 1) & 63); + j = 2; + } + else if (c < 240) { + w = (c & 15) * 4096 + (data.charCodeAt(i + 1) & 63) * 64 + (data.charCodeAt(i + 2) & 63); + j = 3; + } + else { + j = 4; + w = (c & 7) * 262144 + (data.charCodeAt(i + 1) & 63) * 4096 + (data.charCodeAt(i + 2) & 63) * 64 + (data.charCodeAt(i + 3) & 63); + w -= 65536; + ww = 0xD800 + ((w >>> 10) & 1023); + w = 0xDC00 + (w & 1023); + } + if (ww !== 0) { + out[k++] = ww & 255; + out[k++] = ww >>> 8; + ww = 0; + } + out[k++] = w % 256; + out[k++] = w >>> 8; + } + return out.slice(0, k).toString('ucs2'); +} +function utf8readc(data) { return Buffer_from(data, 'binary').toString('utf8'); } +var utf8corpus = "foo bar baz\u00e2\u0098\u0083\u00f0\u009f\u008d\u00a3"; +var utf8read = has_buf && ( /*#__PURE__*/utf8readc(utf8corpus) == /*#__PURE__*/ utf8reada(utf8corpus) && utf8readc || /*#__PURE__*/ utf8readb(utf8corpus) == /*#__PURE__*/ utf8reada(utf8corpus) && utf8readb) || utf8reada; +var utf8write /*:StringConv*/ = has_buf ? function (data) { return Buffer_from(data, 'utf8').toString("binary"); } : function (orig /*:string*/) { + var out /*:Array*/ = [], i = 0, c = 0, d = 0; + while (i < orig.length) { + c = orig.charCodeAt(i++); + switch (true) { + case c < 128: + out.push(String.fromCharCode(c)); + break; + case c < 2048: + out.push(String.fromCharCode(192 + (c >> 6))); + out.push(String.fromCharCode(128 + (c & 63))); + break; + case c >= 55296 && c < 57344: + c -= 55296; + d = orig.charCodeAt(i++) - 56320 + (c << 10); + out.push(String.fromCharCode(240 + ((d >> 18) & 7))); + out.push(String.fromCharCode(144 + ((d >> 12) & 63))); + out.push(String.fromCharCode(128 + ((d >> 6) & 63))); + out.push(String.fromCharCode(128 + (d & 63))); + break; + default: + out.push(String.fromCharCode(224 + (c >> 12))); + out.push(String.fromCharCode(128 + ((c >> 6) & 63))); + out.push(String.fromCharCode(128 + (c & 63))); + } + } + return out.join(""); +}; +// matches ... extracts content +var matchtag = /*#__PURE__*/ (function () { + var mtcache /*:{[k:string]:RegExp}*/ = ({} /*:any*/); + return function matchtag(f /*:string*/, g /*:?string*/) { + var t = f + "|" + (g || ""); + if (mtcache[t]) + return mtcache[t]; + return (mtcache[t] = new RegExp('<(?:\\w+:)?' + f + '(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)', ((g || "") /*:any*/))); + }; +})(); +var htmldecode /*:{(s:string):string}*/ = /*#__PURE__*/ (function () { + var entities /*:Array<[RegExp, string]>*/ = [ + ['nbsp', ' '], ['middot', '·'], + ['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&'] + ].map(function (x /*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; }); + return function htmldecode(str /*:string*/) { + var o = str + // Remove new lines and spaces from start of content + .replace(/^[\t\n\r ]+/, "") + // Remove new lines and spaces from end of content + .replace(/[\t\n\r ]+$/, "") + // Added line which removes any white space characters after and before html tags + .replace(/>\s+/g, ">").replace(/\s+ tags with new lines + .replace(/<\s*[bB][rR]\s*\/?>/g, "\n") + // Strip HTML elements + .replace(/<[^>]*>/g, ""); + for (var i = 0; i < entities.length; ++i) + o = o.replace(entities[i][0], entities[i][1]); + return o; + }; +})(); +var vtregex = /*#__PURE__*/ (function () { + var vt_cache = {}; + return function vt_regex(bt) { + if (vt_cache[bt] !== undefined) + return vt_cache[bt]; + return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)", 'g')); + }; +})(); +var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*)*/ = data.match(vtregex(h.baseType)) || []; + var res /*:Array*/ = []; + if (matches.length != h.size) { + if (opts.WTF) + throw new Error("unexpected vector length " + matches.length + " != " + h.size); + return res; + } + matches.forEach(function (x /*:string*/) { + var v = x.replace(vtvregex, "").match(vtmregex); + if (v) + res.push({ v: utf8read(v[2]), t: v[1] }); + }); + return res; +} +var wtregex = /(^\s|\s$|\n)/; +function writetag(f /*:string*/, g /*:string*/) { return '<' + f + (g.match(wtregex) ? ' xml:space="preserve"' : "") + '>' + g + ''; } +function wxt_helper(h) { return keys(h).map(function (k) { return " " + k + '="' + h[k] + '"'; }).join(""); } +function writextag(f /*:string*/, g /*:?string*/, h) { return '<' + f + ((h != null) ? wxt_helper(h) : "") + ((g != null) ? (g.match(wtregex) ? ' xml:space="preserve"' : "") + '>' + g + ''; } +function write_w3cdtf(d /*:Date*/, t /*:?boolean*/) { try { + return d.toISOString().replace(/\.\d*/, ""); +} +catch (e) { + if (t) + throw e; +} return ""; } +function write_vt(s, xlsx /*:?boolean*/) { + switch (typeof s) { + case 'string': + var o = writextag('vt:lpwstr', escapexml(s)); + if (xlsx) + o = o.replace(/"/g, "_x0022_"); + return o; + case 'number': return writextag((s | 0) == s ? 'vt:i4' : 'vt:r8', escapexml(String(s))); + case 'boolean': return writextag('vt:bool', s ? 'true' : 'false'); + } + if (s instanceof Date) + return writextag('vt:filetime', write_w3cdtf(s)); + throw new Error("Unable to serialize " + s); +} +function xlml_normalize(d) { + if (has_buf && /*::typeof Buffer !== "undefined" && d != null && d instanceof Buffer &&*/ Buffer.isBuffer(d)) + return d.toString('utf8'); + if (typeof d === 'string') + return d; + /* duktape */ + if (typeof Uint8Array !== 'undefined' && d instanceof Uint8Array) + return utf8read(a2s(ab2a(d))); + throw new Error("Bad input format: expected Buffer or string"); +} +/* UOS uses CJK in tags */ +var xlmlregex = /<(\/?)([^\s?>:\/]+)(?:[\s?:\/](?:[^>=]|="[^"]*?")*)?>/mg; +//var xlmlregex = /<(\/?)([a-z0-9]*:|)(\w+)[^>]*>/mg; +var XMLNS = ({ + CORE_PROPS: 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties', + CUST_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", + EXT_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", + CT: 'http://schemas.openxmlformats.org/package/2006/content-types', + RELS: 'http://schemas.openxmlformats.org/package/2006/relationships', + TCMNT: 'http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments', + 'dc': 'http://purl.org/dc/elements/1.1/', + 'dcterms': 'http://purl.org/dc/terms/', + 'dcmitype': 'http://purl.org/dc/dcmitype/', + 'mx': 'http://schemas.microsoft.com/office/mac/excel/2008/main', + 'r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', + 'sjs': 'http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties', + 'vt': 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes', + 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', + 'xsd': 'http://www.w3.org/2001/XMLSchema' +} /*:any*/); +var XMLNS_main = [ + 'http://schemas.openxmlformats.org/spreadsheetml/2006/main', + 'http://purl.oclc.org/ooxml/spreadsheetml/main', + 'http://schemas.microsoft.com/office/excel/2006/main', + 'http://schemas.microsoft.com/office/excel/2006/2' +]; +var XLMLNS = ({ + 'o': 'urn:schemas-microsoft-com:office:office', + 'x': 'urn:schemas-microsoft-com:office:excel', + 'ss': 'urn:schemas-microsoft-com:office:spreadsheet', + 'dt': 'uuid:C2F41010-65B3-11d1-A29F-00AA00C14882', + 'mv': 'http://macVmlSchemaUri', + 'v': 'urn:schemas-microsoft-com:vml', + 'html': 'http://www.w3.org/TR/REC-html40' +} /*:any*/); +function read_double_le(b /*:RawBytes|CFBlob*/, idx /*:number*/) { + var s = 1 - 2 * (b[idx + 7] >>> 7); + var e = ((b[idx + 7] & 0x7f) << 4) + ((b[idx + 6] >>> 4) & 0x0f); + var m = (b[idx + 6] & 0x0f); + for (var i = 5; i >= 0; --i) + m = m * 256 + b[idx + i]; + if (e == 0x7ff) + return m == 0 ? (s * Infinity) : NaN; + if (e == 0) + e = -1022; + else { + e -= 1023; + m += Math.pow(2, 52); + } + return s * Math.pow(2, e - 52) * m; +} +function write_double_le(b /*:RawBytes|CFBlob*/, v /*:number*/, idx /*:number*/) { + var bs = ((((v < 0) || (1 / v == -Infinity)) ? 1 : 0) << 7), e = 0, m = 0; + var av = bs ? (-v) : v; + if (!isFinite(av)) { + e = 0x7ff; + m = isNaN(v) ? 0x6969 : 0; + } + else if (av == 0) + e = m = 0; + else { + e = Math.floor(Math.log(av) / Math.LN2); + m = av * Math.pow(2, 52 - e); + if ((e <= -1023) && (!isFinite(m) || (m < Math.pow(2, 52)))) { + e = -1022; + } + else { + m -= Math.pow(2, 52); + e += 1023; + } + } + for (var i = 0; i <= 5; ++i, m /= 256) + b[idx + i] = m & 0xff; + b[idx + 6] = ((e & 0x0f) << 4) | (m & 0xf); + b[idx + 7] = (e >> 4) | bs; +} +var ___toBuffer = function (bufs /*:Array >*/) { var x = [], w = 10240; for (var i = 0; i < bufs[0].length; ++i) + if (bufs[0][i]) + for (var j = 0, L = bufs[0][i].length; j < L; j += w) + x.push.apply(x, bufs[0][i].slice(j, j + w)); return x; }; +var __toBuffer = has_buf ? function (bufs) { return (bufs[0].length > 0 && Buffer.isBuffer(bufs[0][0])) ? Buffer.concat(bufs[0].map(function (x) { return Buffer.isBuffer(x) ? x : Buffer_from(x); })) : ___toBuffer(bufs); } : ___toBuffer; +var ___utf16le = function (b /*:RawBytes|CFBlob*/, s /*:number*/, e /*:number*/) { var ss /*:Array*/ = []; for (var i = s; i < e; i += 2) + ss.push(String.fromCharCode(__readUInt16LE(b, i))); return ss.join("").replace(chr0, ''); }; +var __utf16le = has_buf ? function (b /*:RawBytes|CFBlob*/, s /*:number*/, e /*:number*/) { if (!Buffer.isBuffer(b) /*:: || !(b instanceof Buffer)*/ || !buf_utf16le) + return ___utf16le(b, s, e); return b.toString('utf16le', s, e).replace(chr0, '') /*.replace(chr1,'!')*/; } : ___utf16le; +var ___hexlify = function (b /*:RawBytes|CFBlob*/, s /*:number*/, l /*:number*/) { var ss /*:Array*/ = []; for (var i = s; i < s + l; ++i) + ss.push(("0" + b[i].toString(16)).slice(-2)); return ss.join(""); }; +var __hexlify = has_buf ? function (b /*:RawBytes|CFBlob*/, s /*:number*/, l /*:number*/) { return Buffer.isBuffer(b) /*:: && b instanceof Buffer*/ ? b.toString('hex', s, s + l) : ___hexlify(b, s, l); } : ___hexlify; +var ___utf8 = function (b /*:RawBytes|CFBlob*/, s /*:number*/, e /*:number*/) { var ss = []; for (var i = s; i < e; i++) + ss.push(String.fromCharCode(__readUInt8(b, i))); return ss.join(""); }; +var __utf8 = has_buf ? function utf8_b(b /*:RawBytes|CFBlob*/, s /*:number*/, e /*:number*/) { return (Buffer.isBuffer(b) /*:: && (b instanceof Buffer)*/) ? b.toString('utf8', s, e) : ___utf8(b, s, e); } : ___utf8; +var ___lpstr = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = __readUInt32LE(b, i); return len > 0 ? __utf8(b, i + 4, i + 4 + len - 1) : ""; }; +var __lpstr = ___lpstr; +var ___cpstr = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = __readUInt32LE(b, i); return len > 0 ? __utf8(b, i + 4, i + 4 + len - 1) : ""; }; +var __cpstr = ___cpstr; +var ___lpwstr = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = 2 * __readUInt32LE(b, i); return len > 0 ? __utf8(b, i + 4, i + 4 + len - 1) : ""; }; +var __lpwstr = ___lpwstr; +var ___lpp4 = function lpp4_(b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = __readUInt32LE(b, i); return len > 0 ? __utf16le(b, i + 4, i + 4 + len) : ""; }; +var __lpp4 = ___lpp4; +var ___8lpp4 = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = __readUInt32LE(b, i); return len > 0 ? __utf8(b, i + 4, i + 4 + len) : ""; }; +var __8lpp4 = ___8lpp4; +var ___double = function (b /*:RawBytes|CFBlob*/, idx /*:number*/) { return read_double_le(b, idx); }; +var __double = ___double; +var is_buf = function is_buf_a(a) { return Array.isArray(a) || (typeof Uint8Array !== "undefined" && a instanceof Uint8Array); }; +if (has_buf /*:: && typeof Buffer !== 'undefined'*/) { + __lpstr = function lpstr_b(b /*:RawBytes|CFBlob*/, i /*:number*/) { if (!Buffer.isBuffer(b) /*:: || !(b instanceof Buffer)*/) + return ___lpstr(b, i); var len = b.readUInt32LE(i); return len > 0 ? b.toString('utf8', i + 4, i + 4 + len - 1) : ""; }; + __cpstr = function cpstr_b(b /*:RawBytes|CFBlob*/, i /*:number*/) { if (!Buffer.isBuffer(b) /*:: || !(b instanceof Buffer)*/) + return ___cpstr(b, i); var len = b.readUInt32LE(i); return len > 0 ? b.toString('utf8', i + 4, i + 4 + len - 1) : ""; }; + __lpwstr = function lpwstr_b(b /*:RawBytes|CFBlob*/, i /*:number*/) { if (!Buffer.isBuffer(b) /*:: || !(b instanceof Buffer)*/ || !buf_utf16le) + return ___lpwstr(b, i); var len = 2 * b.readUInt32LE(i); return b.toString('utf16le', i + 4, i + 4 + len - 1); }; + __lpp4 = function lpp4_b(b /*:RawBytes|CFBlob*/, i /*:number*/) { if (!Buffer.isBuffer(b) /*:: || !(b instanceof Buffer)*/ || !buf_utf16le) + return ___lpp4(b, i); var len = b.readUInt32LE(i); return b.toString('utf16le', i + 4, i + 4 + len); }; + __8lpp4 = function lpp4_8b(b /*:RawBytes|CFBlob*/, i /*:number*/) { if (!Buffer.isBuffer(b) /*:: || !(b instanceof Buffer)*/) + return ___8lpp4(b, i); var len = b.readUInt32LE(i); return b.toString('utf8', i + 4, i + 4 + len); }; + __double = function double_(b /*:RawBytes|CFBlob*/, i /*:number*/) { if (Buffer.isBuffer(b) /*::&& b instanceof Buffer*/) + return b.readDoubleLE(i); return ___double(b, i); }; + is_buf = function is_buf_b(a) { return Buffer.isBuffer(a) || Array.isArray(a) || (typeof Uint8Array !== "undefined" && a instanceof Uint8Array); }; +} +/* from js-xls */ +function cpdoit() { + __utf16le = function (b /*:RawBytes|CFBlob*/, s /*:number*/, e /*:number*/) { return $cptable.utils.decode(1200, b.slice(s, e)).replace(chr0, ''); }; + __utf8 = function (b /*:RawBytes|CFBlob*/, s /*:number*/, e /*:number*/) { return $cptable.utils.decode(65001, b.slice(s, e)); }; + __lpstr = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = __readUInt32LE(b, i); return len > 0 ? $cptable.utils.decode(current_ansi, b.slice(i + 4, i + 4 + len - 1)) : ""; }; + __cpstr = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = __readUInt32LE(b, i); return len > 0 ? $cptable.utils.decode(current_codepage, b.slice(i + 4, i + 4 + len - 1)) : ""; }; + __lpwstr = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = 2 * __readUInt32LE(b, i); return len > 0 ? $cptable.utils.decode(1200, b.slice(i + 4, i + 4 + len - 1)) : ""; }; + __lpp4 = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = __readUInt32LE(b, i); return len > 0 ? $cptable.utils.decode(1200, b.slice(i + 4, i + 4 + len)) : ""; }; + __8lpp4 = function (b /*:RawBytes|CFBlob*/, i /*:number*/) { var len = __readUInt32LE(b, i); return len > 0 ? $cptable.utils.decode(65001, b.slice(i + 4, i + 4 + len)) : ""; }; +} +if (typeof $cptable !== 'undefined') + cpdoit(); +var __readUInt8 = function (b /*:RawBytes|CFBlob*/, idx /*:number*/) { return b[idx]; }; +var __readUInt16LE = function (b /*:RawBytes|CFBlob*/, idx /*:number*/) { return (b[idx + 1] * (1 << 8)) + b[idx]; }; +var __readInt16LE = function (b /*:RawBytes|CFBlob*/, idx /*:number*/) { var u = (b[idx + 1] * (1 << 8)) + b[idx]; return (u < 0x8000) ? u : ((0xffff - u + 1) * -1); }; +var __readUInt32LE = function (b /*:RawBytes|CFBlob*/, idx /*:number*/) { return b[idx + 3] * (1 << 24) + (b[idx + 2] << 16) + (b[idx + 1] << 8) + b[idx]; }; +var __readInt32LE = function (b /*:RawBytes|CFBlob*/, idx /*:number*/) { return (b[idx + 3] << 24) | (b[idx + 2] << 16) | (b[idx + 1] << 8) | b[idx]; }; +var __readInt32BE = function (b /*:RawBytes|CFBlob*/, idx /*:number*/) { return (b[idx] << 24) | (b[idx + 1] << 16) | (b[idx + 2] << 8) | b[idx + 3]; }; +function ReadShift(size /*:number*/, t /*:?string*/) { + var o = "", oI /*:: :number = 0*/, oR, oo = [], w, vv, i, loc; + switch (t) { + case 'dbcs': + loc = this.l; + if (has_buf && Buffer.isBuffer(this) && buf_utf16le) + o = this.slice(this.l, this.l + 2 * size).toString("utf16le"); + else + for (i = 0; i < size; ++i) { + o += String.fromCharCode(__readUInt16LE(this, loc)); + loc += 2; + } + size *= 2; + break; + case 'utf8': + o = __utf8(this, this.l, this.l + size); + break; + case 'utf16le': + size *= 2; + o = __utf16le(this, this.l, this.l + size); + break; + case 'wstr': + if (typeof $cptable !== 'undefined') + o = $cptable.utils.decode(current_codepage, this.slice(this.l, this.l + 2 * size)); + else + return ReadShift.call(this, size, 'dbcs'); + size = 2 * size; + break; + /* [MS-OLEDS] 2.1.4 LengthPrefixedAnsiString */ + case 'lpstr-ansi': + o = __lpstr(this, this.l); + size = 4 + __readUInt32LE(this, this.l); + break; + case 'lpstr-cp': + o = __cpstr(this, this.l); + size = 4 + __readUInt32LE(this, this.l); + break; + /* [MS-OLEDS] 2.1.5 LengthPrefixedUnicodeString */ + case 'lpwstr': + o = __lpwstr(this, this.l); + size = 4 + 2 * __readUInt32LE(this, this.l); + break; + /* [MS-OFFCRYPTO] 2.1.2 Length-Prefixed Padded Unicode String (UNICODE-LP-P4) */ + case 'lpp4': + size = 4 + __readUInt32LE(this, this.l); + o = __lpp4(this, this.l); + if (size & 0x02) + size += 2; + break; + /* [MS-OFFCRYPTO] 2.1.3 Length-Prefixed UTF-8 String (UTF-8-LP-P4) */ + case '8lpp4': + size = 4 + __readUInt32LE(this, this.l); + o = __8lpp4(this, this.l); + if (size & 0x03) + size += 4 - (size & 0x03); + break; + case 'cstr': + size = 0; + o = ""; + while ((w = __readUInt8(this, this.l + size++)) !== 0) + oo.push(_getchar(w)); + o = oo.join(""); + break; + case '_wstr': + size = 0; + o = ""; + while ((w = __readUInt16LE(this, this.l + size)) !== 0) { + oo.push(_getchar(w)); + size += 2; + } + size += 2; + o = oo.join(""); + break; + /* sbcs and dbcs support continue records in the SST way TODO codepages */ + case 'dbcs-cont': + o = ""; + loc = this.l; + for (i = 0; i < size; ++i) { + if (this.lens && this.lens.indexOf(loc) !== -1) { + w = __readUInt8(this, loc); + this.l = loc + 1; + vv = ReadShift.call(this, size - i, w ? 'dbcs-cont' : 'sbcs-cont'); + return oo.join("") + vv; + } + oo.push(_getchar(__readUInt16LE(this, loc))); + loc += 2; + } + o = oo.join(""); + size *= 2; + break; + case 'cpstr': + if (typeof $cptable !== 'undefined') { + o = $cptable.utils.decode(current_codepage, this.slice(this.l, this.l + size)); + break; + } + /* falls through */ + case 'sbcs-cont': + o = ""; + loc = this.l; + for (i = 0; i != size; ++i) { + if (this.lens && this.lens.indexOf(loc) !== -1) { + w = __readUInt8(this, loc); + this.l = loc + 1; + vv = ReadShift.call(this, size - i, w ? 'dbcs-cont' : 'sbcs-cont'); + return oo.join("") + vv; + } + oo.push(_getchar(__readUInt8(this, loc))); + loc += 1; + } + o = oo.join(""); + break; + default: + switch (size) { + case 1: + oI = __readUInt8(this, this.l); + this.l++; + return oI; + case 2: + oI = (t === 'i' ? __readInt16LE : __readUInt16LE)(this, this.l); + this.l += 2; + return oI; + case 4: + case -4: + if (t === 'i' || ((this[this.l + 3] & 0x80) === 0)) { + oI = ((size > 0) ? __readInt32LE : __readInt32BE)(this, this.l); + this.l += 4; + return oI; + } + else { + oR = __readUInt32LE(this, this.l); + this.l += 4; + } + return oR; + case 8: + case -8: + if (t === 'f') { + if (size == 8) + oR = __double(this, this.l); + else + oR = __double([this[this.l + 7], this[this.l + 6], this[this.l + 5], this[this.l + 4], this[this.l + 3], this[this.l + 2], this[this.l + 1], this[this.l + 0]], 0); + this.l += 8; + return oR; + } + else + size = 8; + /* falls through */ + case 16: + o = __hexlify(this, this.l, size); + break; + } + } + this.l += size; + return o; +} +var __writeUInt32LE = function (b /*:RawBytes|CFBlob*/, val /*:number*/, idx /*:number*/) { b[idx] = (val & 0xFF); b[idx + 1] = ((val >>> 8) & 0xFF); b[idx + 2] = ((val >>> 16) & 0xFF); b[idx + 3] = ((val >>> 24) & 0xFF); }; +var __writeInt32LE = function (b /*:RawBytes|CFBlob*/, val /*:number*/, idx /*:number*/) { b[idx] = (val & 0xFF); b[idx + 1] = ((val >> 8) & 0xFF); b[idx + 2] = ((val >> 16) & 0xFF); b[idx + 3] = ((val >> 24) & 0xFF); }; +var __writeUInt16LE = function (b /*:RawBytes|CFBlob*/, val /*:number*/, idx /*:number*/) { b[idx] = (val & 0xFF); b[idx + 1] = ((val >>> 8) & 0xFF); }; +function WriteShift(t /*:number*/, val /*:string|number*/, f /*:?string*/) { + var size = 0, i = 0; + if (f === 'dbcs') { + /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ + for (i = 0; i != val.length; ++i) + __writeUInt16LE(this, val.charCodeAt(i), this.l + 2 * i); + size = 2 * val.length; + } + else if (f === 'sbcs' || f == 'cpstr') { + if (typeof $cptable !== 'undefined' && current_ansi == 874) { + /* TODO: use tables directly, don't encode */ + /*:: if(typeof val !== "string") throw new Error("unreachable"); */ + for (i = 0; i != val.length; ++i) { + var cpp = $cptable.utils.encode(current_ansi, val.charAt(i)); + this[this.l + i] = cpp[0]; + } + size = val.length; + } + else if (typeof $cptable !== 'undefined' && f == 'cpstr') { + cpp = $cptable.utils.encode(current_codepage, val); + /* replace null bytes with _ when relevant */ + if (cpp.length == val.length) + for (i = 0; i < val.length; ++i) + if (cpp[i] == 0 && val.charCodeAt(i) != 0) + cpp[i] = 0x5F; + if (cpp.length == 2 * val.length) + for (i = 0; i < val.length; ++i) + if (cpp[2 * i] == 0 && cpp[2 * i + 1] == 0 && val.charCodeAt(i) != 0) + cpp[2 * i] = 0x5F; + for (i = 0; i < cpp.length; ++i) + this[this.l + i] = cpp[i]; + size = cpp.length; + } + else { + /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ + val = val.replace(/[^\x00-\x7F]/g, "_"); + /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ + for (i = 0; i != val.length; ++i) + this[this.l + i] = (val.charCodeAt(i) & 0xFF); + size = val.length; + } + } + else if (f === 'hex') { + for (; i < t; ++i) { + /*:: if(typeof val !== "string") throw new Error("unreachable"); */ + this[this.l++] = (parseInt(val.slice(2 * i, 2 * i + 2), 16) || 0); + } + return this; + } + else if (f === 'utf16le') { + /*:: if(typeof val !== "string") throw new Error("unreachable"); */ + var end /*:number*/ = Math.min(this.l + t, this.length); + for (i = 0; i < Math.min(val.length, t); ++i) { + var cc = val.charCodeAt(i); + this[this.l++] = (cc & 0xff); + this[this.l++] = (cc >> 8); + } + while (this.l < end) + this[this.l++] = 0; + return this; + } + else /*:: if(typeof val === 'number') */ + switch (t) { + case 1: + size = 1; + this[this.l] = val & 0xFF; + break; + case 2: + size = 2; + this[this.l] = val & 0xFF; + val >>>= 8; + this[this.l + 1] = val & 0xFF; + break; + case 3: + size = 3; + this[this.l] = val & 0xFF; + val >>>= 8; + this[this.l + 1] = val & 0xFF; + val >>>= 8; + this[this.l + 2] = val & 0xFF; + break; + case 4: + size = 4; + __writeUInt32LE(this, val, this.l); + break; + case 8: + size = 8; + if (f === 'f') { + write_double_le(this, val, this.l); + break; + } + /* falls through */ + case 16: break; + case -4: + size = 4; + __writeInt32LE(this, val, this.l); + break; + } + this.l += size; + return this; +} +function CheckField(hexstr /*:string*/, fld /*:string*/) { + var m = __hexlify(this, this.l, hexstr.length >> 1); + if (m !== hexstr) + throw new Error(fld + 'Expected ' + hexstr + ' saw ' + m); + this.l += hexstr.length >> 1; +} +function prep_blob(blob, pos /*:number*/) { + blob.l = pos; + blob.read_shift = /*::(*/ ReadShift /*:: :any)*/; + blob.chk = CheckField; + blob.write_shift = WriteShift; +} +function parsenoop(blob, length /*:: :number, opts?:any */) { blob.l += length; } +function new_buf(sz /*:number*/) { + var o = new_raw_buf(sz); + prep_blob(o, 0); + return o; +} +/* [MS-XLSB] 2.1.4 Record */ +function recordhopper(data, cb /*:RecordHopperCB*/, opts /*:?any*/) { + if (!data) + return; + var tmpbyte, cntbyte, length; + prep_blob(data, data.l || 0); + var L = data.length, RT = 0, tgt = 0; + while (data.l < L) { + RT = data.read_shift(1); + if (RT & 0x80) + RT = (RT & 0x7F) + ((data.read_shift(1) & 0x7F) << 7); + var R = XLSBRecordEnum[RT] || XLSBRecordEnum[0xFFFF]; + tmpbyte = data.read_shift(1); + length = tmpbyte & 0x7F; + for (cntbyte = 1; cntbyte < 4 && (tmpbyte & 0x80); ++cntbyte) + length += ((tmpbyte = data.read_shift(1)) & 0x7F) << (7 * cntbyte); + tgt = data.l + length; + var d = R.f && R.f(data, length, opts); + data.l = tgt; + if (cb(d, R, RT)) + return; + } +} +/* control buffer usage for fixed-length buffers */ +function buf_array() { + var bufs /*:Array*/ = [], blksz = has_buf ? 256 : 2048; + var newblk = function ba_newblk(sz /*:number*/) { + var o /*:Block*/ = (new_buf(sz) /*:any*/); + prep_blob(o, 0); + return o; + }; + var curbuf /*:Block*/ = newblk(blksz); + var endbuf = function ba_endbuf() { + if (!curbuf) + return; + // workaround for new Buffer(3).slice(0,0) bug in bun 0.1.3 + if (curbuf.l) { + if (curbuf.length > curbuf.l) { + curbuf = curbuf.slice(0, curbuf.l); + curbuf.l = curbuf.length; + } + if (curbuf.length > 0) + bufs.push(curbuf); + } + curbuf = null; + }; + var next = function ba_next(sz /*:number*/) { + if (curbuf && (sz < (curbuf.length - curbuf.l))) + return curbuf; + endbuf(); + return (curbuf = newblk(Math.max(sz + 1, blksz))); + }; + var end = function ba_end() { + endbuf(); + return bconcat(bufs); + }; + var push = function ba_push(buf) { endbuf(); curbuf = buf; if (curbuf.l == null) + curbuf.l = curbuf.length; next(blksz); }; + return ({ next: next, push: push, end: end, _bufs: bufs } /*:any*/); +} +function write_record(ba /*:BufArray*/, type /*:number*/, payload, length /*:?number*/) { + var t /*:number*/ = +type, l; + if (isNaN(t)) + return; // TODO: throw something here? + if (!length) + length = XLSBRecordEnum[t].p || (payload || []).length || 0; + l = 1 + (t >= 0x80 ? 1 : 0) + 1 /* + length*/; + if (length >= 0x80) + ++l; + if (length >= 0x4000) + ++l; + if (length >= 0x200000) + ++l; + var o = ba.next(l); + if (t <= 0x7F) + o.write_shift(1, t); + else { + o.write_shift(1, (t & 0x7F) + 0x80); + o.write_shift(1, (t >> 7)); + } + for (var i = 0; i != 4; ++i) { + if (length >= 0x80) { + o.write_shift(1, (length & 0x7F) + 0x80); + length >>= 7; + } + else { + o.write_shift(1, length); + break; + } + } + if ( /*:: length != null &&*/length > 0 && is_buf(payload)) + ba.push(payload); +} +/* XLS ranges enforced */ +function shift_cell_xls(cell /*:CellAddress*/, tgt /*:any*/, opts /*:?any*/) { + var out = dup(cell); + if (tgt.s) { + if (out.cRel) + out.c += tgt.s.c; + if (out.rRel) + out.r += tgt.s.r; + } + else { + if (out.cRel) + out.c += tgt.c; + if (out.rRel) + out.r += tgt.r; + } + if (!opts || opts.biff < 12) { + while (out.c >= 0x100) + out.c -= 0x100; + while (out.r >= 0x10000) + out.r -= 0x10000; + } + return out; +} +function shift_range_xls(cell, range, opts) { + var out = dup(cell); + out.s = shift_cell_xls(out.s, range.s, opts); + out.e = shift_cell_xls(out.e, range.s, opts); + return out; +} +function encode_cell_xls(c /*:CellAddress*/, biff /*:number*/) { + if (c.cRel && c.c < 0) { + c = dup(c); + while (c.c < 0) + c.c += (biff > 8) ? 0x4000 : 0x100; + } + if (c.rRel && c.r < 0) { + c = dup(c); + while (c.r < 0) + c.r += (biff > 8) ? 0x100000 : ((biff > 5) ? 0x10000 : 0x4000); + } + var s = encode_cell(c); + if (!c.cRel && c.cRel != null) + s = fix_col(s); + if (!c.rRel && c.rRel != null) + s = fix_row(s); + return s; +} +function encode_range_xls(r, opts) { + if (r.s.r == 0 && !r.s.rRel) { + if (r.e.r == (opts.biff >= 12 ? 0xFFFFF : (opts.biff >= 8 ? 0x10000 : 0x4000)) && !r.e.rRel) { + return (r.s.cRel ? "" : "$") + encode_col(r.s.c) + ":" + (r.e.cRel ? "" : "$") + encode_col(r.e.c); + } + } + if (r.s.c == 0 && !r.s.cRel) { + if (r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) { + return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r); + } + } + return encode_cell_xls(r.s, opts.biff) + ":" + encode_cell_xls(r.e, opts.biff); +} +function decode_row(rowstr /*:string*/) { return parseInt(unfix_row(rowstr), 10) - 1; } +function encode_row(row /*:number*/) { return "" + (row + 1); } +function fix_row(cstr /*:string*/) { return cstr.replace(/([A-Z]|^)(\d+)$/, "$1$$$2"); } +function unfix_row(cstr /*:string*/) { return cstr.replace(/\$(\d+)$/, "$1"); } +function decode_col(colstr /*:string*/) { var c = unfix_col(colstr), d = 0, i = 0; for (; i !== c.length; ++i) + d = 26 * d + c.charCodeAt(i) - 64; return d - 1; } +function encode_col(col /*:number*/) { if (col < 0) + throw new Error("invalid column " + col); var s = ""; for (++col; col; col = Math.floor((col - 1) / 26)) + s = String.fromCharCode(((col - 1) % 26) + 65) + s; return s; } +function fix_col(cstr /*:string*/) { return cstr.replace(/^([A-Z])/, "$$$1"); } +function unfix_col(cstr /*:string*/) { return cstr.replace(/^\$([A-Z])/, "$1"); } +function split_cell(cstr /*:string*/) { return cstr.replace(/(\$?[A-Z]*)(\$?\d*)/, "$1,$2").split(","); } +function decode_cell(cstr /*:string*/) { + var R = 0, C = 0; + for (var i = 0; i < cstr.length; ++i) { + var cc = cstr.charCodeAt(i); + if (cc >= 48 && cc <= 57) + R = 10 * R + (cc - 48); + else if (cc >= 65 && cc <= 90) + C = 26 * C + (cc - 64); + } + return { c: C - 1, r: R - 1 }; +} +function encode_cell(cell /*:CellAddress*/) { + var col = cell.c + 1; + var s = ""; + for (; col; col = ((col - 1) / 26) | 0) + s = String.fromCharCode(((col - 1) % 26) + 65) + s; + return s + (cell.r + 1); +} +function decode_range(range /*:string*/) { + var idx = range.indexOf(":"); + if (idx == -1) + return { s: decode_cell(range), e: decode_cell(range) }; + return { s: decode_cell(range.slice(0, idx)), e: decode_cell(range.slice(idx + 1)) }; +} +/*# if only one arg, it is assumed to be a Range. If 2 args, both are cell addresses */ +function encode_range(cs /*:CellAddrSpec|Range*/, ce /*:?CellAddrSpec*/) { + if (typeof ce === 'undefined' || typeof ce === 'number') { + /*:: if(!(cs instanceof Range)) throw "unreachable"; */ + return encode_range(cs.s, cs.e); + } + /*:: if((cs instanceof Range)) throw "unreachable"; */ + if (typeof cs !== 'string') + cs = encode_cell((cs /*:any*/)); + if (typeof ce !== 'string') + ce = encode_cell((ce /*:any*/)); + /*:: if(typeof cs !== 'string') throw "unreachable"; */ + /*:: if(typeof ce !== 'string') throw "unreachable"; */ + return cs == ce ? cs : cs + ":" + ce; +} +function fix_range(a1 /*:string*/) { + var s = decode_range(a1); + return "$" + encode_col(s.s.c) + "$" + encode_row(s.s.r) + ":$" + encode_col(s.e.c) + "$" + encode_row(s.e.r); +} +// List of invalid characters needs to be tested further +function formula_quote_sheet_name(sname /*:string*/, opts) { + if (!sname && !(opts && opts.biff <= 5 && opts.biff >= 2)) + throw new Error("empty sheet name"); + if (/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(sname)) + return "'" + sname.replace(/'/g, "''") + "'"; + return sname; +} +function safe_decode_range(range /*:string*/) { + var o = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } }; + var idx = 0, i = 0, cc = 0; + var len = range.length; + for (idx = 0; i < len; ++i) { + if ((cc = range.charCodeAt(i) - 64) < 1 || cc > 26) + break; + idx = 26 * idx + cc; + } + o.s.c = --idx; + for (idx = 0; i < len; ++i) { + if ((cc = range.charCodeAt(i) - 48) < 0 || cc > 9) + break; + idx = 10 * idx + cc; + } + o.s.r = --idx; + if (i === len || cc != 10) { + o.e.c = o.s.c; + o.e.r = o.s.r; + return o; + } + ++i; + for (idx = 0; i != len; ++i) { + if ((cc = range.charCodeAt(i) - 64) < 1 || cc > 26) + break; + idx = 26 * idx + cc; + } + o.e.c = --idx; + for (idx = 0; i != len; ++i) { + if ((cc = range.charCodeAt(i) - 48) < 0 || cc > 9) + break; + idx = 10 * idx + cc; + } + o.e.r = --idx; + return o; +} +function safe_format_cell(cell /*:Cell*/, v /*:any*/) { + var q = (cell.t == 'd' && v instanceof Date); + if (cell.z != null) + try { + return (cell.w = SSF_format(cell.z, q ? datenum(v) : v)); + } + catch (e) { } + try { + return (cell.w = SSF_format((cell.XF || {}).numFmtId || (q ? 14 : 0), q ? datenum(v) : v)); + } + catch (e) { + return '' + v; + } +} +function format_cell(cell /*:Cell*/, v /*:any*/, o /*:any*/) { + if (cell == null || cell.t == null || cell.t == 'z') + return ""; + if (cell.w !== undefined) + return cell.w; + if (cell.t == 'd' && !cell.z && o && o.dateNF) + cell.z = o.dateNF; + if (cell.t == "e") + return BErr[cell.v] || cell.v; + if (v == undefined) + return safe_format_cell(cell, cell.v); + return safe_format_cell(cell, v); +} +function sheet_to_workbook(sheet /*:Worksheet*/, opts) { + var n = opts && opts.sheet ? opts.sheet : "Sheet1"; + var sheets = {}; + sheets[n] = sheet; + return { SheetNames: [n], Sheets: sheets }; +} +function sheet_add_aoa(_ws /*:?Worksheet*/, data /*:AOA*/, opts /*:?any*/) { + var o = opts || {}; + var dense = _ws ? (_ws["!data"] != null) : o.dense; + if (DENSE != null && dense == null) + dense = DENSE; + var ws /*:Worksheet*/ = _ws || ({} /*:any*/); + if (dense && !ws["!data"]) + ws["!data"] = []; + var _R = 0, _C = 0; + if (ws && o.origin != null) { + if (typeof o.origin == 'number') + _R = o.origin; + else { + var _origin /*:CellAddress*/ = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin; + _R = _origin.r; + _C = _origin.c; + } + if (!ws["!ref"]) + ws["!ref"] = "A1:A1"; + } + var range /*:Range*/ = ({ s: { c: 10000000, r: 10000000 }, e: { c: 0, r: 0 } } /*:any*/); + if (ws['!ref']) { + var _range = safe_decode_range(ws['!ref']); + range.s.c = _range.s.c; + range.s.r = _range.s.r; + range.e.c = Math.max(range.e.c, _range.e.c); + range.e.r = Math.max(range.e.r, _range.e.r); + if (_R == -1) + range.e.r = _R = _range.e.r + 1; + } + var row = []; + for (var R = 0; R != data.length; ++R) { + if (!data[R]) + continue; + if (!Array.isArray(data[R])) + throw new Error("aoa_to_sheet expects an array of arrays"); + var __R = _R + R, __Rstr = "" + (__R + 1); + if (dense) { + if (!ws["!data"][__R]) + ws["!data"][__R] = []; + row = ws["!data"][__R]; + } + for (var C = 0; C != data[R].length; ++C) { + if (typeof data[R][C] === 'undefined') + continue; + var cell /*:Cell*/ = ({ v: data[R][C] } /*:any*/); + var __C = _C + C; + if (range.s.r > __R) + range.s.r = __R; + if (range.s.c > __C) + range.s.c = __C; + if (range.e.r < __R) + range.e.r = __R; + if (range.e.c < __C) + range.e.c = __C; + if (data[R][C] && typeof data[R][C] === 'object' && !Array.isArray(data[R][C]) && !(data[R][C] instanceof Date)) + cell = data[R][C]; + else { + if (Array.isArray(cell.v)) { + cell.f = data[R][C][1]; + cell.v = cell.v[0]; + } + if (cell.v === null) { + if (cell.f) + cell.t = 'n'; + else if (o.nullError) { + cell.t = 'e'; + cell.v = 0; + } + else if (!o.sheetStubs) + continue; + else + cell.t = 'z'; + } + else if (typeof cell.v === 'number') + cell.t = 'n'; + else if (typeof cell.v === 'boolean') + cell.t = 'b'; + else if (cell.v instanceof Date) { + cell.z = o.dateNF || table_fmt[14]; + if (!o.UTC) + cell.v = local_to_utc(cell.v); + if (o.cellDates) { + cell.t = 'd'; + cell.w = SSF_format(cell.z, datenum(cell.v, o.date1904)); + } + else { + cell.t = 'n'; + cell.v = datenum(cell.v, o.date1904); + cell.w = SSF_format(cell.z, cell.v); + } + } + else + cell.t = 's'; + } + if (dense) { + if (row[__C] && row[__C].z) + cell.z = row[__C].z; + row[__C] = cell; + } + else { + var cell_ref = encode_col(__C) + __Rstr /*:any*/; + if (ws[cell_ref] && ws[cell_ref].z) + cell.z = ws[cell_ref].z; + ws[cell_ref] = cell; + } + } + } + if (range.s.c < 10000000) + ws['!ref'] = encode_range(range); + return ws; +} +function aoa_to_sheet(data /*:AOA*/, opts /*:?any*/) { return sheet_add_aoa(null, data, opts); } +function parse_Int32LE(data) { + return data.read_shift(4, 'i'); +} +function write_UInt32LE(x /*:number*/, o) { + if (!o) + o = new_buf(4); + o.write_shift(4, x); + return o; +} +/* [MS-XLSB] 2.5.168 */ +function parse_XLWideString(data /*::, length*/) { + var cchCharacters = data.read_shift(4); + return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, 'dbcs'); +} +function write_XLWideString(data /*:string*/, o) { + var _null = false; + if (o == null) { + _null = true; + o = new_buf(4 + 2 * data.length); + } + o.write_shift(4, data.length); + if (data.length > 0) + o.write_shift(0, data, 'dbcs'); + return _null ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.5.91 */ +//function parse_LPWideString(data/*::, length*/)/*:string*/ { +// var cchCharacters = data.read_shift(2); +// return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "utf16le"); +//} +/* [MS-XLSB] 2.5.143 */ +function parse_StrRun(data) { + return { ich: data.read_shift(2), ifnt: data.read_shift(2) }; +} +function write_StrRun(run, o) { + if (!o) + o = new_buf(4); + o.write_shift(2, run.ich || 0); + o.write_shift(2, run.ifnt || 0); + return o; +} +/* [MS-XLSB] 2.5.121 */ +function parse_RichStr(data, length /*:number*/) { + var start = data.l; + var flags = data.read_shift(1); + var str = parse_XLWideString(data); + var rgsStrRun = []; + var z = ({ t: str, h: str } /*:any*/); + if ((flags & 1) !== 0) { /* fRichStr */ + /* TODO: formatted string */ + var dwSizeStrRun = data.read_shift(4); + for (var i = 0; i != dwSizeStrRun; ++i) + rgsStrRun.push(parse_StrRun(data)); + z.r = rgsStrRun; + } + else + z.r = [{ ich: 0, ifnt: 0 }]; + //if((flags & 2) !== 0) { /* fExtStr */ + // /* TODO: phonetic string */ + //} + data.l = start + length; + return z; +} +function write_RichStr(str /*:XLString*/, o /*:?Block*/) { + /* TODO: formatted string */ + var _null = false; + if (o == null) { + _null = true; + o = new_buf(15 + 4 * str.t.length); + } + o.write_shift(1, 0); + write_XLWideString(str.t, o); + return _null ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.328 BrtCommentText (RichStr w/1 run) */ +var parse_BrtCommentText = parse_RichStr; +function write_BrtCommentText(str /*:XLString*/, o /*:?Block*/) { + /* TODO: formatted string */ + var _null = false; + if (o == null) { + _null = true; + o = new_buf(23 + 4 * str.t.length); + } + o.write_shift(1, 1); + write_XLWideString(str.t, o); + o.write_shift(4, 1); + write_StrRun({ ich: 0, ifnt: 0 }, o); + return _null ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.5.9 */ +function parse_XLSBCell(data) { + var col = data.read_shift(4); + var iStyleRef = data.read_shift(2); + iStyleRef += data.read_shift(1) << 16; + data.l++; //var fPhShow = data.read_shift(1); + return { c: col, iStyleRef: iStyleRef }; +} +function write_XLSBCell(cell /*:any*/, o /*:?Block*/) { + if (o == null) + o = new_buf(8); + o.write_shift(-4, cell.c); + o.write_shift(3, cell.iStyleRef || cell.s); + o.write_shift(1, 0); /* fPhShow */ + return o; +} +/* Short XLSB Cell does not include column */ +function parse_XLSBShortCell(data) { + var iStyleRef = data.read_shift(2); + iStyleRef += data.read_shift(1) << 16; + data.l++; //var fPhShow = data.read_shift(1); + return { c: -1, iStyleRef: iStyleRef }; +} +function write_XLSBShortCell(cell /*:any*/, o /*:?Block*/) { + if (o == null) + o = new_buf(4); + o.write_shift(3, cell.iStyleRef || cell.s); + o.write_shift(1, 0); /* fPhShow */ + return o; +} +/* [MS-XLSB] 2.5.21 */ +var parse_XLSBCodeName = parse_XLWideString; +var write_XLSBCodeName = write_XLWideString; +/* [MS-XLSB] 2.5.166 */ +function parse_XLNullableWideString(data /*::, length*/) { + var cchCharacters = data.read_shift(4); + return cchCharacters === 0 || cchCharacters === 0xFFFFFFFF ? "" : data.read_shift(cchCharacters, 'dbcs'); +} +function write_XLNullableWideString(data /*:string*/, o) { + var _null = false; + if (o == null) { + _null = true; + o = new_buf(127); + } + o.write_shift(4, data.length > 0 ? data.length : 0xFFFFFFFF); + if (data.length > 0) + o.write_shift(0, data, 'dbcs'); + return _null ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.5.165 */ +var parse_XLNameWideString = parse_XLWideString; +//var write_XLNameWideString = write_XLWideString; +/* [MS-XLSB] 2.5.114 */ +var parse_RelID = parse_XLNullableWideString; +var write_RelID = write_XLNullableWideString; +/* [MS-XLS] 2.5.217 ; [MS-XLSB] 2.5.122 */ +function parse_RkNumber(data) { + var b = data.slice(data.l, data.l + 4); + var fX100 = (b[0] & 1), fInt = (b[0] & 2); + data.l += 4; + var RK = fInt === 0 ? __double([0, 0, 0, 0, (b[0] & 0xFC), b[1], b[2], b[3]], 0) : __readInt32LE(b, 0) >> 2; + return fX100 ? (RK / 100) : RK; +} +function write_RkNumber(data /*:number*/, o) { + if (o == null) + o = new_buf(4); + var fX100 = 0, fInt = 0, d100 = data * 100; + if ((data == (data | 0)) && (data >= -(1 << 29)) && (data < (1 << 29))) { + fInt = 1; + } + else if ((d100 == (d100 | 0)) && (d100 >= -(1 << 29)) && (d100 < (1 << 29))) { + fInt = 1; + fX100 = 1; + } + if (fInt) + o.write_shift(-4, ((fX100 ? d100 : data) << 2) + (fX100 + 2)); + else + throw new Error("unsupported RkNumber " + data); // TODO +} +/* [MS-XLSB] 2.5.117 RfX */ +function parse_RfX(data /*::, length*/) { + var cell /*:Range*/ = ({ s: {}, e: {} } /*:any*/); + cell.s.r = data.read_shift(4); + cell.e.r = data.read_shift(4); + cell.s.c = data.read_shift(4); + cell.e.c = data.read_shift(4); + return cell; +} +function write_RfX(r /*:Range*/, o) { + if (!o) + o = new_buf(16); + o.write_shift(4, r.s.r); + o.write_shift(4, r.e.r); + o.write_shift(4, r.s.c); + o.write_shift(4, r.e.c); + return o; +} +/* [MS-XLSB] 2.5.153 UncheckedRfX */ +var parse_UncheckedRfX = parse_RfX; +var write_UncheckedRfX = write_RfX; +/* [MS-XLSB] 2.5.155 UncheckedSqRfX */ +//function parse_UncheckedSqRfX(data) { +// var cnt = data.read_shift(4); +// var out = []; +// for(var i = 0; i < cnt; ++i) { +// var rng = parse_UncheckedRfX(data); +// out.push(encode_range(rng)); +// } +// return out.join(","); +//} +//function write_UncheckedSqRfX(sqrfx/*:string*/) { +// var parts = sqrfx.split(/\s*,\s*/); +// var o = new_buf(4); o.write_shift(4, parts.length); +// var out = [o]; +// parts.forEach(function(rng) { +// out.push(write_UncheckedRfX(safe_decode_range(rng))); +// }); +// return bconcat(out); +//} +/* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */ +/* TODO: error checking, NaN and Infinity values are not valid Xnum */ +function parse_Xnum(data /*::, length*/) { + if (data.length - data.l < 8) + throw "XLS Xnum Buffer underflow"; + return data.read_shift(8, 'f'); +} +function write_Xnum(data, o) { return (o || new_buf(8)).write_shift(8, data, 'f'); } +/* [MS-XLSB] 2.4.324 BrtColor */ +function parse_BrtColor(data /*::, length*/) { + var out = {}; + var d = data.read_shift(1); + //var fValidRGB = d & 1; + var xColorType = d >>> 1; + var index = data.read_shift(1); + var nTS = data.read_shift(2, 'i'); + var bR = data.read_shift(1); + var bG = data.read_shift(1); + var bB = data.read_shift(1); + data.l++; //var bAlpha = data.read_shift(1); + switch (xColorType) { + case 0: + out.auto = 1; + break; + case 1: + out.index = index; + var icv = XLSIcv[index]; + /* automatic pseudo index 81 */ + if (icv) + out.rgb = rgb2Hex(icv); + break; + case 2: + /* if(!fValidRGB) throw new Error("invalid"); */ + out.rgb = rgb2Hex([bR, bG, bB]); + break; + case 3: + out.theme = index; + break; + } + if (nTS != 0) + out.tint = nTS > 0 ? nTS / 32767 : nTS / 32768; + return out; +} +function write_BrtColor(color, o) { + if (!o) + o = new_buf(8); + if (!color || color.auto) { + o.write_shift(4, 0); + o.write_shift(4, 0); + return o; + } + if (color.index != null) { + o.write_shift(1, 0x02); + o.write_shift(1, color.index); + } + else if (color.theme != null) { + o.write_shift(1, 0x06); + o.write_shift(1, color.theme); + } + else { + o.write_shift(1, 0x05); + o.write_shift(1, 0); + } + var nTS = color.tint || 0; + if (nTS > 0) + nTS *= 32767; + else if (nTS < 0) + nTS *= 32768; + o.write_shift(2, nTS); + if (!color.rgb || color.theme != null) { + o.write_shift(2, 0); + o.write_shift(1, 0); + o.write_shift(1, 0); + } + else { + var rgb = (color.rgb || 'FFFFFF'); + if (typeof rgb == 'number') + rgb = ("000000" + rgb.toString(16)).slice(-6); + o.write_shift(1, parseInt(rgb.slice(0, 2), 16)); + o.write_shift(1, parseInt(rgb.slice(2, 4), 16)); + o.write_shift(1, parseInt(rgb.slice(4, 6), 16)); + o.write_shift(1, 0xFF); + } + return o; +} +/* [MS-XLSB] 2.5.52 */ +function parse_FontFlags(data /*::, length, opts*/) { + var d = data.read_shift(1); + data.l++; + var out = { + fBold: d & 0x01, + fItalic: d & 0x02, + fUnderline: d & 0x04, + fStrikeout: d & 0x08, + fOutline: d & 0x10, + fShadow: d & 0x20, + fCondense: d & 0x40, + fExtend: d & 0x80 + }; + return out; +} +function write_FontFlags(font, o) { + if (!o) + o = new_buf(2); + var grbit = (font.italic ? 0x02 : 0) | + (font.strike ? 0x08 : 0) | + (font.outline ? 0x10 : 0) | + (font.shadow ? 0x20 : 0) | + (font.condense ? 0x40 : 0) | + (font.extend ? 0x80 : 0); + o.write_shift(1, grbit); + o.write_shift(1, 0); + return o; +} +/* [MS-OLEDS] 2.3.1 and 2.3.2 */ +function parse_ClipboardFormatOrString(o, w /*:number*/) { + // $FlowIgnore + var ClipFmt = { 2: "BITMAP", 3: "METAFILEPICT", 8: "DIB", 14: "ENHMETAFILE" }; + var m /*:number*/ = o.read_shift(4); + switch (m) { + case 0x00000000: return ""; + case 0xffffffff: + case 0xfffffffe: return ClipFmt[o.read_shift(4)] || ""; + } + if (m > 0x190) + throw new Error("Unsupported Clipboard: " + m.toString(16)); + o.l -= 4; + return o.read_shift(0, w == 1 ? "lpstr" : "lpwstr"); +} +function parse_ClipboardFormatOrAnsiString(o) { return parse_ClipboardFormatOrString(o, 1); } +function parse_ClipboardFormatOrUnicodeString(o) { return parse_ClipboardFormatOrString(o, 2); } +/* [MS-OLEPS] 2.2 PropertyType */ +// Note: some tree shakers cannot handle VT_VECTOR | $CONST, hence extra vars +//var VT_EMPTY = 0x0000; +//var VT_NULL = 0x0001; +var VT_I2 = 0x0002; +var VT_I4 = 0x0003; +//var VT_R4 = 0x0004; +//var VT_R8 = 0x0005; +//var VT_CY = 0x0006; +//var VT_DATE = 0x0007; +//var VT_BSTR = 0x0008; +//var VT_ERROR = 0x000A; +var VT_BOOL = 0x000B; +var VT_VARIANT = 0x000C; +//var VT_DECIMAL = 0x000E; +//var VT_I1 = 0x0010; +//var VT_UI1 = 0x0011; +//var VT_UI2 = 0x0012; +var VT_UI4 = 0x0013; +//var VT_I8 = 0x0014; +//var VT_UI8 = 0x0015; +//var VT_INT = 0x0016; +//var VT_UINT = 0x0017; +//var VT_LPSTR = 0x001E; +//var VT_LPWSTR = 0x001F; +var VT_FILETIME = 0x0040; +var VT_BLOB = 0x0041; +//var VT_STREAM = 0x0042; +//var VT_STORAGE = 0x0043; +//var VT_STREAMED_Object = 0x0044; +//var VT_STORED_Object = 0x0045; +//var VT_BLOB_Object = 0x0046; +var VT_CF = 0x0047; +//var VT_CLSID = 0x0048; +//var VT_VERSIONED_STREAM = 0x0049; +//var VT_VECTOR = 0x1000; +var VT_VECTOR_VARIANT = 0x100C; +var VT_VECTOR_LPSTR = 0x101E; +//var VT_ARRAY = 0x2000; +var VT_STRING = 0x0050; // 2.3.3.1.11 VtString +var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString +var VT_CUSTOM = [VT_STRING, VT_USTR]; +/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */ +var DocSummaryPIDDSI = { + /*::[*/ 0x01 /*::]*/: { n: 'CodePage', t: VT_I2 }, + /*::[*/ 0x02 /*::]*/: { n: 'Category', t: VT_STRING }, + /*::[*/ 0x03 /*::]*/: { n: 'PresentationFormat', t: VT_STRING }, + /*::[*/ 0x04 /*::]*/: { n: 'ByteCount', t: VT_I4 }, + /*::[*/ 0x05 /*::]*/: { n: 'LineCount', t: VT_I4 }, + /*::[*/ 0x06 /*::]*/: { n: 'ParagraphCount', t: VT_I4 }, + /*::[*/ 0x07 /*::]*/: { n: 'SlideCount', t: VT_I4 }, + /*::[*/ 0x08 /*::]*/: { n: 'NoteCount', t: VT_I4 }, + /*::[*/ 0x09 /*::]*/: { n: 'HiddenCount', t: VT_I4 }, + /*::[*/ 0x0a /*::]*/: { n: 'MultimediaClipCount', t: VT_I4 }, + /*::[*/ 0x0b /*::]*/: { n: 'ScaleCrop', t: VT_BOOL }, + /*::[*/ 0x0c /*::]*/: { n: 'HeadingPairs', t: VT_VECTOR_VARIANT /* VT_VECTOR | VT_VARIANT */ }, + /*::[*/ 0x0d /*::]*/: { n: 'TitlesOfParts', t: VT_VECTOR_LPSTR /* VT_VECTOR | VT_LPSTR */ }, + /*::[*/ 0x0e /*::]*/: { n: 'Manager', t: VT_STRING }, + /*::[*/ 0x0f /*::]*/: { n: 'Company', t: VT_STRING }, + /*::[*/ 0x10 /*::]*/: { n: 'LinksUpToDate', t: VT_BOOL }, + /*::[*/ 0x11 /*::]*/: { n: 'CharacterCount', t: VT_I4 }, + /*::[*/ 0x13 /*::]*/: { n: 'SharedDoc', t: VT_BOOL }, + /*::[*/ 0x16 /*::]*/: { n: 'HyperlinksChanged', t: VT_BOOL }, + /*::[*/ 0x17 /*::]*/: { n: 'AppVersion', t: VT_I4, p: 'version' }, + /*::[*/ 0x18 /*::]*/: { n: 'DigSig', t: VT_BLOB }, + /*::[*/ 0x1A /*::]*/: { n: 'ContentType', t: VT_STRING }, + /*::[*/ 0x1B /*::]*/: { n: 'ContentStatus', t: VT_STRING }, + /*::[*/ 0x1C /*::]*/: { n: 'Language', t: VT_STRING }, + /*::[*/ 0x1D /*::]*/: { n: 'Version', t: VT_STRING }, + /*::[*/ 0xFF /*::]*/: {}, + /* [MS-OLEPS] 2.18 */ + /*::[*/ 0x80000000 /*::]*/: { n: 'Locale', t: VT_UI4 }, + /*::[*/ 0x80000003 /*::]*/: { n: 'Behavior', t: VT_UI4 }, + /*::[*/ 0x72627262 /*::]*/: {} +}; +/* [MS-OSHARED] 2.3.3.2.1.1 Summary Information Property Set PIDSI */ +var SummaryPIDSI = { + /*::[*/ 0x01 /*::]*/: { n: 'CodePage', t: VT_I2 }, + /*::[*/ 0x02 /*::]*/: { n: 'Title', t: VT_STRING }, + /*::[*/ 0x03 /*::]*/: { n: 'Subject', t: VT_STRING }, + /*::[*/ 0x04 /*::]*/: { n: 'Author', t: VT_STRING }, + /*::[*/ 0x05 /*::]*/: { n: 'Keywords', t: VT_STRING }, + /*::[*/ 0x06 /*::]*/: { n: 'Comments', t: VT_STRING }, + /*::[*/ 0x07 /*::]*/: { n: 'Template', t: VT_STRING }, + /*::[*/ 0x08 /*::]*/: { n: 'LastAuthor', t: VT_STRING }, + /*::[*/ 0x09 /*::]*/: { n: 'RevNumber', t: VT_STRING }, + /*::[*/ 0x0A /*::]*/: { n: 'EditTime', t: VT_FILETIME }, + /*::[*/ 0x0B /*::]*/: { n: 'LastPrinted', t: VT_FILETIME }, + /*::[*/ 0x0C /*::]*/: { n: 'CreatedDate', t: VT_FILETIME }, + /*::[*/ 0x0D /*::]*/: { n: 'ModifiedDate', t: VT_FILETIME }, + /*::[*/ 0x0E /*::]*/: { n: 'PageCount', t: VT_I4 }, + /*::[*/ 0x0F /*::]*/: { n: 'WordCount', t: VT_I4 }, + /*::[*/ 0x10 /*::]*/: { n: 'CharCount', t: VT_I4 }, + /*::[*/ 0x11 /*::]*/: { n: 'Thumbnail', t: VT_CF }, + /*::[*/ 0x12 /*::]*/: { n: 'Application', t: VT_STRING }, + /*::[*/ 0x13 /*::]*/: { n: 'DocSecurity', t: VT_I4 }, + /*::[*/ 0xFF /*::]*/: {}, + /* [MS-OLEPS] 2.18 */ + /*::[*/ 0x80000000 /*::]*/: { n: 'Locale', t: VT_UI4 }, + /*::[*/ 0x80000003 /*::]*/: { n: 'Behavior', t: VT_UI4 }, + /*::[*/ 0x72627262 /*::]*/: {} +}; +/* [MS-XLS] 2.4.63 Country/Region codes */ +var CountryEnum = { + /*::[*/ 0x0001 /*::]*/: "US", + /*::[*/ 0x0002 /*::]*/: "CA", + /*::[*/ 0x0003 /*::]*/: "", + /*::[*/ 0x0007 /*::]*/: "RU", + /*::[*/ 0x0014 /*::]*/: "EG", + /*::[*/ 0x001E /*::]*/: "GR", + /*::[*/ 0x001F /*::]*/: "NL", + /*::[*/ 0x0020 /*::]*/: "BE", + /*::[*/ 0x0021 /*::]*/: "FR", + /*::[*/ 0x0022 /*::]*/: "ES", + /*::[*/ 0x0024 /*::]*/: "HU", + /*::[*/ 0x0027 /*::]*/: "IT", + /*::[*/ 0x0029 /*::]*/: "CH", + /*::[*/ 0x002B /*::]*/: "AT", + /*::[*/ 0x002C /*::]*/: "GB", + /*::[*/ 0x002D /*::]*/: "DK", + /*::[*/ 0x002E /*::]*/: "SE", + /*::[*/ 0x002F /*::]*/: "NO", + /*::[*/ 0x0030 /*::]*/: "PL", + /*::[*/ 0x0031 /*::]*/: "DE", + /*::[*/ 0x0034 /*::]*/: "MX", + /*::[*/ 0x0037 /*::]*/: "BR", + /*::[*/ 0x003d /*::]*/: "AU", + /*::[*/ 0x0040 /*::]*/: "NZ", + /*::[*/ 0x0042 /*::]*/: "TH", + /*::[*/ 0x0051 /*::]*/: "JP", + /*::[*/ 0x0052 /*::]*/: "KR", + /*::[*/ 0x0054 /*::]*/: "VN", + /*::[*/ 0x0056 /*::]*/: "CN", + /*::[*/ 0x005A /*::]*/: "TR", + /*::[*/ 0x0069 /*::]*/: "JS", + /*::[*/ 0x00D5 /*::]*/: "DZ", + /*::[*/ 0x00D8 /*::]*/: "MA", + /*::[*/ 0x00DA /*::]*/: "LY", + /*::[*/ 0x015F /*::]*/: "PT", + /*::[*/ 0x0162 /*::]*/: "IS", + /*::[*/ 0x0166 /*::]*/: "FI", + /*::[*/ 0x01A4 /*::]*/: "CZ", + /*::[*/ 0x0376 /*::]*/: "TW", + /*::[*/ 0x03C1 /*::]*/: "LB", + /*::[*/ 0x03C2 /*::]*/: "JO", + /*::[*/ 0x03C3 /*::]*/: "SY", + /*::[*/ 0x03C4 /*::]*/: "IQ", + /*::[*/ 0x03C5 /*::]*/: "KW", + /*::[*/ 0x03C6 /*::]*/: "SA", + /*::[*/ 0x03CB /*::]*/: "AE", + /*::[*/ 0x03CC /*::]*/: "IL", + /*::[*/ 0x03CE /*::]*/: "QA", + /*::[*/ 0x03D5 /*::]*/: "IR", + /*::[*/ 0xFFFF /*::]*/: "US" // United States +}; +/* [MS-XLS] 2.5.127 */ +var XLSFillPattern = [ + null, + 'solid', + 'mediumGray', + 'darkGray', + 'lightGray', + 'darkHorizontal', + 'darkVertical', + 'darkDown', + 'darkUp', + 'darkGrid', + 'darkTrellis', + 'lightHorizontal', + 'lightVertical', + 'lightDown', + 'lightUp', + 'lightGrid', + 'lightTrellis', + 'gray125', + 'gray0625' +]; +function rgbify(arr /*:Array*/) { return arr.map(function (x) { return [(x >> 16) & 255, (x >> 8) & 255, x & 255]; }); } +/* [MS-XLS] 2.5.161 */ +/* [MS-XLSB] 2.5.75 Icv */ +var _XLSIcv = /*#__PURE__*/ rgbify([ + /* Color Constants */ + 0x000000, + 0xFFFFFF, + 0xFF0000, + 0x00FF00, + 0x0000FF, + 0xFFFF00, + 0xFF00FF, + 0x00FFFF, + /* Overridable Defaults */ + 0x000000, + 0xFFFFFF, + 0xFF0000, + 0x00FF00, + 0x0000FF, + 0xFFFF00, + 0xFF00FF, + 0x00FFFF, + 0x800000, + 0x008000, + 0x000080, + 0x808000, + 0x800080, + 0x008080, + 0xC0C0C0, + 0x808080, + 0x9999FF, + 0x993366, + 0xFFFFCC, + 0xCCFFFF, + 0x660066, + 0xFF8080, + 0x0066CC, + 0xCCCCFF, + 0x000080, + 0xFF00FF, + 0xFFFF00, + 0x00FFFF, + 0x800080, + 0x800000, + 0x008080, + 0x0000FF, + 0x00CCFF, + 0xCCFFFF, + 0xCCFFCC, + 0xFFFF99, + 0x99CCFF, + 0xFF99CC, + 0xCC99FF, + 0xFFCC99, + 0x3366FF, + 0x33CCCC, + 0x99CC00, + 0xFFCC00, + 0xFF9900, + 0xFF6600, + 0x666699, + 0x969696, + 0x003366, + 0x339966, + 0x003300, + 0x333300, + 0x993300, + 0x993366, + 0x333399, + 0x333333, + /* Other entries to appease BIFF8/12 */ + 0x000000, + 0xFFFFFF, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000, + 0x000000 /* 0x51 icvInfoText ?? */ +]); +var XLSIcv = /*#__PURE__*/ dup(_XLSIcv); +/* [MS-XLSB] 2.5.97.2 */ +var BErr = { + /*::[*/ 0x00 /*::]*/: "#NULL!", + /*::[*/ 0x07 /*::]*/: "#DIV/0!", + /*::[*/ 0x0F /*::]*/: "#VALUE!", + /*::[*/ 0x17 /*::]*/: "#REF!", + /*::[*/ 0x1D /*::]*/: "#NAME?", + /*::[*/ 0x24 /*::]*/: "#NUM!", + /*::[*/ 0x2A /*::]*/: "#N/A", + /*::[*/ 0x2B /*::]*/: "#GETTING_DATA", + /*::[*/ 0xFF /*::]*/: "#WTF?" +}; +//var RBErr = evert_num(BErr); +var RBErr = { + "#NULL!": 0x00, + "#DIV/0!": 0x07, + "#VALUE!": 0x0F, + "#REF!": 0x17, + "#NAME?": 0x1D, + "#NUM!": 0x24, + "#N/A": 0x2A, + "#GETTING_DATA": 0x2B, + "#WTF?": 0xFF +}; +var XLSLblBuiltIn = [ + "_xlnm.Consolidate_Area", + "_xlnm.Auto_Open", + "_xlnm.Auto_Close", + "_xlnm.Extract", + "_xlnm.Database", + "_xlnm.Criteria", + "_xlnm.Print_Area", + "_xlnm.Print_Titles", + "_xlnm.Recorder", + "_xlnm.Data_Form", + "_xlnm.Auto_Activate", + "_xlnm.Auto_Deactivate", + "_xlnm.Sheet_Title", + "_xlnm._FilterDatabase" +]; +/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */ +/* 12.3 Part Summary */ +/* 14.2 Part Summary */ +/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */ +var ct2type /*{[string]:string}*/ = ({ + /* Workbook */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks", + "application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks", + "application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks", + "application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks", + "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks", + /* Worksheet */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets", + "application/vnd.ms-excel.worksheet": "sheets", + "application/vnd.ms-excel.binIndexWs": "TODO", + /* Chartsheet */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts", + "application/vnd.ms-excel.chartsheet": "charts", + /* Macrosheet */ + "application/vnd.ms-excel.macrosheet+xml": "macros", + "application/vnd.ms-excel.macrosheet": "macros", + "application/vnd.ms-excel.intlmacrosheet": "TODO", + "application/vnd.ms-excel.binIndexMs": "TODO", + /* Dialogsheet */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs", + "application/vnd.ms-excel.dialogsheet": "dialogs", + /* Shared Strings */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs", + "application/vnd.ms-excel.sharedStrings": "strs", + /* Styles */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles", + "application/vnd.ms-excel.styles": "styles", + /* File Properties */ + "application/vnd.openxmlformats-package.core-properties+xml": "coreprops", + "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops", + "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops", + /* Custom Data Properties */ + "application/vnd.openxmlformats-officedocument.customXmlProperties+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty": "TODO", + /* Comments */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments", + "application/vnd.ms-excel.comments": "comments", + "application/vnd.ms-excel.threadedcomments+xml": "threadedcomments", + "application/vnd.ms-excel.person+xml": "people", + /* Metadata (Stock/Geography and Dynamic Array) */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata", + "application/vnd.ms-excel.sheetMetadata": "metadata", + /* PivotTable */ + "application/vnd.ms-excel.pivotTable": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml": "TODO", + /* Chart Objects */ + "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": "TODO", + /* Chart Colors */ + "application/vnd.ms-office.chartcolorstyle+xml": "TODO", + /* Chart Style */ + "application/vnd.ms-office.chartstyle+xml": "TODO", + /* Chart Advanced */ + "application/vnd.ms-office.chartex+xml": "TODO", + /* Calculation Chain */ + "application/vnd.ms-excel.calcChain": "calcchains", + "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml": "calcchains", + /* Printer Settings */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings": "TODO", + /* ActiveX */ + "application/vnd.ms-office.activeX": "TODO", + "application/vnd.ms-office.activeX+xml": "TODO", + /* Custom Toolbars */ + "application/vnd.ms-excel.attachedToolbars": "TODO", + /* External Data Connections */ + "application/vnd.ms-excel.connections": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": "TODO", + /* External Links */ + "application/vnd.ms-excel.externalLink": "links", + "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links", + /* PivotCache */ + "application/vnd.ms-excel.pivotCacheDefinition": "TODO", + "application/vnd.ms-excel.pivotCacheRecords": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml": "TODO", + /* Query Table */ + "application/vnd.ms-excel.queryTable": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml": "TODO", + /* Shared Workbook */ + "application/vnd.ms-excel.userNames": "TODO", + "application/vnd.ms-excel.revisionHeaders": "TODO", + "application/vnd.ms-excel.revisionLog": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml": "TODO", + /* Single Cell Table */ + "application/vnd.ms-excel.tableSingleCells": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml": "TODO", + /* Slicer */ + "application/vnd.ms-excel.slicer": "TODO", + "application/vnd.ms-excel.slicerCache": "TODO", + "application/vnd.ms-excel.slicer+xml": "TODO", + "application/vnd.ms-excel.slicerCache+xml": "TODO", + /* Sort Map */ + "application/vnd.ms-excel.wsSortMap": "TODO", + /* Table */ + "application/vnd.ms-excel.table": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": "TODO", + /* Themes */ + "application/vnd.openxmlformats-officedocument.theme+xml": "themes", + /* Theme Override */ + "application/vnd.openxmlformats-officedocument.themeOverride+xml": "TODO", + /* Timeline */ + "application/vnd.ms-excel.Timeline+xml": "TODO", + "application/vnd.ms-excel.TimelineCache+xml": "TODO", + /* VBA */ + "application/vnd.ms-office.vbaProject": "vba", + "application/vnd.ms-office.vbaProjectSignature": "TODO", + /* Volatile Dependencies */ + "application/vnd.ms-office.volatileDependencies": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml": "TODO", + /* Control Properties */ + "application/vnd.ms-excel.controlproperties+xml": "TODO", + /* Data Model */ + "application/vnd.openxmlformats-officedocument.model+data": "TODO", + /* Survey */ + "application/vnd.ms-excel.Survey+xml": "TODO", + /* Drawing */ + "application/vnd.openxmlformats-officedocument.drawing+xml": "drawings", + "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml": "TODO", + /* VML */ + "application/vnd.openxmlformats-officedocument.vmlDrawing": "TODO", + "application/vnd.openxmlformats-package.relationships+xml": "rels", + "application/vnd.openxmlformats-officedocument.oleObject": "TODO", + /* Image */ + "image/png": "TODO", + "sheet": "js" +} /*:any*/); +var CT_LIST = { + workbooks: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", + xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml", + xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main", + xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml", + xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml" + }, + strs: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", + xlsb: "application/vnd.ms-excel.sharedStrings" + }, + comments: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", + xlsb: "application/vnd.ms-excel.comments" + }, + sheets: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", + xlsb: "application/vnd.ms-excel.worksheet" + }, + charts: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml", + xlsb: "application/vnd.ms-excel.chartsheet" + }, + dialogs: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml", + xlsb: "application/vnd.ms-excel.dialogsheet" + }, + macros: { + xlsx: "application/vnd.ms-excel.macrosheet+xml", + xlsb: "application/vnd.ms-excel.macrosheet" + }, + metadata: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml", + xlsb: "application/vnd.ms-excel.sheetMetadata" + }, + styles: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", + xlsb: "application/vnd.ms-excel.styles" + } +}; +function new_ct() { + return ({ + workbooks: [], sheets: [], charts: [], dialogs: [], macros: [], + rels: [], strs: [], comments: [], threadedcomments: [], links: [], + coreprops: [], extprops: [], custprops: [], themes: [], styles: [], + calcchains: [], vba: [], drawings: [], metadata: [], people: [], + TODO: [], xmlns: "" + } /*:any*/); +} +function parse_ct(data /*:?string*/) { + var ct = new_ct(); + if (!data || !data.match) + return ct; + var ctext = {}; + (data.match(tagregex) || []).forEach(function (x) { + var y = parsexmltag(x); + switch (y[0].replace(nsregex, "<")) { + case ' 0 ? ct.calcchains[0] : ""; + ct.sst = ct.strs.length > 0 ? ct.strs[0] : ""; + ct.style = ct.styles.length > 0 ? ct.styles[0] : ""; + ct.defaults = ctext; + delete ct.calcchains; + return ct; +} +function write_ct(ct, opts, raw) { + var type2ct /*{[string]:Array}*/ = evert_arr(ct2type); + var o /*:Array*/ = [], v; + if (!raw) { + o[o.length] = (XML_HEADER); + o[o.length] = writextag('Types', null, { + 'xmlns': XMLNS.CT, + 'xmlns:xsd': XMLNS.xsd, + 'xmlns:xsi': XMLNS.xsi + }); + o = o.concat([ + ['xml', 'application/xml'], + ['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'], + ['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'], + ['data', 'application/vnd.openxmlformats-officedocument.model+data'], + /* from test files */ + ['bmp', 'image/bmp'], + ['png', 'image/png'], + ['gif', 'image/gif'], + ['emf', 'image/x-emf'], + ['wmf', 'image/x-wmf'], + ['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'], + ['tif', 'image/tiff'], ['tiff', 'image/tiff'], + ['pdf', 'application/pdf'], + ['rels', 'application/vnd.openxmlformats-package.relationships+xml'] + ].map(function (x) { + return writextag('Default', null, { 'Extension': x[0], 'ContentType': x[1] }); + })); + } + /* only write first instance */ + var f1 = function (w) { + if (ct[w] && ct[w].length > 0) { + v = ct[w][0]; + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "" : "/") + v, + 'ContentType': CT_LIST[w][opts.bookType] || CT_LIST[w]['xlsx'] + })); + } + }; + /* book type-specific */ + var f2 = function (w) { + (ct[w] || []).forEach(function (v) { + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "" : "/") + v, + 'ContentType': CT_LIST[w][opts.bookType] || CT_LIST[w]['xlsx'] + })); + }); + }; + /* standard type */ + var f3 = function (t) { + (ct[t] || []).forEach(function (v) { + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "" : "/") + v, + 'ContentType': type2ct[t][0] + })); + }); + }; + f1('workbooks'); + f2('sheets'); + f2('charts'); + f3('themes'); + ['strs', 'styles'].forEach(f1); + ['coreprops', 'extprops', 'custprops'].forEach(f3); + f3('vba'); + f3('comments'); + f3('threadedcomments'); + f3('drawings'); + f2('metadata'); + f3('people'); + if (!raw && o.length > 2) { + o[o.length] = (''); + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* 9.3 Relationships */ +var RELS = ({ + WB: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", + SHEET: "http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument", + HLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", + VML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing", + XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath", + XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing", + XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink", + CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", + CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", + CMNT: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", + CORE_PROPS: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", + EXT_PROPS: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties', + CUST_PROPS: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties', + SST: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings", + STY: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", + THEME: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", + CHART: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", + CHARTEX: "http://schemas.microsoft.com/office/2014/relationships/chartEx", + CS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet", + WS: [ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", + "http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet" + ], + DS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet", + MS: "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet", + IMG: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", + DRAW: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing", + XLMETA: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata", + TCMNT: "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment", + PEOPLE: "http://schemas.microsoft.com/office/2017/10/relationships/person", + CONN: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", + VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject" +} /*:any*/); +/* 9.3.3 Representing Relationships */ +function get_rels_path(file /*:string*/) { + var n = file.lastIndexOf("/"); + return file.slice(0, n + 1) + '_rels/' + file.slice(n + 1) + ".rels"; +} +function parse_rels(data /*:?string*/, currentFilePath /*:string*/) { + var rels = { "!id": {} }; + if (!data) + return rels; + if (currentFilePath.charAt(0) !== '/') { + currentFilePath = '/' + currentFilePath; + } + var hash = {}; + (data.match(tagregex) || []).forEach(function (x) { + var y = parsexmltag(x); + /* 9.3.2.2 OPC_Relationships */ + if (y[0] === ' 2) { + o[o.length] = (''); + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +function add_rels(rels, rId /*:number*/, f, type, relobj, targetmode /*:?string*/) { + if (!relobj) + relobj = {}; + if (!rels['!id']) + rels['!id'] = {}; + if (!rels['!idx']) + rels['!idx'] = 1; + if (rId < 0) + for (rId = rels['!idx']; rels['!id']['rId' + rId]; ++rId) { /* empty */ } + rels['!idx'] = rId + 1; + relobj.Id = 'rId' + rId; + relobj.Type = type; + relobj.Target = f; + if (targetmode) + relobj.TargetMode = targetmode; + else if ([RELS.HLINK, RELS.XPATH, RELS.XMISS].indexOf(relobj.Type) > -1) + relobj.TargetMode = "External"; + if (rels['!id'][relobj.Id]) + throw new Error("Cannot rewrite rId " + rId); + rels['!id'][relobj.Id] = relobj; + rels[('/' + relobj.Target).replace("//", "/")] = relobj; + return rId; +} +var CT_ODS = "application/vnd.oasis.opendocument.spreadsheet"; +function parse_manifest(d, opts) { + var str = xlml_normalize(d); + var Rn; + var FEtag; + while (Rn = xlmlregex.exec(str)) + switch (Rn[3]) { + case "manifest": + break; + case "file-entry": + FEtag = parsexmltag(Rn[0], false); + if (FEtag.path == "/" && FEtag.type !== CT_ODS) + throw new Error("This OpenDocument is not a spreadsheet"); + break; + case "encryption-data": + case "algorithm": + case "start-key-generation": + case "key-derivation": + throw new Error("Unsupported ODS Encryption"); + default: + if (opts && opts.WTF) + throw Rn; + } +} +function write_manifest(manifest) { + var o = [XML_HEADER]; + o.push('\n'); + o.push(' \n'); + for (var i = 0; i < manifest.length; ++i) + o.push(' \n'); + o.push(""); + return o.join(""); +} +function write_rdf_type(file, res, tag) { + return [ + ' \n', + ' \n', + " \n" + ].join(""); +} +function write_rdf_has(base, file) { + return [ + ' \n', + ' \n', + " \n" + ].join(""); +} +function write_rdf(rdf) { + var o = [XML_HEADER]; + o.push('\n'); + for (var i = 0; i != rdf.length; ++i) { + o.push(write_rdf_type(rdf[i][0], rdf[i][1])); + o.push(write_rdf_has("", rdf[i][0])); + } + o.push(write_rdf_type("", "Document", "pkg")); + o.push(""); + return o.join(""); +} +function write_meta_ods(wb, opts) { + return 'SheetJS ' + XLSX.version + ""; +} +/* ECMA-376 Part II 11.1 Core Properties Part */ +/* [MS-OSHARED] 2.3.3.2.[1-2].1 (PIDSI/PIDDSI) */ +var CORE_PROPS /*:Array >*/ = [ + ["cp:category", "Category"], + ["cp:contentStatus", "ContentStatus"], + ["cp:keywords", "Keywords"], + ["cp:lastModifiedBy", "LastAuthor"], + ["cp:lastPrinted", "LastPrinted"], + ["cp:revision", "RevNumber"], + ["cp:version", "Version"], + ["dc:creator", "Author"], + ["dc:description", "Comments"], + ["dc:identifier", "Identifier"], + ["dc:language", "Language"], + ["dc:subject", "Subject"], + ["dc:title", "Title"], + ["dcterms:created", "CreatedDate", 'date'], + ["dcterms:modified", "ModifiedDate", 'date'] +]; +var CORE_PROPS_REGEX /*:Array*/ = /*#__PURE__*/ (function () { + var r = new Array(CORE_PROPS.length); + for (var i = 0; i < CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i]; + var g = "(?:" + f[0].slice(0, f[0].indexOf(":")) + ":)" + f[0].slice(f[0].indexOf(":") + 1); + r[i] = new RegExp("<" + g + "[^>]*>([\\s\\S]*?)<\/" + g + ">"); + } + return r; +})(); +function parse_core_props(data) { + var p = {}; + data = utf8read(data); + for (var i = 0; i < CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]); + if (cur != null && cur.length > 0) + p[f[1]] = unescapexml(cur[1]); + if (f[2] === 'date' && p[f[1]]) + p[f[1]] = parseDate(p[f[1]]); + } + return p; +} +function cp_doit(f, g, h, o, p) { + if (p[f] != null || g == null || g === "") + return; + p[f] = g; + g = escapexml(g); + o[o.length] = (h ? writextag(f, g, h) : writetag(f, g)); +} +function write_core_props(cp, _opts) { + var opts = _opts || {}; + var o = [XML_HEADER, writextag('cp:coreProperties', null, { + //'xmlns': XMLNS.CORE_PROPS, + 'xmlns:cp': XMLNS.CORE_PROPS, + 'xmlns:dc': XMLNS.dc, + 'xmlns:dcterms': XMLNS.dcterms, + 'xmlns:dcmitype': XMLNS.dcmitype, + 'xmlns:xsi': XMLNS.xsi + })], p = {}; + if (!cp && !opts.Props) + return o.join(""); + if (cp) { + if (cp.CreatedDate != null) + cp_doit("dcterms:created", typeof cp.CreatedDate === "string" ? cp.CreatedDate : write_w3cdtf(cp.CreatedDate, opts.WTF), { "xsi:type": "dcterms:W3CDTF" }, o, p); + if (cp.ModifiedDate != null) + cp_doit("dcterms:modified", typeof cp.ModifiedDate === "string" ? cp.ModifiedDate : write_w3cdtf(cp.ModifiedDate, opts.WTF), { "xsi:type": "dcterms:W3CDTF" }, o, p); + } + for (var i = 0; i != CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i]; + var v = opts.Props && opts.Props[f[1]] != null ? opts.Props[f[1]] : cp ? cp[f[1]] : null; + if (v === true) + v = "1"; + else if (v === false) + v = "0"; + else if (typeof v == "number") + v = String(v); + if (v != null) + cp_doit(f[0], v, null, o, p); + } + if (o.length > 2) { + o[o.length] = (''); + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* 15.2.12.3 Extended File Properties Part */ +/* [MS-OSHARED] 2.3.3.2.[1-2].1 (PIDSI/PIDDSI) */ +var EXT_PROPS /*:Array >*/ = [ + ["Application", "Application", "string"], + ["AppVersion", "AppVersion", "string"], + ["Company", "Company", "string"], + ["DocSecurity", "DocSecurity", "string"], + ["Manager", "Manager", "string"], + ["HyperlinksChanged", "HyperlinksChanged", "bool"], + ["SharedDoc", "SharedDoc", "bool"], + ["LinksUpToDate", "LinksUpToDate", "bool"], + ["ScaleCrop", "ScaleCrop", "bool"], + ["HeadingPairs", "HeadingPairs", "raw"], + ["TitlesOfParts", "TitlesOfParts", "raw"] +]; +var PseudoPropsPairs = [ + "Worksheets", "SheetNames", + "NamedRanges", "DefinedNames", + "Chartsheets", "ChartNames" +]; +function load_props_pairs(HP /*:string|Array>*/, TOP, props, opts) { + var v = []; + if (typeof HP == "string") + v = parseVector(HP, opts); + else + for (var j = 0; j < HP.length; ++j) + v = v.concat(HP[j].map(function (hp) { return { v: hp }; })); + var parts = (typeof TOP == "string") ? parseVector(TOP, opts).map(function (x) { return x.v; }) : TOP; + var idx = 0, len = 0; + if (parts.length > 0) + for (var i = 0; i !== v.length; i += 2) { + len = +(v[i + 1].v); + switch (v[i].v) { + case "Worksheets": + case "工作表": + case "Листы": + case "أوراق العمل": + case "ワークシート": + case "×’×œ×™×•× ×•×ª עבודה": + case "Arbeitsblätter": + case "Çalışma Sayfaları": + case "Feuilles de calcul": + case "Fogli di lavoro": + case "Folhas de cálculo": + case "Planilhas": + case "Regneark": + case "Hojas de cálculo": + case "Werkbladen": + props.Worksheets = len; + props.SheetNames = parts.slice(idx, idx + len); + break; + case "Named Ranges": + case "Rangos con nombre": + case "名前付き一覧": + case "Benannte Bereiche": + case "Navngivne omrÃ¥der": + props.NamedRanges = len; + props.DefinedNames = parts.slice(idx, idx + len); + break; + case "Charts": + case "Diagramme": + props.Chartsheets = len; + props.ChartNames = parts.slice(idx, idx + len); + break; + } + idx += len; + } +} +function parse_ext_props(data, p, opts) { + var q = {}; + if (!p) + p = {}; + data = utf8read(data); + EXT_PROPS.forEach(function (f) { + var xml = (data.match(matchtag(f[0])) || [])[1]; + switch (f[2]) { + case "string": + if (xml) + p[f[1]] = unescapexml(xml); + break; + case "bool": + p[f[1]] = xml === "true"; + break; + case "raw": + var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">")); + if (cur && cur.length > 0) + q[f[1]] = cur[1]; + break; + } + }); + if (q.HeadingPairs && q.TitlesOfParts) + load_props_pairs(q.HeadingPairs, q.TitlesOfParts, p, opts); + return p; +} +function write_ext_props(cp /*::, opts*/) { + var o /*:Array*/ = [], W = writextag; + if (!cp) + cp = {}; + cp.Application = "SheetJS"; + o[o.length] = (XML_HEADER); + o[o.length] = (writextag('Properties', null, { + 'xmlns': XMLNS.EXT_PROPS, + 'xmlns:vt': XMLNS.vt + })); + EXT_PROPS.forEach(function (f) { + if (cp[f[1]] === undefined) + return; + var v; + switch (f[2]) { + case 'string': + v = escapexml(String(cp[f[1]])); + break; + case 'bool': + v = cp[f[1]] ? 'true' : 'false'; + break; + } + if (v !== undefined) + o[o.length] = (W(f[0], v)); + }); + /* TODO: HeadingPairs, TitlesOfParts */ + o[o.length] = (W('HeadingPairs', W('vt:vector', W('vt:variant', 'Worksheets') + W('vt:variant', W('vt:i4', String(cp.Worksheets))), { size: 2, baseType: "variant" }))); + o[o.length] = (W('TitlesOfParts', W('vt:vector', cp.SheetNames.map(function (s) { return "" + escapexml(s) + ""; }).join(""), { size: cp.Worksheets, baseType: "lpstr" }))); + if (o.length > 2) { + o[o.length] = (''); + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* 15.2.12.2 Custom File Properties Part */ +var custregex = /<[^>]+>[^<]*/g; +function parse_cust_props(data /*:string*/, opts) { + var p = {}, name = ""; + var m = data.match(custregex); + if (m) + for (var i = 0; i != m.length; ++i) { + var x = m[i], y = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': + name = null; + break; + default: if (x.indexOf(''); + var type = toks[0].slice(4), text = toks[1]; + /* 22.4.2.32 (CT_Variant). Omit the binary types from 22.4 (Variant Types) */ + switch (type) { + case 'lpstr': + case 'bstr': + case 'lpwstr': + p[name] = unescapexml(text); + break; + case 'bool': + p[name] = parsexmlbool(text); + break; + case 'i1': + case 'i2': + case 'i4': + case 'i8': + case 'int': + case 'uint': + p[name] = parseInt(text, 10); + break; + case 'r4': + case 'r8': + case 'decimal': + p[name] = parseFloat(text); + break; + case 'filetime': + case 'date': + p[name] = parseDate(text); + break; + case 'cy': + case 'error': + p[name] = unescapexml(text); + break; + default: + if (type.slice(-1) == '/') + break; + if (opts.WTF && typeof console !== 'undefined') + console.warn('Unexpected', x, type, toks); + } + } + else if (x.slice(0, 2) === " 2) { + o[o.length] = ''; + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* Common Name -> XLML Name */ +var XLMLDocPropsMap = { + Title: 'Title', + Subject: 'Subject', + Author: 'Author', + Keywords: 'Keywords', + Comments: 'Description', + LastAuthor: 'LastAuthor', + RevNumber: 'Revision', + Application: 'AppName', + /* TotalTime: 'TotalTime', */ + LastPrinted: 'LastPrinted', + CreatedDate: 'Created', + ModifiedDate: 'LastSaved', + /* Pages */ + /* Words */ + /* Characters */ + Category: 'Category', + /* PresentationFormat */ + Manager: 'Manager', + Company: 'Company', + /* Guid */ + /* HyperlinkBase */ + /* Bytes */ + /* Lines */ + /* Paragraphs */ + /* CharactersWithSpaces */ + AppVersion: 'Version', + ContentStatus: 'ContentStatus', + Identifier: 'Identifier', + Language: 'Language' /* NOTE: missing from schema */ +}; +var evert_XLMLDPM; +function xlml_set_prop(Props, tag /*:string*/, val) { + if (!evert_XLMLDPM) + evert_XLMLDPM = evert(XLMLDocPropsMap); + tag = evert_XLMLDPM[tag] || tag; + Props[tag] = val; +} +function xlml_write_docprops(Props, opts) { + var o /*:Array*/ = []; + keys(XLMLDocPropsMap).map(function (m) { + for (var i = 0; i < CORE_PROPS.length; ++i) + if (CORE_PROPS[i][1] == m) + return CORE_PROPS[i]; + for (i = 0; i < EXT_PROPS.length; ++i) + if (EXT_PROPS[i][1] == m) + return EXT_PROPS[i]; + throw m; + }).forEach(function (p) { + if (Props[p[1]] == null) + return; + var m = opts && opts.Props && opts.Props[p[1]] != null ? opts.Props[p[1]] : Props[p[1]]; + switch (p[2]) { + case 'date': + m = new Date(m).toISOString().replace(/\.\d*Z/, "Z"); + break; + } + if (typeof m == 'number') + m = String(m); + else if (m === true || m === false) { + m = m ? "1" : "0"; + } + else if (m instanceof Date) + m = new Date(m).toISOString().replace(/\.\d*Z/, ""); + o.push(writetag(XLMLDocPropsMap[p[1]] || p[1], m)); + }); + return writextag('DocumentProperties', o.join(""), { xmlns: XLMLNS.o }); +} +function xlml_write_custprops(Props, Custprops /*::, opts*/) { + var BLACKLIST = ["Worksheets", "SheetNames"]; + var T = 'CustomDocumentProperties'; + var o /*:Array*/ = []; + if (Props) + keys(Props).forEach(function (k) { + /*:: if(!Props) return; */ + if (!Object.prototype.hasOwnProperty.call(Props, k)) + return; + for (var i = 0; i < CORE_PROPS.length; ++i) + if (k == CORE_PROPS[i][1]) + return; + for (i = 0; i < EXT_PROPS.length; ++i) + if (k == EXT_PROPS[i][1]) + return; + for (i = 0; i < BLACKLIST.length; ++i) + if (k == BLACKLIST[i]) + return; + var m = Props[k]; + var t = "string"; + if (typeof m == 'number') { + t = "float"; + m = String(m); + } + else if (m === true || m === false) { + t = "boolean"; + m = m ? "1" : "0"; + } + else + m = String(m); + o.push(writextag(escapexmltag(k), m, { "dt:dt": t })); + }); + if (Custprops) + keys(Custprops).forEach(function (k) { + /*:: if(!Custprops) return; */ + if (!Object.prototype.hasOwnProperty.call(Custprops, k)) + return; + if (Props && Object.prototype.hasOwnProperty.call(Props, k)) + return; + var m = Custprops[k]; + var t = "string"; + if (typeof m == 'number') { + t = "float"; + m = String(m); + } + else if (m === true || m === false) { + t = "boolean"; + m = m ? "1" : "0"; + } + else if (m instanceof Date) { + t = "dateTime.tz"; + m = m.toISOString(); + } + else + m = String(m); + o.push(writextag(escapexmltag(k), m, { "dt:dt": t })); + }); + return '<' + T + ' xmlns="' + XLMLNS.o + '">' + o.join("") + ''; +} +/* [MS-DTYP] 2.3.3 FILETIME */ +/* [MS-OLEDS] 2.1.3 FILETIME (Packet Version) */ +/* [MS-OLEPS] 2.8 FILETIME (Packet Version) */ +function parse_FILETIME(blob) { + var dwLowDateTime = blob.read_shift(4), dwHighDateTime = blob.read_shift(4); + return new Date(((dwHighDateTime / 1e7 * Math.pow(2, 32) + dwLowDateTime / 1e7) - 11644473600) * 1000).toISOString().replace(/\.000/, ""); +} +function write_FILETIME(time /*:string|Date*/) { + var date = (typeof time == "string") ? new Date(Date.parse(time)) : time; + var t = date.getTime() / 1000 + 11644473600; + var l = t % Math.pow(2, 32), h = (t - l) / Math.pow(2, 32); + l *= 1e7; + h *= 1e7; + var w = (l / Math.pow(2, 32)) | 0; + if (w > 0) { + l = l % Math.pow(2, 32); + h += w; + } + var o = new_buf(8); + o.write_shift(4, l); + o.write_shift(4, h); + return o; +} +/* [MS-OSHARED] 2.3.3.1.4 Lpstr */ +function parse_lpstr(blob, type, pad /*:?number*/) { + var start = blob.l; + var str = blob.read_shift(0, 'lpstr-cp'); + if (pad) + while ((blob.l - start) & 3) + ++blob.l; + return str; +} +/* [MS-OSHARED] 2.3.3.1.6 Lpwstr */ +function parse_lpwstr(blob, type, pad) { + var str = blob.read_shift(0, 'lpwstr'); + if (pad) + blob.l += (4 - ((str.length + 1) & 3)) & 3; + return str; +} +/* [MS-OSHARED] 2.3.3.1.11 VtString */ +/* [MS-OSHARED] 2.3.3.1.12 VtUnalignedString */ +function parse_VtStringBase(blob, stringType, pad) { + if (stringType === 0x1F /*VT_LPWSTR*/) + return parse_lpwstr(blob); + return parse_lpstr(blob, stringType, pad); +} +function parse_VtString(blob, t /*:number*/, pad /*:?boolean*/) { return parse_VtStringBase(blob, t, pad === false ? 0 : 4); } +function parse_VtUnalignedString(blob, t /*:number*/) { if (!t) + throw new Error("VtUnalignedString must have positive length"); return parse_VtStringBase(blob, t, 0); } +/* [MS-OSHARED] 2.3.3.1.7 VtVecLpwstrValue */ +function parse_VtVecLpwstrValue(blob) { + var length = blob.read_shift(4); + var ret /*:Array*/ = []; + for (var i = 0; i != length; ++i) { + var start = blob.l; + ret[i] = blob.read_shift(0, 'lpwstr').replace(chr0, ''); + if ((blob.l - start) & 0x02) + blob.l += 2; + } + return ret; +} +/* [MS-OSHARED] 2.3.3.1.9 VtVecUnalignedLpstrValue */ +function parse_VtVecUnalignedLpstrValue(blob) { + var length = blob.read_shift(4); + var ret /*:Array*/ = []; + for (var i = 0; i != length; ++i) + ret[i] = blob.read_shift(0, 'lpstr-cp').replace(chr0, ''); + return ret; +} +/* [MS-OSHARED] 2.3.3.1.13 VtHeadingPair */ +function parse_VtHeadingPair(blob) { + var start = blob.l; + var headingString = parse_TypedPropertyValue(blob, VT_USTR); + if (blob[blob.l] == 0x00 && blob[blob.l + 1] == 0x00 && ((blob.l - start) & 0x02)) + blob.l += 2; + var headerParts = parse_TypedPropertyValue(blob, VT_I4); + return [headingString, headerParts]; +} +/* [MS-OSHARED] 2.3.3.1.14 VtVecHeadingPairValue */ +function parse_VtVecHeadingPairValue(blob) { + var cElements = blob.read_shift(4); + var out = []; + for (var i = 0; i < cElements / 2; ++i) + out.push(parse_VtHeadingPair(blob)); + return out; +} +/* [MS-OLEPS] 2.18.1 Dictionary (uses 2.17, 2.16) */ +function parse_dictionary(blob, CodePage) { + var cnt = blob.read_shift(4); + var dict /*:{[number]:string}*/ = ({} /*:any*/); + for (var j = 0; j != cnt; ++j) { + var pid = blob.read_shift(4); + var len = blob.read_shift(4); + dict[pid] = blob.read_shift(len, (CodePage === 0x4B0 ? 'utf16le' : 'utf8')).replace(chr0, '').replace(chr1, '!'); + if (CodePage === 0x4B0 && (len % 2)) + blob.l += 2; + } + if (blob.l & 3) + blob.l = (blob.l >> 2 + 1) << 2; + return dict; +} +/* [MS-OLEPS] 2.9 BLOB */ +function parse_BLOB(blob) { + var size = blob.read_shift(4); + var bytes = blob.slice(blob.l, blob.l + size); + blob.l += size; + if ((size & 3) > 0) + blob.l += (4 - (size & 3)) & 3; + return bytes; +} +/* [MS-OLEPS] 2.11 ClipboardData */ +function parse_ClipboardData(blob) { + // TODO + var o = {}; + o.Size = blob.read_shift(4); + //o.Format = blob.read_shift(4); + blob.l += o.Size + 3 - (o.Size - 1) % 4; + return o; +} +/* [MS-OLEPS] 2.15 TypedPropertyValue */ +function parse_TypedPropertyValue(blob, type /*:number*/, _opts) { + var t = blob.read_shift(2), ret, opts = _opts || {}; + blob.l += 2; + if (type !== VT_VARIANT) + if (t !== type && VT_CUSTOM.indexOf(type) === -1 && !((type & 0xFFFE) == 0x101E && (t & 0xFFFE) == 0x101E)) + throw new Error('Expected type ' + type + ' saw ' + t); + switch (type === VT_VARIANT ? t : type) { + case 0x02 /*VT_I2*/: + ret = blob.read_shift(2, 'i'); + if (!opts.raw) + blob.l += 2; + return ret; + case 0x03 /*VT_I4*/: + ret = blob.read_shift(4, 'i'); + return ret; + case 0x0B /*VT_BOOL*/: return blob.read_shift(4) !== 0x0; + case 0x13 /*VT_UI4*/: + ret = blob.read_shift(4); + return ret; + case 0x1E /*VT_LPSTR*/: return parse_lpstr(blob, t, 4).replace(chr0, ''); + case 0x1F /*VT_LPWSTR*/: return parse_lpwstr(blob); + case 0x40 /*VT_FILETIME*/: return parse_FILETIME(blob); + case 0x41 /*VT_BLOB*/: return parse_BLOB(blob); + case 0x47 /*VT_CF*/: return parse_ClipboardData(blob); + case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw).replace(chr0, ''); + case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t /*, 4*/).replace(chr0, ''); + case 0x100C /*VT_VECTOR|VT_VARIANT*/: return parse_VtVecHeadingPairValue(blob); + case 0x101E /*VT_VECTOR|VT_LPSTR*/: + case 0x101F /*VT_VECTOR|VT_LPWSTR*/: + return t == 0x101F ? parse_VtVecLpwstrValue(blob) : parse_VtVecUnalignedLpstrValue(blob); + default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + t); + } +} +function write_TypedPropertyValue(type /*:number*/, value) { + var o = new_buf(4), p = new_buf(4); + o.write_shift(4, type == 0x50 ? 0x1F : type); + switch (type) { + case 0x03 /*VT_I4*/: + p.write_shift(-4, value); + break; + case 0x05 /*VT_I4*/: + p = new_buf(8); + p.write_shift(8, value, 'f'); + break; + case 0x0B /*VT_BOOL*/: + p.write_shift(4, value ? 0x01 : 0x00); + break; + case 0x40 /*VT_FILETIME*/: /*:: if(typeof value !== "string" && !(value instanceof Date)) throw "unreachable"; */ + p = write_FILETIME(value); + break; + case 0x1F /*VT_LPWSTR*/: + case 0x50 /*VT_STRING*/: + /*:: if(typeof value !== "string") throw "unreachable"; */ + p = new_buf(4 + 2 * (value.length + 1) + (value.length % 2 ? 0 : 2)); + p.write_shift(4, value.length + 1); + p.write_shift(0, value, "dbcs"); + while (p.l != p.length) + p.write_shift(1, 0); + break; + default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + value); + } + return bconcat([o, p]); +} +/* [MS-OLEPS] 2.20 PropertySet */ +function parse_PropertySet(blob, PIDSI) { + var start_addr = blob.l; + var size = blob.read_shift(4); + var NumProps = blob.read_shift(4); + var Props = [], i = 0; + var CodePage = 0; + var Dictionary = -1, DictObj /*:{[number]:string}*/ = ({} /*:any*/); + for (i = 0; i != NumProps; ++i) { + var PropID = blob.read_shift(4); + var Offset = blob.read_shift(4); + Props[i] = [PropID, Offset + start_addr]; + } + Props.sort(function (x, y) { return x[1] - y[1]; }); + var PropH = {}; + for (i = 0; i != NumProps; ++i) { + if (blob.l !== Props[i][1]) { + var fail = true; + if (i > 0 && PIDSI) + switch (PIDSI[Props[i - 1][0]].t) { + case 0x02 /*VT_I2*/: + if (blob.l + 2 === Props[i][1]) { + blob.l += 2; + fail = false; + } + break; + case 0x50 /*VT_STRING*/: + if (blob.l <= Props[i][1]) { + blob.l = Props[i][1]; + fail = false; + } + break; + case 0x100C /*VT_VECTOR|VT_VARIANT*/: + if (blob.l <= Props[i][1]) { + blob.l = Props[i][1]; + fail = false; + } + break; + } + if ((!PIDSI || i == 0) && blob.l <= Props[i][1]) { + fail = false; + blob.l = Props[i][1]; + } + if (fail) + throw new Error("Read Error: Expected address " + Props[i][1] + ' at ' + blob.l + ' :' + i); + } + if (PIDSI) { + if (Props[i][0] == 0 && Props.length > i + 1 && Props[i][1] == Props[i + 1][1]) + continue; // R9 + var piddsi = PIDSI[Props[i][0]]; + PropH[piddsi.n] = parse_TypedPropertyValue(blob, piddsi.t, { raw: true }); + if (piddsi.p === 'version') + PropH[piddsi.n] = String(PropH[piddsi.n] >> 16) + "." + ("0000" + String(PropH[piddsi.n] & 0xFFFF)).slice(-4); + if (piddsi.n == "CodePage") + switch (PropH[piddsi.n]) { + case 0: PropH[piddsi.n] = 1252; + /* falls through */ + case 874: + case 932: + case 936: + case 949: + case 950: + case 1250: + case 1251: + case 1253: + case 1254: + case 1255: + case 1256: + case 1257: + case 1258: + case 10000: + case 1200: + case 1201: + case 1252: + case 65000: + case -536: + case 65001: + case -535: + set_cp(CodePage = (PropH[piddsi.n] >>> 0) & 0xFFFF); + break; + default: throw new Error("Unsupported CodePage: " + PropH[piddsi.n]); + } + } + else { + if (Props[i][0] === 0x1) { + CodePage = PropH.CodePage = (parse_TypedPropertyValue(blob, VT_I2) /*:number*/); + set_cp(CodePage); + if (Dictionary !== -1) { + var oldpos = blob.l; + blob.l = Props[Dictionary][1]; + DictObj = parse_dictionary(blob, CodePage); + blob.l = oldpos; + } + } + else if (Props[i][0] === 0) { + if (CodePage === 0) { + Dictionary = i; + blob.l = Props[i + 1][1]; + continue; + } + DictObj = parse_dictionary(blob, CodePage); + } + else { + var name = DictObj[Props[i][0]]; + var val; + /* [MS-OSHARED] 2.3.3.2.3.1.2 + PROPVARIANT */ + switch (blob[blob.l]) { + case 0x41 /*VT_BLOB*/: + blob.l += 4; + val = parse_BLOB(blob); + break; + case 0x1E /*VT_LPSTR*/: + blob.l += 4; + val = parse_VtString(blob, blob[blob.l - 4]).replace(/\u0000+$/, ""); + break; + case 0x1F /*VT_LPWSTR*/: + blob.l += 4; + val = parse_VtString(blob, blob[blob.l - 4]).replace(/\u0000+$/, ""); + break; + case 0x03 /*VT_I4*/: + blob.l += 4; + val = blob.read_shift(4, 'i'); + break; + case 0x13 /*VT_UI4*/: + blob.l += 4; + val = blob.read_shift(4); + break; + case 0x05 /*VT_R8*/: + blob.l += 4; + val = blob.read_shift(8, 'f'); + break; + case 0x0B /*VT_BOOL*/: + blob.l += 4; + val = parsebool(blob, 4); + break; + case 0x40 /*VT_FILETIME*/: + blob.l += 4; + val = parseDate(parse_FILETIME(blob)); + break; + default: throw new Error("unparsed value: " + blob[blob.l]); + } + PropH[name] = val; + } + } + } + blob.l = start_addr + size; /* step ahead to skip padding */ + return PropH; +} +var XLSPSSkip = ["CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID"]; +function guess_property_type(val /*:any*/) { + switch (typeof val) { + case "boolean": return 0x0B; + case "number": return ((val | 0) == val) ? 0x03 : 0x05; + case "string": return 0x1F; + case "object": + if (val instanceof Date) + return 0x40; + break; + } + return -1; +} +function write_PropertySet(entries, RE, PIDSI) { + var hdr = new_buf(8), piao = [], prop = []; + var sz = 8, i = 0; + var pr = new_buf(8), pio = new_buf(8); + pr.write_shift(4, 0x0002); + pr.write_shift(4, 0x04B0); + pio.write_shift(4, 0x0001); + prop.push(pr); + piao.push(pio); + sz += 8 + pr.length; + if (!RE) { + pio = new_buf(8); + pio.write_shift(4, 0); + piao.unshift(pio); + var bufs = [new_buf(4)]; + bufs[0].write_shift(4, entries.length); + for (i = 0; i < entries.length; ++i) { + var value = entries[i][0]; + pr = new_buf(4 + 4 + 2 * (value.length + 1) + (value.length % 2 ? 0 : 2)); + pr.write_shift(4, i + 2); + pr.write_shift(4, value.length + 1); + pr.write_shift(0, value, "dbcs"); + while (pr.l != pr.length) + pr.write_shift(1, 0); + bufs.push(pr); + } + pr = bconcat(bufs); + prop.unshift(pr); + sz += 8 + pr.length; + } + for (i = 0; i < entries.length; ++i) { + if (RE && !RE[entries[i][0]]) + continue; + if (XLSPSSkip.indexOf(entries[i][0]) > -1 || PseudoPropsPairs.indexOf(entries[i][0]) > -1) + continue; + if (entries[i][1] == null) + continue; + var val = entries[i][1], idx = 0; + if (RE) { + idx = +RE[entries[i][0]]; + var pinfo = (PIDSI /*:: || {}*/)[idx] /*:: || {} */; + if (pinfo.p == "version" && typeof val == "string") { + /*:: if(typeof val !== "string") throw "unreachable"; */ + var arr = val.split("."); + val = ((+arr[0]) << 16) + ((+arr[1]) || 0); + } + pr = write_TypedPropertyValue(pinfo.t, val); + } + else { + var T = guess_property_type(val); + if (T == -1) { + T = 0x1F; + val = String(val); + } + pr = write_TypedPropertyValue(T, val); + } + prop.push(pr); + pio = new_buf(8); + pio.write_shift(4, !RE ? 2 + i : idx); + piao.push(pio); + sz += 8 + pr.length; + } + var w = 8 * (prop.length + 1); + for (i = 0; i < prop.length; ++i) { + piao[i].write_shift(4, w); + w += prop[i].length; + } + hdr.write_shift(4, sz); + hdr.write_shift(4, prop.length); + return bconcat([hdr].concat(piao).concat(prop)); +} +/* [MS-OLEPS] 2.21 PropertySetStream */ +function parse_PropertySetStream(file, PIDSI, clsid) { + var blob = file.content; + if (!blob) + return ({} /*:any*/); + prep_blob(blob, 0); + var NumSets, FMTID0, FMTID1, Offset0, Offset1 = 0; + blob.chk('feff', 'Byte Order: '); + /*var vers = */ blob.read_shift(2); // TODO: check version + var SystemIdentifier = blob.read_shift(4); + var CLSID = blob.read_shift(16); + if (CLSID !== CFB.utils.consts.HEADER_CLSID && CLSID !== clsid) + throw new Error("Bad PropertySet CLSID " + CLSID); + NumSets = blob.read_shift(4); + if (NumSets !== 1 && NumSets !== 2) + throw new Error("Unrecognized #Sets: " + NumSets); + FMTID0 = blob.read_shift(16); + Offset0 = blob.read_shift(4); + if (NumSets === 1 && Offset0 !== blob.l) + throw new Error("Length mismatch: " + Offset0 + " !== " + blob.l); + else if (NumSets === 2) { + FMTID1 = blob.read_shift(16); + Offset1 = blob.read_shift(4); + } + var PSet0 = parse_PropertySet(blob, PIDSI); + var rval = ({ SystemIdentifier: SystemIdentifier } /*:any*/); + for (var y in PSet0) + rval[y] = PSet0[y]; + //rval.blob = blob; + rval.FMTID = FMTID0; + //rval.PSet0 = PSet0; + if (NumSets === 1) + return rval; + if (Offset1 - blob.l == 2) + blob.l += 2; + if (blob.l !== Offset1) + throw new Error("Length mismatch 2: " + blob.l + " !== " + Offset1); + var PSet1; + try { + PSet1 = parse_PropertySet(blob, null); + } + catch (e) { /* empty */ } + for (y in PSet1) + rval[y] = PSet1[y]; + rval.FMTID = [FMTID0, FMTID1]; // TODO: verify FMTID0/1 + return rval; +} +function write_PropertySetStream(entries, clsid, RE, PIDSI /*:{[key:string|number]:any}*/, entries2 /*:?any*/, clsid2 /*:?any*/) { + var hdr = new_buf(entries2 ? 68 : 48); + var bufs = [hdr]; + hdr.write_shift(2, 0xFFFE); + hdr.write_shift(2, 0x0000); /* TODO: type 1 props */ + hdr.write_shift(4, 0x32363237); + hdr.write_shift(16, CFB.utils.consts.HEADER_CLSID, "hex"); + hdr.write_shift(4, (entries2 ? 2 : 1)); + hdr.write_shift(16, clsid, "hex"); + hdr.write_shift(4, (entries2 ? 68 : 48)); + var ps0 = write_PropertySet(entries, RE, PIDSI); + bufs.push(ps0); + if (entries2) { + var ps1 = write_PropertySet(entries2, null, null); + hdr.write_shift(16, clsid2, "hex"); + hdr.write_shift(4, 68 + ps0.length); + bufs.push(ps1); + } + return bconcat(bufs); +} +function parsenoop2(blob, length) { blob.read_shift(length); return null; } +function writezeroes(n, o) { if (!o) + o = new_buf(n); for (var j = 0; j < n; ++j) + o.write_shift(1, 0); return o; } +function parslurp(blob, length, cb) { + var arr = [], target = blob.l + length; + while (blob.l < target) + arr.push(cb(blob, target - blob.l)); + if (target !== blob.l) + throw new Error("Slurp error"); + return arr; +} +function parsebool(blob, length /*:number*/) { return blob.read_shift(length) === 0x1; } +function writebool(v /*:any*/, o) { if (!o) + o = new_buf(2); o.write_shift(2, +!!v); return o; } +function parseuint16(blob /*::, length:?number, opts:?any*/) { return blob.read_shift(2, 'u'); } +function writeuint16(v /*:number*/, o) { if (!o) + o = new_buf(2); o.write_shift(2, v); return o; } +function parseuint16a(blob, length /*:: :?number, opts:?any*/) { return parslurp(blob, length, parseuint16); } +/* --- 2.5 Structures --- */ +/* [MS-XLS] 2.5.10 Bes (boolean or error) */ +function parse_Bes(blob /*::, length*/) { + var v = blob.read_shift(1), t = blob.read_shift(1); + return t === 0x01 ? v : v === 0x01; +} +function write_Bes(v, t /*:string*/, o) { + if (!o) + o = new_buf(2); + o.write_shift(1, ((t == 'e') ? +v : +!!v)); + o.write_shift(1, ((t == 'e') ? 1 : 0)); + return o; +} +/* [MS-XLS] 2.5.240 ShortXLUnicodeString */ +function parse_ShortXLUnicodeString(blob, length, opts) { + var cch = blob.read_shift(opts && opts.biff >= 12 ? 2 : 1); + var encoding = 'sbcs-cont'; + var cp = current_codepage; + if (opts && opts.biff >= 8) + current_codepage = 1200; + if (!opts || opts.biff == 8) { + var fHighByte = blob.read_shift(1); + if (fHighByte) { + encoding = 'dbcs-cont'; + } + } + else if (opts.biff == 12) { + encoding = 'wstr'; + } + if (opts.biff >= 2 && opts.biff <= 5) + encoding = 'cpstr'; + var o = cch ? blob.read_shift(cch, encoding) : ""; + current_codepage = cp; + return o; +} +/* 2.5.293 XLUnicodeRichExtendedString */ +function parse_XLUnicodeRichExtendedString(blob) { + var cp = current_codepage; + current_codepage = 1200; + var cch = blob.read_shift(2), flags = blob.read_shift(1); + var /*fHighByte = flags & 0x1,*/ fExtSt = flags & 0x4, fRichSt = flags & 0x8; + var width = 1 + (flags & 0x1); // 0x0 -> utf8, 0x1 -> dbcs + var cRun = 0, cbExtRst; + var z = {}; + if (fRichSt) + cRun = blob.read_shift(2); + if (fExtSt) + cbExtRst = blob.read_shift(4); + var encoding = width == 2 ? 'dbcs-cont' : 'sbcs-cont'; + var msg = cch === 0 ? "" : blob.read_shift(cch, encoding); + if (fRichSt) + blob.l += 4 * cRun; //TODO: parse this + if (fExtSt) + blob.l += cbExtRst; //TODO: parse this + z.t = msg; + if (!fRichSt) { + z.raw = "" + z.t + ""; + z.r = z.t; + } + current_codepage = cp; + return z; +} +function write_XLUnicodeRichExtendedString(xlstr /*:: :XLString, opts*/) { + var str = (xlstr.t || ""), nfmts = 1; + var hdr = new_buf(3 + (nfmts > 1 ? 2 : 0)); + hdr.write_shift(2, str.length); + hdr.write_shift(1, (nfmts > 1 ? 0x08 : 0x00) | 0x01); + if (nfmts > 1) + hdr.write_shift(2, nfmts); + var otext = new_buf(2 * str.length); + otext.write_shift(2 * str.length, str, 'utf16le'); + var out = [hdr, otext]; + return bconcat(out); +} +/* 2.5.296 XLUnicodeStringNoCch */ +function parse_XLUnicodeStringNoCch(blob, cch, opts) { + var retval; + if (opts) { + if (opts.biff >= 2 && opts.biff <= 5) + return blob.read_shift(cch, 'cpstr'); + if (opts.biff >= 12) + return blob.read_shift(cch, 'dbcs-cont'); + } + var fHighByte = blob.read_shift(1); + if (fHighByte === 0) { + retval = blob.read_shift(cch, 'sbcs-cont'); + } + else { + retval = blob.read_shift(cch, 'dbcs-cont'); + } + return retval; +} +/* 2.5.294 XLUnicodeString */ +function parse_XLUnicodeString(blob, length, opts) { + var cch = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + if (cch === 0) { + blob.l++; + return ""; + } + return parse_XLUnicodeStringNoCch(blob, cch, opts); +} +/* BIFF5 override */ +function parse_XLUnicodeString2(blob, length, opts) { + if (opts.biff > 5) + return parse_XLUnicodeString(blob, length, opts); + var cch = blob.read_shift(1); + if (cch === 0) { + blob.l++; + return ""; + } + return blob.read_shift(cch, (opts.biff <= 4 || !blob.lens) ? 'cpstr' : 'sbcs-cont'); +} +/* TODO: BIFF5 and lower, codepage awareness */ +function write_XLUnicodeString(str, opts, o) { + if (!o) + o = new_buf(3 + 2 * str.length); + o.write_shift(2, str.length); + o.write_shift(1, 1); + o.write_shift(31, str, 'utf16le'); + return o; +} +/* [MS-XLS] 2.5.61 ControlInfo */ +function parse_ControlInfo(blob /*::, length, opts*/) { + var flags = blob.read_shift(1); + blob.l++; + var accel = blob.read_shift(2); + blob.l += 2; + return [flags, accel]; +} +/* [MS-OSHARED] 2.3.7.6 URLMoniker TODO: flags */ +function parse_URLMoniker(blob /*::, length, opts*/) { + var len = blob.read_shift(4), start = blob.l; + var extra = false; + if (len > 24) { + /* look ahead */ + blob.l += len - 24; + if (blob.read_shift(16) === "795881f43b1d7f48af2c825dc4852763") + extra = true; + blob.l = start; + } + var url = blob.read_shift((extra ? len - 24 : len) >> 1, 'utf16le').replace(chr0, ""); + if (extra) + blob.l += 24; + return url; +} +/* [MS-OSHARED] 2.3.7.8 FileMoniker TODO: all fields */ +function parse_FileMoniker(blob /*::, length*/) { + var cAnti = blob.read_shift(2); + var preamble = ""; + while (cAnti-- > 0) + preamble += "../"; + var ansiPath = blob.read_shift(0, 'lpstr-ansi'); + blob.l += 2; //var endServer = blob.read_shift(2); + if (blob.read_shift(2) != 0xDEAD) + throw new Error("Bad FileMoniker"); + var sz = blob.read_shift(4); + if (sz === 0) + return preamble + ansiPath.replace(/\\/g, "/"); + var bytes = blob.read_shift(4); + if (blob.read_shift(2) != 3) + throw new Error("Bad FileMoniker"); + var unicodePath = blob.read_shift(bytes >> 1, 'utf16le').replace(chr0, ""); + return preamble + unicodePath; +} +/* [MS-OSHARED] 2.3.7.2 HyperlinkMoniker TODO: all the monikers */ +function parse_HyperlinkMoniker(blob, length) { + var clsid = blob.read_shift(16); + length -= 16; + switch (clsid) { + case "e0c9ea79f9bace118c8200aa004ba90b": return parse_URLMoniker(blob, length); + case "0303000000000000c000000000000046": return parse_FileMoniker(blob, length); + default: throw new Error("Unsupported Moniker " + clsid); + } +} +/* [MS-OSHARED] 2.3.7.9 HyperlinkString */ +function parse_HyperlinkString(blob /*::, length*/) { + var len = blob.read_shift(4); + var o = len > 0 ? blob.read_shift(len, 'utf16le').replace(chr0, "") : ""; + return o; +} +function write_HyperlinkString(str /*:string*/, o) { + if (!o) + o = new_buf(6 + str.length * 2); + o.write_shift(4, 1 + str.length); + for (var i = 0; i < str.length; ++i) + o.write_shift(2, str.charCodeAt(i)); + o.write_shift(2, 0); + return o; +} +/* [MS-OSHARED] 2.3.7.1 Hyperlink Object */ +function parse_Hyperlink(blob, length) { + var end = blob.l + length; + var sVer = blob.read_shift(4); + if (sVer !== 2) + throw new Error("Unrecognized streamVersion: " + sVer); + var flags = blob.read_shift(2); + blob.l += 2; + var displayName, targetFrameName, moniker, oleMoniker, Loc = "", guid, fileTime; + if (flags & 0x0010) + displayName = parse_HyperlinkString(blob, end - blob.l); + if (flags & 0x0080) + targetFrameName = parse_HyperlinkString(blob, end - blob.l); + if ((flags & 0x0101) === 0x0101) + moniker = parse_HyperlinkString(blob, end - blob.l); + if ((flags & 0x0101) === 0x0001) + oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l); + if (flags & 0x0008) + Loc = parse_HyperlinkString(blob, end - blob.l); + if (flags & 0x0020) + guid = blob.read_shift(16); + if (flags & 0x0040) + fileTime = parse_FILETIME(blob /*, 8*/); + blob.l = end; + var target = targetFrameName || moniker || oleMoniker || ""; + if (target && Loc) + target += "#" + Loc; + if (!target) + target = "#" + Loc; + if ((flags & 0x0002) && target.charAt(0) == "/" && target.charAt(1) != "/") + target = "file://" + target; + var out = ({ Target: target } /*:any*/); + if (guid) + out.guid = guid; + if (fileTime) + out.time = fileTime; + if (displayName) + out.Tooltip = displayName; + return out; +} +function write_Hyperlink(hl) { + var out = new_buf(512), i = 0; + var Target = hl.Target; + if (Target.slice(0, 7) == "file://") + Target = Target.slice(7); + var hashidx = Target.indexOf("#"); + var F = hashidx > -1 ? 0x1f : 0x17; + switch (Target.charAt(0)) { + case "#": + F = 0x1c; + break; + case ".": + F &= ~2; + break; + } + out.write_shift(4, 2); + out.write_shift(4, F); + var data = [8, 6815827, 6619237, 4849780, 83]; + for (i = 0; i < data.length; ++i) + out.write_shift(4, data[i]); + if (F == 0x1C) { + Target = Target.slice(1); + write_HyperlinkString(Target, out); + } + else if (F & 0x02) { + data = "e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "); + for (i = 0; i < data.length; ++i) + out.write_shift(1, parseInt(data[i], 16)); + var Pretarget = hashidx > -1 ? Target.slice(0, hashidx) : Target; + out.write_shift(4, 2 * (Pretarget.length + 1)); + for (i = 0; i < Pretarget.length; ++i) + out.write_shift(2, Pretarget.charCodeAt(i)); + out.write_shift(2, 0); + if (F & 0x08) + write_HyperlinkString(hashidx > -1 ? Target.slice(hashidx + 1) : "", out); + } + else { + data = "03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "); + for (i = 0; i < data.length; ++i) + out.write_shift(1, parseInt(data[i], 16)); + var P = 0; + while (Target.slice(P * 3, P * 3 + 3) == "../" || Target.slice(P * 3, P * 3 + 3) == "..\\") + ++P; + out.write_shift(2, P); + out.write_shift(4, Target.length - 3 * P + 1); + for (i = 0; i < Target.length - 3 * P; ++i) + out.write_shift(1, Target.charCodeAt(i + 3 * P) & 0xFF); + out.write_shift(1, 0); + out.write_shift(2, 0xFFFF); + out.write_shift(2, 0xDEAD); + for (i = 0; i < 6; ++i) + out.write_shift(4, 0); + } + return out.slice(0, out.l); +} +/* 2.5.178 LongRGBA */ +function parse_LongRGBA(blob /*::, length*/) { var r = blob.read_shift(1), g = blob.read_shift(1), b = blob.read_shift(1), a = blob.read_shift(1); return [r, g, b, a]; } +/* 2.5.177 LongRGB */ +function parse_LongRGB(blob, length) { var x = parse_LongRGBA(blob, length); x[3] = 0; return x; } +/* [MS-XLS] 2.5.19 */ +function parse_XLSCell(blob, length, opts) { + var rw = blob.read_shift(2); // 0-indexed + var col = blob.read_shift(2); + var ret = ({ r: rw, c: col, ixfe: 0 } /*:any*/); + if (opts && opts.biff == 2 || length == 7) { + /* TODO: pass back flags */ + var flags = blob.read_shift(1); + ret.ixfe = flags & 0x3F; + blob.l += 2; + /* + var ifntifmt = blob.read_shift(1); + var ifmt = ifntifmt & 0x3f, ifnt = ifntifmt >> 6; + var flags3 = blob.read_shift(1); + */ + } + else + ret.ixfe = blob.read_shift(2); + return ret; +} +function write_XLSCell(R /*:number*/, C /*:number*/, ixfe /*:?number*/, o) { + if (!o) + o = new_buf(6); + o.write_shift(2, R); + o.write_shift(2, C); + o.write_shift(2, ixfe || 0); + return o; +} +/* [MS-XLS] 2.5.134 */ +function parse_frtHeader(blob) { + var rt = blob.read_shift(2); + var flags = blob.read_shift(2); // TODO: parse these flags + blob.l += 8; + return { type: rt, flags: flags }; +} +function parse_OptXLUnicodeString(blob, length, opts) { return length === 0 ? "" : parse_XLUnicodeString2(blob, length, opts); } +/* [MS-XLS] 2.5.344 */ +function parse_XTI(blob, length, opts) { + var w = opts.biff > 8 ? 4 : 2; + var iSupBook = blob.read_shift(w), itabFirst = blob.read_shift(w, 'i'), itabLast = blob.read_shift(w, 'i'); + return [iSupBook, itabFirst, itabLast]; +} +/* [MS-XLS] 2.5.218 */ +function parse_RkRec(blob) { + var ixfe = blob.read_shift(2); + var RK = parse_RkNumber(blob); + return [ixfe, RK]; +} +/* [MS-XLS] 2.5.1 */ +function parse_AddinUdf(blob, length, opts) { + blob.l += 4; + length -= 4; + var l = blob.l + length; + var udfName = parse_ShortXLUnicodeString(blob, length, opts); + var cb = blob.read_shift(2); + l -= blob.l; + if (cb !== l) + throw new Error("Malformed AddinUdf: padding = " + l + " != " + cb); + blob.l += cb; + return udfName; +} +/* [MS-XLS] 2.5.209 TODO: Check sizes */ +function parse_Ref8U(blob /*::, length*/) { + var rwFirst = blob.read_shift(2); + var rwLast = blob.read_shift(2); + var colFirst = blob.read_shift(2); + var colLast = blob.read_shift(2); + return { s: { c: colFirst, r: rwFirst }, e: { c: colLast, r: rwLast } }; +} +function write_Ref8U(r /*:Range*/, o) { + if (!o) + o = new_buf(8); + o.write_shift(2, r.s.r); + o.write_shift(2, r.e.r); + o.write_shift(2, r.s.c); + o.write_shift(2, r.e.c); + return o; +} +/* [MS-XLS] 2.5.211 */ +function parse_RefU(blob /*::, length*/) { + var rwFirst = blob.read_shift(2); + var rwLast = blob.read_shift(2); + var colFirst = blob.read_shift(1); + var colLast = blob.read_shift(1); + return { s: { c: colFirst, r: rwFirst }, e: { c: colLast, r: rwLast } }; +} +/* [MS-XLS] 2.5.207 */ +var parse_Ref = parse_RefU; +/* [MS-XLS] 2.5.143 */ +function parse_FtCmo(blob /*::, length*/) { + blob.l += 4; + var ot = blob.read_shift(2); + var id = blob.read_shift(2); + var flags = blob.read_shift(2); + blob.l += 12; + return [id, ot, flags]; +} +/* [MS-XLS] 2.5.149 */ +function parse_FtNts(blob) { + var out = {}; + blob.l += 4; + blob.l += 16; // GUID TODO + out.fSharedNote = blob.read_shift(2); + blob.l += 4; + return out; +} +/* [MS-XLS] 2.5.142 */ +function parse_FtCf(blob) { + var out = {}; + blob.l += 4; + blob.cf = blob.read_shift(2); + return out; +} +/* [MS-XLS] 2.5.140 - 2.5.154 and friends */ +function parse_FtSkip(blob) { blob.l += 2; blob.l += blob.read_shift(2); } +var FtTab = { + /*::[*/ 0x00 /*::]*/: parse_FtSkip, + /*::[*/ 0x04 /*::]*/: parse_FtSkip, + /*::[*/ 0x05 /*::]*/: parse_FtSkip, + /*::[*/ 0x06 /*::]*/: parse_FtSkip, + /*::[*/ 0x07 /*::]*/: parse_FtCf, + /*::[*/ 0x08 /*::]*/: parse_FtSkip, + /*::[*/ 0x09 /*::]*/: parse_FtSkip, + /*::[*/ 0x0A /*::]*/: parse_FtSkip, + /*::[*/ 0x0B /*::]*/: parse_FtSkip, + /*::[*/ 0x0C /*::]*/: parse_FtSkip, + /*::[*/ 0x0D /*::]*/: parse_FtNts, + /*::[*/ 0x0E /*::]*/: parse_FtSkip, + /*::[*/ 0x0F /*::]*/: parse_FtSkip, + /*::[*/ 0x10 /*::]*/: parse_FtSkip, + /*::[*/ 0x11 /*::]*/: parse_FtSkip, + /*::[*/ 0x12 /*::]*/: parse_FtSkip, + /*::[*/ 0x13 /*::]*/: parse_FtSkip, + /*::[*/ 0x14 /*::]*/: parse_FtSkip, + /*::[*/ 0x15 /*::]*/: parse_FtCmo +}; +function parse_FtArray(blob, length /*::, ot*/) { + var tgt = blob.l + length; + var fts = []; + while (blob.l < tgt) { + var ft = blob.read_shift(2); + blob.l -= 2; + try { + fts[ft] = FtTab[ft](blob, tgt - blob.l); + } + catch (e) { + blob.l = tgt; + return fts; + } + } + if (blob.l != tgt) + blob.l = tgt; //throw new Error("bad Object Ft-sequence"); + return fts; +} +/* --- 2.4 Records --- */ +/* [MS-XLS] 2.4.21 */ +function parse_BOF(blob, length) { + var o = { BIFFVer: 0, dt: 0 }; + o.BIFFVer = blob.read_shift(2); + length -= 2; + if (length >= 2) { + o.dt = blob.read_shift(2); + blob.l -= 2; + } + switch (o.BIFFVer) { + case 0x0600: /* BIFF8 */ + case 0x0500: /* BIFF5 */ + case 0x0400: /* BIFF4 */ + case 0x0300: /* BIFF3 */ + case 0x0200: /* BIFF2 */ + case 0x0002: + case 0x0007: /* BIFF2 */ + break; + default: if (length > 6) + throw new Error("Unexpected BIFF Ver " + o.BIFFVer); + } + blob.read_shift(length); + return o; +} +function write_BOF(wb /*:Workbook*/, t /*:number*/, o) { + var h = 0x0600, w = 16; + switch (o.bookType) { + case 'biff8': break; + case 'biff5': + h = 0x0500; + w = 8; + break; + case 'biff4': + h = 0x0004; + w = 6; + break; + case 'biff3': + h = 0x0003; + w = 6; + break; + case 'biff2': + h = 0x0002; + w = 4; + break; + case 'xla': break; + default: throw new Error("unsupported BIFF version"); + } + var out = new_buf(w); + out.write_shift(2, h); + out.write_shift(2, t); + if (w > 4) + out.write_shift(2, 0x7262); + if (w > 6) + out.write_shift(2, 0x07CD); + if (w > 8) { + out.write_shift(2, 0xC009); + out.write_shift(2, 0x0001); + out.write_shift(2, 0x0706); + out.write_shift(2, 0x0000); + } + return out; +} +/* [MS-XLS] 2.4.146 */ +function parse_InterfaceHdr(blob, length) { + if (length === 0) + return 0x04b0; + if ((blob.read_shift(2)) !== 0x04b0) { /* empty */ } + return 0x04b0; +} +/* [MS-XLS] 2.4.349 */ +function parse_WriteAccess(blob, length, opts) { + if (opts.enc) { + blob.l += length; + return ""; + } + var l = blob.l; + // TODO: make sure XLUnicodeString doesnt overrun + var UserName = parse_XLUnicodeString2(blob, 0, opts); + blob.read_shift(length + l - blob.l); + return UserName; +} +function write_WriteAccess(s /*:string*/, opts) { + var b8 = !opts || opts.biff == 8; + var o = new_buf(b8 ? 112 : 54); + o.write_shift(opts.biff == 8 ? 2 : 1, 7); + if (b8) + o.write_shift(1, 0); + o.write_shift(4, 0x33336853); + o.write_shift(4, (0x00534A74 | (b8 ? 0 : 0x20000000))); + while (o.l < o.length) + o.write_shift(1, (b8 ? 0 : 32)); + return o; +} +/* [MS-XLS] 2.4.351 */ +function parse_WsBool(blob, length, opts) { + var flags = opts && opts.biff == 8 || length == 2 ? blob.read_shift(2) : (blob.l += length, 0); + return { fDialog: flags & 0x10, fBelow: flags & 0x40, fRight: flags & 0x80 }; +} +/* [MS-XLS] 2.4.28 */ +function parse_BoundSheet8(blob, length, opts) { + var name = ""; + if (opts.biff == 4) { + name = parse_ShortXLUnicodeString(blob, 0, opts); + if (name.length === 0) + name = "Sheet1"; + return { name: name }; + } + var pos = blob.read_shift(4); + var hidden = blob.read_shift(1) & 0x03; + var dt = blob.read_shift(1); + switch (dt) { + case 0: + dt = 'Worksheet'; + break; + case 1: + dt = 'Macrosheet'; + break; + case 2: + dt = 'Chartsheet'; + break; + case 6: + dt = 'VBAModule'; + break; + } + name = parse_ShortXLUnicodeString(blob, 0, opts); + if (name.length === 0) + name = "Sheet1"; + return { pos: pos, hs: hidden, dt: dt, name: name }; +} +function write_BoundSheet8(data, opts) { + var w = (!opts || opts.biff >= 8 ? 2 : 1); + var o = new_buf(8 + w * data.name.length); + o.write_shift(4, data.pos); + o.write_shift(1, data.hs || 0); + o.write_shift(1, data.dt); + o.write_shift(1, data.name.length); + if (opts.biff >= 8) + o.write_shift(1, 1); + o.write_shift(w * data.name.length, data.name, opts.biff < 8 ? 'sbcs' : 'utf16le'); + var out = o.slice(0, o.l); + out.l = o.l; + return out; +} +/* [MS-XLS] 2.4.265 TODO */ +function parse_SST(blob, length) { + var end = blob.l + length; + var cnt = blob.read_shift(4); + var ucnt = blob.read_shift(4); + var strs /*:SST*/ = ([] /*:any*/); + for (var i = 0; i != ucnt && blob.l < end; ++i) { + strs.push(parse_XLUnicodeRichExtendedString(blob)); + } + strs.Count = cnt; + strs.Unique = ucnt; + return strs; +} +function write_SST(sst, opts) { + var header = new_buf(8); + header.write_shift(4, sst.Count); + header.write_shift(4, sst.Unique); + var strs = []; + for (var j = 0; j < sst.length; ++j) + strs[j] = write_XLUnicodeRichExtendedString(sst[j], opts); + var o = bconcat([header].concat(strs)); + /*::(*/ o /*:: :any)*/.parts = [header.length].concat(strs.map(function (str) { return str.length; })); + return o; +} +/* [MS-XLS] 2.4.107 */ +function parse_ExtSST(blob, length) { + var extsst = {}; + extsst.dsst = blob.read_shift(2); + blob.l += length - 2; + return extsst; +} +/* [MS-XLS] 2.4.221 TODO: check BIFF2-4 */ +function parse_Row(blob) { + var z = ({} /*:any*/); + z.r = blob.read_shift(2); + z.c = blob.read_shift(2); + z.cnt = blob.read_shift(2) - z.c; + var miyRw = blob.read_shift(2); + blob.l += 4; // reserved(2), unused(2) + var flags = blob.read_shift(1); // various flags + blob.l += 3; // reserved(8), ixfe(12), flags(4) + if (flags & 0x07) + z.level = flags & 0x07; + // collapsed: flags & 0x10 + if (flags & 0x20) + z.hidden = true; + if (flags & 0x40) + z.hpt = miyRw / 20; + return z; +} +/* [MS-XLS] 2.4.125 */ +function parse_ForceFullCalculation(blob) { + var header = parse_frtHeader(blob); + if (header.type != 0x08A3) + throw new Error("Invalid Future Record " + header.type); + var fullcalc = blob.read_shift(4); + return fullcalc !== 0x0; +} +/* [MS-XLS] 2.4.215 rt */ +function parse_RecalcId(blob) { + blob.read_shift(2); + return blob.read_shift(4); +} +/* [MS-XLS] 2.4.87 */ +function parse_DefaultRowHeight(blob, length, opts) { + var f = 0; + if (!(opts && opts.biff == 2)) { + f = blob.read_shift(2); + } + var miyRw = blob.read_shift(2); + if ((opts && opts.biff == 2)) { + f = 1 - (miyRw >> 15); + miyRw &= 0x7fff; + } + var fl = { Unsynced: f & 1, DyZero: (f & 2) >> 1, ExAsc: (f & 4) >> 2, ExDsc: (f & 8) >> 3 }; + return [fl, miyRw]; +} +/* [MS-XLS] 2.4.345 TODO */ +function parse_Window1(blob) { + var xWn = blob.read_shift(2), yWn = blob.read_shift(2), dxWn = blob.read_shift(2), dyWn = blob.read_shift(2); + var flags = blob.read_shift(2), iTabCur = blob.read_shift(2), iTabFirst = blob.read_shift(2); + var ctabSel = blob.read_shift(2), wTabRatio = blob.read_shift(2); + return { Pos: [xWn, yWn], Dim: [dxWn, dyWn], Flags: flags, CurTab: iTabCur, + FirstTab: iTabFirst, Selected: ctabSel, TabRatio: wTabRatio }; +} +function write_Window1( /*::opts*/) { + var o = new_buf(18); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0x7260); + o.write_shift(2, 0x44c0); + o.write_shift(2, 0x38); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 1); + o.write_shift(2, 0x01f4); + return o; +} +/* [MS-XLS] 2.4.346 TODO */ +function parse_Window2(blob, length, opts) { + if (opts && opts.biff >= 2 && opts.biff < 5) + return {}; + var f = blob.read_shift(2); + return { RTL: f & 0x40 }; +} +function write_Window2(view) { + var o = new_buf(18), f = 0x6b6; + if (view && view.RTL) + f |= 0x40; + o.write_shift(2, f); + o.write_shift(4, 0); + o.write_shift(4, 64); + o.write_shift(4, 0); + o.write_shift(4, 0); + return o; +} +/* [MS-XLS] 2.4.189 TODO */ +function parse_Pane( /*blob, length, opts*/) { +} +/* [MS-XLS] 2.4.122 TODO */ +function parse_Font(blob, length, opts) { + var o /*:any*/ = { + dyHeight: blob.read_shift(2), + fl: blob.read_shift(2) + }; + switch ((opts && opts.biff) || 8) { + case 2: break; + case 3: + case 4: + blob.l += 2; + break; + default: + blob.l += 10; + break; + } + o.name = parse_ShortXLUnicodeString(blob, 0, opts); + return o; +} +function write_Font(data, opts) { + var name = data.name || "Arial"; + var b5 = (opts && (opts.biff == 5)), w = (b5 ? (15 + name.length) : (16 + 2 * name.length)); + var o = new_buf(w); + o.write_shift(2, (data.sz || 12) * 20); + o.write_shift(4, 0); + o.write_shift(2, 400); + o.write_shift(4, 0); + o.write_shift(2, 0); + o.write_shift(1, name.length); + if (!b5) + o.write_shift(1, 1); + o.write_shift((b5 ? 1 : 2) * name.length, name, (b5 ? "sbcs" : "utf16le")); + return o; +} +/* [MS-XLS] 2.4.149 */ +function parse_LabelSst(blob, length, opts) { + var cell = parse_XLSCell(blob, length, opts); + cell.isst = blob.read_shift(4); + return cell; +} +function write_LabelSst(R /*:number*/, C /*:number*/, v /*:number*/, os /*:number*/ /*::, opts*/) { + var o = new_buf(10); + write_XLSCell(R, C, os, o); + o.write_shift(4, v); + return o; +} +/* [MS-XLS] 2.4.148 */ +function parse_Label(blob, length, opts) { + if (opts.biffguess && opts.biff == 2) + opts.biff = 5; + var target = blob.l + length; + var cell = parse_XLSCell(blob, length, opts); + var str = parse_XLUnicodeString(blob, target - blob.l, opts); + cell.val = str; + return cell; +} +function write_Label(R /*:number*/, C /*:number*/, v /*:string*/, os /*:number*/, opts) { + var b8 = !opts || opts.biff == 8; + var o = new_buf(6 + 2 + (+b8) + (1 + b8) * v.length); + write_XLSCell(R, C, os, o); + o.write_shift(2, v.length); + if (b8) + o.write_shift(1, 1); + o.write_shift((1 + b8) * v.length, v, b8 ? 'utf16le' : 'sbcs'); + return o; +} +/* [MS-XLS] 2.4.126 Number Formats */ +function parse_Format(blob, length, opts) { + var numFmtId = blob.read_shift(2); + var fmtstr = parse_XLUnicodeString2(blob, 0, opts); + return [numFmtId, fmtstr]; +} +function write_Format(i /*:number*/, f /*:string*/, opts, o) { + var b5 = (opts && (opts.biff == 5)); + if (!o) + o = new_buf(b5 ? (3 + f.length) : (5 + 2 * f.length)); + o.write_shift(2, i); + o.write_shift((b5 ? 1 : 2), f.length); + if (!b5) + o.write_shift(1, 1); + o.write_shift((b5 ? 1 : 2) * f.length, f, (b5 ? 'sbcs' : 'utf16le')); + var out = (o.length > o.l) ? o.slice(0, o.l) : o; + if (out.l == null) + out.l = out.length; + return out; +} +var parse_BIFF2Format = parse_XLUnicodeString2; +function write_BIFF2Format(f /*:string*/) { + var o = new_buf(1 + f.length); + o.write_shift(1, f.length); + o.write_shift(f.length, f, "sbcs"); + return o; +} +function write_BIFF4Format(f /*:string*/) { + var o = new_buf(3 + f.length); + o.l += 2; + o.write_shift(1, f.length); + o.write_shift(f.length, f, "sbcs"); + return o; +} +/* [MS-XLS] 2.4.90 */ +function parse_Dimensions(blob, length, opts) { + var end = blob.l + length; + var w = opts.biff == 8 || !opts.biff ? 4 : 2; + var r = blob.read_shift(w), R = blob.read_shift(w); + var c = blob.read_shift(2), C = blob.read_shift(2); + blob.l = end; + return { s: { r: r, c: c }, e: { r: R, c: C } }; +} +function write_Dimensions(range, opts) { + var w = opts.biff == 8 || !opts.biff ? 4 : 2; + var o = new_buf(2 * w + 6); + o.write_shift(w, range.s.r); + o.write_shift(w, range.e.r + 1); + o.write_shift(2, range.s.c); + o.write_shift(2, range.e.c + 1); + o.write_shift(2, 0); + return o; +} +/* [MS-XLS] 2.4.220 */ +function parse_RK(blob) { + var rw = blob.read_shift(2), col = blob.read_shift(2); + var rkrec = parse_RkRec(blob); + return { r: rw, c: col, ixfe: rkrec[0], rknum: rkrec[1] }; +} +/* [MS-XLS] 2.4.175 */ +function parse_MulRk(blob, length) { + var target = blob.l + length - 2; + var rw = blob.read_shift(2), col = blob.read_shift(2); + var rkrecs = []; + while (blob.l < target) + rkrecs.push(parse_RkRec(blob)); + if (blob.l !== target) + throw new Error("MulRK read error"); + var lastcol = blob.read_shift(2); + if (rkrecs.length != lastcol - col + 1) + throw new Error("MulRK length mismatch"); + return { r: rw, c: col, C: lastcol, rkrec: rkrecs }; +} +/* [MS-XLS] 2.4.174 */ +function parse_MulBlank(blob, length) { + var target = blob.l + length - 2; + var rw = blob.read_shift(2), col = blob.read_shift(2); + var ixfes = []; + while (blob.l < target) + ixfes.push(blob.read_shift(2)); + if (blob.l !== target) + throw new Error("MulBlank read error"); + var lastcol = blob.read_shift(2); + if (ixfes.length != lastcol - col + 1) + throw new Error("MulBlank length mismatch"); + return { r: rw, c: col, C: lastcol, ixfe: ixfes }; +} +/* [MS-XLS] 2.5.20 2.5.249 TODO: interpret values here */ +function parse_CellStyleXF(blob, length, style, opts) { + var o = {}; + var a = blob.read_shift(4), b = blob.read_shift(4); + var c = blob.read_shift(4), d = blob.read_shift(2); + o.patternType = XLSFillPattern[c >> 26]; + if (!opts.cellStyles) + return o; + o.alc = a & 0x07; + o.fWrap = (a >> 3) & 0x01; + o.alcV = (a >> 4) & 0x07; + o.fJustLast = (a >> 7) & 0x01; + o.trot = (a >> 8) & 0xFF; + o.cIndent = (a >> 16) & 0x0F; + o.fShrinkToFit = (a >> 20) & 0x01; + o.iReadOrder = (a >> 22) & 0x02; + o.fAtrNum = (a >> 26) & 0x01; + o.fAtrFnt = (a >> 27) & 0x01; + o.fAtrAlc = (a >> 28) & 0x01; + o.fAtrBdr = (a >> 29) & 0x01; + o.fAtrPat = (a >> 30) & 0x01; + o.fAtrProt = (a >> 31) & 0x01; + o.dgLeft = b & 0x0F; + o.dgRight = (b >> 4) & 0x0F; + o.dgTop = (b >> 8) & 0x0F; + o.dgBottom = (b >> 12) & 0x0F; + o.icvLeft = (b >> 16) & 0x7F; + o.icvRight = (b >> 23) & 0x7F; + o.grbitDiag = (b >> 30) & 0x03; + o.icvTop = c & 0x7F; + o.icvBottom = (c >> 7) & 0x7F; + o.icvDiag = (c >> 14) & 0x7F; + o.dgDiag = (c >> 21) & 0x0F; + o.icvFore = d & 0x7F; + o.icvBack = (d >> 7) & 0x7F; + o.fsxButton = (d >> 14) & 0x01; + return o; +} +//function parse_CellXF(blob, length, opts) {return parse_CellStyleXF(blob,length,0, opts);} +//function parse_StyleXF(blob, length, opts) {return parse_CellStyleXF(blob,length,1, opts);} +/* [MS-XLS] 2.4.353 TODO: actually do this right */ +function parse_XF(blob, length, opts) { + var o = {}; + o.ifnt = blob.read_shift(2); + o.numFmtId = blob.read_shift(2); + o.flags = blob.read_shift(2); + o.fStyle = (o.flags >> 2) & 0x01; + length -= 6; + o.data = parse_CellStyleXF(blob, length, o.fStyle, opts); + return o; +} +function write_XF(data, ixfeP, opts, o) { + var b5 = (opts && (opts.biff == 5)); + if (!o) + o = new_buf(b5 ? 16 : 20); + o.write_shift(2, 0); + if (data.style) { + o.write_shift(2, (data.numFmtId || 0)); + o.write_shift(2, 0xFFF4); + } + else { + o.write_shift(2, (data.numFmtId || 0)); + o.write_shift(2, (ixfeP << 4)); + } + var f = 0; + if (data.numFmtId > 0 && b5) + f |= 0x0400; + o.write_shift(4, f); + o.write_shift(4, 0); + if (!b5) + o.write_shift(4, 0); + o.write_shift(2, 0); + return o; +} +function parse_BIFF2XF(blob /*::, length, opts*/) { + var o = {}; + o.ifnt = blob.read_shift(1); + blob.l++; + o.flags = blob.read_shift(1); + o.numFmtId = o.flags & 0x3F; + o.flags >>= 6; + o.fStyle = 0; + o.data = {}; // TODO + return o; +} +function write_BIFF2XF(xf) { + var o = new_buf(4); + o.l += 2; + o.write_shift(1, xf.numFmtId); + o.l++; + return o; +} +function write_BIFF3XF(xf) { + var o = new_buf(12); + o.l++; + o.write_shift(1, xf.numFmtId); + o.l += 10; + return o; +} +/* TODO: check other fields */ +var write_BIFF4XF = write_BIFF3XF; +function parse_BIFF3XF(blob /*::, length, opts*/) { + var o = {}; + o.ifnt = blob.read_shift(1); + o.numFmtId = blob.read_shift(1); + o.flags = blob.read_shift(2); + o.fStyle = (o.flags >> 2) & 0x01; + o.data = {}; // TODO + return o; +} +function parse_BIFF4XF(blob /*::, length, opts*/) { + var o = {}; + o.ifnt = blob.read_shift(1); + o.numFmtId = blob.read_shift(1); + o.flags = blob.read_shift(2); + o.fStyle = (o.flags >> 2) & 0x01; + o.data = {}; // TODO + return o; +} +/* [MS-XLS] 2.4.134 */ +function parse_Guts(blob) { + blob.l += 4; + var out = [blob.read_shift(2), blob.read_shift(2)]; + if (out[0] !== 0) + out[0]--; + if (out[1] !== 0) + out[1]--; + if (out[0] > 7 || out[1] > 7) + throw new Error("Bad Gutters: " + out.join("|")); + return out; +} +function write_Guts(guts /*:Array*/) { + var o = new_buf(8); + o.write_shift(4, 0); + o.write_shift(2, guts[0] ? guts[0] + 1 : 0); + o.write_shift(2, guts[1] ? guts[1] + 1 : 0); + return o; +} +/* [MS-XLS] 2.4.24 */ +function parse_BoolErr(blob, length, opts) { + var cell = parse_XLSCell(blob, 6, opts); + var val = parse_Bes(blob, 2); + cell.val = val; + cell.t = (val === true || val === false) ? 'b' : 'e'; + return cell; +} +function write_BoolErr(R /*:number*/, C /*:number*/, v, os /*:number*/, opts, t /*:string*/) { + var o = new_buf(8); + write_XLSCell(R, C, os, o); + write_Bes(v, t, o); + return o; +} +/* [MS-XLS] 2.4.180 Number */ +function parse_Number(blob, length, opts) { + if (opts.biffguess && opts.biff == 2) + opts.biff = 5; + var cell = parse_XLSCell(blob, 6, opts); + var xnum = parse_Xnum(blob, 8); + cell.val = xnum; + return cell; +} +function write_Number(R /*:number*/, C /*:number*/, v, os /*:: :number, opts*/) { + var o = new_buf(14); + write_XLSCell(R, C, os, o); + write_Xnum(v, o); + return o; +} +var parse_XLHeaderFooter = parse_OptXLUnicodeString; // TODO: parse 2.4.136 +/* [MS-XLS] 2.4.271 */ +function parse_SupBook(blob, length, opts) { + var end = blob.l + length; + var ctab = blob.read_shift(2); + var cch = blob.read_shift(2); + opts.sbcch = cch; + if (cch == 0x0401 || cch == 0x3A01) + return [cch, ctab]; + if (cch < 0x01 || cch > 0xff) + throw new Error("Unexpected SupBook type: " + cch); + var virtPath = parse_XLUnicodeStringNoCch(blob, cch); + /* TODO: 2.5.277 Virtual Path */ + var rgst = []; + while (end > blob.l) + rgst.push(parse_XLUnicodeString(blob)); + return [cch, ctab, virtPath, rgst]; +} +/* [MS-XLS] 2.4.105 TODO */ +function parse_ExternName(blob, length, opts) { + var flags = blob.read_shift(2); + var body; + var o = ({ + fBuiltIn: flags & 0x01, + fWantAdvise: (flags >>> 1) & 0x01, + fWantPict: (flags >>> 2) & 0x01, + fOle: (flags >>> 3) & 0x01, + fOleLink: (flags >>> 4) & 0x01, + cf: (flags >>> 5) & 0x3FF, + fIcon: flags >>> 15 & 0x01 + } /*:any*/); + if (opts.sbcch === 0x3A01) + body = parse_AddinUdf(blob, length - 2, opts); + //else throw new Error("unsupported SupBook cch: " + opts.sbcch); + o.body = body || blob.read_shift(length - 2); + if (typeof body === "string") + o.Name = body; + return o; +} +/* [MS-XLS] 2.4.150 TODO */ +function parse_Lbl(blob, length, opts) { + var target = blob.l + length; + var flags = blob.read_shift(2); + var chKey = blob.read_shift(1); + var cch = blob.read_shift(1); + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + var itab = 0; + if (!opts || opts.biff >= 5) { + if (opts.biff != 5) + blob.l += 2; + itab = blob.read_shift(2); + if (opts.biff == 5) + blob.l += 2; + blob.l += 4; + } + var name = parse_XLUnicodeStringNoCch(blob, cch, opts); + if (flags & 0x20) + name = XLSLblBuiltIn[name.charCodeAt(0)]; + var npflen = target - blob.l; + if (opts && opts.biff == 2) + --npflen; + /*jshint -W018 */ + var rgce = (target == blob.l || cce === 0 || !(npflen > 0)) ? [] : parse_NameParsedFormula(blob, npflen, opts, cce); + /*jshint +W018 */ + return { + chKey: chKey, + Name: name, + itab: itab, + rgce: rgce + }; +} +/* [MS-XLS] 2.4.106 TODO: legacy record filename encoding */ +function parse_ExternSheet(blob, length, opts) { + if (opts.biff < 8) + return parse_BIFF5ExternSheet(blob, length, opts); + /* see issue 2907 */ + if (!(opts.biff > 8) && (length == blob[blob.l] + (blob[blob.l + 1] == 0x03 ? 1 : 0) + 1)) + return parse_BIFF5ExternSheet(blob, length, opts); + var o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2); + while (len-- !== 0) + o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts)); + // [iSupBook, itabFirst, itabLast]; + if (blob.l != target) + throw new Error("Bad ExternSheet: " + blob.l + " != " + target); + return o; +} +function parse_BIFF5ExternSheet(blob, length, opts) { + if (blob[blob.l + 1] == 0x03) + blob[blob.l]++; + var o = parse_ShortXLUnicodeString(blob, length, opts); + return o.charCodeAt(0) == 0x03 ? o.slice(1) : o; +} +/* [MS-XLS] 2.4.176 TODO: check older biff */ +function parse_NameCmt(blob, length, opts) { + if (opts.biff < 8) { + blob.l += length; + return; + } + var cchName = blob.read_shift(2); + var cchComment = blob.read_shift(2); + var name = parse_XLUnicodeStringNoCch(blob, cchName, opts); + var comment = parse_XLUnicodeStringNoCch(blob, cchComment, opts); + return [name, comment]; +} +/* [MS-XLS] 2.4.260 */ +function parse_ShrFmla(blob, length, opts) { + var ref = parse_RefU(blob, 6); + blob.l++; + var cUse = blob.read_shift(1); + length -= 8; + return [parse_SharedParsedFormula(blob, length, opts), cUse, ref]; +} +/* [MS-XLS] 2.4.4 TODO */ +function parse_Array(blob, length, opts) { + var ref = parse_Ref(blob, 6); + /* TODO: fAlwaysCalc */ + switch (opts.biff) { + case 2: + blob.l++; + length -= 7; + break; + case 3: + case 4: + blob.l += 2; + length -= 8; + break; + default: + blob.l += 6; + length -= 12; + } + return [ref, parse_ArrayParsedFormula(blob, length, opts, ref)]; +} +/* [MS-XLS] 2.4.173 */ +function parse_MTRSettings(blob) { + var fMTREnabled = blob.read_shift(4) !== 0x00; + var fUserSetThreadCount = blob.read_shift(4) !== 0x00; + var cUserThreadCount = blob.read_shift(4); + return [fMTREnabled, fUserSetThreadCount, cUserThreadCount]; +} +/* [MS-XLS] 2.5.186 */ +function parse_NoteSh(blob, length, opts) { + var row = blob.read_shift(2), col = blob.read_shift(2); + var flags = blob.read_shift(2), idObj = blob.read_shift(2); + var stAuthor = parse_XLUnicodeString2(blob, 0, opts); + return [{ r: row, c: col }, stAuthor, idObj, flags]; +} +/* [MS-XLS] 2.4.179 */ +function parse_Note(blob, length, opts) { + if (opts && (opts.biff < 8)) { + var row = blob.read_shift(2), col = blob.read_shift(2); + if (row == 0xFFFF || row == -1) + return; // TODO: test continuation + var cch = blob.read_shift(2); + var cmnt = blob.read_shift(Math.min(cch, 2048), 'cpstr'); + return [{ r: row, c: col }, cmnt]; + } + /* TODO: Support revisions */ + return parse_NoteSh(blob, length, opts); +} +function write_NOTE_BIFF2(text /*:string*/, R /*:number*/, C /*:number*/, len /*?:number*/) { + var o = new_buf(6 + (len || text.length)); + o.write_shift(2, R); + o.write_shift(2, C); + o.write_shift(2, len || text.length); + o.write_shift(text.length, text, "sbcs"); + return o; +} +/* [MS-XLS] 2.4.168 */ +function parse_MergeCells(blob, length) { + var merges /*:Array*/ = []; + var cmcs = blob.read_shift(2); + while (cmcs--) + merges.push(parse_Ref8U(blob, length)); + return merges; +} +function write_MergeCells(merges /*:Array*/) { + var o = new_buf(2 + merges.length * 8); + o.write_shift(2, merges.length); + for (var i = 0; i < merges.length; ++i) + write_Ref8U(merges[i], o); + return o; +} +/* [MS-XLS] 2.4.181 TODO: parse all the things! */ +function parse_Obj(blob, length, opts) { + if (opts && opts.biff < 8) + return parse_BIFF5Obj(blob, length, opts); + var cmo = parse_FtCmo(blob, 22); // id, ot, flags + var fts = parse_FtArray(blob, length - 22, cmo[1]); + return { cmo: cmo, ft: fts }; +} +/* from older spec */ +var parse_BIFF5OT = { + 0x08: function (blob, length) { + var tgt = blob.l + length; + blob.l += 10; // todo + var cf = blob.read_shift(2); + blob.l += 4; + blob.l += 2; //var cbPictFmla = blob.read_shift(2); + blob.l += 2; + blob.l += 2; //var grbit = blob.read_shift(2); + blob.l += 4; + var cchName = blob.read_shift(1); + blob.l += cchName; // TODO: stName + blob.l = tgt; // TODO: fmla + return { fmt: cf }; + } +}; +function parse_BIFF5Obj(blob, length, opts) { + blob.l += 4; //var cnt = blob.read_shift(4); + var ot = blob.read_shift(2); + var id = blob.read_shift(2); + var grbit = blob.read_shift(2); + blob.l += 2; //var colL = blob.read_shift(2); + blob.l += 2; //var dxL = blob.read_shift(2); + blob.l += 2; //var rwT = blob.read_shift(2); + blob.l += 2; //var dyT = blob.read_shift(2); + blob.l += 2; //var colR = blob.read_shift(2); + blob.l += 2; //var dxR = blob.read_shift(2); + blob.l += 2; //var rwB = blob.read_shift(2); + blob.l += 2; //var dyB = blob.read_shift(2); + blob.l += 2; //var cbMacro = blob.read_shift(2); + blob.l += 6; + length -= 36; + var fts = []; + fts.push((parse_BIFF5OT[ot] || parsenoop)(blob, length, opts)); + return { cmo: [id, ot, grbit], ft: fts }; +} +/* [MS-XLS] 2.4.329 TODO: parse properly */ +function parse_TxO(blob, length, opts) { + var s = blob.l; + var texts = ""; + try { + blob.l += 4; + var ot = (opts.lastobj || { cmo: [0, 0] }).cmo[1]; + var controlInfo; // eslint-disable-line no-unused-vars + if ([0, 5, 7, 11, 12, 14].indexOf(ot) == -1) + blob.l += 6; + else + controlInfo = parse_ControlInfo(blob, 6, opts); // eslint-disable-line no-unused-vars + var cchText = blob.read_shift(2); + /*var cbRuns = */ blob.read_shift(2); + /*var ifntEmpty = */ parseuint16(blob, 2); + var len = blob.read_shift(2); + blob.l += len; + //var fmla = parse_ObjFmla(blob, s + length - blob.l); + for (var i = 1; i < blob.lens.length - 1; ++i) { + if (blob.l - s != blob.lens[i]) + throw new Error("TxO: bad continue record"); + var hdr = blob[blob.l]; + var t = parse_XLUnicodeStringNoCch(blob, blob.lens[i + 1] - blob.lens[i] - 1); + texts += t; + if (texts.length >= (hdr ? cchText : 2 * cchText)) + break; + } + if (texts.length !== cchText && texts.length !== cchText * 2) { + throw new Error("cchText: " + cchText + " != " + texts.length); + } + blob.l = s + length; + /* [MS-XLS] 2.5.272 TxORuns */ + // var rgTxoRuns = []; + // for(var j = 0; j != cbRuns/8-1; ++j) blob.l += 8; + // var cchText2 = blob.read_shift(2); + // if(cchText2 !== cchText) throw new Error("TxOLastRun mismatch: " + cchText2 + " " + cchText); + // blob.l += 6; + // if(s + length != blob.l) throw new Error("TxO " + (s + length) + ", at " + blob.l); + return { t: texts }; + } + catch (e) { + blob.l = s + length; + return { t: texts }; + } +} +/* [MS-XLS] 2.4.140 */ +function parse_HLink(blob, length) { + var ref = parse_Ref8U(blob, 8); + blob.l += 16; /* CLSID */ + var hlink = parse_Hyperlink(blob, length - 24); + return [ref, hlink]; +} +function write_HLink(hl) { + var O = new_buf(24); + var ref = decode_cell(hl[0]); + O.write_shift(2, ref.r); + O.write_shift(2, ref.r); + O.write_shift(2, ref.c); + O.write_shift(2, ref.c); + var clsid = "d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "); + for (var i = 0; i < 16; ++i) + O.write_shift(1, parseInt(clsid[i], 16)); + return bconcat([O, write_Hyperlink(hl[1])]); +} +/* [MS-XLS] 2.4.141 */ +function parse_HLinkTooltip(blob, length) { + blob.read_shift(2); + var ref = parse_Ref8U(blob, 8); + var wzTooltip = blob.read_shift((length - 10) / 2, 'dbcs-cont'); + wzTooltip = wzTooltip.replace(chr0, ""); + return [ref, wzTooltip]; +} +function write_HLinkTooltip(hl) { + var TT = hl[1].Tooltip; + var O = new_buf(10 + 2 * (TT.length + 1)); + O.write_shift(2, 0x0800); + var ref = decode_cell(hl[0]); + O.write_shift(2, ref.r); + O.write_shift(2, ref.r); + O.write_shift(2, ref.c); + O.write_shift(2, ref.c); + for (var i = 0; i < TT.length; ++i) + O.write_shift(2, TT.charCodeAt(i)); + O.write_shift(2, 0); + return O; +} +/* [MS-XLS] 2.4.63 */ +function parse_Country(blob) { + var o = [0, 0], d; + d = blob.read_shift(2); + o[0] = CountryEnum[d] || d; + d = blob.read_shift(2); + o[1] = CountryEnum[d] || d; + return o; +} +function write_Country(o) { + if (!o) + o = new_buf(4); + o.write_shift(2, 0x01); + o.write_shift(2, 0x01); + return o; +} +/* [MS-XLS] 2.4.50 ClrtClient */ +function parse_ClrtClient(blob) { + var ccv = blob.read_shift(2); + var o = []; + while (ccv-- > 0) + o.push(parse_LongRGB(blob, 8)); + return o; +} +/* [MS-XLS] 2.4.188 */ +function parse_Palette(blob) { + var ccv = blob.read_shift(2); + var o = []; + while (ccv-- > 0) + o.push(parse_LongRGB(blob, 8)); + return o; +} +/* [MS-XLS] 2.4.354 */ +function parse_XFCRC(blob) { + blob.l += 2; + var o = { cxfs: 0, crc: 0 }; + o.cxfs = blob.read_shift(2); + o.crc = blob.read_shift(4); + return o; +} +/* [MS-XLS] 2.4.53 TODO: parse flags */ +/* [MS-XLSB] 2.4.323 TODO: parse flags */ +function parse_ColInfo(blob, length, opts) { + if (!opts.cellStyles) + return parsenoop(blob, length); + var w = opts && opts.biff >= 12 ? 4 : 2; + var colFirst = blob.read_shift(w); + var colLast = blob.read_shift(w); + var coldx = blob.read_shift(w); + var ixfe = blob.read_shift(w); + var flags = blob.read_shift(2); + if (w == 2) + blob.l += 2; + var o = ({ s: colFirst, e: colLast, w: coldx, ixfe: ixfe, flags: flags } /*:any*/); + if (opts.biff >= 5 || !opts.biff) + o.level = (flags >> 8) & 0x7; + return o; +} +function write_ColInfo(col, idx) { + var o = new_buf(12); + o.write_shift(2, idx); + o.write_shift(2, idx); + o.write_shift(2, col.width * 256); + o.write_shift(2, 0); + var f = 0; + if (col.hidden) + f |= 1; + o.write_shift(1, f); + f = col.level || 0; + o.write_shift(1, f); + o.write_shift(2, 0); + return o; +} +/* [MS-XLS] 2.4.257 */ +function parse_Setup(blob, length) { + var o = {}; + if (length < 32) + return o; + blob.l += 16; + o.header = parse_Xnum(blob, 8); + o.footer = parse_Xnum(blob, 8); + blob.l += 2; + return o; +} +/* [MS-XLS] 2.4.261 */ +function parse_ShtProps(blob, length, opts) { + var def = { area: false }; + if (opts.biff != 5) { + blob.l += length; + return def; + } + var d = blob.read_shift(1); + blob.l += 3; + if ((d & 0x10)) + def.area = true; + return def; +} +/* [MS-XLS] 2.4.241 */ +function write_RRTabId(n /*:number*/) { + var out = new_buf(2 * n); + for (var i = 0; i < n; ++i) + out.write_shift(2, i + 1); + return out; +} +var parse_Blank = parse_XLSCell; /* [MS-XLS] 2.4.20 Just the cell */ +var parse_Scl = parseuint16a; /* [MS-XLS] 2.4.247 num, den */ +var parse_String = parse_XLUnicodeString; /* [MS-XLS] 2.4.268 */ +/* --- Specific to versions before BIFF8 --- */ +function parse_ImData(blob) { + var cf = blob.read_shift(2); + var env = blob.read_shift(2); + var lcb = blob.read_shift(4); + var o = { fmt: cf, env: env, len: lcb, data: blob.slice(blob.l, blob.l + lcb) }; + blob.l += lcb; + return o; +} +function write_BIFF2Cell(out, r /*:number*/, c /*:number*/, ixfe /*:number*/, ifmt /*:number*/) { + if (!out) + out = new_buf(7); + out.write_shift(2, r); + out.write_shift(2, c); + out.write_shift(1, ixfe || 0 /* & 0x3F */); + out.write_shift(1, ifmt || 0 /* & 0x3F */); + out.write_shift(1, 0); + return out; +} +/* BIFF2_??? where ??? is the name from [XLS] */ +function parse_BIFF2STR(blob, length, opts) { + if (opts.biffguess && opts.biff == 5) + opts.biff = 2; + var cell = parse_XLSCell(blob, 7, opts); + var str = parse_XLUnicodeString2(blob, length - 7, opts); + cell.t = 'str'; + cell.val = str; + return cell; +} +function parse_BIFF2NUM(blob, length, opts) { + var cell = parse_XLSCell(blob, 7, opts); + var num = parse_Xnum(blob, 8); + cell.t = 'n'; + cell.val = num; + return cell; +} +function write_BIFF2NUM(r /*:number*/, c /*:number*/, val /*:number*/, ixfe, ifmt) { + var out = new_buf(15); + write_BIFF2Cell(out, r, c, ixfe || 0, ifmt || 0); + out.write_shift(8, val, 'f'); + return out; +} +function parse_BIFF2INT(blob, length, opts) { + var cell = parse_XLSCell(blob, 7, opts); + var num = blob.read_shift(2); + cell.t = 'n'; + cell.val = num; + return cell; +} +function write_BIFF2INT(r /*:number*/, c /*:number*/, val /*:number*/, ixfe /*:number*/, ifmt /*:number*/) { + var out = new_buf(9); + write_BIFF2Cell(out, r, c, ixfe || 0, ifmt || 0); + out.write_shift(2, val); + return out; +} +function parse_BIFF2STRING(blob) { + var cch = blob.read_shift(1); + if (cch === 0) { + blob.l++; + return ""; + } + return blob.read_shift(cch, 'sbcs-cont'); +} +function parse_BIFF2BOOLERR(blob, length, opts) { + var bestart = blob.l + 7; + var cell = parse_XLSCell(blob, 6, opts); + blob.l = bestart; + var val = parse_Bes(blob, 2); + cell.val = val; + cell.t = (val === true || val === false) ? 'b' : 'e'; + return cell; +} +/* TODO: convert to BIFF8 font struct */ +function parse_BIFF2FONTXTRA(blob, length) { + blob.l += 6; // unknown + blob.l += 2; // font weight "bls" + blob.l += 1; // charset + blob.l += 3; // unknown + blob.l += 1; // font family + blob.l += length - 13; +} +/* TODO: parse rich text runs */ +function parse_RString(blob, length, opts) { + var end = blob.l + length; + var cell = parse_XLSCell(blob, 6, opts); + var cch = blob.read_shift(2); + var str = parse_XLUnicodeStringNoCch(blob, cch, opts); + blob.l = end; + cell.t = 'str'; + cell.val = str; + return cell; +} +function parse_BIFF4SheetInfo(blob /*::, length, opts*/) { + var flags = blob.read_shift(4); + var cch = blob.read_shift(1), name = blob.read_shift(cch, "sbcs"); + if (name.length === 0) + name = "Sheet1"; + return { flags: flags, name: name }; +} +var DBF_SUPPORTED_VERSIONS = [0x02, 0x03, 0x30, 0x31, 0x83, 0x8B, 0x8C, 0xF5]; +var DBF = /*#__PURE__*/ (function () { + var dbf_codepage_map = { + /* Code Pages Supported by Visual FoxPro */ + /*::[*/ 0x01 /*::]*/: 437, /*::[*/ 0x02 /*::]*/: 850, + /*::[*/ 0x03 /*::]*/: 1252, /*::[*/ 0x04 /*::]*/: 10000, + /*::[*/ 0x64 /*::]*/: 852, /*::[*/ 0x65 /*::]*/: 866, + /*::[*/ 0x66 /*::]*/: 865, /*::[*/ 0x67 /*::]*/: 861, + /*::[*/ 0x68 /*::]*/: 895, /*::[*/ 0x69 /*::]*/: 620, + /*::[*/ 0x6A /*::]*/: 737, /*::[*/ 0x6B /*::]*/: 857, + /*::[*/ 0x78 /*::]*/: 950, /*::[*/ 0x79 /*::]*/: 949, + /*::[*/ 0x7A /*::]*/: 936, /*::[*/ 0x7B /*::]*/: 932, + /*::[*/ 0x7C /*::]*/: 874, /*::[*/ 0x7D /*::]*/: 1255, + /*::[*/ 0x7E /*::]*/: 1256, /*::[*/ 0x96 /*::]*/: 10007, + /*::[*/ 0x97 /*::]*/: 10029, /*::[*/ 0x98 /*::]*/: 10006, + /*::[*/ 0xC8 /*::]*/: 1250, /*::[*/ 0xC9 /*::]*/: 1251, + /*::[*/ 0xCA /*::]*/: 1254, /*::[*/ 0xCB /*::]*/: 1253, + /* shapefile DBF extension */ + /*::[*/ 0x00 /*::]*/: 20127, /*::[*/ 0x08 /*::]*/: 865, + /*::[*/ 0x09 /*::]*/: 437, /*::[*/ 0x0A /*::]*/: 850, + /*::[*/ 0x0B /*::]*/: 437, /*::[*/ 0x0D /*::]*/: 437, + /*::[*/ 0x0E /*::]*/: 850, /*::[*/ 0x0F /*::]*/: 437, + /*::[*/ 0x10 /*::]*/: 850, /*::[*/ 0x11 /*::]*/: 437, + /*::[*/ 0x12 /*::]*/: 850, /*::[*/ 0x13 /*::]*/: 932, + /*::[*/ 0x14 /*::]*/: 850, /*::[*/ 0x15 /*::]*/: 437, + /*::[*/ 0x16 /*::]*/: 850, /*::[*/ 0x17 /*::]*/: 865, + /*::[*/ 0x18 /*::]*/: 437, /*::[*/ 0x19 /*::]*/: 437, + /*::[*/ 0x1A /*::]*/: 850, /*::[*/ 0x1B /*::]*/: 437, + /*::[*/ 0x1C /*::]*/: 863, /*::[*/ 0x1D /*::]*/: 850, + /*::[*/ 0x1F /*::]*/: 852, /*::[*/ 0x22 /*::]*/: 852, + /*::[*/ 0x23 /*::]*/: 852, /*::[*/ 0x24 /*::]*/: 860, + /*::[*/ 0x25 /*::]*/: 850, /*::[*/ 0x26 /*::]*/: 866, + /*::[*/ 0x37 /*::]*/: 850, /*::[*/ 0x40 /*::]*/: 852, + /*::[*/ 0x4D /*::]*/: 936, /*::[*/ 0x4E /*::]*/: 949, + /*::[*/ 0x4F /*::]*/: 950, /*::[*/ 0x50 /*::]*/: 874, + /*::[*/ 0x57 /*::]*/: 1252, /*::[*/ 0x58 /*::]*/: 1252, + /*::[*/ 0x59 /*::]*/: 1252, /*::[*/ 0x6C /*::]*/: 863, + /*::[*/ 0x86 /*::]*/: 737, /*::[*/ 0x87 /*::]*/: 852, + /*::[*/ 0x88 /*::]*/: 857, /*::[*/ 0xCC /*::]*/: 1257, + /*::[*/ 0xFF /*::]*/: 16969 + }; + var dbf_reverse_map = evert({ + /*::[*/ 0x01 /*::]*/: 437, /*::[*/ 0x02 /*::]*/: 850, + /*::[*/ 0x03 /*::]*/: 1252, /*::[*/ 0x04 /*::]*/: 10000, + /*::[*/ 0x64 /*::]*/: 852, /*::[*/ 0x65 /*::]*/: 866, + /*::[*/ 0x66 /*::]*/: 865, /*::[*/ 0x67 /*::]*/: 861, + /*::[*/ 0x68 /*::]*/: 895, /*::[*/ 0x69 /*::]*/: 620, + /*::[*/ 0x6A /*::]*/: 737, /*::[*/ 0x6B /*::]*/: 857, + /*::[*/ 0x78 /*::]*/: 950, /*::[*/ 0x79 /*::]*/: 949, + /*::[*/ 0x7A /*::]*/: 936, /*::[*/ 0x7B /*::]*/: 932, + /*::[*/ 0x7C /*::]*/: 874, /*::[*/ 0x7D /*::]*/: 1255, + /*::[*/ 0x7E /*::]*/: 1256, /*::[*/ 0x96 /*::]*/: 10007, + /*::[*/ 0x97 /*::]*/: 10029, /*::[*/ 0x98 /*::]*/: 10006, + /*::[*/ 0xC8 /*::]*/: 1250, /*::[*/ 0xC9 /*::]*/: 1251, + /*::[*/ 0xCA /*::]*/: 1254, /*::[*/ 0xCB /*::]*/: 1253, + /*::[*/ 0x00 /*::]*/: 20127 + }); + /* TODO: find an actual specification */ + function dbf_to_aoa(buf, opts) { + var out /*:AOA*/ = []; + var d /*:Block*/ = (new_raw_buf(1) /*:any*/); + switch (opts.type) { + case 'base64': + d = s2a(Base64_decode(buf)); + break; + case 'binary': + d = s2a(buf); + break; + case 'buffer': + case 'array': + d = buf; + break; + } + prep_blob(d, 0); + /* header */ + var ft = d.read_shift(1); + var memo = !!(ft & 0x88); + var vfp = false, l7 = false; + switch (ft) { + case 0x02: break; // dBASE II + case 0x03: break; // dBASE III + case 0x30: + vfp = true; + memo = true; + break; // VFP + case 0x31: + vfp = true; + memo = true; + break; // VFP with autoincrement + // 0x43 dBASE IV SQL table files + // 0x63 dBASE IV SQL system files + case 0x83: break; // dBASE III with memo + case 0x8B: break; // dBASE IV with memo + case 0x8C: + l7 = true; + break; // dBASE Level 7 with memo + // case 0xCB dBASE IV SQL table files with memo + case 0xF5: break; // FoxPro 2.x with memo + // case 0xFB FoxBASE + default: throw new Error("DBF Unsupported Version: " + ft.toString(16)); + } + var nrow = 0, fpos = 0x0209; + if (ft == 0x02) + nrow = d.read_shift(2); + d.l += 3; // dBASE II stores DDMMYY date, others use YYMMDD + if (ft != 0x02) + nrow = d.read_shift(4); + if (nrow > 1048576) + nrow = 1e6; + if (ft != 0x02) + fpos = d.read_shift(2); // header length + var rlen = d.read_shift(2); // record length + var /*flags = 0,*/ current_cp = opts.codepage || 1252; + if (ft != 0x02) { // 20 reserved bytes + d.l += 16; + /*flags = */ d.read_shift(1); + //if(memo && ((flags & 0x02) === 0)) throw new Error("DBF Flags " + flags.toString(16) + " ft " + ft.toString(16)); + /* codepage present in FoxPro and dBASE Level 7 */ + if (d[d.l] !== 0) + current_cp = dbf_codepage_map[d[d.l]]; + d.l += 1; + d.l += 2; + } + if (l7) + d.l += 36; // Level 7: 32 byte "Language driver name", 4 byte reserved + /*:: type DBFField = { name:string; len:number; type:string; } */ + var fields /*:Array*/ = [], field /*:DBFField*/ = ({} /*:any*/); + var hend = Math.min(d.length, (ft == 0x02 ? 0x209 : (fpos - 10 - (vfp ? 264 : 0)))); + var ww = l7 ? 32 : 11; + while (d.l < hend && d[d.l] != 0x0d) { + field = ({} /*:any*/); + field.name = (typeof $cptable !== "undefined" ? $cptable.utils.decode(current_cp, d.slice(d.l, d.l + ww)) : a2s(d.slice(d.l, d.l + ww))).replace(/[\u0000\r\n].*$/g, ""); + d.l += ww; + field.type = String.fromCharCode(d.read_shift(1)); + if (ft != 0x02 && !l7) + field.offset = d.read_shift(4); + field.len = d.read_shift(1); + if (ft == 0x02) + field.offset = d.read_shift(2); + field.dec = d.read_shift(1); + if (field.name.length) + fields.push(field); + if (ft != 0x02) + d.l += l7 ? 13 : 14; + switch (field.type) { + case 'B': // Double (VFP) / Binary (dBASE L7) + if ((!vfp || field.len != 8) && opts.WTF) + console.log('Skipping ' + field.name + ':' + field.type); + break; + case 'G': // General (FoxPro and dBASE L7) + case 'P': // Picture (FoxPro and dBASE L7) + if (opts.WTF) + console.log('Skipping ' + field.name + ':' + field.type); + break; + case '+': // Autoincrement (dBASE L7 only) + case '0': // _NullFlags (VFP only) + case '@': // Timestamp (dBASE L7 only) + case 'C': // Character (dBASE II) + case 'D': // Date (dBASE III) + case 'F': // Float (dBASE IV) + case 'I': // Long (VFP and dBASE L7) + case 'L': // Logical (dBASE II) + case 'M': // Memo (dBASE III) + case 'N': // Number (dBASE II) + case 'O': // Double (dBASE L7 only) + case 'T': // Datetime (VFP only) + case 'Y': // Currency (VFP only) + break; + default: throw new Error('Unknown Field Type: ' + field.type); + } + } + if (d[d.l] !== 0x0D) + d.l = fpos - 1; + if (d.read_shift(1) !== 0x0D) + throw new Error("DBF Terminator not found " + d.l + " " + d[d.l]); + d.l = fpos; + /* data */ + var R = 0, C = 0; + out[0] = []; + for (C = 0; C != fields.length; ++C) + out[0][C] = fields[C].name; + while (nrow-- > 0) { + if (d[d.l] === 0x2A) { + // TODO: record marked as deleted -- create a hidden row? + d.l += rlen; + continue; + } + ++d.l; + out[++R] = []; + C = 0; + for (C = 0; C != fields.length; ++C) { + var dd = d.slice(d.l, d.l + fields[C].len); + d.l += fields[C].len; + prep_blob(dd, 0); + var s = typeof $cptable !== "undefined" ? $cptable.utils.decode(current_cp, dd) : a2s(dd); + switch (fields[C].type) { + case 'C': + // NOTE: it is conventional to write ' / / ' for empty dates + if (s.trim().length) + out[R][C] = s.replace(/\s+$/, ""); + break; + case 'D': + if (s.length === 8) { + out[R][C] = new Date(Date.UTC(+s.slice(0, 4), +s.slice(4, 6) - 1, +s.slice(6, 8), 0, 0, 0, 0)); + if (!(opts && opts.UTC)) { + out[R][C] = utc_to_local(out[R][C]); + } + } + else + out[R][C] = s; + break; + case 'F': + out[R][C] = parseFloat(s.trim()); + break; + case '+': + case 'I': + out[R][C] = l7 ? dd.read_shift(-4, 'i') ^ 0x80000000 : dd.read_shift(4, 'i'); + break; + case 'L': + switch (s.trim().toUpperCase()) { + case 'Y': + case 'T': + out[R][C] = true; + break; + case 'N': + case 'F': + out[R][C] = false; + break; + case '': + case '?': break; + default: throw new Error("DBF Unrecognized L:|" + s + "|"); + } + break; + case 'M': /* TODO: handle memo files */ + if (!memo) + throw new Error("DBF Unexpected MEMO for type " + ft.toString(16)); + out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10) : dd.read_shift(4)); + break; + case 'N': + s = s.replace(/\u0000/g, "").trim(); + // NOTE: dBASE II interprets " . " as 0 + if (s && s != ".") + out[R][C] = +s || 0; + break; + case '@': + // NOTE: dBASE specs appear to be incorrect + out[R][C] = new Date(dd.read_shift(-8, 'f') - 0x388317533400); + break; + case 'T': + { + var hi = dd.read_shift(4), lo = dd.read_shift(4); + if (hi == 0 && lo == 0) + break; + out[R][C] = new Date((hi - 0x253D8C) * 0x5265C00 + lo); + if (!(opts && opts.UTC)) + out[R][C] = utc_to_local(out[R][C]); + } + break; + case 'Y': + out[R][C] = dd.read_shift(4, 'i') / 1e4 + (dd.read_shift(4, 'i') / 1e4) * Math.pow(2, 32); + break; + case 'O': + out[R][C] = -dd.read_shift(-8, 'f'); + break; + case 'B': if (vfp && fields[C].len == 8) { + out[R][C] = dd.read_shift(8, 'f'); + break; + } + /* falls through */ + case 'G': + case 'P': + dd.l += fields[C].len; + break; + case '0': + if (fields[C].name === '_NullFlags') + break; + /* falls through */ + default: throw new Error("DBF Unsupported data type " + fields[C].type); + } + } + } + if (ft != 0x02) + if (d.l < d.length && d[d.l++] != 0x1A) + throw new Error("DBF EOF Marker missing " + (d.l - 1) + " of " + d.length + " " + d[d.l - 1].toString(16)); + if (opts && opts.sheetRows) + out = out.slice(0, opts.sheetRows); + opts.DBF = fields; + return out; + } + function dbf_to_sheet(buf, opts) { + var o = opts || {}; + if (!o.dateNF) + o.dateNF = "yyyymmdd"; + var ws = aoa_to_sheet(dbf_to_aoa(buf, o), o); + ws["!cols"] = o.DBF.map(function (field) { + return { + wch: field.len, + DBF: field + }; + }); + delete o.DBF; + return ws; + } + function dbf_to_workbook(buf, opts) { + try { + var o = sheet_to_workbook(dbf_to_sheet(buf, opts), opts); + o.bookType = "dbf"; + return o; + } + catch (e) { + if (opts && opts.WTF) + throw e; + } + return ({ SheetNames: [], Sheets: {} }); + } + var _RLEN = { 'B': 8, 'C': 250, 'L': 1, 'D': 8, '?': 0, '': 0 }; + function sheet_to_dbf(ws /*:Worksheet*/, opts /*:WriteOpts*/) { + var o = opts || {}; + var old_cp = current_codepage; + if (+o.codepage >= 0) + set_cp(+o.codepage); + if (o.type == "string") + throw new Error("Cannot write DBF to JS string"); + var ba = buf_array(); + var aoa /*:AOA*/ = sheet_to_json(ws, { header: 1, raw: true, cellDates: true }); + var headers = aoa[0], data = aoa.slice(1), cols = ws["!cols"] || []; + var i = 0, j = 0, hcnt = 0, rlen = 1; + for (i = 0; i < headers.length; ++i) { + if (((cols[i] || {}).DBF || {}).name) { + headers[i] = cols[i].DBF.name; + ++hcnt; + continue; + } + if (headers[i] == null) + continue; + ++hcnt; + if (typeof headers[i] === 'number') + headers[i] = headers[i].toString(10); + if (typeof headers[i] !== 'string') + throw new Error("DBF Invalid column name " + headers[i] + " |" + (typeof headers[i]) + "|"); + if (headers.indexOf(headers[i]) !== i) + for (j = 0; j < 1024; ++j) + if (headers.indexOf(headers[i] + "_" + j) == -1) { + headers[i] += "_" + j; + break; + } + } + var range = safe_decode_range(ws['!ref']); + var coltypes /*:Array*/ = []; + var colwidths /*:Array*/ = []; + var coldecimals /*:Array*/ = []; + for (i = 0; i <= range.e.c - range.s.c; ++i) { + var guess = '', _guess = '', maxlen = 0; + var col /*:Array*/ = []; + for (j = 0; j < data.length; ++j) { + if (data[j][i] != null) + col.push(data[j][i]); + } + if (col.length == 0 || headers[i] == null) { + coltypes[i] = '?'; + continue; + } + for (j = 0; j < col.length; ++j) { + switch (typeof col[j]) { + /* TODO: check if L2 compat is desired */ + case 'number': + _guess = 'B'; + break; + case 'string': + _guess = 'C'; + break; + case 'boolean': + _guess = 'L'; + break; + case 'object': + _guess = col[j] instanceof Date ? 'D' : 'C'; + break; + default: _guess = 'C'; + } + /* TODO: cache the values instead of encoding twice */ + maxlen = Math.max(maxlen, (typeof $cptable !== "undefined" && typeof col[j] == "string" ? $cptable.utils.encode(current_ansi, col[j]) : String(col[j])).length); + guess = guess && guess != _guess ? 'C' : _guess; + //if(guess == 'C') break; + } + if (maxlen > 250) + maxlen = 250; + _guess = ((cols[i] || {}).DBF || {}).type; + /* TODO: more fine grained control over DBF type resolution */ + if (_guess == 'C') { + if (cols[i].DBF.len > maxlen) + maxlen = cols[i].DBF.len; + } + if (guess == 'B' && _guess == 'N') { + guess = 'N'; + coldecimals[i] = cols[i].DBF.dec; + maxlen = cols[i].DBF.len; + } + colwidths[i] = guess == 'C' || _guess == 'N' ? maxlen : (_RLEN[guess] || 0); + rlen += colwidths[i]; + coltypes[i] = guess; + } + var h = ba.next(32); + h.write_shift(4, 0x13021130); + h.write_shift(4, data.length); + h.write_shift(2, 296 + 32 * hcnt); + h.write_shift(2, rlen); + for (i = 0; i < 4; ++i) + h.write_shift(4, 0); + var cp = +dbf_reverse_map[ /*::String(*/current_codepage /*::)*/] || 0x03; + h.write_shift(4, 0x00000000 | (cp << 8)); + if (dbf_codepage_map[cp] != +o.codepage) { + if (o.codepage) + console.error("DBF Unsupported codepage " + current_codepage + ", using 1252"); + current_codepage = 1252; + } + for (i = 0, j = 0; i < headers.length; ++i) { + if (headers[i] == null) + continue; + var hf = ba.next(32); + /* TODO: test how applications handle non-ASCII field names */ + var _f = (headers[i].slice(-10) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00").slice(0, 11); + hf.write_shift(1, _f, "sbcs"); + hf.write_shift(1, coltypes[i] == '?' ? 'C' : coltypes[i], "sbcs"); + hf.write_shift(4, j); + hf.write_shift(1, colwidths[i] || _RLEN[coltypes[i]] || 0); + hf.write_shift(1, coldecimals[i] || 0); + hf.write_shift(1, 0x02); + hf.write_shift(4, 0); + hf.write_shift(1, 0); + hf.write_shift(4, 0); + hf.write_shift(4, 0); + j += (colwidths[i] || _RLEN[coltypes[i]] || 0); + } + var hb = ba.next(264); + hb.write_shift(4, 0x0000000D); + for (i = 0; i < 65; ++i) + hb.write_shift(4, 0x00000000); + for (i = 0; i < data.length; ++i) { + var rout = ba.next(rlen); + rout.write_shift(1, 0); + for (j = 0; j < headers.length; ++j) { + if (headers[j] == null) + continue; + switch (coltypes[j]) { + case 'L': + rout.write_shift(1, data[i][j] == null ? 0x3F : data[i][j] ? 0x54 : 0x46); + break; + case 'B': + rout.write_shift(8, data[i][j] || 0, 'f'); + break; + case 'N': + var _n = "0"; + if (typeof data[i][j] == "number") + _n = data[i][j].toFixed(coldecimals[j] || 0); + if (_n.length > colwidths[j]) + _n = _n.slice(0, colwidths[j]); // addresses decimal > width + for (hcnt = 0; hcnt < colwidths[j] - _n.length; ++hcnt) + rout.write_shift(1, 0x20); + rout.write_shift(1, _n, "sbcs"); + break; + case 'D': + if (!data[i][j]) + rout.write_shift(8, "00000000", "sbcs"); + else { + rout.write_shift(4, ("0000" + data[i][j].getFullYear()).slice(-4), "sbcs"); + rout.write_shift(2, ("00" + (data[i][j].getMonth() + 1)).slice(-2), "sbcs"); + rout.write_shift(2, ("00" + data[i][j].getDate()).slice(-2), "sbcs"); + } + break; + case 'C': + var _l = rout.l; + var _s = String(data[i][j] != null ? data[i][j] : "").slice(0, colwidths[j]); + rout.write_shift(1, _s, "cpstr"); + _l += colwidths[j] - rout.l; + for (hcnt = 0; hcnt < _l; ++hcnt) + rout.write_shift(1, 0x20); + break; + } + } + // data + } + current_codepage = old_cp; + ba.next(1).write_shift(1, 0x1A); + return ba.end(); + } + return { + to_workbook: dbf_to_workbook, + to_sheet: dbf_to_sheet, + from_sheet: sheet_to_dbf + }; +})(); +var SYLK = /*#__PURE__*/ (function () { + /* TODO: stress test sequences */ + var sylk_escapes = ({ + AA: 'À', BA: 'Á', CA: 'Â', DA: 195, HA: 'Ä', JA: 197, + AE: 'È', BE: 'É', CE: 'Ê', HE: 'Ë', + AI: 'ÃŒ', BI: 'Í', CI: 'ÃŽ', HI: 'Ï', + AO: 'Ã’', BO: 'Ó', CO: 'Ô', DO: 213, HO: 'Ö', + AU: 'Ù', BU: 'Ú', CU: 'Û', HU: 'Ãœ', + Aa: 'à ', Ba: 'á', Ca: 'â', Da: 227, Ha: 'ä', Ja: 229, + Ae: 'è', Be: 'é', Ce: 'ê', He: 'ë', + Ai: 'ì', Bi: 'í', Ci: 'î', Hi: 'ï', + Ao: 'ò', Bo: 'ó', Co: 'ô', Do: 245, Ho: 'ö', + Au: 'ù', Bu: 'ú', Cu: 'û', Hu: 'ü', + KC: 'Ç', Kc: 'ç', q: 'æ', z: 'Å“', a: 'Æ', j: 'Å’', + DN: 209, Dn: 241, Hy: 255, + S: 169, c: 170, R: 174, "B ": 180, + /*::[*/ 0 /*::]*/: 176, /*::[*/ 1 /*::]*/: 177, /*::[*/ 2 /*::]*/: 178, + /*::[*/ 3 /*::]*/: 179, /*::[*/ 5 /*::]*/: 181, /*::[*/ 6 /*::]*/: 182, + /*::[*/ 7 /*::]*/: 183, Q: 185, k: 186, b: 208, i: 216, l: 222, s: 240, y: 248, + "!": 161, '"': 162, "#": 163, "(": 164, "%": 165, "'": 167, "H ": 168, + "+": 171, ";": 187, "<": 188, "=": 189, ">": 190, "?": 191, "{": 223 + } /*:any*/); + var sylk_char_regex = new RegExp("\u001BN(" + keys(sylk_escapes).join("|").replace(/\|\|\|/, "|\\||").replace(/([?()+])/g, "\\$1") + "|\\|)", "gm"); + var sylk_char_fn = function (_, $1) { var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; }; + var decode_sylk_char = function ($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20) << 4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); }; + sylk_escapes["|"] = 254; + /* TODO: evert the escape map */ + var encode_sylk_str = function ($$) { return $$.replace(/\n/g, "\x1b :").replace(/\r/g, "\x1b ="); }; + /* https://oss.sheetjs.com/notes/sylk/ for more details */ + function sylk_to_aoa(d /*:RawData*/, opts) { + switch (opts.type) { + case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts); + case 'binary': return sylk_to_aoa_str(d, opts); + case 'buffer': return sylk_to_aoa_str(has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d), opts); + case 'array': return sylk_to_aoa_str(cc2str(d), opts); + } + throw new Error("Unrecognized type " + opts.type); + } + function sylk_to_aoa_str(str /*:string*/, opts) { + var records = str.split(/[\n\r]+/), R = -1, C = -1, ri = 0, rj = 0, arr /*:AOA*/ = []; + var formats /*:Array*/ = []; + var next_cell_format /*:string|null*/ = null; + var sht = {}, rowinfo /*:Array*/ = [], colinfo /*:Array*/ = [], cw /*:Array*/ = []; + var Mval = 0, j; + var wb = { Workbook: { WBProps: {}, Names: [] } }; + if (+opts.codepage >= 0) + set_cp(+opts.codepage); + for (; ri !== records.length; ++ri) { + Mval = 0; + var rstr = records[ri].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g, decode_sylk_char).replace(sylk_char_regex, sylk_char_fn); + var record = rstr.replace(/;;/g, "\u0000").split(";").map(function (x) { return x.replace(/\u0000/g, ";"); }); + var RT = record[0], val; + if (rstr.length > 0) + switch (RT) { + case 'ID': break; /* header */ + case 'E': break; /* EOF */ + case 'B': break; /* dimensions */ + case 'O': /* workbook options */ + for (rj = 1; rj < record.length; ++rj) + switch (record[rj].charAt(0)) { + case 'V': + { + var d1904 = parseInt(record[rj].slice(1), 10); + // NOTE: it is technically an error if d1904 >= 5 or < 0 + if (d1904 >= 1 && d1904 <= 4) + wb.Workbook.WBProps.date1904 = true; + } + break; + } + break; + case 'W': break; /* window */ + case 'P': + switch (record[1].charAt(0)) { + case 'P': + formats.push(rstr.slice(3).replace(/;;/g, ";")); + break; + } + break; + case 'NN': + { /* defined name */ + var nn = { Sheet: 0 }; + for (rj = 1; rj < record.length; ++rj) + switch (record[rj].charAt(0)) { + case 'N': + nn.Name = record[rj].slice(1); + break; + case 'E': + nn.Ref = (opts && opts.sheet || "Sheet1") + "!" + rc_to_a1(record[rj].slice(1)); + break; + } + wb.Workbook.Names.push(nn); + } + break; + // case 'NE': // ?? + // case 'NU': // ?? + case 'C': /* cell */ + var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1, formula = "", cell_t = "z"; + var cmnt = ""; + for (rj = 1; rj < record.length; ++rj) + switch (record[rj].charAt(0)) { + case 'A': + cmnt = record[rj].slice(1); + break; // TODO: comment + case 'X': + C = parseInt(record[rj].slice(1), 10) - 1; + C_seen_X = true; + break; + case 'Y': + R = parseInt(record[rj].slice(1), 10) - 1; + if (!C_seen_X) + C = 0; + for (j = arr.length; j <= R; ++j) + arr[j] = []; + break; + case 'K': + val = record[rj].slice(1); + if (val.charAt(0) === '"') { + val = val.slice(1, val.length - 1); + cell_t = "s"; + } + else if (val === 'TRUE' || val === 'FALSE') { + val = val === 'TRUE'; + cell_t = "b"; + } + else if (!isNaN(fuzzynum(val))) { + val = fuzzynum(val); + cell_t = "n"; + if (next_cell_format !== null && fmt_is_date(next_cell_format) && opts.cellDates) { + val = numdate(wb.Workbook.WBProps.date1904 ? val + 1462 : val); + cell_t = typeof val == "number" ? "n" : "d"; + } + } + if (typeof $cptable !== 'undefined' && typeof val == "string" && ((opts || {}).type != "string") && (opts || {}).codepage) + val = $cptable.utils.decode(opts.codepage, val); + C_seen_K = true; + break; + case 'E': + C_seen_E = true; + formula = rc_to_a1(record[rj].slice(1), { r: R, c: C }); + break; + case 'S': + C_seen_S = true; + break; + case 'G': break; // unknown + case 'R': + _R = parseInt(record[rj].slice(1), 10) - 1; + break; + case 'C': + _C = parseInt(record[rj].slice(1), 10) - 1; + break; + // case 'P': // ?? + // case 'D': // ?? + default: if (opts && opts.WTF) + throw new Error("SYLK bad record " + rstr); + } + if (C_seen_K) { + if (!arr[R][C]) + arr[R][C] = { t: cell_t, v: val }; + else { + arr[R][C].t = cell_t; + arr[R][C].v = val; + } + if (next_cell_format) + arr[R][C].z = next_cell_format; + if (opts.cellText !== false && next_cell_format) + arr[R][C].w = SSF_format(arr[R][C].z, arr[R][C].v, { date1904: wb.Workbook.WBProps.date1904 }); + next_cell_format = null; + } + if (C_seen_S) { + if (C_seen_E) + throw new Error("SYLK shared formula cannot have own formula"); + var shrbase = _R > -1 && arr[_R][_C]; + if (!shrbase || !shrbase[1]) + throw new Error("SYLK shared formula cannot find base"); + formula = shift_formula_str(shrbase[1], { r: R - _R, c: C - _C }); + } + if (formula) { + if (!arr[R][C]) + arr[R][C] = { t: 'n', f: formula }; + else + arr[R][C].f = formula; + } + if (cmnt) { + if (!arr[R][C]) + arr[R][C] = { t: 'z' }; + arr[R][C].c = [{ a: "SheetJSYLK", t: cmnt }]; + } + break; + case 'F': /* Format */ + var F_seen = 0; + for (rj = 1; rj < record.length; ++rj) + switch (record[rj].charAt(0)) { + case 'X': + C = parseInt(record[rj].slice(1), 10) - 1; + ++F_seen; + break; + case 'Y': + R = parseInt(record[rj].slice(1), 10) - 1; /*C = 0;*/ + for (j = arr.length; j <= R; ++j) + arr[j] = []; + break; + case 'M': + Mval = parseInt(record[rj].slice(1), 10) / 20; + break; + case 'F': break; /* ??? */ + case 'G': break; /* hide grid */ + case 'P': + next_cell_format = formats[parseInt(record[rj].slice(1), 10)]; + break; + case 'S': break; /* cell style */ + case 'D': break; /* column */ + case 'N': break; /* font */ + case 'W': + cw = record[rj].slice(1).split(" "); + for (j = parseInt(cw[0], 10); j <= parseInt(cw[1], 10); ++j) { + Mval = parseInt(cw[2], 10); + colinfo[j - 1] = Mval === 0 ? { hidden: true } : { wch: Mval }; + } + break; + case 'C': /* default column format */ + C = parseInt(record[rj].slice(1), 10) - 1; + if (!colinfo[C]) + colinfo[C] = {}; + break; + case 'R': /* row properties */ + R = parseInt(record[rj].slice(1), 10) - 1; + if (!rowinfo[R]) + rowinfo[R] = {}; + if (Mval > 0) { + rowinfo[R].hpt = Mval; + rowinfo[R].hpx = pt2px(Mval); + } + else if (Mval === 0) + rowinfo[R].hidden = true; + break; + // case 'K': // ?? + // case 'E': // ?? + default: if (opts && opts.WTF) + throw new Error("SYLK bad record " + rstr); + } + if (F_seen < 1) + next_cell_format = null; + break; + default: if (opts && opts.WTF) + throw new Error("SYLK bad record " + rstr); + } + } + if (rowinfo.length > 0) + sht['!rows'] = rowinfo; + if (colinfo.length > 0) + sht['!cols'] = colinfo; + colinfo.forEach(function (col) { process_col(col); }); + if (opts && opts.sheetRows) + arr = arr.slice(0, opts.sheetRows); + return [arr, sht, wb]; + } + function sylk_to_workbook(d /*:RawData*/, opts) { + var aoasht = sylk_to_aoa(d, opts); + var aoa = aoasht[0], ws = aoasht[1], wb = aoasht[2]; + var _opts = dup(opts); + _opts.date1904 = (((wb || {}).Workbook || {}).WBProps || {}).date1904; + var o = aoa_to_sheet(aoa, _opts); + keys(ws).forEach(function (k) { o[k] = ws[k]; }); + var outwb = sheet_to_workbook(o, opts); + keys(wb).forEach(function (k) { outwb[k] = wb[k]; }); + outwb.bookType = "sylk"; + return outwb; + } + function write_ws_cell_sylk(cell /*:Cell*/, ws /*:Worksheet*/, R /*:number*/, C /*:number*/, opts, date1904 /*:boolean*/) { + var o = "C;Y" + (R + 1) + ";X" + (C + 1) + ";K"; + switch (cell.t) { + case 'n': + o += (cell.v || 0); + if (cell.f && !cell.F) + o += ";E" + a1_to_rc(cell.f, { r: R, c: C }); + break; + case 'b': + o += cell.v ? "TRUE" : "FALSE"; + break; + case 'e': + o += cell.w || cell.v; + break; + case 'd': + o += datenum(parseDate(cell.v, date1904), date1904); + break; + case 's': + o += '"' + (cell.v == null ? "" : String(cell.v)).replace(/"/g, "").replace(/;/g, ";;") + '"'; + break; + } + return o; + } + function write_ws_cmnt_sylk(cmnt /*:Comment*/, R /*:number*/, C /*:number*/) { + var o = "C;Y" + (R + 1) + ";X" + (C + 1) + ";A"; + /* TODO: max length? */ + o += encode_sylk_str(cmnt.map(function (c) { return c.t; }).join("")); + return o; + } + function write_ws_cols_sylk(out, cols) { + cols.forEach(function (col, i) { + var rec = "F;W" + (i + 1) + " " + (i + 1) + " "; + if (col.hidden) + rec += "0"; + else { + if (typeof col.width == 'number' && !col.wpx) + col.wpx = width2px(col.width); + if (typeof col.wpx == 'number' && !col.wch) + col.wch = px2char(col.wpx); + if (typeof col.wch == 'number') + rec += Math.round(col.wch); + } + if (rec.charAt(rec.length - 1) != " ") + out.push(rec); + }); + } + function write_ws_rows_sylk(out /*:Array*/, rows /*:Array*/) { + rows.forEach(function (row, i) { + var rec = "F;"; + if (row.hidden) + rec += "M0;"; + else if (row.hpt) + rec += "M" + 20 * row.hpt + ";"; + else if (row.hpx) + rec += "M" + 20 * px2pt(row.hpx) + ";"; + if (rec.length > 2) + out.push(rec + "R" + (i + 1)); + }); + } + function sheet_to_sylk(ws /*:Worksheet*/, opts /*:?any*/, wb /*:?WorkBook*/) { + if (!opts) + opts = {}; + opts._formats = ["General"]; + /* TODO: codepage */ + var preamble /*:Array*/ = ["ID;PSheetJS;N;E"], o /*:Array*/ = []; + var r = safe_decode_range(ws['!ref']), cell /*:Cell*/; + var dense = ws["!data"] != null; + var RS = "\r\n"; + var d1904 = (((wb || {}).Workbook || {}).WBProps || {}).date1904; + var _lastfmt = "General"; + preamble.push("P;PGeneral"); + /* Excel has been inconsistent in comment placement */ + var R = r.s.r, C = r.s.c, p = []; + for (R = r.s.r; R <= r.e.r; ++R) { + if (dense && !ws["!data"][R]) + continue; + p = []; + for (C = r.s.c; C <= r.e.c; ++C) { + cell = dense ? ws["!data"][R][C] : ws[encode_col(C) + encode_row(R)]; + if (!cell || !cell.c) + continue; + p.push(write_ws_cmnt_sylk(cell.c, R, C)); + } + if (p.length) + o.push(p.join(RS)); + } + for (R = r.s.r; R <= r.e.r; ++R) { + if (dense && !ws["!data"][R]) + continue; + p = []; + for (C = r.s.c; C <= r.e.c; ++C) { + cell = dense ? ws["!data"][R][C] : ws[encode_col(C) + encode_row(R)]; + if (!cell || (cell.v == null && (!cell.f || cell.F))) + continue; + if ((cell.z || (cell.t == "d" ? table_fmt[14] : "General")) != _lastfmt) { + var ifmt = opts._formats.indexOf(cell.z); + if (ifmt == -1) { + opts._formats.push(cell.z); + ifmt = opts._formats.length - 1; + preamble.push("P;P" + cell.z.replace(/;/g, ";;")); + } + p.push("F;P" + ifmt + ";Y" + (R + 1) + ";X" + (C + 1)); + } + p.push(write_ws_cell_sylk(cell, ws, R, C, opts, d1904)); + } + o.push(p.join(RS)); + } + preamble.push("F;P0;DG0G8;M255"); + if (ws['!cols']) + write_ws_cols_sylk(preamble, ws['!cols']); + if (ws['!rows']) + write_ws_rows_sylk(preamble, ws['!rows']); + preamble.push("B;Y" + (r.e.r - r.s.r + 1) + ";X" + (r.e.c - r.s.c + 1) + ";D" + [r.s.c, r.s.r, r.e.c, r.e.r].join(" ")); + preamble.push("O;L;D;B" + (d1904 ? ";V4" : "") + ";K47;G100 0.001"); + delete opts._formats; + return preamble.join(RS) + RS + o.join(RS) + RS + "E" + RS; + } + return { + to_workbook: sylk_to_workbook, + from_sheet: sheet_to_sylk + }; +})(); +var DIF = /*#__PURE__*/ (function () { + function dif_to_aoa(d /*:RawData*/, opts) { + switch (opts.type) { + case 'base64': return dif_to_aoa_str(Base64_decode(d), opts); + case 'binary': return dif_to_aoa_str(d, opts); + case 'buffer': return dif_to_aoa_str(has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d), opts); + case 'array': return dif_to_aoa_str(cc2str(d), opts); + } + throw new Error("Unrecognized type " + opts.type); + } + function dif_to_aoa_str(str /*:string*/, opts) { + var records = str.split('\n'), R = -1, C = -1, ri = 0, arr /*:AOA*/ = []; + for (; ri !== records.length; ++ri) { + if (records[ri].trim() === 'BOT') { + arr[++R] = []; + C = 0; + continue; + } + if (R < 0) + continue; + var metadata = records[ri].trim().split(","); + var type = metadata[0], value = metadata[1]; + ++ri; + var data = records[ri] || ""; + while (((data.match(/["]/g) || []).length & 1) && ri < records.length - 1) + data += "\n" + records[++ri]; + data = data.trim(); + switch (+type) { + case -1: + if (data === 'BOT') { + arr[++R] = []; + C = 0; + continue; + } + else if (data !== 'EOD') + throw new Error("Unrecognized DIF special command " + data); + break; + case 0: + if (data === 'TRUE') + arr[R][C] = true; + else if (data === 'FALSE') + arr[R][C] = false; + else if (!isNaN(fuzzynum(value))) + arr[R][C] = fuzzynum(value); + else if (!isNaN(fuzzydate(value).getDate())) { + arr[R][C] = parseDate(value); + if (!(opts && opts.UTC)) { + arr[R][C] = utc_to_local(arr[R][C]); + } + } + else + arr[R][C] = value; + ++C; + break; + case 1: + data = data.slice(1, data.length - 1); + data = data.replace(/""/g, '"'); + if (DIF_XL && data && data.match(/^=".*"$/)) + data = data.slice(2, -1); + arr[R][C++] = data !== '' ? data : null; + break; + } + if (data === 'EOD') + break; + } + if (opts && opts.sheetRows) + arr = arr.slice(0, opts.sheetRows); + return arr; + } + function dif_to_sheet(str /*:string*/, opts) { return aoa_to_sheet(dif_to_aoa(str, opts), opts); } + function dif_to_workbook(str /*:string*/, opts) { + var o = sheet_to_workbook(dif_to_sheet(str, opts), opts); + o.bookType = "dif"; + return o; + } + function make_value(v /*:number*/, s /*:string*/) { return "0," + String(v) + "\r\n" + s; } + function make_value_str(s /*:string*/) { return "1,0\r\n\"" + s.replace(/"/g, '""') + '"'; } + function sheet_to_dif(ws /*:Worksheet*/ /*::, opts:?any*/) { + var _DIF_XL = DIF_XL; + var r = safe_decode_range(ws['!ref']); + var dense = ws["!data"] != null; + var o /*:Array*/ = [ + "TABLE\r\n0,1\r\n\"sheetjs\"\r\n", + "VECTORS\r\n0," + (r.e.r - r.s.r + 1) + "\r\n\"\"\r\n", + "TUPLES\r\n0," + (r.e.c - r.s.c + 1) + "\r\n\"\"\r\n", + "DATA\r\n0,0\r\n\"\"\r\n" + ]; + for (var R = r.s.r; R <= r.e.r; ++R) { + var row = dense ? ws["!data"][R] : []; + var p = "-1,0\r\nBOT\r\n"; + for (var C = r.s.c; C <= r.e.c; ++C) { + var cell /*:Cell*/ = dense ? (row && row[C]) : ws[encode_cell({ r: R, c: C })]; + if (cell == null) { + p += ("1,0\r\n\"\"\r\n"); + continue; + } + switch (cell.t) { + case 'n': + if (_DIF_XL) { + if (cell.w != null) + p += ("0," + cell.w + "\r\nV"); + else if (cell.v != null) + p += (make_value(cell.v, "V")); // TODO: should this call SSF_format? + else if (cell.f != null && !cell.F) + p += (make_value_str("=" + cell.f)); + else + p += ("1,0\r\n\"\""); + } + else { + if (cell.v == null) + p += ("1,0\r\n\"\""); + else + p += (make_value(cell.v, "V")); + } + break; + case 'b': + p += (cell.v ? make_value(1, "TRUE") : make_value(0, "FALSE")); + break; + case 's': + p += (make_value_str((!_DIF_XL || isNaN(+cell.v)) ? cell.v : '="' + cell.v + '"')); + break; + case 'd': + if (!cell.w) + cell.w = SSF_format(cell.z || table_fmt[14], datenum(parseDate(cell.v))); + if (_DIF_XL) + p += (make_value(cell.w, "V")); + else + p += (make_value_str(cell.w)); + break; + default: p += ("1,0\r\n\"\""); + } + p += "\r\n"; + } + o.push(p); + } + return o.join("") + "-1,0\r\nEOD"; + } + return { + to_workbook: dif_to_workbook, + to_sheet: dif_to_sheet, + from_sheet: sheet_to_dif + }; +})(); +var ETH = /*#__PURE__*/ (function () { + function decode(s /*:string*/) { return s.replace(/\\b/g, "\\").replace(/\\c/g, ":").replace(/\\n/g, "\n"); } + function encode(s /*:string*/) { return s.replace(/\\/g, "\\b").replace(/:/g, "\\c").replace(/\n/g, "\\n"); } + function eth_to_aoa(str /*:string*/, opts) { + var records = str.split('\n'), R = -1, C = -1, ri = 0, arr /*:AOA*/ = []; + for (; ri !== records.length; ++ri) { + var record = records[ri].trim().split(":"); + if (record[0] !== 'cell') + continue; + var addr = decode_cell(record[1]); + if (arr.length <= addr.r) + for (R = arr.length; R <= addr.r; ++R) + if (!arr[R]) + arr[R] = []; + R = addr.r; + C = addr.c; + switch (record[2]) { + case 't': + arr[R][C] = decode(record[3]); + break; + case 'v': + arr[R][C] = +record[3]; + break; + case 'vtf': var _f = record[record.length - 1]; + /* falls through */ + case 'vtc': + switch (record[3]) { + case 'nl': + arr[R][C] = +record[4] ? true : false; + break; + default: + arr[R][C] = +record[4]; + break; + } + if (record[2] == 'vtf') + arr[R][C] = [arr[R][C], _f]; + } + } + if (opts && opts.sheetRows) + arr = arr.slice(0, opts.sheetRows); + return arr; + } + function eth_to_sheet(d /*:string*/, opts) { return aoa_to_sheet(eth_to_aoa(d, opts), opts); } + function eth_to_workbook(d /*:string*/, opts) { return sheet_to_workbook(eth_to_sheet(d, opts), opts); } + var header = [ + "socialcalc:version:1.5", + "MIME-Version: 1.0", + "Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave" + ].join("\n"); + var sep = [ + "--SocialCalcSpreadsheetControlSave", + "Content-type: text/plain; charset=UTF-8" + ].join("\n") + "\n"; + /* TODO: the other parts */ + var meta = [ + "# SocialCalc Spreadsheet Control Save", + "part:sheet" + ].join("\n"); + var end = "--SocialCalcSpreadsheetControlSave--"; + function sheet_to_eth_data(ws /*:Worksheet*/) { + if (!ws || !ws['!ref']) + return ""; + var o /*:Array*/ = [], oo /*:Array*/ = [], cell, coord = ""; + var r = decode_range(ws['!ref']); + var dense = ws["!data"] != null; + for (var R = r.s.r; R <= r.e.r; ++R) { + for (var C = r.s.c; C <= r.e.c; ++C) { + coord = encode_cell({ r: R, c: C }); + cell = dense ? (ws["!data"][R] || [])[C] : ws[coord]; + if (!cell || cell.v == null || cell.t === 'z') + continue; + oo = ["cell", coord, 't']; + switch (cell.t) { + case 's': + case 'str': + oo.push(encode(cell.v)); + break; + case 'n': + if (!cell.f) { + oo[2] = 'v'; + oo[3] = cell.v; + } + else { + oo[2] = 'vtf'; + oo[3] = 'n'; + oo[4] = cell.v; + oo[5] = encode(cell.f); + } + break; + case 'b': + oo[2] = 'vt' + (cell.f ? 'f' : 'c'); + oo[3] = 'nl'; + oo[4] = cell.v ? "1" : "0"; + oo[5] = encode(cell.f || (cell.v ? 'TRUE' : 'FALSE')); + break; + case 'd': + var t = datenum(parseDate(cell.v)); + oo[2] = 'vtc'; + oo[3] = 'nd'; + oo[4] = "" + t; + oo[5] = cell.w || SSF_format(cell.z || table_fmt[14], t); + break; + case 'e': continue; + } + o.push(oo.join(":")); + } + } + o.push("sheet:c:" + (r.e.c - r.s.c + 1) + ":r:" + (r.e.r - r.s.r + 1) + ":tvf:1"); + o.push("valueformat:1:text-wiki"); + //o.push("copiedfrom:" + ws['!ref']); // clipboard only + return o.join("\n"); + } + function sheet_to_eth(ws /*:Worksheet*/ /*::, opts:?any*/) { + return [header, sep, meta, sep, sheet_to_eth_data(ws), end].join("\n"); + // return ["version:1.5", sheet_to_eth_data(ws)].join("\n"); // clipboard form + } + return { + to_workbook: eth_to_workbook, + to_sheet: eth_to_sheet, + from_sheet: sheet_to_eth + }; +})(); +var PRN = /*#__PURE__*/ (function () { + function set_text_arr(data /*:string*/, arr /*:AOA*/, R /*:number*/, C /*:number*/, o /*:any*/) { + if (o.raw) + arr[R][C] = data; + else if (data === "") { /* empty */ } + else if (data === 'TRUE') + arr[R][C] = true; + else if (data === 'FALSE') + arr[R][C] = false; + else if (!isNaN(fuzzynum(data))) + arr[R][C] = fuzzynum(data); + else if (!isNaN(fuzzydate(data).getDate())) + arr[R][C] = parseDate(data); + else + arr[R][C] = data; + } + function prn_to_aoa_str(f /*:string*/, opts) { + var o = opts || {}; + var arr /*:AOA*/ = ([] /*:any*/); + if (!f || f.length === 0) + return arr; + var lines = f.split(/[\r\n]/); + var L = lines.length - 1; + while (L >= 0 && lines[L].length === 0) + --L; + var start = 10, idx = 0; + var R = 0; + for (; R <= L; ++R) { + idx = lines[R].indexOf(" "); + if (idx == -1) + idx = lines[R].length; + else + idx++; + start = Math.max(start, idx); + } + for (R = 0; R <= L; ++R) { + arr[R] = []; + /* TODO: confirm that widths are always 10 */ + var C = 0; + set_text_arr(lines[R].slice(0, start).trim(), arr, R, C, o); + for (C = 1; C <= (lines[R].length - start) / 10 + 1; ++C) + set_text_arr(lines[R].slice(start + (C - 1) * 10, start + C * 10).trim(), arr, R, C, o); + } + if (o.sheetRows) + arr = arr.slice(0, o.sheetRows); + return arr; + } + // List of accepted CSV separators + var guess_seps = { + /*::[*/ 0x2C /*::]*/: ',', + /*::[*/ 0x09 /*::]*/: "\t", + /*::[*/ 0x3B /*::]*/: ';', + /*::[*/ 0x7C /*::]*/: '|' + }; + // CSV separator weights to be used in case of equal numbers + var guess_sep_weights = { + /*::[*/ 0x2C /*::]*/: 3, + /*::[*/ 0x09 /*::]*/: 2, + /*::[*/ 0x3B /*::]*/: 1, + /*::[*/ 0x7C /*::]*/: 0 + }; + function guess_sep(str) { + var cnt = {}, instr = false, end = 0, cc = 0; + for (; end < str.length; ++end) { + if ((cc = str.charCodeAt(end)) == 0x22) + instr = !instr; + else if (!instr && cc in guess_seps) + cnt[cc] = (cnt[cc] || 0) + 1; + } + cc = []; + for (end in cnt) + if (Object.prototype.hasOwnProperty.call(cnt, end)) { + cc.push([cnt[end], end]); + } + if (!cc.length) { + cnt = guess_sep_weights; + for (end in cnt) + if (Object.prototype.hasOwnProperty.call(cnt, end)) { + cc.push([cnt[end], end]); + } + } + cc.sort(function (a, b) { return a[0] - b[0] || guess_sep_weights[a[1]] - guess_sep_weights[b[1]]; }); + return guess_seps[cc.pop()[1]] || 0x2C; + } + function dsv_to_sheet_str(str /*:string*/, opts) { + var o = opts || {}; + var sep = ""; + if (DENSE != null && o.dense == null) + o.dense = DENSE; + var ws /*:Worksheet*/ = ({} /*:any*/); + if (o.dense) + ws["!data"] = []; + var range /*:Range*/ = ({ s: { c: 0, r: 0 }, e: { c: 0, r: 0 } } /*:any*/); + if (str.slice(0, 4) == "sep=") { + // If the line ends in \r\n + if (str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10) { + sep = str.charAt(4); + str = str.slice(7); + } + // If line ends in \r OR \n + else if (str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10) { + sep = str.charAt(4); + str = str.slice(6); + } + else + sep = guess_sep(str.slice(0, 1024)); + } + else if (o && o.FS) + sep = o.FS; + else + sep = guess_sep(str.slice(0, 1024)); + var R = 0, C = 0, v = 0; + var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc = 0, startcc = str.charCodeAt(0); + var _re /*:?RegExp*/ = o.dateNF != null ? dateNF_regex(o.dateNF) : null; + function finish_cell() { + /* TODO: fuzzy parsers should pass back assumed number format */ + var s = str.slice(start, end); + if (s.slice(-1) == "\r") + s = s.slice(0, -1); + var cell = ({} /*:any*/); + if (s.charAt(0) == '"' && s.charAt(s.length - 1) == '"') + s = s.slice(1, -1).replace(/""/g, '"'); + if (o.cellText !== false) + cell.w = s; + if (s.length === 0) + cell.t = 'z'; + else if (o.raw) { + cell.t = 's'; + cell.v = s; + } + else if (s.trim().length === 0) { + cell.t = 's'; + cell.v = s; + } + else if (s.charCodeAt(0) == 0x3D) { + if (s.charCodeAt(1) == 0x22 && s.charCodeAt(s.length - 1) == 0x22) { + cell.t = 's'; + cell.v = s.slice(2, -1).replace(/""/g, '"'); + } + else if (fuzzyfmla(s)) { + cell.t = 'n'; + cell.f = s.slice(1); + } + else { + cell.t = 's'; + cell.v = s; + } + } + else if (s == "TRUE") { + cell.t = 'b'; + cell.v = true; + } + else if (s == "FALSE") { + cell.t = 'b'; + cell.v = false; + } + else if (!isNaN(v = fuzzynum(s))) { + cell.t = 'n'; + cell.v = v; + } + else if (!isNaN((v = fuzzydate(s)).getDate()) || _re && s.match(_re)) { + cell.z = o.dateNF || table_fmt[14]; + if (_re && s.match(_re)) { + var news = dateNF_fix(s, o.dateNF, (s.match(_re) || [])); + v = parseDate(news); + if (o && o.UTC === false) + v = utc_to_local(v); + } + else if (o && o.UTC === false) + v = utc_to_local(v); + else if (o.cellText !== false && o.dateNF) + cell.w = SSF_format(cell.z, v); + if (o.cellDates) { + cell.t = 'd'; + cell.v = v; + } + else { + cell.t = 'n'; + cell.v = datenum(v); + } + if (!o.cellNF) + delete cell.z; + } + else { + cell.t = 's'; + cell.v = s; + } + if (cell.t == 'z') { } + else if (o.dense) { + if (!ws["!data"][R]) + ws["!data"][R] = []; + ws["!data"][R][C] = cell; + } + else + ws[encode_cell({ c: C, r: R })] = cell; + start = end + 1; + startcc = str.charCodeAt(start); + if (range.e.c < C) + range.e.c = C; + if (range.e.r < R) + range.e.r = R; + if (cc == sepcc) + ++C; + else { + C = 0; + ++R; + if (o.sheetRows && o.sheetRows <= R) + return true; + } + } + outer: for (; end < str.length; ++end) + switch ((cc = str.charCodeAt(end))) { + case 0x22: + if (startcc === 0x22) + instr = !instr; + break; + case 0x0d: + if (instr) + break; + if (str.charCodeAt(end + 1) == 0x0a) + ++end; + /* falls through */ + case sepcc: + case 0x0a: + if (!instr && finish_cell()) + break outer; + break; + default: break; + } + if (end - start > 0) + finish_cell(); + ws['!ref'] = encode_range(range); + return ws; + } + function prn_to_sheet_str(str /*:string*/, opts) { + if (!(opts && opts.PRN)) + return dsv_to_sheet_str(str, opts); + if (opts.FS) + return dsv_to_sheet_str(str, opts); + if (str.slice(0, 4) == "sep=") + return dsv_to_sheet_str(str, opts); + if (str.indexOf("\t") >= 0 || str.indexOf(",") >= 0 || str.indexOf(";") >= 0) + return dsv_to_sheet_str(str, opts); + return aoa_to_sheet(prn_to_aoa_str(str, opts), opts); + } + function prn_to_sheet(d /*:RawData*/, opts) { + var str = "", bytes = opts.type == 'string' ? [0, 0, 0, 0] : firstbyte(d, opts); + switch (opts.type) { + case 'base64': + str = Base64_decode(d); + break; + case 'binary': + str = d; + break; + case 'buffer': + if (opts.codepage == 65001) + str = d.toString('utf8'); // TODO: test if buf + else if (opts.codepage && typeof $cptable !== 'undefined') + str = $cptable.utils.decode(opts.codepage, d); + else + str = has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d); + break; + case 'array': + str = cc2str(d); + break; + case 'string': + str = d; + break; + default: throw new Error("Unrecognized type " + opts.type); + } + if (bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) + str = utf8read(str.slice(3)); + else if (opts.type != 'string' && opts.type != 'buffer' && opts.codepage == 65001) + str = utf8read(str); + else if ((opts.type == 'binary') && typeof $cptable !== 'undefined' && opts.codepage) + str = $cptable.utils.decode(opts.codepage, $cptable.utils.encode(28591, str)); + if (str.slice(0, 19) == "socialcalc:version:") + return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts); + return prn_to_sheet_str(str, opts); + } + function prn_to_workbook(d /*:RawData*/, opts) { return sheet_to_workbook(prn_to_sheet(d, opts), opts); } + function sheet_to_prn(ws /*:Worksheet*/ /*::, opts:?any*/) { + var o /*:Array*/ = []; + var r = safe_decode_range(ws['!ref']), cell /*:Cell*/; + var dense = ws["!data"] != null; + for (var R = r.s.r; R <= r.e.r; ++R) { + var oo /*:Array*/ = []; + for (var C = r.s.c; C <= r.e.c; ++C) { + var coord = encode_cell({ r: R, c: C }); + cell = dense ? (ws["!data"][R] || [])[C] : ws[coord]; + if (!cell || cell.v == null) { + oo.push(" "); + continue; + } + var w = (cell.w || (format_cell(cell), cell.w) || "").slice(0, 10); + while (w.length < 10) + w += " "; + oo.push(w + (C === 0 ? " " : "")); + } + o.push(oo.join("")); + } + return o.join("\n"); + } + return { + to_workbook: prn_to_workbook, + to_sheet: prn_to_sheet, + from_sheet: sheet_to_prn + }; +})(); +/* Excel defaults to SYLK but warns if data is not valid */ +function read_wb_ID(d, opts) { + var o = opts || {}, OLD_WTF = !!o.WTF; + o.WTF = true; + try { + var out = SYLK.to_workbook(d, o); + o.WTF = OLD_WTF; + return out; + } + catch (e) { + o.WTF = OLD_WTF; + if (!e.message.match(/SYLK bad record ID/) && OLD_WTF) + throw e; + return PRN.to_workbook(d, opts); + } +} +var WK_ = /*#__PURE__*/ (function () { + function lotushopper(data, cb /*:RecordHopperCB*/, opts /*:any*/) { + if (!data) + return; + prep_blob(data, data.l || 0); + var Enum = opts.Enum || WK1Enum; + while (data.l < data.length) { + var RT = data.read_shift(2); + var R = Enum[RT] || Enum[0xFFFF]; + var length = data.read_shift(2); + var tgt = data.l + length; + var d = R.f && R.f(data, length, opts); + data.l = tgt; + if (cb(d, R, RT)) + return; + } + } + function lotus_to_workbook(d /*:RawData*/, opts) { + switch (opts.type) { + case 'base64': return lotus_to_workbook_buf(s2a(Base64_decode(d)), opts); + case 'binary': return lotus_to_workbook_buf(s2a(d), opts); + case 'buffer': + case 'array': return lotus_to_workbook_buf(d, opts); + } + throw "Unsupported type " + opts.type; + } + /* NOTE: this list intentionally starts at 1 */ + var LOTUS_DATE_FMTS = [ + "mmmm", + "dd-mmm-yyyy", + "dd-mmm", + "mmm-yyyy", + "@", + "mm/dd", + "hh:mm:ss AM/PM", + "hh:mm AM/PM", + "mm/dd/yyyy", + "mm/dd", + "hh:mm:ss", + "hh:mm" // 12 + ]; + function lotus_to_workbook_buf(d, opts) { + if (!d) + return d; + var o = opts || {}; + if (DENSE != null && o.dense == null) + o.dense = DENSE; + var s /*:Worksheet*/ = ({} /*:any*/), n = "Sheet1", next_n = "", sidx = 0; + var sheets = {}, snames = [], realnames = [], sdata = []; + if (o.dense) + sdata = s["!data"] = []; + var refguess = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + var sheetRows = o.sheetRows || 0; + var lastcell = {}; + if (d[4] == 0x51 && d[5] == 0x50 && d[6] == 0x57) + return qpw_to_workbook_buf(d, opts); + if (d[2] == 0x00) { + if (d[3] == 0x08 || d[3] == 0x09) { + if (d.length >= 16 && d[14] == 0x05 && d[15] === 0x6c) + throw new Error("Unsupported Works 3 for Mac file"); + } + } + if (d[2] == 0x02) { + o.Enum = WK1Enum; + lotushopper(d, function (val, R, RT) { + switch (RT) { + case 0x00: /* BOF */ + o.vers = val; + if (val >= 0x1000) + o.qpro = true; + break; + case 0xFF: /* BOF (works 3+) */ + o.vers = val; + o.works = true; + break; + case 0x06: + refguess = val; + break; /* RANGE */ + case 0xCC: + if (val) + next_n = val; + break; /* SHEETNAMECS */ + case 0xDE: + next_n = val; + break; /* SHEETNAMELP */ + case 0x0F: /* LABEL */ + case 0x33: /* STRING */ + if ((!o.qpro && !o.works || RT == 0x33) && val[1].v.charCodeAt(0) < 0x30) + val[1].v = val[1].v.slice(1); + if (o.works || o.works2) + val[1].v = val[1].v.replace(/\r\n/g, "\n"); + /* falls through */ + case 0x0D: /* INTEGER */ + case 0x0E: /* NUMBER */ + case 0x10: /* FORMULA */ + /* TODO: actual translation of the format code */ + if ((val[2] & 0x70) == 0x70 && (val[2] & 0x0F) > 1 && (val[2] & 0x0F) < 15) { + val[1].z = o.dateNF || LOTUS_DATE_FMTS[(val[2] & 0x0F) - 1] || table_fmt[14]; + if (o.cellDates) { + val[1].v = numdate(val[1].v); + val[1].t = typeof val[1].v == "number" ? 'n' : 'd'; + } + } + if (o.qpro) { + if (val[3] > sidx) { + s["!ref"] = encode_range(refguess); + sheets[n] = s; + snames.push(n); + s = ({} /*:any*/); + if (o.dense) + sdata = s["!data"] = []; + refguess = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + sidx = val[3]; + n = next_n || "Sheet" + (sidx + 1); + next_n = ""; + } + } + var tmpcell = o.dense ? (sdata[val[0].r] || [])[val[0].c] : s[encode_cell(val[0])]; + if (tmpcell) { + tmpcell.t = val[1].t; + tmpcell.v = val[1].v; + if (val[1].z != null) + tmpcell.z = val[1].z; + if (val[1].f != null) + tmpcell.f = val[1].f; + lastcell = tmpcell; + break; + } + if (o.dense) { + if (!sdata[val[0].r]) + sdata[val[0].r] = []; + sdata[val[0].r][val[0].c] = val[1]; + } + else + s[encode_cell(val[0])] = val[1]; + lastcell = val[1]; + break; + case 0x5405: + o.works2 = true; + break; + case 0x5402: + { + /* TODO: enumerate all extended number formats */ + if (val == 0x14a1) { + lastcell.z = "hh:mm:ss"; + if (o.cellDates && lastcell.t == "n") { + lastcell.v = numdate(lastcell.v); + lastcell.t = typeof lastcell.v == "number" ? 'n' : 'd'; + } + } + } + break; + } + }, o); + } + else if (d[2] == 0x1A || d[2] == 0x0E) { + o.Enum = WK3Enum; + if (d[2] == 0x0E) { + o.qpro = true; + d.l = 0; + } + lotushopper(d, function (val, R, RT) { + switch (RT) { + case 0xCC: + n = val; + break; /* SHEETNAMECS */ + case 0x16: /* LABEL16 */ + if (val[1].v.charCodeAt(0) < 0x30) + val[1].v = val[1].v.slice(1); + // TODO: R9 appears to encode control codes this way -- verify against other versions + val[1].v = val[1].v.replace(/\x0F./g, function ($$) { return String.fromCharCode($$.charCodeAt(1) - 0x20); }).replace(/\r\n/g, "\n"); + /* falls through */ + case 0x17: /* NUMBER17 */ + case 0x18: /* NUMBER18 */ + case 0x19: /* FORMULA19 */ + case 0x25: /* NUMBER25 */ + case 0x27: /* NUMBER27 */ + case 0x28: /* FORMULA28 */ + if (val[3] > sidx) { + s["!ref"] = encode_range(refguess); + sheets[n] = s; + snames.push(n); + s = ({} /*:any*/); + if (o.dense) + sdata = s["!data"] = []; + refguess = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + sidx = val[3]; + n = "Sheet" + (sidx + 1); + } + if (sheetRows > 0 && val[0].r >= sheetRows) + break; + if (o.dense) { + if (!sdata[val[0].r]) + sdata[val[0].r] = []; + sdata[val[0].r][val[0].c] = val[1]; + } + else + s[encode_cell(val[0])] = val[1]; + if (refguess.e.c < val[0].c) + refguess.e.c = val[0].c; + if (refguess.e.r < val[0].r) + refguess.e.r = val[0].r; + break; + case 0x1B: /* XFORMAT */ + if (val[0x36b0]) + realnames[val[0x36b0][0]] = val[0x36b0][1]; + break; + case 0x0601: /* SHEETINFOQP */ + realnames[val[0]] = val[1]; + if (val[0] == sidx) + n = val[1]; + break; + default: break; + } + }, o); + } + else + throw new Error("Unrecognized LOTUS BOF " + d[2]); + s["!ref"] = encode_range(refguess); + sheets[next_n || n] = s; + snames.push(next_n || n); + if (!realnames.length) + return { SheetNames: snames, Sheets: sheets }; + var osheets = {}, rnames = []; + /* TODO: verify no collisions */ + for (var i = 0; i < realnames.length; ++i) + if (sheets[snames[i]]) { + rnames.push(realnames[i] || snames[i]); + osheets[realnames[i]] = sheets[realnames[i]] || sheets[snames[i]]; + } + else { + rnames.push(realnames[i]); + osheets[realnames[i]] = ({ "!ref": "A1" }); + } + return { SheetNames: rnames, Sheets: osheets }; + } + function sheet_to_wk1(ws /*:Worksheet*/, opts /*:WriteOpts*/) { + var o = opts || {}; + if (+o.codepage >= 0) + set_cp(+o.codepage); + if (o.type == "string") + throw new Error("Cannot write WK1 to JS string"); + var ba = buf_array(); + var range = safe_decode_range(ws["!ref"]); + var dense = ws["!data"] != null; + var cols = []; + write_biff_rec(ba, 0x00, write_BOF_WK1(0x0406)); + write_biff_rec(ba, 0x06, write_RANGE(range)); + var max_R = Math.min(range.e.r, 8191); + for (var C = range.s.c; C <= range.e.c; ++C) + cols[C] = encode_col(C); + for (var R = range.s.r; R <= max_R; ++R) { + var rr = encode_row(R); + for (C = range.s.c; C <= range.e.c; ++C) { + var cell = dense ? (ws["!data"][R] || [])[C] : ws[cols[C] + rr]; + if (!cell || cell.t == "z") + continue; + /* TODO: formula records */ + switch (cell.t) { + case "n": + if ((cell.v | 0) == cell.v && cell.v >= -32768 && cell.v <= 32767) + write_biff_rec(ba, 0x0d, write_INTEGER(R, C, cell)); + else + write_biff_rec(ba, 0x0e, write_NUMBER(R, C, cell)); + break; + case "d": + var dc = datenum(cell.v); + if ((dc | 0) == dc && dc >= -32768 && dc <= 32767) + write_biff_rec(ba, 0x0d, write_INTEGER(R, C, { t: "n", v: dc, z: cell.z || table_fmt[14] })); + else + write_biff_rec(ba, 0x0e, write_NUMBER(R, C, { t: "n", v: dc, z: cell.z || table_fmt[14] })); + break; + default: + var str = format_cell(cell); + write_biff_rec(ba, 0x0F, write_LABEL(R, C, str.slice(0, 239))); + } + } + } + write_biff_rec(ba, 0x01); + return ba.end(); + } + function book_to_wk3(wb /*:Workbook*/, opts /*:WriteOpts*/) { + var o = opts || {}; + if (+o.codepage >= 0) + set_cp(+o.codepage); + if (o.type == "string") + throw new Error("Cannot write WK3 to JS string"); + var ba = buf_array(); + write_biff_rec(ba, 0x00, write_BOF_WK3(wb)); + for (var i = 0, cnt = 0; i < wb.SheetNames.length; ++i) + if ((wb.Sheets[wb.SheetNames[i]] || {})["!ref"]) + write_biff_rec(ba, 0x1b, write_XFORMAT_SHEETNAME(wb.SheetNames[i], cnt++)); + var wsidx = 0; + for (i = 0; i < wb.SheetNames.length; ++i) { + var ws = wb.Sheets[wb.SheetNames[i]]; + if (!ws || !ws["!ref"]) + continue; + var range = safe_decode_range(ws["!ref"]); + var dense = ws["!data"] != null; + var cols = []; + var max_R = Math.min(range.e.r, 8191); + for (var R = range.s.r; R <= max_R; ++R) { + var rr = encode_row(R); + for (var C = range.s.c; C <= range.e.c; ++C) { + if (R === range.s.r) + cols[C] = encode_col(C); + var ref = cols[C] + rr; + var cell = dense ? (ws["!data"][R] || [])[C] : ws[ref]; + if (!cell || cell.t == "z") + continue; + /* TODO: FORMULA19 NUMBER18 records */ + if (cell.t == "n") { + write_biff_rec(ba, 0x17, write_NUMBER_17(R, C, wsidx, cell.v)); + } + else { + var str = format_cell(cell); + /* TODO: max len? */ + write_biff_rec(ba, 0x16, write_LABEL_16(R, C, wsidx, str.slice(0, 239))); + } + } + } + ++wsidx; + } + write_biff_rec(ba, 0x01); + return ba.end(); + } + function write_BOF_WK1(v /*:number*/) { + var out = new_buf(2); + out.write_shift(2, v); + return out; + } + function write_BOF_WK3(wb /*:Workbook*/) { + var out = new_buf(26); + out.write_shift(2, 0x1000); + out.write_shift(2, 0x0004); + out.write_shift(4, 0x0000); + var rows = 0, cols = 0, wscnt = 0; + for (var i = 0; i < wb.SheetNames.length; ++i) { + var name = wb.SheetNames[i]; + var ws = wb.Sheets[name]; + if (!ws || !ws["!ref"]) + continue; + ++wscnt; + var range = decode_range(ws["!ref"]); + if (rows < range.e.r) + rows = range.e.r; + if (cols < range.e.c) + cols = range.e.c; + } + if (rows > 8191) + rows = 8191; + out.write_shift(2, rows); + out.write_shift(1, wscnt); + out.write_shift(1, cols); + out.write_shift(2, 0x00); + out.write_shift(2, 0x00); + out.write_shift(1, 0x01); + out.write_shift(1, 0x02); + out.write_shift(4, 0); + out.write_shift(4, 0); + return out; + } + function parse_RANGE(blob, length, opts) { + var o = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } }; + if (length == 8 && opts.qpro) { + o.s.c = blob.read_shift(1); + blob.l++; + o.s.r = blob.read_shift(2); + o.e.c = blob.read_shift(1); + blob.l++; + o.e.r = blob.read_shift(2); + return o; + } + o.s.c = blob.read_shift(2); + o.s.r = blob.read_shift(2); + if (length == 12 && opts.qpro) + blob.l += 2; + o.e.c = blob.read_shift(2); + o.e.r = blob.read_shift(2); + if (length == 12 && opts.qpro) + blob.l += 2; + if (o.s.c == 0xFFFF) + o.s.c = o.e.c = o.s.r = o.e.r = 0; + return o; + } + function write_RANGE(range) { + var out = new_buf(8); + out.write_shift(2, range.s.c); + out.write_shift(2, range.s.r); + out.write_shift(2, range.e.c); + out.write_shift(2, range.e.r); + return out; + } + function parse_cell(blob, length, opts) { + var o = [{ c: 0, r: 0 }, { t: 'n', v: 0 }, 0, 0]; + if (opts.qpro && opts.vers != 0x5120) { + o[0].c = blob.read_shift(1); + o[3] = blob.read_shift(1); + o[0].r = blob.read_shift(2); + blob.l += 2; + } + else if (opts.works) { // TODO: verify with more complex works3-4 examples + o[0].c = blob.read_shift(2); + o[0].r = blob.read_shift(2); + o[2] = blob.read_shift(2); + } + else { + o[2] = blob.read_shift(1); + o[0].c = blob.read_shift(2); + o[0].r = blob.read_shift(2); + } + return o; + } + function get_wk1_fmt(cell) { + /* TODO: some fuzzy matching on the number format */ + if (cell.z && fmt_is_date(cell.z)) { + return 0xf0 | (LOTUS_DATE_FMTS.indexOf(cell.z) + 1 || 2); + } + return 0xFF; + } + function parse_LABEL(blob, length, opts) { + var tgt = blob.l + length; + var o = parse_cell(blob, length, opts); + o[1].t = 's'; + if ((opts.vers & 0xFFFE) == 0x5120) { // WQ1 / WQ2 + blob.l++; + var len = blob.read_shift(1); + o[1].v = blob.read_shift(len, 'utf8'); + return o; + } + if (opts.qpro) + blob.l++; + o[1].v = blob.read_shift(tgt - blob.l, 'cstr'); + return o; + } + function write_LABEL(R, C, s) { + /* TODO: encoding */ + var o = new_buf(7 + s.length); + o.write_shift(1, 0xFF); + o.write_shift(2, C); + o.write_shift(2, R); + o.write_shift(1, 0x27); // ?? + for (var i = 0; i < o.length; ++i) { + var cc = s.charCodeAt(i); + o.write_shift(1, cc >= 0x80 ? 0x5F : cc); + } + o.write_shift(1, 0); + return o; + } + function parse_STRING(blob, length, opts) { + var tgt = blob.l + length; + var o = parse_cell(blob, length, opts); + o[1].t = 's'; + if (opts.vers == 0x5120) { + var len = blob.read_shift(1); + o[1].v = blob.read_shift(len, 'utf8'); + return o; + } + o[1].v = blob.read_shift(tgt - blob.l, 'cstr'); + return o; + } + function parse_INTEGER(blob, length, opts) { + var o = parse_cell(blob, length, opts); + o[1].v = blob.read_shift(2, 'i'); + return o; + } + function write_INTEGER(R, C, cell) { + var o = new_buf(7); + o.write_shift(1, get_wk1_fmt(cell)); + o.write_shift(2, C); + o.write_shift(2, R); + o.write_shift(2, cell.v, 'i'); + return o; + } + function parse_NUMBER(blob, length, opts) { + var o = parse_cell(blob, length, opts); + o[1].v = blob.read_shift(8, 'f'); + return o; + } + function write_NUMBER(R, C, cell) { + var o = new_buf(13); + o.write_shift(1, get_wk1_fmt(cell)); + o.write_shift(2, C); + o.write_shift(2, R); + o.write_shift(8, cell.v, 'f'); + return o; + } + function parse_FORMULA(blob, length, opts) { + var tgt = blob.l + length; + var o = parse_cell(blob, length, opts); + /* TODO: formula */ + o[1].v = blob.read_shift(8, 'f'); + if (opts.qpro) + blob.l = tgt; + else { + var flen = blob.read_shift(2); + wk1_fmla_to_csf(blob.slice(blob.l, blob.l + flen), o); + blob.l += flen; + } + return o; + } + function wk1_parse_rc(B, V, col) { + var rel = V & 0x8000; + V &= ~0x8000; + V = (rel ? B : 0) + ((V >= 0x2000) ? V - 0x4000 : V); + return (rel ? "" : "$") + (col ? encode_col(V) : encode_row(V)); + } + /* var oprec = [ + 8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 4, 5, 5, 7, 3, 3, + 3, 3, 3, 3, 1, 1, 2, 6, 8, 8, 8, 8, 8, 8, 8, 8 + ]; */ + /* TODO: flesh out */ + var FuncTab = { + 0x1F: ["NA", 0], + // 0x20: ["ERR", 0], + 0x21: ["ABS", 1], + 0x22: ["TRUNC", 1], + 0x23: ["SQRT", 1], + 0x24: ["LOG", 1], + 0x25: ["LN", 1], + 0x26: ["PI", 0], + 0x27: ["SIN", 1], + 0x28: ["COS", 1], + 0x29: ["TAN", 1], + 0x2A: ["ATAN2", 2], + 0x2B: ["ATAN", 1], + 0x2C: ["ASIN", 1], + 0x2D: ["ACOS", 1], + 0x2E: ["EXP", 1], + 0x2F: ["MOD", 2], + // 0x30 + 0x31: ["ISNA", 1], + 0x32: ["ISERR", 1], + 0x33: ["FALSE", 0], + 0x34: ["TRUE", 0], + 0x35: ["RAND", 0], + 0x36: ["DATE", 3], + // 0x37 NOW + // 0x38 PMT + // 0x39 PV + // 0x3A FV + // 0x3B IF + // 0x3C DAY + // 0x3D MONTH + // 0x3E YEAR + 0x3F: ["ROUND", 2], + 0x40: ["TIME", 3], + // 0x41 HOUR + // 0x42 MINUTE + // 0x43 SECOND + 0x44: ["ISNUMBER", 1], + 0x45: ["ISTEXT", 1], + 0x46: ["LEN", 1], + 0x47: ["VALUE", 1], + // 0x48: ["FIXED", ?? 1], + 0x49: ["MID", 3], + 0x4A: ["CHAR", 1], + // 0x4B + // 0x4C FIND + // 0x4D DATEVALUE + // 0x4E TIMEVALUE + // 0x4F CELL + 0x50: ["SUM", 69], + 0x51: ["AVERAGEA", 69], + 0x52: ["COUNTA", 69], + 0x53: ["MINA", 69], + 0x54: ["MAXA", 69], + // 0x55 VLOOKUP + // 0x56 NPV + // 0x57 VAR + // 0x58 STD + // 0x59 IRR + // 0x5A HLOOKUP + // 0x5B DSUM + // 0x5C DAVERAGE + // 0x5D DCOUNTA + // 0x5E DMIN + // 0x5F DMAX + // 0x60 DVARP + // 0x61 DSTDEVP + // 0x62 INDEX + // 0x63 COLS + // 0x64 ROWS + // 0x65 REPEAT + 0x66: ["UPPER", 1], + 0x67: ["LOWER", 1], + // 0x68 LEFT + // 0x69 RIGHT + // 0x6A REPLACE + 0x6B: ["PROPER", 1], + // 0x6C CELL + 0x6D: ["TRIM", 1], + // 0x6E CLEAN + 0x6F: ["T", 1] + // 0x70 V + }; + var BinOpTab = [ + "", "", "", "", "", "", "", "", + "", "+", "-", "*", "/", "^", "=", "<>", + "<=", ">=", "<", ">", "", "", "", "", + "&", "", "", "", "", "", "", "" // eslint-disable-line no-mixed-spaces-and-tabs + ]; + function wk1_fmla_to_csf(blob, o) { + prep_blob(blob, 0); + var out = [], argc = 0, R = "", C = "", argL = "", argR = ""; + while (blob.l < blob.length) { + var cc = blob[blob.l++]; + switch (cc) { + case 0x00: + out.push(blob.read_shift(8, 'f')); + break; + case 0x01: + { + C = wk1_parse_rc(o[0].c, blob.read_shift(2), true); + R = wk1_parse_rc(o[0].r, blob.read_shift(2), false); + out.push(C + R); + } + break; + case 0x02: + { + var c = wk1_parse_rc(o[0].c, blob.read_shift(2), true); + var r = wk1_parse_rc(o[0].r, blob.read_shift(2), false); + C = wk1_parse_rc(o[0].c, blob.read_shift(2), true); + R = wk1_parse_rc(o[0].r, blob.read_shift(2), false); + out.push(c + r + ":" + C + R); + } + break; + case 0x03: + if (blob.l < blob.length) { + console.error("WK1 premature formula end"); + return; + } + break; + case 0x04: + out.push("(" + out.pop() + ")"); + break; + case 0x05: + out.push(blob.read_shift(2)); + break; + case 0x06: + { + /* TODO: text encoding */ + var Z = ""; + while ((cc = blob[blob.l++])) + Z += String.fromCharCode(cc); + out.push('"' + Z.replace(/"/g, '""') + '"'); + } + break; + case 0x08: + out.push("-" + out.pop()); + break; + case 0x17: + out.push("+" + out.pop()); + break; + case 0x16: + out.push("NOT(" + out.pop() + ")"); + break; + case 0x14: + case 0x15: + { + argR = out.pop(); + argL = out.pop(); + out.push(["AND", "OR"][cc - 0x14] + "(" + argL + "," + argR + ")"); + } + break; + default: + if (cc < 0x20 && BinOpTab[cc]) { + argR = out.pop(); + argL = out.pop(); + out.push(argL + BinOpTab[cc] + argR); + } + else if (FuncTab[cc]) { + argc = FuncTab[cc][1]; + if (argc == 69) + argc = blob[blob.l++]; + if (argc > out.length) { + console.error("WK1 bad formula parse 0x" + cc.toString(16) + ":|" + out.join("|") + "|"); + return; + } + var args = out.slice(-argc); + out.length -= argc; + out.push(FuncTab[cc][0] + "(" + args.join(",") + ")"); + } + else if (cc <= 0x07) + return console.error("WK1 invalid opcode " + cc.toString(16)); + else if (cc <= 0x18) + return console.error("WK1 unsupported op " + cc.toString(16)); + else if (cc <= 0x1E) + return console.error("WK1 invalid opcode " + cc.toString(16)); + else if (cc <= 0x73) + return console.error("WK1 unsupported function opcode " + cc.toString(16)); + // possible future functions ?? + else + return console.error("WK1 unrecognized opcode " + cc.toString(16)); + } + } + if (out.length == 1) + o[1].f = "" + out[0]; + else + console.error("WK1 bad formula parse |" + out.join("|") + "|"); + } + function parse_cell_3(blob /*::, length*/) { + var o = [{ c: 0, r: 0 }, { t: 'n', v: 0 }, 0]; + o[0].r = blob.read_shift(2); + o[3] = blob[blob.l++]; + o[0].c = blob[blob.l++]; + return o; + } + function parse_LABEL_16(blob, length) { + var o = parse_cell_3(blob, length); + o[1].t = 's'; + o[1].v = blob.read_shift(length - 4, 'cstr'); + return o; + } + function write_LABEL_16(R, C, wsidx, s) { + /* TODO: encoding */ + var o = new_buf(6 + s.length); + o.write_shift(2, R); + o.write_shift(1, wsidx); + o.write_shift(1, C); + o.write_shift(1, 0x27); + for (var i = 0; i < s.length; ++i) { + var cc = s.charCodeAt(i); + o.write_shift(1, cc >= 0x80 ? 0x5F : cc); + } + o.write_shift(1, 0); + return o; + } + function parse_NUMBER_18(blob, length) { + var o = parse_cell_3(blob, length); + o[1].v = blob.read_shift(2); + var v = o[1].v >> 1; + if (o[1].v & 0x1) { + switch (v & 0x07) { + case 0: + v = (v >> 3) * 5000; + break; + case 1: + v = (v >> 3) * 500; + break; + case 2: + v = (v >> 3) / 20; + break; + case 3: + v = (v >> 3) / 200; + break; + case 4: + v = (v >> 3) / 2000; + break; + case 5: + v = (v >> 3) / 20000; + break; + case 6: + v = (v >> 3) / 16; + break; + case 7: + v = (v >> 3) / 64; + break; + } + } + o[1].v = v; + return o; + } + function parse_NUMBER_17(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(4); + var v2 = blob.read_shift(4); + var e = blob.read_shift(2); + if (e == 0xFFFF) { + if (v1 === 0 && v2 === 0xC0000000) { + o[1].t = "e"; + o[1].v = 0x0F; + } // ERR -> #VALUE! + else if (v1 === 0 && v2 === 0xD0000000) { + o[1].t = "e"; + o[1].v = 0x2A; + } // NA -> #N/A + else + o[1].v = 0; + return o; + } + var s = e & 0x8000; + e = (e & 0x7FFF) - 16446; + o[1].v = (1 - s * 2) * (v2 * Math.pow(2, e + 32) + v1 * Math.pow(2, e)); + return o; + } + function write_NUMBER_17(R, C, wsidx, v) { + var o = new_buf(14); + o.write_shift(2, R); + o.write_shift(1, wsidx); + o.write_shift(1, C); + if (v == 0) { + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(2, 0xFFFF); + return o; + } + var s = 0, e = 0, v1 = 0, v2 = 0; + if (v < 0) { + s = 1; + v = -v; + } + e = Math.log2(v) | 0; + v /= Math.pow(2, e - 31); + v2 = (v) >>> 0; + if ((v2 & 0x80000000) == 0) { + v /= 2; + ++e; + v2 = v >>> 0; + } + v -= v2; + v2 |= 0x80000000; + v2 >>>= 0; + v *= Math.pow(2, 32); + v1 = v >>> 0; + o.write_shift(4, v1); + o.write_shift(4, v2); + e += 0x3FFF + (s ? 0x8000 : 0); + o.write_shift(2, e); + return o; + } + function parse_FORMULA_19(blob, length) { + var o = parse_NUMBER_17(blob, 14); + blob.l += length - 14; /* TODO: WK3 formula */ + return o; + } + function parse_NUMBER_25(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(4); + o[1].v = v1 >> 6; + return o; + } + function parse_NUMBER_27(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(8, 'f'); + o[1].v = v1; + return o; + } + function parse_FORMULA_28(blob, length) { + var o = parse_NUMBER_27(blob, 12); + blob.l += length - 12; /* TODO: formula */ + return o; + } + function parse_SHEETNAMECS(blob, length) { + return blob[blob.l + length - 1] == 0 ? blob.read_shift(length, 'cstr') : ""; + } + function parse_SHEETNAMELP(blob, length) { + var len = blob[blob.l++]; + if (len > length - 1) + len = length - 1; + var o = ""; + while (o.length < len) + o += String.fromCharCode(blob[blob.l++]); + return o; + } + function parse_SHEETINFOQP(blob, length, opts) { + if (!opts.qpro || length < 21) + return; + var id = blob.read_shift(1); + blob.l += 17; + blob.l += 1; //var len = blob.read_shift(1); + blob.l += 2; + var nm = blob.read_shift(length - 21, 'cstr'); + return [id, nm]; + } + function parse_XFORMAT(blob, length) { + var o = {}, tgt = blob.l + length; + while (blob.l < tgt) { + var dt = blob.read_shift(2); + if (dt == 0x36b0) { + o[dt] = [0, ""]; + o[dt][0] = blob.read_shift(2); + while (blob[blob.l]) { + o[dt][1] += String.fromCharCode(blob[blob.l]); + blob.l++; + } + blob.l++; + } + // TODO: 0x3a99 ?? + } + return o; + } + function write_XFORMAT_SHEETNAME(name, wsidx) { + var out = new_buf(5 + name.length); + out.write_shift(2, 0x36b0); + out.write_shift(2, wsidx); + for (var i = 0; i < name.length; ++i) { + var cc = name.charCodeAt(i); + out[out.l++] = cc > 0x7F ? 0x5F : cc; + } + out[out.l++] = 0; + return out; + } + var WK1Enum = { + /*::[*/ 0x0000 /*::]*/: { n: "BOF", f: parseuint16 }, + /*::[*/ 0x0001 /*::]*/: { n: "EOF" }, + /*::[*/ 0x0002 /*::]*/: { n: "CALCMODE" }, + /*::[*/ 0x0003 /*::]*/: { n: "CALCORDER" }, + /*::[*/ 0x0004 /*::]*/: { n: "SPLIT" }, + /*::[*/ 0x0005 /*::]*/: { n: "SYNC" }, + /*::[*/ 0x0006 /*::]*/: { n: "RANGE", f: parse_RANGE }, + /*::[*/ 0x0007 /*::]*/: { n: "WINDOW1" }, + /*::[*/ 0x0008 /*::]*/: { n: "COLW1" }, + /*::[*/ 0x0009 /*::]*/: { n: "WINTWO" }, + /*::[*/ 0x000A /*::]*/: { n: "COLW2" }, + /*::[*/ 0x000B /*::]*/: { n: "NAME" }, + /*::[*/ 0x000C /*::]*/: { n: "BLANK" }, + /*::[*/ 0x000D /*::]*/: { n: "INTEGER", f: parse_INTEGER }, + /*::[*/ 0x000E /*::]*/: { n: "NUMBER", f: parse_NUMBER }, + /*::[*/ 0x000F /*::]*/: { n: "LABEL", f: parse_LABEL }, + /*::[*/ 0x0010 /*::]*/: { n: "FORMULA", f: parse_FORMULA }, + /*::[*/ 0x0018 /*::]*/: { n: "TABLE" }, + /*::[*/ 0x0019 /*::]*/: { n: "ORANGE" }, + /*::[*/ 0x001A /*::]*/: { n: "PRANGE" }, + /*::[*/ 0x001B /*::]*/: { n: "SRANGE" }, + /*::[*/ 0x001C /*::]*/: { n: "FRANGE" }, + /*::[*/ 0x001D /*::]*/: { n: "KRANGE1" }, + /*::[*/ 0x0020 /*::]*/: { n: "HRANGE" }, + /*::[*/ 0x0023 /*::]*/: { n: "KRANGE2" }, + /*::[*/ 0x0024 /*::]*/: { n: "PROTEC" }, + /*::[*/ 0x0025 /*::]*/: { n: "FOOTER" }, + /*::[*/ 0x0026 /*::]*/: { n: "HEADER" }, + /*::[*/ 0x0027 /*::]*/: { n: "SETUP" }, + /*::[*/ 0x0028 /*::]*/: { n: "MARGINS" }, + /*::[*/ 0x0029 /*::]*/: { n: "LABELFMT" }, + /*::[*/ 0x002A /*::]*/: { n: "TITLES" }, + /*::[*/ 0x002B /*::]*/: { n: "SHEETJS" }, + /*::[*/ 0x002D /*::]*/: { n: "GRAPH" }, + /*::[*/ 0x002E /*::]*/: { n: "NGRAPH" }, + /*::[*/ 0x002F /*::]*/: { n: "CALCCOUNT" }, + /*::[*/ 0x0030 /*::]*/: { n: "UNFORMATTED" }, + /*::[*/ 0x0031 /*::]*/: { n: "CURSORW12" }, + /*::[*/ 0x0032 /*::]*/: { n: "WINDOW" }, + /*::[*/ 0x0033 /*::]*/: { n: "STRING", f: parse_STRING }, + /*::[*/ 0x0037 /*::]*/: { n: "PASSWORD" }, + /*::[*/ 0x0038 /*::]*/: { n: "LOCKED" }, + /*::[*/ 0x003C /*::]*/: { n: "QUERY" }, + /*::[*/ 0x003D /*::]*/: { n: "QUERYNAME" }, + /*::[*/ 0x003E /*::]*/: { n: "PRINT" }, + /*::[*/ 0x003F /*::]*/: { n: "PRINTNAME" }, + /*::[*/ 0x0040 /*::]*/: { n: "GRAPH2" }, + /*::[*/ 0x0041 /*::]*/: { n: "GRAPHNAME" }, + /*::[*/ 0x0042 /*::]*/: { n: "ZOOM" }, + /*::[*/ 0x0043 /*::]*/: { n: "SYMSPLIT" }, + /*::[*/ 0x0044 /*::]*/: { n: "NSROWS" }, + /*::[*/ 0x0045 /*::]*/: { n: "NSCOLS" }, + /*::[*/ 0x0046 /*::]*/: { n: "RULER" }, + /*::[*/ 0x0047 /*::]*/: { n: "NNAME" }, + /*::[*/ 0x0048 /*::]*/: { n: "ACOMM" }, + /*::[*/ 0x0049 /*::]*/: { n: "AMACRO" }, + /*::[*/ 0x004A /*::]*/: { n: "PARSE" }, + // 0x0064 + /*::[*/ 0x0066 /*::]*/: { n: "PRANGES??" }, + /*::[*/ 0x0067 /*::]*/: { n: "RRANGES??" }, + /*::[*/ 0x0068 /*::]*/: { n: "FNAME??" }, + /*::[*/ 0x0069 /*::]*/: { n: "MRANGES??" }, + // 0x0096 + // 0x0099 + // 0x009A + // 0x009B + // 0x009C + // 0x00C0 + // 0x00C7 + // 0x00C9 + /*::[*/ 0x00CC /*::]*/: { n: "SHEETNAMECS", f: parse_SHEETNAMECS }, + // 0x00CD + /*::[*/ 0x00DE /*::]*/: { n: "SHEETNAMELP", f: parse_SHEETNAMELP }, + /*::[*/ 0x00FF /*::]*/: { n: "BOF", f: parseuint16 }, + /*::[*/ 0x5402 /*::]*/: { n: "WKSNF", f: parseuint16 }, + /*::[*/ 0xFFFF /*::]*/: { n: "" } + }; + var WK3Enum = { + /*::[*/ 0x0000 /*::]*/: { n: "BOF" }, + /*::[*/ 0x0001 /*::]*/: { n: "EOF" }, + /*::[*/ 0x0002 /*::]*/: { n: "PASSWORD" }, + /*::[*/ 0x0003 /*::]*/: { n: "CALCSET" }, + /*::[*/ 0x0004 /*::]*/: { n: "WINDOWSET" }, + /*::[*/ 0x0005 /*::]*/: { n: "SHEETCELLPTR" }, + /*::[*/ 0x0006 /*::]*/: { n: "SHEETLAYOUT" }, + /*::[*/ 0x0007 /*::]*/: { n: "COLUMNWIDTH" }, + /*::[*/ 0x0008 /*::]*/: { n: "HIDDENCOLUMN" }, + /*::[*/ 0x0009 /*::]*/: { n: "USERRANGE" }, + /*::[*/ 0x000A /*::]*/: { n: "SYSTEMRANGE" }, + /*::[*/ 0x000B /*::]*/: { n: "ZEROFORCE" }, + /*::[*/ 0x000C /*::]*/: { n: "SORTKEYDIR" }, + /*::[*/ 0x000D /*::]*/: { n: "FILESEAL" }, + /*::[*/ 0x000E /*::]*/: { n: "DATAFILLNUMS" }, + /*::[*/ 0x000F /*::]*/: { n: "PRINTMAIN" }, + /*::[*/ 0x0010 /*::]*/: { n: "PRINTSTRING" }, + /*::[*/ 0x0011 /*::]*/: { n: "GRAPHMAIN" }, + /*::[*/ 0x0012 /*::]*/: { n: "GRAPHSTRING" }, + /*::[*/ 0x0013 /*::]*/: { n: "??" }, + /*::[*/ 0x0014 /*::]*/: { n: "ERRCELL" }, + /*::[*/ 0x0015 /*::]*/: { n: "NACELL" }, + /*::[*/ 0x0016 /*::]*/: { n: "LABEL16", f: parse_LABEL_16 }, + /*::[*/ 0x0017 /*::]*/: { n: "NUMBER17", f: parse_NUMBER_17 }, + /*::[*/ 0x0018 /*::]*/: { n: "NUMBER18", f: parse_NUMBER_18 }, + /*::[*/ 0x0019 /*::]*/: { n: "FORMULA19", f: parse_FORMULA_19 }, + /*::[*/ 0x001A /*::]*/: { n: "FORMULA1A" }, + /*::[*/ 0x001B /*::]*/: { n: "XFORMAT", f: parse_XFORMAT }, + /*::[*/ 0x001C /*::]*/: { n: "DTLABELMISC" }, + /*::[*/ 0x001D /*::]*/: { n: "DTLABELCELL" }, + /*::[*/ 0x001E /*::]*/: { n: "GRAPHWINDOW" }, + /*::[*/ 0x001F /*::]*/: { n: "CPA" }, + /*::[*/ 0x0020 /*::]*/: { n: "LPLAUTO" }, + /*::[*/ 0x0021 /*::]*/: { n: "QUERY" }, + /*::[*/ 0x0022 /*::]*/: { n: "HIDDENSHEET" }, + /*::[*/ 0x0023 /*::]*/: { n: "??" }, + /*::[*/ 0x0025 /*::]*/: { n: "NUMBER25", f: parse_NUMBER_25 }, + /*::[*/ 0x0026 /*::]*/: { n: "??" }, + /*::[*/ 0x0027 /*::]*/: { n: "NUMBER27", f: parse_NUMBER_27 }, + /*::[*/ 0x0028 /*::]*/: { n: "FORMULA28", f: parse_FORMULA_28 }, + /*::[*/ 0x008E /*::]*/: { n: "??" }, + /*::[*/ 0x0093 /*::]*/: { n: "??" }, + /*::[*/ 0x0096 /*::]*/: { n: "??" }, + /*::[*/ 0x0097 /*::]*/: { n: "??" }, + /*::[*/ 0x0098 /*::]*/: { n: "??" }, + /*::[*/ 0x0099 /*::]*/: { n: "??" }, + /*::[*/ 0x009A /*::]*/: { n: "??" }, + /*::[*/ 0x009B /*::]*/: { n: "??" }, + /*::[*/ 0x009C /*::]*/: { n: "??" }, + /*::[*/ 0x00A3 /*::]*/: { n: "??" }, + /*::[*/ 0x00AE /*::]*/: { n: "??" }, + /*::[*/ 0x00AF /*::]*/: { n: "??" }, + /*::[*/ 0x00B0 /*::]*/: { n: "??" }, + /*::[*/ 0x00B1 /*::]*/: { n: "??" }, + /*::[*/ 0x00B8 /*::]*/: { n: "??" }, + /*::[*/ 0x00B9 /*::]*/: { n: "??" }, + /*::[*/ 0x00BA /*::]*/: { n: "??" }, + /*::[*/ 0x00BB /*::]*/: { n: "??" }, + /*::[*/ 0x00BC /*::]*/: { n: "??" }, + /*::[*/ 0x00C3 /*::]*/: { n: "??" }, + /*::[*/ 0x00C9 /*::]*/: { n: "??" }, + /*::[*/ 0x00CC /*::]*/: { n: "SHEETNAMECS", f: parse_SHEETNAMECS }, + /*::[*/ 0x00CD /*::]*/: { n: "??" }, + /*::[*/ 0x00CE /*::]*/: { n: "??" }, + /*::[*/ 0x00CF /*::]*/: { n: "??" }, + /*::[*/ 0x00D0 /*::]*/: { n: "??" }, + /*::[*/ 0x0100 /*::]*/: { n: "??" }, + /*::[*/ 0x0103 /*::]*/: { n: "??" }, + /*::[*/ 0x0104 /*::]*/: { n: "??" }, + /*::[*/ 0x0105 /*::]*/: { n: "??" }, + /*::[*/ 0x0106 /*::]*/: { n: "??" }, + /*::[*/ 0x0107 /*::]*/: { n: "??" }, + /*::[*/ 0x0109 /*::]*/: { n: "??" }, + /*::[*/ 0x010A /*::]*/: { n: "??" }, + /*::[*/ 0x010B /*::]*/: { n: "??" }, + /*::[*/ 0x010C /*::]*/: { n: "??" }, + /*::[*/ 0x010E /*::]*/: { n: "??" }, + /*::[*/ 0x010F /*::]*/: { n: "??" }, + /*::[*/ 0x0180 /*::]*/: { n: "??" }, + /*::[*/ 0x0185 /*::]*/: { n: "??" }, + /*::[*/ 0x0186 /*::]*/: { n: "??" }, + /*::[*/ 0x0189 /*::]*/: { n: "??" }, + /*::[*/ 0x018C /*::]*/: { n: "??" }, + /*::[*/ 0x0200 /*::]*/: { n: "??" }, + /*::[*/ 0x0202 /*::]*/: { n: "??" }, + /*::[*/ 0x0201 /*::]*/: { n: "??" }, + /*::[*/ 0x0204 /*::]*/: { n: "??" }, + /*::[*/ 0x0205 /*::]*/: { n: "??" }, + /*::[*/ 0x0280 /*::]*/: { n: "??" }, + /*::[*/ 0x0281 /*::]*/: { n: "??" }, + /*::[*/ 0x0282 /*::]*/: { n: "??" }, + /*::[*/ 0x0283 /*::]*/: { n: "??" }, + /*::[*/ 0x0284 /*::]*/: { n: "??" }, + /*::[*/ 0x0285 /*::]*/: { n: "??" }, + /*::[*/ 0x0286 /*::]*/: { n: "??" }, + /*::[*/ 0x0287 /*::]*/: { n: "??" }, + /*::[*/ 0x0288 /*::]*/: { n: "??" }, + /*::[*/ 0x0292 /*::]*/: { n: "??" }, + /*::[*/ 0x0293 /*::]*/: { n: "??" }, + /*::[*/ 0x0294 /*::]*/: { n: "??" }, + /*::[*/ 0x0295 /*::]*/: { n: "??" }, + /*::[*/ 0x0296 /*::]*/: { n: "??" }, + /*::[*/ 0x0299 /*::]*/: { n: "??" }, + /*::[*/ 0x029A /*::]*/: { n: "??" }, + /*::[*/ 0x0300 /*::]*/: { n: "??" }, + /*::[*/ 0x0304 /*::]*/: { n: "??" }, + /*::[*/ 0x0601 /*::]*/: { n: "SHEETINFOQP", f: parse_SHEETINFOQP }, + /*::[*/ 0x0640 /*::]*/: { n: "??" }, + /*::[*/ 0x0642 /*::]*/: { n: "??" }, + /*::[*/ 0x0701 /*::]*/: { n: "??" }, + /*::[*/ 0x0702 /*::]*/: { n: "??" }, + /*::[*/ 0x0703 /*::]*/: { n: "??" }, + /*::[*/ 0x0704 /*::]*/: { n: "??" }, + /*::[*/ 0x0780 /*::]*/: { n: "??" }, + /*::[*/ 0x0800 /*::]*/: { n: "??" }, + /*::[*/ 0x0801 /*::]*/: { n: "??" }, + /*::[*/ 0x0804 /*::]*/: { n: "??" }, + /*::[*/ 0x0A80 /*::]*/: { n: "??" }, + /*::[*/ 0x2AF6 /*::]*/: { n: "??" }, + /*::[*/ 0x3231 /*::]*/: { n: "??" }, + /*::[*/ 0x6E49 /*::]*/: { n: "??" }, + /*::[*/ 0x6F44 /*::]*/: { n: "??" }, + /*::[*/ 0xFFFF /*::]*/: { n: "" } + }; + /* TODO: fill out and verify this table across QP versions */ + var QPWNFTable = { + /*::[*/ 0x05 /*::*/: "dd-mmm-yy", + /*::[*/ 0x06 /*::*/: "dd-mmm", + /*::[*/ 0x07 /*::*/: "mmm-yy", + /*::[*/ 0x08 /*::*/: "mm/dd/yy", + /*::[*/ 0x0A /*::*/: "hh:mm:ss AM/PM", + /*::[*/ 0x0B /*::*/: "hh:mm AM/PM", + /*::[*/ 0x0E /*::*/: "dd-mmm-yyyy", + /*::[*/ 0x0F /*::*/: "mmm-yyyy", + /*::[*/ 0x22 /*::*/: "0.00", + /*::[*/ 0x32 /*::*/: "0.00;[Red]0.00", + /*::[*/ 0x42 /*::*/: "0.00;\(0.00\)", + /*::[*/ 0x52 /*::*/: "0.00;[Red]\(0.00\)", + /*::[*/ 162 /*::*/: '"$"#,##0;\\("$"#,##0\\)' // slightly different from SSF 5 + }; + /* QPW uses a different set of record types */ + function qpw_to_workbook_buf(d, opts) { + prep_blob(d, 0); + var o = opts || {}; + if (DENSE != null && o.dense == null) + o.dense = DENSE; + var s /*:Worksheet*/ = ({} /*:any*/); + if (o.dense) + s["!data"] = []; + var SST = [], sname = "", formulae = []; + var range = { s: { r: -1, c: -1 }, e: { r: -1, c: -1 } }; + var cnt = 0, type = 0, C = 0, R = 0; + var wb = { SheetNames: [], Sheets: {} }; + var FMTS = []; + outer: while (d.l < d.length) { + var RT = d.read_shift(2), length = d.read_shift(2); + var p = d.slice(d.l, d.l + length); + prep_blob(p, 0); + switch (RT) { + case 0x01: /* BOF */ + if (p.read_shift(4) != 0x39575051) + throw "Bad QPW9 BOF!"; + break; + case 0x02: /* EOF */ break outer; + case 0x08: /* NF */ break; // TODO: this is tied to custom number formats + case 0x0A: /* FORMATS */ + { + var fcnt = p.read_shift(4); + var step = ((p.length - p.l) / fcnt) | 0; + for (var ifmt = 0; ifmt < fcnt; ++ifmt) { + var end = p.l + step; + var fmt = {}; + p.l += 2; + fmt.numFmtId = p.read_shift(2); + if (QPWNFTable[fmt.numFmtId]) + fmt.z = QPWNFTable[fmt.numFmtId]; + p.l = end; + FMTS.push(fmt); + } + } + break; + /* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TableModelArchive */ + case 0x0401: /* BON */ break; + case 0x0402: /* EON */ /* TODO: backfill missing sheets based on BON cnt */ break; + case 0x0407: + { /* SST */ + p.l += 12; + while (p.l < p.length) { + cnt = p.read_shift(2); + type = p.read_shift(1); + SST.push(p.read_shift(cnt, 'cstr')); + } + } + break; + case 0x0408: + { /* FORMULAE */ + //p.l += 12; + //while(p.l < p.length) { + // cnt = p.read_shift(2); + // formulae.push(p.slice(p.l, p.l + cnt + 1)); p.l += cnt + 1; + //} + } + break; + case 0x0601: + { /* BOS */ + var sidx = p.read_shift(2); + s = ({} /*:any*/); + if (o.dense) + s["!data"] = []; + range.s.c = p.read_shift(2); + range.e.c = p.read_shift(2); + range.s.r = p.read_shift(4); + range.e.r = p.read_shift(4); + p.l += 4; + if (p.l + 2 < p.length) { + cnt = p.read_shift(2); + type = p.read_shift(1); + sname = cnt == 0 ? "" : p.read_shift(cnt, 'cstr'); + } + if (!sname) + sname = encode_col(sidx); + /* TODO: backfill empty sheets */ + } + break; + case 0x0602: + { /* EOS */ + /* NOTE: QP valid range A1:IV1000000 */ + if (range.s.c > 0xFF || range.s.r > 999999) + break; + if (range.e.c < range.s.c) + range.e.c = range.s.c; + if (range.e.r < range.s.r) + range.e.r = range.s.r; + s["!ref"] = encode_range(range); + book_append_sheet(wb, s, sname); // TODO: a barrel roll + } + break; + case 0x0A01: + { /* COL (like XLS Row, modulo the layout transposition) */ + C = p.read_shift(2); + if (range.e.c < C) + range.e.c = C; + if (range.s.c > C) + range.s.c = C; + R = p.read_shift(4); + if (range.s.r > R) + range.s.r = R; + R = p.read_shift(4); + if (range.e.r < R) + range.e.r = R; + } + break; + case 0x0C01: + { /* MulCells (like XLS MulRK, but takes advantage of common column data patterns) */ + R = p.read_shift(4), cnt = p.read_shift(4); + if (range.s.r > R) + range.s.r = R; + if (range.e.r < R + cnt - 1) + range.e.r = R + cnt - 1; + var CC = encode_col(C); + while (p.l < p.length) { + var cell = { t: "z" }; + var flags = p.read_shift(1), fmtidx = -1; + if (flags & 0x80) + fmtidx = p.read_shift(2); + var mul = (flags & 0x40) ? p.read_shift(2) - 1 : 0; + switch (flags & 0x1F) { + case 0: break; + case 1: break; + case 2: + cell = { t: "n", v: p.read_shift(2) }; + break; + case 3: + cell = { t: "n", v: p.read_shift(2, 'i') }; + break; + case 4: + cell = { t: "n", v: parse_RkNumber(p) }; + break; + case 5: + cell = { t: "n", v: p.read_shift(8, 'f') }; + break; + case 7: + cell = { t: "s", v: SST[type = p.read_shift(4) - 1] }; + break; + case 8: + cell = { t: "n", v: p.read_shift(8, 'f') }; + p.l += 2; /* cell.f = formulae[p.read_shift(4)]; */ + p.l += 4; + break; + default: throw "Unrecognized QPW cell type " + (flags & 0x1F); + } + if (fmtidx != -1 && (FMTS[fmtidx - 1] || {}).z) + cell.z = FMTS[fmtidx - 1].z; + var delta = 0; + if (flags & 0x20) + switch (flags & 0x1F) { + case 2: + delta = p.read_shift(2); + break; + case 3: + delta = p.read_shift(2, 'i'); + break; + case 7: + delta = p.read_shift(2); + break; + default: throw "Unsupported delta for QPW cell type " + (flags & 0x1F); + } + if (!(!o.sheetStubs && cell.t == "z")) { + var newcell = dup(cell); + if (cell.t == "n" && cell.z && fmt_is_date(cell.z) && o.cellDates) { + newcell.v = numdate(cell.v); + newcell.t = typeof newcell.v == "number" ? 'n' : 'd'; + } + if (s["!data"] != null) { + if (!s["!data"][R]) + s["!data"][R] = []; + s["!data"][R][C] = newcell; + } + else + s[CC + encode_row(R)] = newcell; + } + ++R; + --cnt; + while (mul-- > 0 && cnt >= 0) { + if (flags & 0x20) + switch (flags & 0x1F) { + case 2: + cell = { t: "n", v: (cell.v + delta) & 0xFFFF }; + break; + case 3: + cell = { t: "n", v: (cell.v + delta) & 0xFFFF }; + if (cell.v > 0x7FFF) + cell.v -= 0x10000; + break; + case 7: + cell = { t: "s", v: SST[type = (type + delta) >>> 0] }; + break; + default: throw "Cannot apply delta for QPW cell type " + (flags & 0x1F); + } + else + switch (flags & 0x1F) { + case 1: + cell = { t: "z" }; + break; + case 2: + cell = { t: "n", v: p.read_shift(2) }; + break; + case 7: + cell = { t: "s", v: SST[type = p.read_shift(4) - 1] }; + break; + default: throw "Cannot apply repeat for QPW cell type " + (flags & 0x1F); + } + if (fmtidx != -1) + ; + if (!(!o.sheetStubs && cell.t == "z")) { + if (s["!data"] != null) { + if (!s["!data"][R]) + s["!data"][R] = []; + s["!data"][R][C] = cell; + } + else + s[CC + encode_row(R)] = cell; + } + ++R; + --cnt; + } + } + } + break; + default: break; + } + d.l += length; + } + return wb; + } + return { + sheet_to_wk1: sheet_to_wk1, + book_to_wk3: book_to_wk3, + to_workbook: lotus_to_workbook + }; +})(); +/* 18.4.7 rPr CT_RPrElt */ +function parse_rpr(rpr) { + var font = {}, m = rpr.match(tagregex), i = 0; + var pass = false; + if (m) + for (; i != m.length; ++i) { + var y = parsexmltag(m[i]); + switch (y[0].replace(/\w*:/g, "")) { + /* 18.8.12 condense CT_BooleanProperty */ + /* ** not required . */ + case '': + case '': + font.shadow = 1; + break; + case '': break; + /* 18.4.1 charset CT_IntProperty TODO */ + case '': + case '': + font.outline = 1; + break; + case '': break; + /* 18.4.5 rFont CT_FontName */ + case '': + case '': + font.strike = 1; + break; + case '': break; + /* 18.4.13 u CT_UnderlineProperty */ + case '': + case '': + font.u = 1; + break; + case '': break; + /* 18.8.2 b */ + case '': + case '': + font.b = 1; + break; + case '': break; + /* 18.8.26 i */ + case '': + case '': + font.i = 1; + break; + case '': break; + /* 18.3.1.15 color CT_Color TODO: tint, theme, auto, indexed */ + case '': + case '': + case '': break; + /* 18.8.18 family ST_FontFamily */ + case '': + case '': + case '': break; + /* 18.4.14 vertAlign CT_VerticalAlignFontProperty TODO */ + case '': + case '': + case '': break; + /* 18.8.35 scheme CT_FontScheme TODO */ + case '': + case '': + case '': break; + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': + case '': break; + case '': + pass = false; + break; + default: + if (y[0].charCodeAt(1) !== 47 && !pass) + throw new Error('Unrecognized rich format ' + y[0]); + } + } + return font; +} +var parse_rs = /*#__PURE__*/ (function () { + var tregex = matchtag("t"), rpregex = matchtag("rPr"); + /* 18.4.4 r CT_RElt */ + function parse_r(r) { + /* 18.4.12 t ST_Xstring */ + var t = r.match(tregex) /*, cp = 65001*/; + if (!t) + return { t: "s", v: "" }; + var o /*:Cell*/ = ({ t: 's', v: unescapexml(t[1]) } /*:any*/); + var rpr = r.match(rpregex); + if (rpr) + o.s = parse_rpr(rpr[1]); + return o; + } + var rregex = /<(?:\w+:)?r>/g, rend = /<\/(?:\w+:)?r>/; + return function parse_rs(rs) { + return rs.replace(rregex, "").split(rend).map(parse_r).filter(function (r) { return r.v; }); + }; +})(); +/* Parse a list of tags */ +var rs_to_html = /*#__PURE__*/ (function parse_rs_factory() { + var nlregex = /(\r\n|\n)/g; + function parse_rpr2(font, intro, outro) { + var style /*:Array*/ = []; + if (font.u) + style.push("text-decoration: underline;"); + if (font.uval) + style.push("text-underline-style:" + font.uval + ";"); + if (font.sz) + style.push("font-size:" + font.sz + "pt;"); + if (font.outline) + style.push("text-effect: outline;"); + if (font.shadow) + style.push("text-shadow: auto;"); + intro.push(''); + if (font.b) { + intro.push(""); + outro.push(""); + } + if (font.i) { + intro.push(""); + outro.push(""); + } + if (font.strike) { + intro.push(""); + outro.push(""); + } + var align = font.valign || ""; + if (align == "superscript" || align == "super") + align = "sup"; + else if (align == "subscript") + align = "sub"; + if (align != "") { + intro.push("<" + align + ">"); + outro.push(""); + } + outro.push(""); + return font; + } + /* 18.4.4 r CT_RElt */ + function r_to_html(r) { + var terms /*:[Array, string, Array]*/ = [[], r.v, []]; + if (!r.v) + return ""; + if (r.s) + parse_rpr2(r.s, terms[0], terms[2]); + return terms[0].join("") + terms[1].replace(nlregex, '
') + terms[2].join(""); + } + return function parse_rs(rs) { + return rs.map(r_to_html).join(""); + }; +})(); +/* 18.4.8 si CT_Rst */ +var sitregex = /<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g, sirregex = /<(?:\w+:)?r\b[^>]*>/; +var sirphregex = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g; +function parse_si(x, opts) { + var html = opts ? opts.cellHTML : true; + var z = {}; + if (!x) + return { t: "" }; + //var y; + /* 18.4.12 t ST_Xstring (Plaintext String) */ + // TODO: is whitespace actually valid here? + if (x.match(/^\s*<(?:\w+:)?t[^>]*>/)) { + z.t = unescapexml(utf8read(x.slice(x.indexOf(">") + 1).split(/<\/(?:\w+:)?t>/)[0] || ""), true); + z.r = utf8read(x); + if (html) + z.h = escapehtml(z.t); + } + /* 18.4.4 r CT_RElt (Rich Text Run) */ + else if (( /*y = */x.match(sirregex))) { + z.r = utf8read(x); + z.t = unescapexml(utf8read((x.replace(sirphregex, '').match(sitregex) || []).join("").replace(tagregex, "")), true); + if (html) + z.h = rs_to_html(parse_rs(z.r)); + } + /* 18.4.3 phoneticPr CT_PhoneticPr (TODO: needed for Asian support) */ + /* 18.4.6 rPh CT_PhoneticRun (TODO: needed for Asian support) */ + return z; +} +/* 18.4 Shared String Table */ +var sstr0 = /<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/; +var sstr1 = /<(?:\w+:)?(?:si|sstItem)>/g; +var sstr2 = /<\/(?:\w+:)?(?:si|sstItem)>/; +function parse_sst_xml(data /*:string*/, opts) { + var s /*:SST*/ = ([] /*:any*/), ss = ""; + if (!data) + return s; + /* 18.4.9 sst CT_Sst */ + var sst = data.match(sstr0); + if (sst) { + ss = sst[2].replace(sstr1, "").split(sstr2); + for (var i = 0; i != ss.length; ++i) { + var o = parse_si(ss[i].trim(), opts); + if (o != null) + s[s.length] = o; + } + sst = parsexmltag(sst[1]); + s.Count = sst.count; + s.Unique = sst.uniqueCount; + } + return s; +} +var straywsregex = /^\s|\s$|[\t\n\r]/; +function write_sst_xml(sst /*:SST*/, opts) { + if (!opts.bookSST) + return ""; + var o = [XML_HEADER]; + o[o.length] = (writextag('sst', null, { + xmlns: XMLNS_main[0], + count: sst.Count, + uniqueCount: sst.Unique + })); + for (var i = 0; i != sst.length; ++i) { + if (sst[i] == null) + continue; + var s /*:XLString*/ = sst[i]; + var sitag = ""; + if (s.r) + sitag += s.r; + else { + sitag += ""; + } + sitag += ""; + o[o.length] = (sitag); + } + if (o.length > 2) { + o[o.length] = (''); + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* [MS-XLSB] 2.4.221 BrtBeginSst */ +function parse_BrtBeginSst(data) { + return [data.read_shift(4), data.read_shift(4)]; +} +/* [MS-XLSB] 2.1.7.45 Shared Strings */ +function parse_sst_bin(data, opts) { + var s /*:SST*/ = ([] /*:any*/); + var pass = false; + recordhopper(data, function hopper_sst(val, R, RT) { + switch (RT) { + case 0x009F: /* BrtBeginSst */ + s.Count = val[0]; + s.Unique = val[1]; + break; + case 0x0013: /* BrtSSTItem */ + s.push(val); + break; + case 0x00A0: /* BrtEndSst */ + return true; + case 0x0023: /* BrtFRTBegin */ + pass = true; + break; + case 0x0024: /* BrtFRTEnd */ + pass = false; + break; + default: + if (R.T) { } + if (!pass || opts.WTF) + throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }); + return s; +} +function write_BrtBeginSst(sst, o) { + if (!o) + o = new_buf(8); + o.write_shift(4, sst.Count); + o.write_shift(4, sst.Unique); + return o; +} +var write_BrtSSTItem = write_RichStr; +function write_sst_bin(sst /*::, opts*/) { + var ba = buf_array(); + write_record(ba, 0x009F /* BrtBeginSst */, write_BrtBeginSst(sst)); + for (var i = 0; i < sst.length; ++i) + write_record(ba, 0x0013 /* BrtSSTItem */, write_BrtSSTItem(sst[i])); + /* FRTSST */ + write_record(ba, 0x00A0 /* BrtEndSst */); + return ba.end(); +} +function _JS2ANSI(str /*:string*/) { + if (typeof $cptable !== 'undefined') + return $cptable.utils.encode(current_ansi, str); + var o /*:Array*/ = [], oo = str.split(""); + for (var i = 0; i < oo.length; ++i) + o[i] = oo[i].charCodeAt(0); + return o; +} +/* [MS-OFFCRYPTO] 2.1.4 Version */ +function parse_CRYPTOVersion(blob, length /*:?number*/) { + var o /*:any*/ = {}; + o.Major = blob.read_shift(2); + o.Minor = blob.read_shift(2); + /*:: if(length == null) return o; */ + if (length >= 4) + blob.l += length - 4; + return o; +} +/* [MS-OFFCRYPTO] 2.1.5 DataSpaceVersionInfo */ +function parse_DataSpaceVersionInfo(blob) { + var o = {}; + o.id = blob.read_shift(0, 'lpp4'); + o.R = parse_CRYPTOVersion(blob, 4); + o.U = parse_CRYPTOVersion(blob, 4); + o.W = parse_CRYPTOVersion(blob, 4); + return o; +} +/* [MS-OFFCRYPTO] 2.1.6.1 DataSpaceMapEntry Structure */ +function parse_DataSpaceMapEntry(blob) { + var len = blob.read_shift(4); + var end = blob.l + len - 4; + var o = {}; + var cnt = blob.read_shift(4); + var comps /*:Array<{t:number, v:string}>*/ = []; + /* [MS-OFFCRYPTO] 2.1.6.2 DataSpaceReferenceComponent Structure */ + while (cnt-- > 0) + comps.push({ t: blob.read_shift(4), v: blob.read_shift(0, 'lpp4') }); + o.name = blob.read_shift(0, 'lpp4'); + o.comps = comps; + if (blob.l != end) + throw new Error("Bad DataSpaceMapEntry: " + blob.l + " != " + end); + return o; +} +/* [MS-OFFCRYPTO] 2.1.6 DataSpaceMap */ +function parse_DataSpaceMap(blob) { + var o = []; + blob.l += 4; // must be 0x8 + var cnt = blob.read_shift(4); + while (cnt-- > 0) + o.push(parse_DataSpaceMapEntry(blob)); + return o; +} +/* [MS-OFFCRYPTO] 2.1.7 DataSpaceDefinition */ +function parse_DataSpaceDefinition(blob) { + var o /*:Array*/ = []; + blob.l += 4; // must be 0x8 + var cnt = blob.read_shift(4); + while (cnt-- > 0) + o.push(blob.read_shift(0, 'lpp4')); + return o; +} +/* [MS-OFFCRYPTO] 2.1.8 DataSpaceDefinition */ +function parse_TransformInfoHeader(blob) { + var o = {}; + /*var len = */ blob.read_shift(4); + blob.l += 4; // must be 0x1 + o.id = blob.read_shift(0, 'lpp4'); + o.name = blob.read_shift(0, 'lpp4'); + o.R = parse_CRYPTOVersion(blob, 4); + o.U = parse_CRYPTOVersion(blob, 4); + o.W = parse_CRYPTOVersion(blob, 4); + return o; +} +function parse_Primary(blob) { + /* [MS-OFFCRYPTO] 2.2.6 IRMDSTransformInfo */ + var hdr = parse_TransformInfoHeader(blob); + /* [MS-OFFCRYPTO] 2.1.9 EncryptionTransformInfo */ + hdr.ename = blob.read_shift(0, '8lpp4'); + hdr.blksz = blob.read_shift(4); + hdr.cmode = blob.read_shift(4); + if (blob.read_shift(4) != 0x04) + throw new Error("Bad !Primary record"); + return hdr; +} +/* [MS-OFFCRYPTO] 2.3.2 Encryption Header */ +function parse_EncryptionHeader(blob, length /*:number*/) { + var tgt = blob.l + length; + var o = {}; + o.Flags = (blob.read_shift(4) & 0x3F); + blob.l += 4; + o.AlgID = blob.read_shift(4); + var valid = false; + switch (o.AlgID) { + case 0x660E: + case 0x660F: + case 0x6610: + valid = (o.Flags == 0x24); + break; + case 0x6801: + valid = (o.Flags == 0x04); + break; + case 0: + valid = (o.Flags == 0x10 || o.Flags == 0x04 || o.Flags == 0x24); + break; + default: throw 'Unrecognized encryption algorithm: ' + o.AlgID; + } + if (!valid) + throw new Error("Encryption Flags/AlgID mismatch"); + o.AlgIDHash = blob.read_shift(4); + o.KeySize = blob.read_shift(4); + o.ProviderType = blob.read_shift(4); + blob.l += 8; + o.CSPName = blob.read_shift((tgt - blob.l) >> 1, 'utf16le'); + blob.l = tgt; + return o; +} +/* [MS-OFFCRYPTO] 2.3.3 Encryption Verifier */ +function parse_EncryptionVerifier(blob, length /*:number*/) { + var o = {}, tgt = blob.l + length; + blob.l += 4; // SaltSize must be 0x10 + o.Salt = blob.slice(blob.l, blob.l + 16); + blob.l += 16; + o.Verifier = blob.slice(blob.l, blob.l + 16); + blob.l += 16; + /*var sz = */ blob.read_shift(4); + o.VerifierHash = blob.slice(blob.l, tgt); + blob.l = tgt; + return o; +} +/* [MS-OFFCRYPTO] 2.3.4.* EncryptionInfo Stream */ +function parse_EncryptionInfo(blob) { + var vers = parse_CRYPTOVersion(blob); + switch (vers.Minor) { + case 0x02: return [vers.Minor, parse_EncInfoStd(blob, vers)]; + case 0x03: return [vers.Minor, parse_EncInfoExt(blob, vers)]; + case 0x04: return [vers.Minor, parse_EncInfoAgl(blob, vers)]; + } + throw new Error("ECMA-376 Encrypted file unrecognized Version: " + vers.Minor); +} +/* [MS-OFFCRYPTO] 2.3.4.5 EncryptionInfo Stream (Standard Encryption) */ +function parse_EncInfoStd(blob /*::, vers*/) { + var flags = blob.read_shift(4); + if ((flags & 0x3F) != 0x24) + throw new Error("EncryptionInfo mismatch"); + var sz = blob.read_shift(4); + //var tgt = blob.l + sz; + var hdr = parse_EncryptionHeader(blob, sz); + var verifier = parse_EncryptionVerifier(blob, blob.length - blob.l); + return { t: "Std", h: hdr, v: verifier }; +} +/* [MS-OFFCRYPTO] 2.3.4.6 EncryptionInfo Stream (Extensible Encryption) */ +function parse_EncInfoExt( /*::blob, vers*/) { throw new Error("File is password-protected: ECMA-376 Extensible"); } +/* [MS-OFFCRYPTO] 2.3.4.10 EncryptionInfo Stream (Agile Encryption) */ +function parse_EncInfoAgl(blob /*::, vers*/) { + var KeyData = ["saltSize", "blockSize", "keyBits", "hashSize", "cipherAlgorithm", "cipherChaining", "hashAlgorithm", "saltValue"]; + blob.l += 4; + var xml = blob.read_shift(blob.length - blob.l, 'utf8'); + var o = {}; + xml.replace(tagregex, function xml_agile(x) { + var y /*:any*/ = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': break; + case '': + case '': break; + case '': break; + case ' 4 || vers.Major < 2) + throw new Error('unrecognized major version code: ' + vers.Major); + o.Flags = blob.read_shift(4); + length -= 4; + var sz = blob.read_shift(4); + length -= 4; + o.EncryptionHeader = parse_EncryptionHeader(blob, sz); + length -= sz; + o.EncryptionVerifier = parse_EncryptionVerifier(blob, length); + return o; +} +/* [MS-OFFCRYPTO] 2.3.6.1 RC4 Encryption Header */ +function parse_RC4Header(blob /*::, length*/) { + var o = {}; + var vers = o.EncryptionVersionInfo = parse_CRYPTOVersion(blob, 4); + if (vers.Major != 1 || vers.Minor != 1) + throw 'unrecognized version code ' + vers.Major + ' : ' + vers.Minor; + o.Salt = blob.read_shift(16); + o.EncryptedVerifier = blob.read_shift(16); + o.EncryptedVerifierHash = blob.read_shift(16); + return o; +} +/* [MS-OFFCRYPTO] 2.3.7.1 Binary Document Password Verifier Derivation */ +function crypto_CreatePasswordVerifier_Method1(Password /*:string*/) { + var Verifier = 0x0000, PasswordArray; + var PasswordDecoded = _JS2ANSI(Password); + var len = PasswordDecoded.length + 1, i, PasswordByte; + var Intermediate1, Intermediate2, Intermediate3; + PasswordArray = new_raw_buf(len); + PasswordArray[0] = PasswordDecoded.length; + for (i = 1; i != len; ++i) + PasswordArray[i] = PasswordDecoded[i - 1]; + for (i = len - 1; i >= 0; --i) { + PasswordByte = PasswordArray[i]; + Intermediate1 = ((Verifier & 0x4000) === 0x0000) ? 0 : 1; + Intermediate2 = (Verifier << 1) & 0x7FFF; + Intermediate3 = Intermediate1 | Intermediate2; + Verifier = Intermediate3 ^ PasswordByte; + } + return Verifier ^ 0xCE4B; +} +/* [MS-OFFCRYPTO] 2.3.7.2 Binary Document XOR Array Initialization */ +var crypto_CreateXorArray_Method1 = /*#__PURE__*/ (function () { + var PadArray = [0xBB, 0xFF, 0xFF, 0xBA, 0xFF, 0xFF, 0xB9, 0x80, 0x00, 0xBE, 0x0F, 0x00, 0xBF, 0x0F, 0x00]; + var InitialCode = [0xE1F0, 0x1D0F, 0xCC9C, 0x84C0, 0x110C, 0x0E10, 0xF1CE, 0x313E, 0x1872, 0xE139, 0xD40F, 0x84F9, 0x280C, 0xA96A, 0x4EC3]; + var XorMatrix = [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09, 0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF, 0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0, 0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40, 0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5, 0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A, 0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9, 0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0, 0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC, 0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10, 0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168, 0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C, 0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD, 0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC, 0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4]; + var Ror = function (Byte) { return ((Byte / 2) | (Byte * 128)) & 0xFF; }; + var XorRor = function (byte1, byte2) { return Ror(byte1 ^ byte2); }; + var CreateXorKey_Method1 = function (Password) { + var XorKey = InitialCode[Password.length - 1]; + var CurrentElement = 0x68; + for (var i = Password.length - 1; i >= 0; --i) { + var Char = Password[i]; + for (var j = 0; j != 7; ++j) { + if (Char & 0x40) + XorKey ^= XorMatrix[CurrentElement]; + Char *= 2; + --CurrentElement; + } + } + return XorKey; + }; + return function (password /*:string*/) { + var Password = _JS2ANSI(password); + var XorKey = CreateXorKey_Method1(Password); + var Index = Password.length; + var ObfuscationArray = new_raw_buf(16); + for (var i = 0; i != 16; ++i) + ObfuscationArray[i] = 0x00; + var Temp, PasswordLastChar, PadIndex; + if ((Index & 1) === 1) { + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(PadArray[0], Temp); + --Index; + Temp = XorKey & 0xFF; + PasswordLastChar = Password[Password.length - 1]; + ObfuscationArray[Index] = XorRor(PasswordLastChar, Temp); + } + while (Index > 0) { + --Index; + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + --Index; + Temp = XorKey & 0xFF; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + } + Index = 15; + PadIndex = 15 - Password.length; + while (PadIndex > 0) { + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(PadArray[PadIndex], Temp); + --Index; + --PadIndex; + Temp = XorKey & 0xFF; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + --Index; + --PadIndex; + } + return ObfuscationArray; + }; +})(); +/* [MS-OFFCRYPTO] 2.3.7.3 Binary Document XOR Data Transformation Method 1 */ +var crypto_DecryptData_Method1 = function (password /*:string*/, Data, XorArrayIndex, XorArray, O) { + /* If XorArray is set, use it; if O is not set, make changes in-place */ + if (!O) + O = Data; + if (!XorArray) + XorArray = crypto_CreateXorArray_Method1(password); + var Index, Value; + for (Index = 0; Index != Data.length; ++Index) { + Value = Data[Index]; + Value ^= XorArray[XorArrayIndex]; + Value = ((Value >> 5) | (Value << 3)) & 0xFF; + O[Index] = Value; + ++XorArrayIndex; + } + return [O, XorArrayIndex, XorArray]; +}; +var crypto_MakeXorDecryptor = function (password /*:string*/) { + var XorArrayIndex = 0, XorArray = crypto_CreateXorArray_Method1(password); + return function (Data) { + var O = crypto_DecryptData_Method1("", Data, XorArrayIndex, XorArray); + XorArrayIndex = O[1]; + return O[0]; + }; +}; +/* 2.5.343 */ +function parse_XORObfuscation(blob, length, opts, out) { + var o = ({ key: parseuint16(blob), verificationBytes: parseuint16(blob) } /*:any*/); + if (opts.password) + o.verifier = crypto_CreatePasswordVerifier_Method1(opts.password); + out.valid = o.verificationBytes === o.verifier; + if (out.valid) + out.insitu = crypto_MakeXorDecryptor(opts.password); + return o; +} +/* 2.4.117 */ +function parse_FilePassHeader(blob, length /*:number*/, oo) { + var o = oo || {}; + o.Info = blob.read_shift(2); + blob.l -= 2; + if (o.Info === 1) + o.Data = parse_RC4Header(blob, length); + else + o.Data = parse_RC4CryptoHeader(blob, length); + return o; +} +function parse_FilePass(blob, length /*:number*/, opts) { + var o = ({ Type: opts.biff >= 8 ? blob.read_shift(2) : 0 } /*:any*/); /* wEncryptionType */ + if (o.Type) + parse_FilePassHeader(blob, length - 2, o); + else + parse_XORObfuscation(blob, opts.biff >= 8 ? length : length - 2, opts, o); + return o; +} +function rtf_to_sheet(d, opts) { + switch (opts.type) { + case "base64": + return rtf_to_sheet_str(Base64_decode(d), opts); + case "binary": + return rtf_to_sheet_str(d, opts); + case "buffer": + return rtf_to_sheet_str(has_buf && Buffer.isBuffer(d) ? d.toString("binary") : a2s(d), opts); + case "array": + return rtf_to_sheet_str(cc2str(d), opts); + } + throw new Error("Unrecognized type " + opts.type); +} +function rtf_to_sheet_str(str, opts) { + var o = opts || {}; + var ws = {}; + var dense = o.dense; + if (dense) + ws["!data"] = []; + var rows = str.match(/\\trowd[\s\S]*?\\row\b/g); + if (!rows) + throw new Error("RTF missing table"); + var range = { s: { c: 0, r: 0 }, e: { c: 0, r: rows.length - 1 } }; + var row = []; + rows.forEach(function (rowtf, R) { + if (dense) + row = ws["!data"][R] = []; + var rtfre = /\\[\w\-]+\b/g; + var last_index = 0; + var res; + var C = -1; + var payload = []; + while ((res = rtfre.exec(rowtf)) != null) { + var data = rowtf.slice(last_index, rtfre.lastIndex - res[0].length); + if (data.charCodeAt(0) == 32) + data = data.slice(1); + if (data.length) + payload.push(data); + switch (res[0]) { + case "\\cell": + ++C; + if (payload.length) { + var cell = { v: payload.join(""), t: "s" }; + if (cell.v == "TRUE" || cell.v == "FALSE") { + cell.v = cell.v == "TRUE"; + cell.t = "b"; + } + else if (!isNaN(fuzzynum(cell.v))) { + cell.t = "n"; + if (o.cellText !== false) + cell.w = cell.v; + cell.v = fuzzynum(cell.v); + } + if (dense) + row[C] = cell; + else + ws[encode_cell({ r: R, c: C })] = cell; + } + payload = []; + break; + case "\\par": + payload.push("\n"); + break; + } + last_index = rtfre.lastIndex; + } + if (C > range.e.c) + range.e.c = C; + }); + ws["!ref"] = encode_range(range); + return ws; +} +function rtf_to_workbook(d, opts) { + var wb = sheet_to_workbook(rtf_to_sheet(d, opts), opts); + wb.bookType = "rtf"; + return wb; +} +function sheet_to_rtf(ws, opts) { + var o = ["{\\rtf1\\ansi"]; + if (!ws["!ref"]) + return o[0] + "}"; + var r = safe_decode_range(ws["!ref"]), cell; + var dense = ws["!data"] != null, row = []; + for (var R = r.s.r; R <= r.e.r; ++R) { + o.push("\\trowd\\trautofit1"); + for (var C = r.s.c; C <= r.e.c; ++C) + o.push("\\cellx" + (C + 1)); + o.push("\\pard\\intbl"); + if (dense) + row = ws["!data"][R] || []; + for (C = r.s.c; C <= r.e.c; ++C) { + var coord = encode_cell({ r: R, c: C }); + cell = dense ? row[C] : ws[coord]; + if (!cell || cell.v == null && (!cell.f || cell.F)) { + o.push(" \\cell"); + continue; + } + o.push(" " + (cell.w || (format_cell(cell), cell.w) || "").replace(/[\r\n]/g, "\\par ")); + o.push("\\cell"); + } + o.push("\\pard\\intbl\\row"); + } + return o.join("") + "}"; +} +function hex2RGB(h) { + var o = h.slice(h[0] === "#" ? 1 : 0).slice(0, 6); + return [parseInt(o.slice(0, 2), 16), parseInt(o.slice(2, 4), 16), parseInt(o.slice(4, 6), 16)]; +} +function rgb2Hex(rgb) { + for (var i = 0, o = 1; i != 3; ++i) + o = o * 256 + (rgb[i] > 255 ? 255 : rgb[i] < 0 ? 0 : rgb[i]); + return o.toString(16).toUpperCase().slice(1); +} +function rgb2HSL(rgb) { + var R = rgb[0] / 255, G = rgb[1] / 255, B = rgb[2] / 255; + var M = Math.max(R, G, B), m = Math.min(R, G, B), C = M - m; + if (C === 0) + return [0, 0, R]; + var H6 = 0, S = 0, L2 = (M + m); + S = C / (L2 > 1 ? 2 - L2 : L2); + switch (M) { + case R: + H6 = ((G - B) / C + 6) % 6; + break; + case G: + H6 = ((B - R) / C + 2); + break; + case B: + H6 = ((R - G) / C + 4); + break; + } + return [H6 / 6, S, L2 / 2]; +} +function hsl2RGB(hsl) { + var H = hsl[0], S = hsl[1], L = hsl[2]; + var C = S * 2 * (L < 0.5 ? L : 1 - L), m = L - C / 2; + var rgb = [m, m, m], h6 = 6 * H; + var X; + if (S !== 0) + switch (h6 | 0) { + case 0: + case 6: + X = C * h6; + rgb[0] += C; + rgb[1] += X; + break; + case 1: + X = C * (2 - h6); + rgb[0] += X; + rgb[1] += C; + break; + case 2: + X = C * (h6 - 2); + rgb[1] += C; + rgb[2] += X; + break; + case 3: + X = C * (4 - h6); + rgb[1] += X; + rgb[2] += C; + break; + case 4: + X = C * (h6 - 4); + rgb[2] += C; + rgb[0] += X; + break; + case 5: + X = C * (6 - h6); + rgb[2] += X; + rgb[0] += C; + break; + } + for (var i = 0; i != 3; ++i) + rgb[i] = Math.round(rgb[i] * 255); + return rgb; +} +/* 18.8.3 bgColor tint algorithm */ +function rgb_tint(hex, tint) { + if (tint === 0) + return hex; + var hsl = rgb2HSL(hex2RGB(hex)); + if (tint < 0) + hsl[2] = hsl[2] * (1 + tint); + else + hsl[2] = 1 - (1 - hsl[2]) * (1 - tint); + return rgb2Hex(hsl2RGB(hsl)); +} +/* 18.3.1.13 width calculations */ +/* [MS-OI29500] 2.1.595 Column Width & Formatting */ +var DEF_MDW = 6, MAX_MDW = 15, MIN_MDW = 1, MDW = DEF_MDW; +function width2px(width) { return Math.floor((width + (Math.round(128 / MDW)) / 256) * MDW); } +function px2char(px) { return (Math.floor((px - 5) / MDW * 100 + 0.5)) / 100; } +function char2width(chr) { return (Math.round((chr * MDW + 5) / MDW * 256)) / 256; } +//function px2char_(px) { return (((px - 5)/MDW * 100 + 0.5))/100; } +//function char2width_(chr) { return (((chr * MDW + 5)/MDW*256))/256; } +function cycle_width(collw) { return char2width(px2char(width2px(collw))); } +/* XLSX/XLSB/XLS specify width in units of MDW */ +function find_mdw_colw(collw) { + var delta = Math.abs(collw - cycle_width(collw)), _MDW = MDW; + if (delta > 0.005) + for (MDW = MIN_MDW; MDW < MAX_MDW; ++MDW) + if (Math.abs(collw - cycle_width(collw)) <= delta) { + delta = Math.abs(collw - cycle_width(collw)); + _MDW = MDW; + } + MDW = _MDW; +} +/* XLML specifies width in terms of pixels */ +/*function find_mdw_wpx(wpx) { + var delta = Infinity, guess = 0, _MDW = MIN_MDW; + for(MDW=MIN_MDW; MDW 0.5) guess--; + if(Math.abs(guess) < delta) { delta = Math.abs(guess); _MDW = MDW; } + } + MDW = _MDW; +}*/ +function process_col(coll /*:ColInfo*/) { + if (coll.width) { + coll.wpx = width2px(coll.width); + coll.wch = px2char(coll.wpx); + coll.MDW = MDW; + } + else if (coll.wpx) { + coll.wch = px2char(coll.wpx); + coll.width = char2width(coll.wch); + coll.MDW = MDW; + } + else if (typeof coll.wch == 'number') { + coll.width = char2width(coll.wch); + coll.wpx = width2px(coll.width); + coll.MDW = MDW; + } + if (coll.customWidth) + delete coll.customWidth; +} +var DEF_PPI = 96, PPI = DEF_PPI; +function px2pt(px) { return px * 96 / PPI; } +function pt2px(pt) { return pt * PPI / 96; } +/* [MS-EXSPXML3] 2.4.54 ST_enmPattern */ +var XLMLPatternTypeMap = { + "None": "none", + "Solid": "solid", + "Gray50": "mediumGray", + "Gray75": "darkGray", + "Gray25": "lightGray", + "HorzStripe": "darkHorizontal", + "VertStripe": "darkVertical", + "ReverseDiagStripe": "darkDown", + "DiagStripe": "darkUp", + "DiagCross": "darkGrid", + "ThickDiagCross": "darkTrellis", + "ThinHorzStripe": "lightHorizontal", + "ThinVertStripe": "lightVertical", + "ThinReverseDiagStripe": "lightDown", + "ThinHorzCross": "lightGrid" +}; +/* 18.8.5 borders CT_Borders */ +function parse_borders(t, styles, themes, opts) { + styles.Borders = []; + var border = {}; + var pass = false; + (t[0].match(tagregex) || []).forEach(function (x) { + var y = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': + case '': break; + /* 18.8.4 border CT_Border */ + case '': + case '': + border = /*::(*/ {} /*:: :any)*/; + if (y.diagonalUp) + border.diagonalUp = parsexmlbool(y.diagonalUp); + if (y.diagonalDown) + border.diagonalDown = parsexmlbool(y.diagonalDown); + styles.Borders.push(border); + break; + case '': break; + /* note: not in spec, appears to be CT_BorderPr */ + case '': break; + case '': break; + case '': break; + /* note: not in spec, appears to be CT_BorderPr */ + case '': break; + case '': break; + case '': break; + /* 18.8.43 top CT_BorderPr */ + case '': break; + case '': break; + case '': break; + /* 18.8.6 bottom CT_BorderPr */ + case '': break; + case '': break; + case '': break; + /* 18.8.13 diagonal CT_BorderPr */ + case '': + case '': break; + case '': break; + /* 18.8.25 horizontal CT_BorderPr */ + case '': + case '': break; + case '': break; + /* 18.8.44 vertical CT_BorderPr */ + case '': + case '': break; + case '': break; + /* 18.8.37 start CT_BorderPr */ + case '': + case '': break; + case '': break; + /* 18.8.16 end CT_BorderPr */ + case '': + case '': break; + case '': break; + /* 18.8.? color CT_Color */ + case '': + break; + case '': + case '': break; + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': + case '': break; + case '': + pass = false; + break; + default: if (opts && opts.WTF) { + if (!pass) + throw new Error('unrecognized ' + y[0] + ' in borders'); + } + } + }); +} +/* 18.8.21 fills CT_Fills */ +function parse_fills(t, styles, themes, opts) { + styles.Fills = []; + var fill = {}; + var pass = false; + (t[0].match(tagregex) || []).forEach(function (x) { + var y = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': + case '': break; + /* 18.8.20 fill CT_Fill */ + case '': + case '': + fill = {}; + styles.Fills.push(fill); + break; + case '': break; + /* 18.8.24 gradientFill CT_GradientFill */ + case '': break; + case '': + styles.Fills.push(fill); + fill = {}; + break; + /* 18.8.32 patternFill CT_PatternFill */ + case '': + if (y.patternType) + fill.patternType = y.patternType; + break; + case '': + case '': break; + /* 18.8.3 bgColor CT_Color */ + case '': + case '': break; + /* 18.8.19 fgColor CT_Color */ + case '': + case '': break; + /* 18.8.38 stop CT_GradientStop */ + case '': break; + case '': break; + /* 18.8.? color CT_Color */ + case '': break; + case '': break; + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': + case '': break; + case '': + pass = false; + break; + default: if (opts && opts.WTF) { + if (!pass) + throw new Error('unrecognized ' + y[0] + ' in fills'); + } + } + }); +} +/* 18.8.23 fonts CT_Fonts */ +function parse_fonts(t, styles, themes, opts) { + styles.Fonts = []; + var font = {}; + var pass = false; + (t[0].match(tagregex) || []).forEach(function (x) { + var y = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': + case '': break; + /* 18.8.22 font CT_Font */ + case '': break; + case '': + case '': + styles.Fonts.push(font); + font = {}; + break; + /* 18.8.29 name CT_FontName */ + case '': + case '': break; + /* 18.8.2 b CT_BooleanProperty */ + case '': + font.bold = 1; + break; + /* 18.8.26 i CT_BooleanProperty */ + case '': + font.italic = 1; + break; + /* 18.4.13 u CT_UnderlineProperty */ + case '': + font.underline = 1; + break; + /* 18.4.10 strike CT_BooleanProperty */ + case '': + font.strike = 1; + break; + /* 18.4.2 outline CT_BooleanProperty */ + case '': + font.outline = 1; + break; + /* 18.8.36 shadow CT_BooleanProperty */ + case '': + font.shadow = 1; + break; + /* 18.8.12 condense CT_BooleanProperty */ + case '': + font.condense = 1; + break; + /* 18.8.17 extend CT_BooleanProperty */ + case '': + font.extend = 1; + break; + /* 18.4.11 sz CT_FontSize */ + case '': + case '': break; + /* 18.4.14 vertAlign CT_VerticalAlignFontProperty */ + case '': + case '': break; + /* 18.8.18 family CT_FontFamily */ + case '': + case '': break; + /* 18.8.35 scheme CT_FontScheme */ + case '': + case '': break; + /* 18.4.1 charset CT_IntProperty */ + case '': + case '': break; + /* note: sometimes mc:AlternateContent appears bare */ + case '': + pass = false; + break; + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': + case '': break; + case '': + pass = false; + break; + default: if (opts && opts.WTF) { + if (!pass) + throw new Error('unrecognized ' + y[0] + ' in fonts'); + } + } + }); +} +/* 18.8.31 numFmts CT_NumFmts */ +function parse_numFmts(t, styles, opts) { + styles.NumberFmt = []; + var k /*Array*/ = (keys(table_fmt) /*:any*/); + for (var i = 0; i < k.length; ++i) + styles.NumberFmt[k[i]] = table_fmt[k[i]]; + var m = t[0].match(tagregex); + if (!m) + return; + for (i = 0; i < m.length; ++i) { + var y = parsexmltag(m[i]); + switch (strip_ns(y[0])) { + case '': + case '': + case '': break; + case ' 0) { + if (j > 0x188) { + for (j = 0x188; j > 0x3c; --j) + if (styles.NumberFmt[j] == null) + break; + styles.NumberFmt[j] = f; + } + SSF__load(f, j); + } + } + break; + case '': break; + default: if (opts.WTF) + throw new Error('unrecognized ' + y[0] + ' in numFmts'); + } + } +} +function write_numFmts(NF /*:{[n:number|string]:string}*/ /*::, opts*/) { + var o = [""]; + [[5, 8], [23, 26], [41, 44], [/*63*/ 50, /*66],[164,*/ 392]].forEach(function (r) { + for (var i = r[0]; i <= r[1]; ++i) + if (NF[i] != null) + o[o.length] = (writextag('numFmt', null, { numFmtId: i, formatCode: escapexml(NF[i]) })); + }); + if (o.length === 1) + return ""; + o[o.length] = (""); + o[0] = writextag('numFmts', null, { count: o.length - 2 }).replace("/>", ">"); + return o.join(""); +} +/* 18.8.10 cellXfs CT_CellXfs */ +var cellXF_uint = ["numFmtId", "fillId", "fontId", "borderId", "xfId"]; +var cellXF_bool = ["applyAlignment", "applyBorder", "applyFill", "applyFont", "applyNumberFormat", "applyProtection", "pivotButton", "quotePrefix"]; +function parse_cellXfs(t, styles, opts) { + styles.CellXf = []; + var xf; + var pass = false; + (t[0].match(tagregex) || []).forEach(function (x) { + var y = parsexmltag(x), i = 0; + switch (strip_ns(y[0])) { + case '': + case '': + case '': break; + /* 18.8.45 xf CT_Xf */ + case '': + xf = y; + delete xf[0]; + for (i = 0; i < cellXF_uint.length; ++i) + if (xf[cellXF_uint[i]]) + xf[cellXF_uint[i]] = parseInt(xf[cellXF_uint[i]], 10); + for (i = 0; i < cellXF_bool.length; ++i) + if (xf[cellXF_bool[i]]) + xf[cellXF_bool[i]] = parsexmlbool(xf[cellXF_bool[i]]); + if (styles.NumberFmt && xf.numFmtId > 0x188) { + for (i = 0x188; i > 0x3c; --i) + if (styles.NumberFmt[xf.numFmtId] == styles.NumberFmt[i]) { + xf.numFmtId = i; + break; + } + } + styles.CellXf.push(xf); + break; + case '': break; + /* 18.8.1 alignment CT_CellAlignment */ + case '': + var alignment = {}; + if (y.vertical) + alignment.vertical = y.vertical; + if (y.horizontal) + alignment.horizontal = y.horizontal; + if (y.textRotation != null) + alignment.textRotation = y.textRotation; + if (y.indent) + alignment.indent = y.indent; + if (y.wrapText) + alignment.wrapText = parsexmlbool(y.wrapText); + xf.alignment = alignment; + break; + case '': break; + /* 18.8.33 protection CT_CellProtection */ + case '': + case '': break; + /* note: sometimes mc:AlternateContent appears bare */ + case '': + pass = false; + break; + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': + case '': break; + case '': + pass = false; + break; + default: if (opts && opts.WTF) { + if (!pass) + throw new Error('unrecognized ' + y[0] + ' in cellXfs'); + } + } + }); +} +function write_cellXfs(cellXfs) { + var o /*:Array*/ = []; + o[o.length] = (writextag('cellXfs', null)); + cellXfs.forEach(function (c) { + o[o.length] = (writextag('xf', null, c)); + }); + o[o.length] = (""); + if (o.length === 2) + return ""; + o[0] = writextag('cellXfs', null, { count: o.length - 2 }).replace("/>", ">"); + return o.join(""); +} +/* 18.8 Styles CT_Stylesheet*/ +var parse_sty_xml = /*#__PURE__*/ (function make_pstyx() { + var numFmtRegex = /<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/; + var cellXfRegex = /<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/; + var fillsRegex = /<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/; + var fontsRegex = /<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/; + var bordersRegex = /<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/; + return function parse_sty_xml(data, themes, opts) { + var styles = {}; + if (!data) + return styles; + data = data.replace(//mg, "").replace(//gm, ""); + /* 18.8.39 styleSheet CT_Stylesheet */ + var t; + /* 18.8.31 numFmts CT_NumFmts ? */ + if ((t = data.match(numFmtRegex))) + parse_numFmts(t, styles, opts); + /* 18.8.23 fonts CT_Fonts ? */ + if ((t = data.match(fontsRegex))) + parse_fonts(t, styles, themes, opts); + /* 18.8.21 fills CT_Fills ? */ + if ((t = data.match(fillsRegex))) + parse_fills(t, styles, themes, opts); + /* 18.8.5 borders CT_Borders ? */ + if ((t = data.match(bordersRegex))) + parse_borders(t, styles, themes, opts); + /* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */ + /* 18.8.8 cellStyles CT_CellStyles ? */ + /* 18.8.10 cellXfs CT_CellXfs ? */ + if ((t = data.match(cellXfRegex))) + parse_cellXfs(t, styles, opts); + /* 18.8.15 dxfs CT_Dxfs ? */ + /* 18.8.42 tableStyles CT_TableStyles ? */ + /* 18.8.11 colors CT_Colors ? */ + /* 18.2.10 extLst CT_ExtensionList ? */ + return styles; + }; +})(); +function write_sty_xml(wb /*:Workbook*/, opts) { + var o = [XML_HEADER, writextag('styleSheet', null, { + 'xmlns': XMLNS_main[0], + 'xmlns:vt': XMLNS.vt + })], w; + if (wb.SSF && (w = write_numFmts(wb.SSF)) != null) + o[o.length] = w; + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + if ((w = write_cellXfs(opts.cellXfs))) + o[o.length] = (w); + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + if (o.length > 2) { + o[o.length] = (''); + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* [MS-XLSB] 2.4.657 BrtFmt */ +function parse_BrtFmt(data, length /*:number*/) { + var numFmtId = data.read_shift(2); + var stFmtCode = parse_XLWideString(data, length - 2); + return [numFmtId, stFmtCode]; +} +function write_BrtFmt(i /*:number*/, f /*:string*/, o) { + if (!o) + o = new_buf(6 + 4 * f.length); + o.write_shift(2, i); + write_XLWideString(f, o); + var out = (o.length > o.l) ? o.slice(0, o.l) : o; + if (o.l == null) + o.l = o.length; + return out; +} +/* [MS-XLSB] 2.4.659 BrtFont TODO */ +function parse_BrtFont(data, length /*:number*/, opts) { + var out = ({} /*:any*/); + out.sz = data.read_shift(2) / 20; + var grbit = parse_FontFlags(data, 2, opts); + if (grbit.fItalic) + out.italic = 1; + if (grbit.fCondense) + out.condense = 1; + if (grbit.fExtend) + out.extend = 1; + if (grbit.fShadow) + out.shadow = 1; + if (grbit.fOutline) + out.outline = 1; + if (grbit.fStrikeout) + out.strike = 1; + var bls = data.read_shift(2); + if (bls === 0x02BC) + out.bold = 1; + switch (data.read_shift(2)) { + /* case 0: out.vertAlign = "baseline"; break; */ + case 1: + out.vertAlign = "superscript"; + break; + case 2: + out.vertAlign = "subscript"; + break; + } + var underline = data.read_shift(1); + if (underline != 0) + out.underline = underline; + var family = data.read_shift(1); + if (family > 0) + out.family = family; + var bCharSet = data.read_shift(1); + if (bCharSet > 0) + out.charset = bCharSet; + data.l++; + out.color = parse_BrtColor(data, 8); + switch (data.read_shift(1)) { + /* case 0: out.scheme = "none": break; */ + case 1: + out.scheme = "major"; + break; + case 2: + out.scheme = "minor"; + break; + } + out.name = parse_XLWideString(data, length - 21); + return out; +} +function write_BrtFont(font /*:any*/, o) { + if (!o) + o = new_buf(25 + 4 * 32); + o.write_shift(2, font.sz * 20); + write_FontFlags(font, o); + o.write_shift(2, font.bold ? 0x02BC : 0x0190); + var sss = 0; + if (font.vertAlign == "superscript") + sss = 1; + else if (font.vertAlign == "subscript") + sss = 2; + o.write_shift(2, sss); + o.write_shift(1, font.underline || 0); + o.write_shift(1, font.family || 0); + o.write_shift(1, font.charset || 0); + o.write_shift(1, 0); + write_BrtColor(font.color, o); + var scheme = 0; + if (font.scheme == "major") + scheme = 1; + if (font.scheme == "minor") + scheme = 2; + o.write_shift(1, scheme); + write_XLWideString(font.name, o); + return o.length > o.l ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.650 BrtFill */ +var XLSBFillPTNames = [ + "none", + "solid", + "mediumGray", + "darkGray", + "lightGray", + "darkHorizontal", + "darkVertical", + "darkDown", + "darkUp", + "darkGrid", + "darkTrellis", + "lightHorizontal", + "lightVertical", + "lightDown", + "lightUp", + "lightGrid", + "lightTrellis", + "gray125", + "gray0625" +]; +var rev_XLSBFillPTNames /*:EvertNumType*/; +/* TODO: gradient fill representation */ +var parse_BrtFill = parsenoop; +function write_BrtFill(fill, o) { + if (!o) + o = new_buf(4 * 3 + 8 * 7 + 16 * 1); + if (!rev_XLSBFillPTNames) + rev_XLSBFillPTNames = (evert(XLSBFillPTNames) /*:any*/); + var fls /*:number*/ = rev_XLSBFillPTNames[fill.patternType]; + if (fls == null) + fls = 0x28; + o.write_shift(4, fls); + var j = 0; + if (fls != 0x28) { + /* TODO: custom FG Color */ + write_BrtColor({ auto: 1 }, o); + /* TODO: custom BG Color */ + write_BrtColor({ auto: 1 }, o); + for (; j < 12; ++j) + o.write_shift(4, 0); + } + else { + for (; j < 4; ++j) + o.write_shift(4, 0); + for (; j < 12; ++j) + o.write_shift(4, 0); /* TODO */ + /* iGradientType */ + /* xnumDegree */ + /* xnumFillToLeft */ + /* xnumFillToRight */ + /* xnumFillToTop */ + /* xnumFillToBottom */ + /* cNumStop */ + /* xfillGradientStop */ + } + return o.length > o.l ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.824 BrtXF */ +function parse_BrtXF(data, length /*:number*/) { + var tgt = data.l + length; + var ixfeParent = data.read_shift(2); + var ifmt = data.read_shift(2); + data.l = tgt; + return { ixfe: ixfeParent, numFmtId: ifmt }; +} +function write_BrtXF(data, ixfeP, o) { + if (!o) + o = new_buf(16); + o.write_shift(2, ixfeP || 0); + o.write_shift(2, data.numFmtId || 0); + o.write_shift(2, 0); /* iFont */ + o.write_shift(2, 0); /* iFill */ + o.write_shift(2, 0); /* ixBorder */ + o.write_shift(1, 0); /* trot */ + o.write_shift(1, 0); /* indent */ + var flow = 0; + o.write_shift(1, flow); /* flags */ + o.write_shift(1, 0); /* flags */ + o.write_shift(1, 0); /* xfGrbitAtr */ + o.write_shift(1, 0); + return o; +} +/* [MS-XLSB] 2.5.4 Blxf TODO */ +function write_Blxf(data, o) { + if (!o) + o = new_buf(10); + o.write_shift(1, 0); /* dg */ + o.write_shift(1, 0); + o.write_shift(4, 0); /* color */ + o.write_shift(4, 0); /* color */ + return o; +} +/* [MS-XLSB] 2.4.302 BrtBorder TODO */ +var parse_BrtBorder = parsenoop; +function write_BrtBorder(border, o) { + if (!o) + o = new_buf(51); + o.write_shift(1, 0); /* diagonal */ + write_Blxf(null, o); /* top */ + write_Blxf(null, o); /* bottom */ + write_Blxf(null, o); /* left */ + write_Blxf(null, o); /* right */ + write_Blxf(null, o); /* diag */ + return o.length > o.l ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.763 BrtStyle TODO */ +function write_BrtStyle(style, o) { + if (!o) + o = new_buf(12 + 4 * 10); + o.write_shift(4, style.xfId); + o.write_shift(2, 1); + o.write_shift(1, +style.builtinId); + o.write_shift(1, 0); /* iLevel */ + write_XLNullableWideString(style.name || "", o); + return o.length > o.l ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.272 BrtBeginTableStyles */ +function write_BrtBeginTableStyles(cnt, defTableStyle, defPivotStyle) { + var o = new_buf(4 + 256 * 2 * 4); + o.write_shift(4, cnt); + write_XLNullableWideString(defTableStyle, o); + write_XLNullableWideString(defPivotStyle, o); + return o.length > o.l ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.1.7.50 Styles */ +function parse_sty_bin(data, themes, opts) { + var styles = {}; + styles.NumberFmt = ([] /*:any*/); + for (var y in table_fmt) + styles.NumberFmt[y] = table_fmt[y]; + styles.CellXf = []; + styles.Fonts = []; + var state /*:Array*/ = []; + var pass = false; + recordhopper(data, function hopper_sty(val, R, RT) { + switch (RT) { + case 0x002C: /* BrtFmt */ + styles.NumberFmt[val[0]] = val[1]; + SSF__load(val[1], val[0]); + break; + case 0x002B: /* BrtFont */ + styles.Fonts.push(val); + if (val.color.theme != null && themes && themes.themeElements && themes.themeElements.clrScheme) { + val.color.rgb = rgb_tint(themes.themeElements.clrScheme[val.color.theme].rgb, val.color.tint || 0); + } + break; + case 0x0401: /* BrtKnownFonts */ break; + case 0x002D: /* BrtFill */ + break; + case 0x002E: /* BrtBorder */ + break; + case 0x002F: /* BrtXF */ + if (state[state.length - 1] == 0x0269 /* BrtBeginCellXFs */) { + styles.CellXf.push(val); + } + break; + case 0x0030: /* BrtStyle */ + case 0x01FB: /* BrtDXF */ + case 0x023C: /* BrtMRUColor */ + case 0x01DB: /* BrtIndexedColor */ + break; + case 0x0493: /* BrtDXF14 */ + case 0x0836: /* BrtDXF15 */ + case 0x046A: /* BrtSlicerStyleElement */ + case 0x0200: /* BrtTableStyleElement */ + case 0x082F: /* BrtTimelineStyleElement */ + case 0x0C00: /* BrtUid */ + break; + case 0x0023: /* BrtFRTBegin */ + pass = true; + break; + case 0x0024: /* BrtFRTEnd */ + pass = false; + break; + case 0x0025: /* BrtACBegin */ + state.push(RT); + pass = true; + break; + case 0x0026: /* BrtACEnd */ + state.pop(); + pass = false; + break; + default: + if (R.T > 0) + state.push(RT); + else if (R.T < 0) + state.pop(); + else if (!pass || (opts.WTF && state[state.length - 1] != 0x0025 /* BrtACBegin */)) + throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }); + return styles; +} +function write_FMTS_bin(ba, NF /*:?SSFTable*/) { + if (!NF) + return; + var cnt = 0; + [[5, 8], [23, 26], [41, 44], [/*63*/ 50, /*66],[164,*/ 392]].forEach(function (r) { + /*:: if(!NF) return; */ + for (var i = r[0]; i <= r[1]; ++i) + if (NF[i] != null) + ++cnt; + }); + if (cnt == 0) + return; + write_record(ba, 0x0267 /* BrtBeginFmts */, write_UInt32LE(cnt)); + [[5, 8], [23, 26], [41, 44], [/*63*/ 50, /*66],[164,*/ 392]].forEach(function (r) { + /*:: if(!NF) return; */ + for (var i = r[0]; i <= r[1]; ++i) + if (NF[i] != null) + write_record(ba, 0x002C /* BrtFmt */, write_BrtFmt(i, NF[i])); + }); + write_record(ba, 0x0268 /* BrtEndFmts */); +} +function write_FONTS_bin(ba /*::, data*/) { + var cnt = 1; + if (cnt == 0) + return; + write_record(ba, 0x0263 /* BrtBeginFonts */, write_UInt32LE(cnt)); + write_record(ba, 0x002B /* BrtFont */, write_BrtFont({ + sz: 12, + color: { theme: 1 }, + name: "Calibri", + family: 2, + scheme: "minor" + })); + /* 1*65491BrtFont [ACFONTS] */ + write_record(ba, 0x0264 /* BrtEndFonts */); +} +function write_FILLS_bin(ba /*::, data*/) { + var cnt = 2; + if (cnt == 0) + return; + write_record(ba, 0x025B /* BrtBeginFills */, write_UInt32LE(cnt)); + write_record(ba, 0x002D /* BrtFill */, write_BrtFill({ patternType: "none" })); + write_record(ba, 0x002D /* BrtFill */, write_BrtFill({ patternType: "gray125" })); + /* 1*65431BrtFill */ + write_record(ba, 0x025C /* BrtEndFills */); +} +function write_BORDERS_bin(ba /*::, data*/) { + var cnt = 1; + if (cnt == 0) + return; + write_record(ba, 0x0265 /* BrtBeginBorders */, write_UInt32LE(cnt)); + write_record(ba, 0x002E /* BrtBorder */, write_BrtBorder({})); + /* 1*65430BrtBorder */ + write_record(ba, 0x0266 /* BrtEndBorders */); +} +function write_CELLSTYLEXFS_bin(ba /*::, data*/) { + var cnt = 1; + write_record(ba, 0x0272 /* BrtBeginCellStyleXFs */, write_UInt32LE(cnt)); + write_record(ba, 0x002F /* BrtXF */, write_BrtXF({ + numFmtId: 0, + fontId: 0, + fillId: 0, + borderId: 0 + }, 0xFFFF)); + /* 1*65430(BrtXF *FRT) */ + write_record(ba, 0x0273 /* BrtEndCellStyleXFs */); +} +function write_CELLXFS_bin(ba, data) { + write_record(ba, 0x0269 /* BrtBeginCellXFs */, write_UInt32LE(data.length)); + data.forEach(function (c) { write_record(ba, 0x002F /* BrtXF */, write_BrtXF(c, 0)); }); + /* 1*65430(BrtXF *FRT) */ + write_record(ba, 0x026A /* BrtEndCellXFs */); +} +function write_STYLES_bin(ba /*::, data*/) { + var cnt = 1; + write_record(ba, 0x026B /* BrtBeginStyles */, write_UInt32LE(cnt)); + write_record(ba, 0x0030 /* BrtStyle */, write_BrtStyle({ + xfId: 0, + builtinId: 0, + name: "Normal" + })); + /* 1*65430(BrtStyle *FRT) */ + write_record(ba, 0x026C /* BrtEndStyles */); +} +function write_DXFS_bin(ba /*::, data*/) { + var cnt = 0; + write_record(ba, 0x01F9 /* BrtBeginDXFs */, write_UInt32LE(cnt)); + /* *2147483647(BrtDXF *FRT) */ + write_record(ba, 0x01FA /* BrtEndDXFs */); +} +function write_TABLESTYLES_bin(ba /*::, data*/) { + var cnt = 0; + write_record(ba, 0x01FC /* BrtBeginTableStyles */, write_BrtBeginTableStyles(cnt, "TableStyleMedium9", "PivotStyleMedium4")); + /* *TABLESTYLE */ + write_record(ba, 0x01FD /* BrtEndTableStyles */); +} +function write_COLORPALETTE_bin( /*::ba, data*/) { + return; + /* BrtBeginColorPalette [INDEXEDCOLORS] [MRUCOLORS] BrtEndColorPalette */ +} +/* [MS-XLSB] 2.1.7.50 Styles */ +function write_sty_bin(wb, opts) { + var ba = buf_array(); + write_record(ba, 0x0116 /* BrtBeginStyleSheet */); + write_FMTS_bin(ba, wb.SSF); + write_FONTS_bin(ba, wb); + write_FILLS_bin(ba, wb); + write_BORDERS_bin(ba, wb); + write_CELLSTYLEXFS_bin(ba, wb); + write_CELLXFS_bin(ba, opts.cellXfs); + write_STYLES_bin(ba, wb); + write_DXFS_bin(ba, wb); + write_TABLESTYLES_bin(ba, wb); + write_COLORPALETTE_bin(ba, wb); + /* FRTSTYLESHEET*/ + write_record(ba, 0x0117 /* BrtEndStyleSheet */); + return ba.end(); +} +/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */ +var XLSXThemeClrScheme = [ + '', '', '', '', + '', '', '', + '', '', '', + '', '' +]; +/* 20.1.6.2 clrScheme CT_ColorScheme */ +function parse_clrScheme(t, themes, opts) { + themes.themeElements.clrScheme = []; + var color = {}; + (t[0].match(tagregex) || []).forEach(function (x) { + var y = parsexmltag(x); + switch (y[0]) { + /* 20.1.6.2 clrScheme (Color Scheme) CT_ColorScheme */ + case '': break; + /* 20.1.2.3.32 srgbClr CT_SRgbColor */ + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + case '': + if (y[0].charAt(1) === '/') { + themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color; + color = {}; + } + else { + color.name = y[0].slice(3, y[0].length - 1); + } + break; + default: if (opts && opts.WTF) + throw new Error('Unrecognized ' + y[0] + ' in clrScheme'); + } + }); +} +/* 20.1.4.1.18 fontScheme CT_FontScheme */ +function parse_fontScheme( /*::t, themes, opts*/) { } +/* 20.1.4.1.15 fmtScheme CT_StyleMatrix */ +function parse_fmtScheme( /*::t, themes, opts*/) { } +var clrsregex = /]*)>[\s\S]*<\/a:clrScheme>/; +var fntsregex = /]*)>[\s\S]*<\/a:fontScheme>/; +var fmtsregex = /]*)>[\s\S]*<\/a:fmtScheme>/; +/* 20.1.6.10 themeElements CT_BaseStyles */ +function parse_themeElements(data, themes, opts) { + themes.themeElements = {}; + var t; + [ + /* clrScheme CT_ColorScheme */ + ['clrScheme', clrsregex, parse_clrScheme], + /* fontScheme CT_FontScheme */ + ['fontScheme', fntsregex, parse_fontScheme], + /* fmtScheme CT_StyleMatrix */ + ['fmtScheme', fmtsregex, parse_fmtScheme] + ].forEach(function (m) { + if (!(t = data.match(m[1]))) + throw new Error(m[0] + ' not found in themeElements'); + m[2](t, themes, opts); + }); +} +var themeltregex = /]*)>[\s\S]*<\/a:themeElements>/; +/* 14.2.7 Theme Part */ +function parse_theme_xml(data /*:string*/, opts) { + /* 20.1.6.9 theme CT_OfficeStyleSheet */ + if (!data || data.length === 0) + data = write_theme(); + var t; + var themes = {}; + /* themeElements CT_BaseStyles */ + if (!(t = data.match(themeltregex))) + throw new Error('themeElements not found in theme'); + parse_themeElements(t[0], themes, opts); + themes.raw = data; + return themes; +} +function write_theme(Themes, opts) { + if (opts && opts.themeXLSX) + return opts.themeXLSX; + if (Themes && typeof Themes.raw == "string") + return Themes.raw; + var o = [XML_HEADER]; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + return o.join(""); +} +/* [MS-XLS] 2.4.326 TODO: payload is a zip file */ +function parse_Theme(blob, length, opts) { + var end = blob.l + length; + var dwThemeVersion = blob.read_shift(4); + if (dwThemeVersion === 124226) + return; + if (!opts.cellStyles) { + blob.l = end; + return; + } + var data = blob.slice(blob.l); + blob.l = end; + var zip; + try { + zip = zip_read(data, { type: "array" }); + } + catch (e) { + return; + } + var themeXML = getzipstr(zip, "theme/theme/theme1.xml", true); + if (!themeXML) + return; + return parse_theme_xml(themeXML, opts); +} +/* 2.5.49 */ +function parse_ColorTheme(blob /*::, length*/) { return blob.read_shift(4); } +/* 2.5.155 */ +function parse_FullColorExt(blob /*::, length*/) { + var o = {}; + o.xclrType = blob.read_shift(2); + o.nTintShade = blob.read_shift(2); + switch (o.xclrType) { + case 0: + blob.l += 4; + break; + case 1: + o.xclrValue = parse_IcvXF(blob, 4); + break; + case 2: + o.xclrValue = parse_LongRGBA(blob, 4); + break; + case 3: + o.xclrValue = parse_ColorTheme(blob, 4); + break; + case 4: + blob.l += 4; + break; + } + blob.l += 8; + return o; +} +/* 2.5.164 TODO: read 7 bits*/ +function parse_IcvXF(blob, length) { + return parsenoop(blob, length); +} +/* 2.5.280 */ +function parse_XFExtGradient(blob, length) { + return parsenoop(blob, length); +} +/* [MS-XLS] 2.5.108 */ +function parse_ExtProp(blob /*::, length*/) { + var extType = blob.read_shift(2); + var cb = blob.read_shift(2) - 4; + var o = [extType]; + switch (extType) { + case 0x04: + case 0x05: + case 0x07: + case 0x08: + case 0x09: + case 0x0A: + case 0x0B: + case 0x0D: + o[1] = parse_FullColorExt(blob, cb); + break; + case 0x06: + o[1] = parse_XFExtGradient(blob, cb); + break; + case 0x0E: + case 0x0F: + o[1] = blob.read_shift(cb === 1 ? 1 : 2); + break; + default: throw new Error("Unrecognized ExtProp type: " + extType + " " + cb); + } + return o; +} +/* 2.4.355 */ +function parse_XFExt(blob, length) { + var end = blob.l + length; + blob.l += 2; + var ixfe = blob.read_shift(2); + blob.l += 2; + var cexts = blob.read_shift(2); + var ext /*:AOA*/ = []; + while (cexts-- > 0) + ext.push(parse_ExtProp(blob, end - blob.l)); + return { ixfe: ixfe, ext: ext }; +} +/* xf is an XF, see parse_XFExt for xfext */ +function update_xfext(xf, xfext) { + xfext.forEach(function (xfe) { + switch (xfe[0]) { /* 2.5.108 extPropData */ + case 0x04: break; /* foreground color */ + case 0x05: break; /* background color */ + case 0x06: break; /* gradient fill */ + case 0x07: break; /* top cell border color */ + case 0x08: break; /* bottom cell border color */ + case 0x09: break; /* left cell border color */ + case 0x0a: break; /* right cell border color */ + case 0x0b: break; /* diagonal cell border color */ + case 0x0d: /* text color */ + break; + case 0x0e: break; /* font scheme */ + case 0x0f: break; /* indentation level */ + } + }); +} +function parse_BrtMdtinfo(data, length) { + return { + flags: data.read_shift(4), + version: data.read_shift(4), + name: parse_XLWideString(data, length - 8) + }; +} +function write_BrtMdtinfo(data) { + var o = new_buf(12 + 2 * data.name.length); + o.write_shift(4, data.flags); + o.write_shift(4, data.version); + write_XLWideString(data.name, o); + return o.slice(0, o.l); +} +function parse_BrtMdb(data) { + var out = []; + var cnt = data.read_shift(4); + while (cnt-- > 0) + out.push([data.read_shift(4), data.read_shift(4)]); + return out; +} +function write_BrtMdb(mdb) { + var o = new_buf(4 + 8 * mdb.length); + o.write_shift(4, mdb.length); + for (var i = 0; i < mdb.length; ++i) { + o.write_shift(4, mdb[i][0]); + o.write_shift(4, mdb[i][1]); + } + return o; +} +function write_BrtBeginEsfmd(cnt, name) { + var o = new_buf(8 + 2 * name.length); + o.write_shift(4, cnt); + write_XLWideString(name, o); + return o.slice(0, o.l); +} +function parse_BrtBeginEsmdb(data) { + data.l += 4; + return data.read_shift(4) != 0; +} +function write_BrtBeginEsmdb(cnt, cm) { + var o = new_buf(8); + o.write_shift(4, cnt); + o.write_shift(4, cm ? 1 : 0); + return o; +} +function parse_xlmeta_bin(data, name, _opts) { + var out = { Types: [], Cell: [], Value: [] }; + var opts = _opts || {}; + var state = []; + var pass = false; + var metatype = 2; + recordhopper(data, function (val, R, RT) { + switch (RT) { + case 335: + out.Types.push({ name: val.name }); + break; + case 51: + val.forEach(function (r) { + if (metatype == 1) + out.Cell.push({ type: out.Types[r[0] - 1].name, index: r[1] }); + else if (metatype == 0) + out.Value.push({ type: out.Types[r[0] - 1].name, index: r[1] }); + }); + break; + case 337: + metatype = val ? 1 : 0; + break; + case 338: + metatype = 2; + break; + case 35: + state.push(RT); + pass = true; + break; + case 36: + state.pop(); + pass = false; + break; + default: + if (R.T) { + } + else if (!pass || opts.WTF && state[state.length - 1] != 35) + throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }); + return out; +} +function write_xlmeta_bin() { + var ba = buf_array(); + write_record(ba, 332); + write_record(ba, 334, write_UInt32LE(1)); + write_record(ba, 335, write_BrtMdtinfo({ + name: "XLDAPR", + version: 12e4, + flags: 3496657072 + })); + write_record(ba, 336); + write_record(ba, 339, write_BrtBeginEsfmd(1, "XLDAPR")); + write_record(ba, 52); + write_record(ba, 35, write_UInt32LE(514)); + write_record(ba, 4096, write_UInt32LE(0)); + write_record(ba, 4097, writeuint16(1)); + write_record(ba, 36); + write_record(ba, 53); + write_record(ba, 340); + write_record(ba, 337, write_BrtBeginEsmdb(1, true)); + write_record(ba, 51, write_BrtMdb([[1, 0]])); + write_record(ba, 338); + write_record(ba, 333); + return ba.end(); +} +function parse_xlmeta_xml(data, name, opts) { + var out = { Types: [], Cell: [], Value: [] }; + if (!data) + return out; + var pass = false; + var metatype = 2; + var lastmeta; + data.replace(tagregex, function (x) { + var y = parsexmltag(x); + switch (strip_ns(y[0])) { + case "": + break; + case "": + break; + case "": + break; + case "": + break; + case "": + break; + case "": + break; + case "": + break; + case "": + metatype = 2; + break; + case "": + metatype = 2; + break; + case "": + case "": + case "": + break; + case "": + pass = false; + break; + case "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n'); + return o.join(""); +} +/* 18.6 Calculation Chain */ +function parse_cc_xml(data /*::, name, opts*/) { + var d = []; + if (!data) + return d; + var i = 1; + (data.match(tagregex) || []).forEach(function (x) { + var y = parsexmltag(x); + switch (y[0]) { + case '': + case '': break; + /* 18.6.1 c CT_CalcCell 1 */ + case ']*r:id="([^"]*)"/) || ["", ""])[1]; + return rels['!id'][id].Target; +} +/* L.5.5.2 SpreadsheetML Comments + VML Schema */ +var shapevmlregex = /<(?:\w+:)?shape(?:[^\w][^>]*)?>([\s\S]*?)<\/(?:\w+:)?shape>/g; +function parse_vml(data /*:string*/, sheet, comments) { + var cidx = 0; + (data.match(shapevmlregex) || []).forEach(function (m) { + var type = ""; + var hidden = true; + var aidx = -1; + var R = -1, C = -1; + m.replace(tagregex, function (x /*:string*/, idx /*:number*/) { + var y = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': + hidden = false; + break; + case '': + aidx = idx + x.length; + break; + case '': + R = +m.slice(aidx, idx).trim(); + break; + case '': + aidx = idx + x.length; + break; + case '': + C = +m.slice(aidx, idx).trim(); + break; + } + return ""; + }); + switch (type) { + case 'Note': + var cell = ws_get_cell_stub(sheet, ((R >= 0 && C >= 0) ? encode_cell({ r: R, c: C }) : comments[cidx].ref)); + if (cell.c) { + cell.c.hidden = hidden; + } + ++cidx; + break; + } + }); +} +/* comment boxes */ +function write_vml(rId /*:number*/, comments, ws) { + var csize = [21600, 21600]; + /* L.5.2.1.2 Path Attribute */ + var bbox = ["m0,0l0", csize[1], csize[0], csize[1], csize[0], "0xe"].join(","); + var o = [ + writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/, ">"), + writextag("o:shapelayout", writextag("o:idmap", null, { 'v:ext': "edit", 'data': rId }), { 'v:ext': "edit" }) + ]; + var _shapeid = 65536 * rId; + var _comments = comments || []; + if (_comments.length > 0) + o.push(writextag("v:shapetype", [ + writextag("v:stroke", null, { joinstyle: "miter" }), + writextag("v:path", null, { gradientshapeok: "t", 'o:connecttype': "rect" }) + ].join(""), { id: "_x0000_t202", coordsize: csize.join(","), 'o:spt': 202, path: bbox })); + _comments.forEach(function (x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); }); + o.push(''); + return o.join(""); +} +function write_vml_comment(x, _shapeid, ws) { + var c = decode_cell(x[0]); + var fillopts = /*::(*/ { 'color2': "#BEFF82", 'type': "gradient" } /*:: :any)*/; + if (fillopts.type == "gradient") + fillopts.angle = "-180"; + var fillparm = fillopts.type == "gradient" ? writextag("o:fill", null, { type: "gradientUnscaled", 'v:ext': "view" }) : null; + var fillxml = writextag('v:fill', fillparm, fillopts); + var shadata = ({ on: "t", 'obscured': "t" } /*:any*/); + return [ + '', + fillxml, + writextag("v:shadow", null, shadata), + writextag("v:path", null, { 'o:connecttype': "none" }), + '
', + '', + '', + '', + /* Part 4 19.4.2.3 Anchor (Anchor) */ + writetag('x:Anchor', [c.c + 1, 0, c.r + 1, 0, c.c + 3, 20, c.r + 5, 20].join(",")), + writetag('x:AutoFill', "False"), + writetag('x:Row', String(c.r)), + writetag('x:Column', String(c.c)), + x[1].hidden ? '' : '', + '', + '' + ].join(""); +} +function sheet_insert_comments(sheet /*:WorkSheet*/, comments /*:Array*/, threaded /*:boolean*/, people /*:?Array*/) { + var dense = sheet["!data"] != null; + var cell /*:Cell*/; + comments.forEach(function (comment) { + var r = decode_cell(comment.ref); + if (r.r < 0 || r.c < 0) + return; + if (dense) { + if (!sheet["!data"][r.r]) + sheet["!data"][r.r] = []; + cell = sheet["!data"][r.r][r.c]; + } + else + cell = sheet[comment.ref]; + if (!cell) { + cell = ({ t: "z" } /*:any*/); + if (dense) + sheet["!data"][r.r][r.c] = cell; + else + sheet[comment.ref] = cell; + var range = safe_decode_range(sheet["!ref"] || "BDWGO1000001:A1"); + if (range.s.r > r.r) + range.s.r = r.r; + if (range.e.r < r.r) + range.e.r = r.r; + if (range.s.c > r.c) + range.s.c = r.c; + if (range.e.c < r.c) + range.e.c = r.c; + var encoded = encode_range(range); + sheet["!ref"] = encoded; + } + if (!cell.c) + cell.c = []; + var o /*:Comment*/ = ({ a: comment.author, t: comment.t, r: comment.r, T: threaded }); + if (comment.h) + o.h = comment.h; + /* threaded comments always override */ + for (var i = cell.c.length - 1; i >= 0; --i) { + if (!threaded && cell.c[i].T) + return; + if (threaded && !cell.c[i].T) + cell.c.splice(i, 1); + } + if (threaded && people) + for (i = 0; i < people.length; ++i) { + if (o.a == people[i].id) { + o.a = people[i].name || o.a; + break; + } + } + cell.c.push(o); + }); +} +/* 18.7 Comments */ +function parse_comments_xml(data /*:string*/, opts) { + /* 18.7.6 CT_Comments */ + if (data.match(/<(?:\w+:)?comments *\/>/)) + return []; + var authors /*:Array*/ = []; + var commentList /*:Array*/ = []; + var authtag = data.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/); + if (authtag && authtag[1]) + authtag[1].split(/<\/\w*:?author>/).forEach(function (x) { + if (x === "" || x.trim() === "") + return; + var a = x.match(/<(?:\w+:)?author[^>]*>(.*)/); + if (a) + authors.push(a[1]); + }); + var cmnttag = data.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/); + if (cmnttag && cmnttag[1]) + cmnttag[1].split(/<\/\w*:?comment>/).forEach(function (x) { + if (x === "" || x.trim() === "") + return; + var cm = x.match(/<(?:\w+:)?comment[^>]*>/); + if (!cm) + return; + var y = parsexmltag(cm[0]); + var comment /*:RawComment*/ = ({ author: y.authorId && authors[y.authorId] || "sheetjsghost", ref: y.ref, guid: y.guid } /*:any*/); + var cell = decode_cell(y.ref); + if (opts.sheetRows && opts.sheetRows <= cell.r) + return; + var textMatch = x.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/); + var rt = !!textMatch && !!textMatch[1] && parse_si(textMatch[1]) || { r: "", t: "", h: "" }; + comment.r = rt.r; + if (rt.r == "") + rt.t = rt.h = ""; + comment.t = (rt.t || "").replace(/\r\n/g, "\n").replace(/\r/g, "\n"); + if (opts.cellHTML) + comment.h = rt.h; + commentList.push(comment); + }); + return commentList; +} +function write_comments_xml(data /*::, opts*/) { + var o = [XML_HEADER, writextag('comments', null, { 'xmlns': XMLNS_main[0] })]; + var iauthor /*:Array*/ = []; + o.push(""); + data.forEach(function (x) { + x[1].forEach(function (w) { + var a = escapexml(w.a); + if (iauthor.indexOf(a) == -1) { + iauthor.push(a); + o.push("" + a + ""); + } + if (w.T && w.ID && iauthor.indexOf("tc=" + w.ID) == -1) { + iauthor.push("tc=" + w.ID); + o.push("" + "tc=" + w.ID + ""); + } + }); + }); + if (iauthor.length == 0) { + iauthor.push("SheetJ5"); + o.push("SheetJ5"); + } + o.push(""); + o.push(""); + data.forEach(function (d) { + /* 18.7.3 CT_Comment */ + var lastauthor = 0, ts = [], tcnt = 0; + if (d[1][0] && d[1][0].T && d[1][0].ID) + lastauthor = iauthor.indexOf("tc=" + d[1][0].ID); + d[1].forEach(function (c) { + if (c.a) + lastauthor = iauthor.indexOf(escapexml(c.a)); + if (c.T) + ++tcnt; + ts.push(c.t == null ? "" : escapexml(c.t)); + }); + if (tcnt === 0) { + d[1].forEach(function (c) { + o.push(''); + o.push(writetag("t", c.t == null ? "" : escapexml(c.t))); + o.push(''); + }); + } + else { + if (d[1][0] && d[1][0].T && d[1][0].ID) + lastauthor = iauthor.indexOf("tc=" + d[1][0].ID); + /* based on Threaded Comments -> Comments projection */ + o.push(''); + var t = "Comment:\n " + (ts[0]) + "\n"; + for (var i = 1; i < ts.length; ++i) + t += "Reply:\n " + ts[i] + "\n"; + o.push(writetag("t", escapexml(t))); + o.push(''); + } + }); + o.push(""); + if (o.length > 2) { + o[o.length] = (''); + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* [MS-XLSX] 2.1.17 */ +function parse_tcmnt_xml(data /*:string*/, opts) { + var out = []; + var pass = false, comment = {}, tidx = 0; + data.replace(tagregex, function xml_tcmnt(x, idx) { + var y /*:any*/ = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': break; + /* 2.6.205 threadedComment CT_ThreadedComment */ + case '': + if (comment.t != null) + out.push(comment); + break; + case '': + case '': + comment.t = data.slice(tidx, idx).replace(/\r\n/g, "\n").replace(/\r/g, "\n"); + break; + /* 2.6.206 mentions CT_ThreadedCommentMentions TODO */ + case '': + pass = true; + break; + case '': + pass = false; + break; + /* 2.6.202 mention CT_Mention TODO */ + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': + case '
': + case '': break; + /* 18.2.7 ext CT_Extension + */ + case '': + pass = false; + break; + default: if (!pass && opts.WTF) + throw new Error('unrecognized ' + y[0] + ' in threaded comments'); + } + return x; + }); + return out; +} +function write_tcmnt_xml(comments, people, opts) { + var o = [XML_HEADER, writextag('ThreadedComments', null, { 'xmlns': XMLNS.TCMNT }).replace(/[\/]>/, ">")]; + comments.forEach(function (carr) { + var rootid = ""; + (carr[1] || []).forEach(function (c, idx) { + if (!c.T) { + delete c.ID; + return; + } + if (c.a && people.indexOf(c.a) == -1) + people.push(c.a); + var tcopts = { + ref: carr[0], + id: "{54EE7951-7262-4200-6969-" + ("000000000000" + opts.tcid++).slice(-12) + "}" + }; + if (idx == 0) + rootid = tcopts.id; + else + tcopts.parentId = rootid; + c.ID = tcopts.id; + if (c.a) + tcopts.personId = "{54EE7950-7262-4200-6969-" + ("000000000000" + people.indexOf(c.a)).slice(-12) + "}"; + o.push(writextag('threadedComment', writetag('text', c.t || ""), tcopts)); + }); + }); + o.push(''); + return o.join(""); +} +/* [MS-XLSX] 2.1.18 */ +function parse_people_xml(data /*:string*/, opts) { + var out = []; + var pass = false; + data.replace(tagregex, function xml_tcmnt(x) { + var y /*:any*/ = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': break; + /* 2.6.203 person CT_Person TODO: providers */ + case '': break; + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': + case '': + case '': break; + /* 18.2.7 ext CT_Extension + */ + case '': + pass = false; + break; + default: if (!pass && opts.WTF) + throw new Error('unrecognized ' + y[0] + ' in threaded comments'); + } + return x; + }); + return out; +} +function write_people_xml(people /*, opts*/) { + var o = [XML_HEADER, writextag('personList', null, { + 'xmlns': XMLNS.TCMNT, + 'xmlns:x': XMLNS_main[0] + }).replace(/[\/]>/, ">")]; + people.forEach(function (person, idx) { + o.push(writextag('person', null, { + displayName: person, + id: "{54EE7950-7262-4200-6969-" + ("000000000000" + idx).slice(-12) + "}", + userId: person, + providerId: "None" + })); + }); + o.push(""); + return o.join(""); +} +/* [MS-XLSB] 2.4.28 BrtBeginComment */ +function parse_BrtBeginComment(data) { + var out = {}; + out.iauthor = data.read_shift(4); + var rfx = parse_UncheckedRfX(data, 16); + out.rfx = rfx.s; + out.ref = encode_cell(rfx.s); + data.l += 16; /*var guid = parse_GUID(data); */ + return out; +} +function write_BrtBeginComment(data, o) { + if (o == null) + o = new_buf(36); + o.write_shift(4, data[1].iauthor); + write_UncheckedRfX((data[0] /*:any*/), o); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + return o; +} +/* [MS-XLSB] 2.4.327 BrtCommentAuthor */ +var parse_BrtCommentAuthor = parse_XLWideString; +function write_BrtCommentAuthor(data) { return write_XLWideString(data.slice(0, 54)); } +/* [MS-XLSB] 2.1.7.8 Comments */ +function parse_comments_bin(data, opts) { + var out /*:Array*/ = []; + var authors /*:Array*/ = []; + var c = {}; + var pass = false; + recordhopper(data, function hopper_cmnt(val, R, RT) { + switch (RT) { + case 0x0278: /* 'BrtCommentAuthor' */ + authors.push(val); + break; + case 0x027B: /* 'BrtBeginComment' */ + c = val; + break; + case 0x027D: /* 'BrtCommentText' */ + c.t = val.t; + c.h = val.h; + c.r = val.r; + break; + case 0x027C: /* 'BrtEndComment' */ + c.author = authors[c.iauthor]; + delete (c /*:any*/).iauthor; + if (opts.sheetRows && c.rfx && opts.sheetRows <= c.rfx.r) + break; + if (!c.t) + c.t = ""; + delete c.rfx; + out.push(c); + break; + case 0x0C00: /* 'BrtUid' */ + break; + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; + break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; + break; + case 0x0025: /* 'BrtACBegin' */ break; + case 0x0026: /* 'BrtACEnd' */ break; + default: + if (R.T) { /* empty */ } + else if (!pass || opts.WTF) + throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }); + return out; +} +function write_comments_bin(data /*::, opts*/) { + var ba = buf_array(); + var iauthor /*:Array*/ = []; + write_record(ba, 0x0274 /* BrtBeginComments */); + write_record(ba, 0x0276 /* BrtBeginCommentAuthors */); + data.forEach(function (comment) { + comment[1].forEach(function (c) { + if (iauthor.indexOf(c.a) > -1) + return; + iauthor.push(c.a.slice(0, 54)); + write_record(ba, 0x0278 /* BrtCommentAuthor */, write_BrtCommentAuthor(c.a)); + if (c.T && c.ID && iauthor.indexOf("tc=" + c.ID) == -1) { + iauthor.push("tc=" + c.ID); + write_record(ba, 0x0278 /* BrtCommentAuthor */, write_BrtCommentAuthor("tc=" + c.ID)); + } + }); + }); + write_record(ba, 0x0277 /* BrtEndCommentAuthors */); + write_record(ba, 0x0279 /* BrtBeginCommentList */); + data.forEach(function (comment) { + comment[1].forEach(function (c) { + var _ia = -1; + if (c.ID) + _ia = iauthor.indexOf("tc=" + c.ID); + if (_ia == -1 && comment[1][0].T && comment[1][0].ID) + _ia = iauthor.indexOf("tc=" + comment[1][0].ID); + if (_ia == -1) + _ia = iauthor.indexOf(c.a); + c.iauthor = _ia; + var range = { s: decode_cell(comment[0]), e: decode_cell(comment[0]) }; + write_record(ba, 0x027B /* BrtBeginComment */, write_BrtBeginComment([range, c])); + if (c.t && c.t.length > 0) + write_record(ba, 0x027D /* BrtCommentText */, write_BrtCommentText(c)); + write_record(ba, 0x027C /* BrtEndComment */); + delete c.iauthor; + }); + }); + write_record(ba, 0x027A /* BrtEndCommentList */); + write_record(ba, 0x0275 /* BrtEndComments */); + return ba.end(); +} +var CT_VBA = "application/vnd.ms-office.vbaProject"; +function make_vba_xls(cfb) { + var newcfb = CFB.utils.cfb_new({ root: "R" }); + cfb.FullPaths.forEach(function (p, i) { + if (p.slice(-1) === "/" || !p.match(/_VBA_PROJECT_CUR/)) + return; + var newpath = p.replace(/^[^\/]*/, "R").replace(/\/_VBA_PROJECT_CUR\u0000*/, ""); + CFB.utils.cfb_add(newcfb, newpath, cfb.FileIndex[i].content); + }); + return CFB.write(newcfb); +} +function fill_vba_xls(cfb, vba) { + vba.FullPaths.forEach(function (p, i) { + if (i == 0) + return; + var newpath = p.replace(/[^\/]*[\/]/, "/_VBA_PROJECT_CUR/"); + if (newpath.slice(-1) !== "/") + CFB.utils.cfb_add(cfb, newpath, vba.FileIndex[i].content); + }); +} +var VBAFMTS = ["xlsb", "xlsm", "xlam", "biff8", "xla"]; +/* macro and dialog sheet stubs */ +function parse_ds_bin( /*::data:any, opts, idx:number, rels, wb, themes, styles*/) { return { '!type': 'dialog' }; } +function parse_ds_xml( /*::data:any, opts, idx:number, rels, wb, themes, styles*/) { return { '!type': 'dialog' }; } +function parse_ms_bin( /*::data:any, opts, idx:number, rels, wb, themes, styles*/) { return { '!type': 'macro' }; } +function parse_ms_xml( /*::data:any, opts, idx:number, rels, wb, themes, styles*/) { return { '!type': 'macro' }; } +/* TODO: it will be useful to parse the function str */ +var rc_to_a1 = /*#__PURE__*/ (function () { + var rcregex = /(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g; + var rcbase /*:Cell*/ = ({ r: 0, c: 0 } /*:any*/); + function rcfunc($$, $1, $2, $3) { + var cRel = false, rRel = false; + if ($2.length == 0) + rRel = true; + else if ($2.charAt(0) == "[") { + rRel = true; + $2 = $2.slice(1, -1); + } + if ($3.length == 0) + cRel = true; + else if ($3.charAt(0) == "[") { + cRel = true; + $3 = $3.slice(1, -1); + } + var R = $2.length > 0 ? parseInt($2, 10) | 0 : 0, C = $3.length > 0 ? parseInt($3, 10) | 0 : 0; + if (cRel) + C += rcbase.c; + else + --C; + if (rRel) + R += rcbase.r; + else + --R; + return $1 + (cRel ? "" : "$") + encode_col(C) + (rRel ? "" : "$") + encode_row(R); + } + return function rc_to_a1(fstr /*:string*/, base /*:Cell*/) { + rcbase = base; + return fstr.replace(rcregex, rcfunc); + }; +})(); +var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g; +var a1_to_rc = /*#__PURE__*/ (function () { + return function a1_to_rc(fstr /*:string*/, base /*:CellAddress*/) { + return fstr.replace(crefregex, function ($0, $1, $2, $3, $4, $5) { + var c = decode_col($3) - ($2 ? 0 : base.c); + var r = decode_row($5) - ($4 ? 0 : base.r); + var R = $4 == "$" ? (r + 1) : (r == 0 ? "" : "[" + r + "]"); + var C = $2 == "$" ? (c + 1) : (c == 0 ? "" : "[" + c + "]"); + return $1 + "R" + R + "C" + C; + }); + }; +})(); +/* no defined name can collide with a valid cell address A1:XFD1048576 ... except LOG10! */ +function shift_formula_str(f /*:string*/, delta /*:Cell*/) { + return f.replace(crefregex, function ($0, $1, $2, $3, $4, $5) { + return $1 + ($2 == "$" ? $2 + $3 : encode_col(decode_col($3) + delta.c)) + ($4 == "$" ? $4 + $5 : encode_row(decode_row($5) + delta.r)); + }); +} +function shift_formula_xlsx(f /*:string*/, range /*:string*/, cell /*:string*/) { + var r = decode_range(range), s = r.s, c = decode_cell(cell); + var delta = { r: c.r - s.r, c: c.c - s.c }; + return shift_formula_str(f, delta); +} +/* TODO: parse formula */ +function fuzzyfmla(f /*:string*/) { + if (f.length == 1) + return false; + return true; +} +function _xlfn(f /*:string*/) { + return f.replace(/_xlfn\./g, ""); +} +function parseread1(blob) { blob.l += 1; return; } +/* [MS-XLS] 2.5.51 */ +function parse_ColRelU(blob, length) { + var c = blob.read_shift(length == 1 ? 1 : 2); + return [c & 0x3FFF, (c >> 14) & 1, (c >> 15) & 1]; +} +/* [MS-XLS] 2.5.198.105 ; [MS-XLSB] 2.5.97.89 */ +function parse_RgceArea(blob, length, opts) { + var w = 2; + if (opts) { + if (opts.biff >= 2 && opts.biff <= 5) + return parse_RgceArea_BIFF2(blob, length, opts); + else if (opts.biff == 12) + w = 4; + } + var r = blob.read_shift(w), R = blob.read_shift(w); + var c = parse_ColRelU(blob, 2); + var C = parse_ColRelU(blob, 2); + return { s: { r: r, c: c[0], cRel: c[1], rRel: c[2] }, e: { r: R, c: C[0], cRel: C[1], rRel: C[2] } }; +} +/* BIFF 2-5 encodes flags in the row field */ +function parse_RgceArea_BIFF2(blob /*::, length, opts*/) { + var r = parse_ColRelU(blob, 2), R = parse_ColRelU(blob, 2); + var c = blob.read_shift(1); + var C = blob.read_shift(1); + return { s: { r: r[0], c: c, cRel: r[1], rRel: r[2] }, e: { r: R[0], c: C, cRel: R[1], rRel: R[2] } }; +} +/* [MS-XLS] 2.5.198.105 ; [MS-XLSB] 2.5.97.90 */ +function parse_RgceAreaRel(blob, length, opts) { + if (opts.biff < 8) + return parse_RgceArea_BIFF2(blob, length, opts); + var r = blob.read_shift(opts.biff == 12 ? 4 : 2), R = blob.read_shift(opts.biff == 12 ? 4 : 2); + var c = parse_ColRelU(blob, 2); + var C = parse_ColRelU(blob, 2); + return { s: { r: r, c: c[0], cRel: c[1], rRel: c[2] }, e: { r: R, c: C[0], cRel: C[1], rRel: C[2] } }; +} +/* [MS-XLS] 2.5.198.109 ; [MS-XLSB] 2.5.97.91 */ +function parse_RgceLoc(blob, length, opts) { + if (opts && opts.biff >= 2 && opts.biff <= 5) + return parse_RgceLoc_BIFF2(blob, length, opts); + var r = blob.read_shift(opts && opts.biff == 12 ? 4 : 2); + var c = parse_ColRelU(blob, 2); + return { r: r, c: c[0], cRel: c[1], rRel: c[2] }; +} +function parse_RgceLoc_BIFF2(blob /*::, length, opts*/) { + var r = parse_ColRelU(blob, 2); + var c = blob.read_shift(1); + return { r: r[0], c: c, cRel: r[1], rRel: r[2] }; +} +/* [MS-XLS] 2.5.198.107, 2.5.47 */ +function parse_RgceElfLoc(blob /*::, length, opts*/) { + var r = blob.read_shift(2); + var c = blob.read_shift(2); + return { r: r, c: c & 0xFF, fQuoted: !!(c & 0x4000), cRel: c >> 15, rRel: c >> 15 }; +} +/* [MS-XLS] 2.5.198.111 ; [MS-XLSB] 2.5.97.92 TODO */ +function parse_RgceLocRel(blob, length, opts) { + var biff = opts && opts.biff ? opts.biff : 8; + if (biff >= 2 && biff <= 5) + return parse_RgceLocRel_BIFF2(blob, length, opts); + var r = blob.read_shift(biff >= 12 ? 4 : 2); + var cl = blob.read_shift(2); + var cRel = (cl & 0x4000) >> 14, rRel = (cl & 0x8000) >> 15; + cl &= 0x3FFF; + if (rRel == 1) + while (r > 0x7FFFF) + r -= 0x100000; + if (cRel == 1) + while (cl > 0x1FFF) + cl = cl - 0x4000; + return { r: r, c: cl, cRel: cRel, rRel: rRel }; +} +function parse_RgceLocRel_BIFF2(blob /*::, length:number, opts*/) { + var rl = blob.read_shift(2); + var c = blob.read_shift(1); + var rRel = (rl & 0x8000) >> 15, cRel = (rl & 0x4000) >> 14; + rl &= 0x3FFF; + if (rRel == 1 && rl >= 0x2000) + rl = rl - 0x4000; + if (cRel == 1 && c >= 0x80) + c = c - 0x100; + return { r: rl, c: c, cRel: cRel, rRel: rRel }; +} +/* [MS-XLS] 2.5.198.27 ; [MS-XLSB] 2.5.97.18 */ +function parse_PtgArea(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts); + return [type, area]; +} +/* [MS-XLS] 2.5.198.28 ; [MS-XLSB] 2.5.97.19 */ +function parse_PtgArea3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2, 'i'); + var w = 8; + if (opts) + switch (opts.biff) { + case 5: + blob.l += 12; + w = 6; + break; + case 12: + w = 12; + break; + } + var area = parse_RgceArea(blob, w, opts); + return [type, ixti, area]; +} +/* [MS-XLS] 2.5.198.29 ; [MS-XLSB] 2.5.97.20 */ +function parse_PtgAreaErr(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + blob.l += opts && (opts.biff > 8) ? 12 : (opts.biff < 8 ? 6 : 8); + return [type]; +} +/* [MS-XLS] 2.5.198.30 ; [MS-XLSB] 2.5.97.21 */ +function parse_PtgAreaErr3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2); + var w = 8; + if (opts) + switch (opts.biff) { + case 5: + blob.l += 12; + w = 6; + break; + case 12: + w = 12; + break; + } + blob.l += w; + return [type, ixti]; +} +/* [MS-XLS] 2.5.198.31 ; [MS-XLSB] 2.5.97.22 */ +function parse_PtgAreaN(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var area = parse_RgceAreaRel(blob, length - 1, opts); + return [type, area]; +} +/* [MS-XLS] 2.5.198.32 ; [MS-XLSB] 2.5.97.23 */ +function parse_PtgArray(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + blob.l += opts.biff == 2 ? 6 : opts.biff == 12 ? 14 : 7; + return [type]; +} +/* [MS-XLS] 2.5.198.33 ; [MS-XLSB] 2.5.97.24 */ +function parse_PtgAttrBaxcel(blob) { + var bitSemi = blob[blob.l + 1] & 0x01; /* 1 = volatile */ + var bitBaxcel = 1; + blob.l += 4; + return [bitSemi, bitBaxcel]; +} +/* [MS-XLS] 2.5.198.34 ; [MS-XLSB] 2.5.97.25 */ +function parse_PtgAttrChoose(blob, length, opts) { + blob.l += 2; + var offset = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + var o /*:Array*/ = []; + /* offset is 1 less than the number of elements */ + for (var i = 0; i <= offset; ++i) + o.push(blob.read_shift(opts && opts.biff == 2 ? 1 : 2)); + return o; +} +/* [MS-XLS] 2.5.198.35 ; [MS-XLSB] 2.5.97.26 */ +function parse_PtgAttrGoto(blob, length, opts) { + var bitGoto = (blob[blob.l + 1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitGoto, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)]; +} +/* [MS-XLS] 2.5.198.36 ; [MS-XLSB] 2.5.97.27 */ +function parse_PtgAttrIf(blob, length, opts) { + var bitIf = (blob[blob.l + 1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitIf, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)]; +} +/* [MS-XLSB] 2.5.97.28 */ +function parse_PtgAttrIfError(blob) { + var bitIf = (blob[blob.l + 1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitIf, blob.read_shift(2)]; +} +/* [MS-XLS] 2.5.198.37 ; [MS-XLSB] 2.5.97.29 */ +function parse_PtgAttrSemi(blob, length, opts) { + var bitSemi = (blob[blob.l + 1] & 0xFF) ? 1 : 0; + blob.l += opts && opts.biff == 2 ? 3 : 4; + return [bitSemi]; +} +/* [MS-XLS] 2.5.198.40 ; [MS-XLSB] 2.5.97.32 */ +function parse_PtgAttrSpaceType(blob /*::, length*/) { + var type = blob.read_shift(1), cch = blob.read_shift(1); + return [type, cch]; +} +/* [MS-XLS] 2.5.198.38 ; [MS-XLSB] 2.5.97.30 */ +function parse_PtgAttrSpace(blob) { + blob.read_shift(2); + return parse_PtgAttrSpaceType(blob, 2); +} +/* [MS-XLS] 2.5.198.39 ; [MS-XLSB] 2.5.97.31 */ +function parse_PtgAttrSpaceSemi(blob) { + blob.read_shift(2); + return parse_PtgAttrSpaceType(blob, 2); +} +/* [MS-XLS] 2.5.198.84 ; [MS-XLSB] 2.5.97.68 TODO */ +function parse_PtgRef(blob, length, opts) { + //var ptg = blob[blob.l] & 0x1F; + var type = (blob[blob.l] & 0x60) >> 5; + blob.l += 1; + var loc = parse_RgceLoc(blob, 0, opts); + return [type, loc]; +} +/* [MS-XLS] 2.5.198.88 ; [MS-XLSB] 2.5.97.72 TODO */ +function parse_PtgRefN(blob, length, opts) { + var type = (blob[blob.l] & 0x60) >> 5; + blob.l += 1; + var loc = parse_RgceLocRel(blob, 0, opts); + return [type, loc]; +} +/* [MS-XLS] 2.5.198.85 ; [MS-XLSB] 2.5.97.69 TODO */ +function parse_PtgRef3d(blob, length, opts) { + var type = (blob[blob.l] & 0x60) >> 5; + blob.l += 1; + var ixti = blob.read_shift(2); // XtiIndex + if (opts && opts.biff == 5) + blob.l += 12; + var loc = parse_RgceLoc(blob, 0, opts); // TODO: or RgceLocRel + return [type, ixti, loc]; +} +/* [MS-XLS] 2.5.198.62 ; [MS-XLSB] 2.5.97.45 TODO */ +function parse_PtgFunc(blob, length, opts) { + //var ptg = blob[blob.l] & 0x1F; + var type = (blob[blob.l] & 0x60) >> 5; + blob.l += 1; + var iftab = blob.read_shift(opts && opts.biff <= 3 ? 1 : 2); + return [FtabArgc[iftab], Ftab[iftab], type]; +} +/* [MS-XLS] 2.5.198.63 ; [MS-XLSB] 2.5.97.46 TODO */ +function parse_PtgFuncVar(blob, length, opts) { + var type = blob[blob.l++]; + var cparams = blob.read_shift(1), tab = opts && opts.biff <= 3 ? [(type == 0x58 ? -1 : 0), blob.read_shift(1)] : parsetab(blob); + return [cparams, (tab[0] === 0 ? Ftab : Cetab)[tab[1]]]; +} +function parsetab(blob) { + return [blob[blob.l + 1] >> 7, blob.read_shift(2) & 0x7FFF]; +} +/* [MS-XLS] 2.5.198.41 ; [MS-XLSB] 2.5.97.33 */ +function parse_PtgAttrSum(blob, length, opts) { + blob.l += opts && opts.biff == 2 ? 3 : 4; + return; +} +/* [MS-XLS] 2.5.198.58 ; [MS-XLSB] 2.5.97.40 */ +function parse_PtgExp(blob, length, opts) { + blob.l++; + if (opts && opts.biff == 12) + return [blob.read_shift(4, 'i'), 0]; + var row = blob.read_shift(2); + var col = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [row, col]; +} +/* [MS-XLS] 2.5.198.57 ; [MS-XLSB] 2.5.97.39 */ +function parse_PtgErr(blob) { blob.l++; return BErr[blob.read_shift(1)]; } +/* [MS-XLS] 2.5.198.66 ; [MS-XLSB] 2.5.97.49 */ +function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); } +/* [MS-XLS] 2.5.198.42 ; [MS-XLSB] 2.5.97.34 */ +function parse_PtgBool(blob) { blob.l++; return blob.read_shift(1) !== 0; } +/* [MS-XLS] 2.5.198.79 ; [MS-XLSB] 2.5.97.63 */ +function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); } +/* [MS-XLS] 2.5.198.89 ; [MS-XLSB] 2.5.97.74 */ +function parse_PtgStr(blob, length, opts) { blob.l++; return parse_ShortXLUnicodeString(blob, length - 1, opts); } +/* [MS-XLS] 2.5.192.112 + 2.5.192.11{3,4,5,6,7} */ +/* [MS-XLSB] 2.5.97.93 + 2.5.97.9{4,5,6,7} */ +function parse_SerAr(blob, biff /*:number*/) { + var val = [blob.read_shift(1)]; + if (biff == 12) + switch (val[0]) { + case 0x02: + val[0] = 0x04; + break; /* SerBool */ + case 0x04: + val[0] = 0x10; + break; /* SerErr */ + case 0x00: + val[0] = 0x01; + break; /* SerNum */ + case 0x01: + val[0] = 0x02; + break; /* SerStr */ + } + switch (val[0]) { + case 0x04: /* SerBool -- boolean */ + val[1] = parsebool(blob, 1) ? 'TRUE' : 'FALSE'; + if (biff != 12) + blob.l += 7; + break; + case 0x25: /* appears to be an alias */ + case 0x10: /* SerErr -- error */ + val[1] = BErr[blob[blob.l]]; + blob.l += ((biff == 12) ? 4 : 8); + break; + case 0x00: /* SerNil -- honestly, I'm not sure how to reproduce this */ + blob.l += 8; + break; + case 0x01: /* SerNum -- Xnum */ + val[1] = parse_Xnum(blob, 8); + break; + case 0x02: /* SerStr -- XLUnicodeString (<256 chars) */ + val[1] = parse_XLUnicodeString2(blob, 0, { biff: biff > 0 && biff < 8 ? 2 : biff }); + break; + default: throw new Error("Bad SerAr: " + val[0]); /* Unreachable */ + } + return val; +} +/* [MS-XLS] 2.5.198.61 ; [MS-XLSB] 2.5.97.44 */ +function parse_PtgExtraMem(blob, cce, opts) { + var count = blob.read_shift((opts.biff == 12) ? 4 : 2); + var out /*:Array*/ = []; + for (var i = 0; i != count; ++i) + out.push(((opts.biff == 12) ? parse_UncheckedRfX : parse_Ref8U)(blob, 8)); + return out; +} +/* [MS-XLS] 2.5.198.59 ; [MS-XLSB] 2.5.97.41 */ +function parse_PtgExtraArray(blob, length, opts) { + var rows = 0, cols = 0; + if (opts.biff == 12) { + rows = blob.read_shift(4); // DRw + cols = blob.read_shift(4); // DCol + } + else { + cols = 1 + blob.read_shift(1); //DColByteU + rows = 1 + blob.read_shift(2); //DRw + } + if (opts.biff >= 2 && opts.biff < 8) { + --rows; + if (--cols == 0) + cols = 0x100; + } + // $FlowIgnore + for (var i = 0, o /*:Array>*/ = []; i != rows && (o[i] = []); ++i) + for (var j = 0; j != cols; ++j) + o[i][j] = parse_SerAr(blob, opts.biff); + return o; +} +/* [MS-XLS] 2.5.198.76 ; [MS-XLSB] 2.5.97.60 */ +function parse_PtgName(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var w = (!opts || (opts.biff >= 8)) ? 4 : 2; + var nameindex = blob.read_shift(w); + switch (opts.biff) { + case 2: + blob.l += 5; + break; + case 3: + case 4: + blob.l += 8; + break; + case 5: + blob.l += 12; + break; + } + return [type, 0, nameindex]; +} +/* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 */ +function parse_PtgNameX(blob, length, opts) { + if (opts.biff == 5) + return parse_PtgNameX_BIFF5(blob, length, opts); + var type = (blob.read_shift(1) >>> 5) & 0x03; + var ixti = blob.read_shift(2); // XtiIndex + var nameindex = blob.read_shift(4); + return [type, ixti, nameindex]; +} +function parse_PtgNameX_BIFF5(blob /*::, length, opts*/) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var ixti = blob.read_shift(2, 'i'); // XtiIndex + blob.l += 8; + var nameindex = blob.read_shift(2); + blob.l += 12; + return [type, ixti, nameindex]; +} +/* [MS-XLS] 2.5.198.70 ; [MS-XLSB] 2.5.97.54 */ +function parse_PtgMemArea(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + blob.l += (opts && opts.biff == 2 ? 3 : 4); + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [type, cce]; +} +/* [MS-XLS] 2.5.198.72 ; [MS-XLSB] 2.5.97.56 */ +function parse_PtgMemFunc(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [type, cce]; +} +/* [MS-XLS] 2.5.198.86 ; [MS-XLSB] 2.5.97.69 */ +function parse_PtgRefErr(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + blob.l += 4; + if (opts.biff < 8) + blob.l--; + if (opts.biff == 12) + blob.l += 2; + return [type]; +} +/* [MS-XLS] 2.5.198.87 ; [MS-XLSB] 2.5.97.71 */ +function parse_PtgRefErr3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2); + var w = 4; + if (opts) + switch (opts.biff) { + case 5: + w = 15; + break; + case 12: + w = 6; + break; + } + blob.l += w; + return [type, ixti]; +} +/* [MS-XLS] 2.5.198.71 ; [MS-XLSB] 2.5.97.55 */ +var parse_PtgMemErr = parsenoop; +/* [MS-XLS] 2.5.198.73 ; [MS-XLSB] 2.5.97.57 */ +var parse_PtgMemNoMem = parsenoop; +/* [MS-XLS] 2.5.198.92 */ +var parse_PtgTbl = parsenoop; +function parse_PtgElfLoc(blob, length, opts) { + blob.l += 2; + return [parse_RgceElfLoc(blob, 4, opts)]; +} +function parse_PtgElfNoop(blob /*::, length, opts*/) { + blob.l += 6; + return []; +} +/* [MS-XLS] 2.5.198.46 */ +var parse_PtgElfCol = parse_PtgElfLoc; +/* [MS-XLS] 2.5.198.47 */ +var parse_PtgElfColS = parse_PtgElfNoop; +/* [MS-XLS] 2.5.198.48 */ +var parse_PtgElfColSV = parse_PtgElfNoop; +/* [MS-XLS] 2.5.198.49 */ +var parse_PtgElfColV = parse_PtgElfLoc; +/* [MS-XLS] 2.5.198.50 */ +function parse_PtgElfLel(blob /*::, length, opts*/) { + blob.l += 2; + return [parseuint16(blob), blob.read_shift(2) & 0x01]; +} +/* [MS-XLS] 2.5.198.51 */ +var parse_PtgElfRadical = parse_PtgElfLoc; +/* [MS-XLS] 2.5.198.52 */ +var parse_PtgElfRadicalLel = parse_PtgElfLel; +/* [MS-XLS] 2.5.198.53 */ +var parse_PtgElfRadicalS = parse_PtgElfNoop; +/* [MS-XLS] 2.5.198.54 */ +var parse_PtgElfRw = parse_PtgElfLoc; +/* [MS-XLS] 2.5.198.55 */ +var parse_PtgElfRwV = parse_PtgElfLoc; +/* [MS-XLSB] 2.5.97.52 TODO */ +var PtgListRT = [ + "Data", + "All", + "Headers", + "??", + "?Data2", + "??", + "?DataHeaders", + "??", + "Totals", + "??", + "??", + "??", + "?DataTotals", + "??", + "??", + "??", + "?Current" +]; +function parse_PtgList(blob /*::, length, opts*/) { + blob.l += 2; + var ixti = blob.read_shift(2); + var flags = blob.read_shift(2); + var idx = blob.read_shift(4); + var c = blob.read_shift(2); + var C = blob.read_shift(2); + var rt = PtgListRT[(flags >> 2) & 0x1F]; + return { ixti: ixti, coltype: (flags & 0x3), rt: rt, idx: idx, c: c, C: C }; +} +/* [MS-XLS] 2.5.198.91 ; [MS-XLSB] 2.5.97.76 */ +function parse_PtgSxName(blob /*::, length, opts*/) { + blob.l += 2; + return [blob.read_shift(4)]; +} +/* [XLS] old spec */ +function parse_PtgSheet(blob, length, opts) { + blob.l += 5; + blob.l += 2; + blob.l += (opts.biff == 2 ? 1 : 4); + return ["PTGSHEET"]; +} +function parse_PtgEndSheet(blob, length, opts) { + blob.l += (opts.biff == 2 ? 4 : 5); + return ["PTGENDSHEET"]; +} +function parse_PtgMemAreaN(blob /*::, length, opts*/) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(2); + return [type, cce]; +} +function parse_PtgMemNoMemN(blob /*::, length, opts*/) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(2); + return [type, cce]; +} +function parse_PtgAttrNoop(blob /*::, length, opts*/) { + blob.l += 4; + return [0, 0]; +} +/* [MS-XLS] 2.5.198.25 ; [MS-XLSB] 2.5.97.16 */ +var PtgTypes = { + /*::[*/ 0x01 /*::]*/: { n: 'PtgExp', f: parse_PtgExp }, + /*::[*/ 0x02 /*::]*/: { n: 'PtgTbl', f: parse_PtgTbl }, + /*::[*/ 0x03 /*::]*/: { n: 'PtgAdd', f: parseread1 }, + /*::[*/ 0x04 /*::]*/: { n: 'PtgSub', f: parseread1 }, + /*::[*/ 0x05 /*::]*/: { n: 'PtgMul', f: parseread1 }, + /*::[*/ 0x06 /*::]*/: { n: 'PtgDiv', f: parseread1 }, + /*::[*/ 0x07 /*::]*/: { n: 'PtgPower', f: parseread1 }, + /*::[*/ 0x08 /*::]*/: { n: 'PtgConcat', f: parseread1 }, + /*::[*/ 0x09 /*::]*/: { n: 'PtgLt', f: parseread1 }, + /*::[*/ 0x0A /*::]*/: { n: 'PtgLe', f: parseread1 }, + /*::[*/ 0x0B /*::]*/: { n: 'PtgEq', f: parseread1 }, + /*::[*/ 0x0C /*::]*/: { n: 'PtgGe', f: parseread1 }, + /*::[*/ 0x0D /*::]*/: { n: 'PtgGt', f: parseread1 }, + /*::[*/ 0x0E /*::]*/: { n: 'PtgNe', f: parseread1 }, + /*::[*/ 0x0F /*::]*/: { n: 'PtgIsect', f: parseread1 }, + /*::[*/ 0x10 /*::]*/: { n: 'PtgUnion', f: parseread1 }, + /*::[*/ 0x11 /*::]*/: { n: 'PtgRange', f: parseread1 }, + /*::[*/ 0x12 /*::]*/: { n: 'PtgUplus', f: parseread1 }, + /*::[*/ 0x13 /*::]*/: { n: 'PtgUminus', f: parseread1 }, + /*::[*/ 0x14 /*::]*/: { n: 'PtgPercent', f: parseread1 }, + /*::[*/ 0x15 /*::]*/: { n: 'PtgParen', f: parseread1 }, + /*::[*/ 0x16 /*::]*/: { n: 'PtgMissArg', f: parseread1 }, + /*::[*/ 0x17 /*::]*/: { n: 'PtgStr', f: parse_PtgStr }, + /*::[*/ 0x1A /*::]*/: { n: 'PtgSheet', f: parse_PtgSheet }, + /*::[*/ 0x1B /*::]*/: { n: 'PtgEndSheet', f: parse_PtgEndSheet }, + /*::[*/ 0x1C /*::]*/: { n: 'PtgErr', f: parse_PtgErr }, + /*::[*/ 0x1D /*::]*/: { n: 'PtgBool', f: parse_PtgBool }, + /*::[*/ 0x1E /*::]*/: { n: 'PtgInt', f: parse_PtgInt }, + /*::[*/ 0x1F /*::]*/: { n: 'PtgNum', f: parse_PtgNum }, + /*::[*/ 0x20 /*::]*/: { n: 'PtgArray', f: parse_PtgArray }, + /*::[*/ 0x21 /*::]*/: { n: 'PtgFunc', f: parse_PtgFunc }, + /*::[*/ 0x22 /*::]*/: { n: 'PtgFuncVar', f: parse_PtgFuncVar }, + /*::[*/ 0x23 /*::]*/: { n: 'PtgName', f: parse_PtgName }, + /*::[*/ 0x24 /*::]*/: { n: 'PtgRef', f: parse_PtgRef }, + /*::[*/ 0x25 /*::]*/: { n: 'PtgArea', f: parse_PtgArea }, + /*::[*/ 0x26 /*::]*/: { n: 'PtgMemArea', f: parse_PtgMemArea }, + /*::[*/ 0x27 /*::]*/: { n: 'PtgMemErr', f: parse_PtgMemErr }, + /*::[*/ 0x28 /*::]*/: { n: 'PtgMemNoMem', f: parse_PtgMemNoMem }, + /*::[*/ 0x29 /*::]*/: { n: 'PtgMemFunc', f: parse_PtgMemFunc }, + /*::[*/ 0x2A /*::]*/: { n: 'PtgRefErr', f: parse_PtgRefErr }, + /*::[*/ 0x2B /*::]*/: { n: 'PtgAreaErr', f: parse_PtgAreaErr }, + /*::[*/ 0x2C /*::]*/: { n: 'PtgRefN', f: parse_PtgRefN }, + /*::[*/ 0x2D /*::]*/: { n: 'PtgAreaN', f: parse_PtgAreaN }, + /*::[*/ 0x2E /*::]*/: { n: 'PtgMemAreaN', f: parse_PtgMemAreaN }, + /*::[*/ 0x2F /*::]*/: { n: 'PtgMemNoMemN', f: parse_PtgMemNoMemN }, + /*::[*/ 0x39 /*::]*/: { n: 'PtgNameX', f: parse_PtgNameX }, + /*::[*/ 0x3A /*::]*/: { n: 'PtgRef3d', f: parse_PtgRef3d }, + /*::[*/ 0x3B /*::]*/: { n: 'PtgArea3d', f: parse_PtgArea3d }, + /*::[*/ 0x3C /*::]*/: { n: 'PtgRefErr3d', f: parse_PtgRefErr3d }, + /*::[*/ 0x3D /*::]*/: { n: 'PtgAreaErr3d', f: parse_PtgAreaErr3d }, + /*::[*/ 0xFF /*::]*/: {} +}; +/* These are duplicated in the PtgTypes table */ +var PtgDupes = { + /*::[*/ 0x40 /*::]*/: 0x20, /*::[*/ 0x60 /*::]*/: 0x20, + /*::[*/ 0x41 /*::]*/: 0x21, /*::[*/ 0x61 /*::]*/: 0x21, + /*::[*/ 0x42 /*::]*/: 0x22, /*::[*/ 0x62 /*::]*/: 0x22, + /*::[*/ 0x43 /*::]*/: 0x23, /*::[*/ 0x63 /*::]*/: 0x23, + /*::[*/ 0x44 /*::]*/: 0x24, /*::[*/ 0x64 /*::]*/: 0x24, + /*::[*/ 0x45 /*::]*/: 0x25, /*::[*/ 0x65 /*::]*/: 0x25, + /*::[*/ 0x46 /*::]*/: 0x26, /*::[*/ 0x66 /*::]*/: 0x26, + /*::[*/ 0x47 /*::]*/: 0x27, /*::[*/ 0x67 /*::]*/: 0x27, + /*::[*/ 0x48 /*::]*/: 0x28, /*::[*/ 0x68 /*::]*/: 0x28, + /*::[*/ 0x49 /*::]*/: 0x29, /*::[*/ 0x69 /*::]*/: 0x29, + /*::[*/ 0x4A /*::]*/: 0x2A, /*::[*/ 0x6A /*::]*/: 0x2A, + /*::[*/ 0x4B /*::]*/: 0x2B, /*::[*/ 0x6B /*::]*/: 0x2B, + /*::[*/ 0x4C /*::]*/: 0x2C, /*::[*/ 0x6C /*::]*/: 0x2C, + /*::[*/ 0x4D /*::]*/: 0x2D, /*::[*/ 0x6D /*::]*/: 0x2D, + /*::[*/ 0x4E /*::]*/: 0x2E, /*::[*/ 0x6E /*::]*/: 0x2E, + /*::[*/ 0x4F /*::]*/: 0x2F, /*::[*/ 0x6F /*::]*/: 0x2F, + /*::[*/ 0x58 /*::]*/: 0x22, /*::[*/ 0x78 /*::]*/: 0x22, + /*::[*/ 0x59 /*::]*/: 0x39, /*::[*/ 0x79 /*::]*/: 0x39, + /*::[*/ 0x5A /*::]*/: 0x3A, /*::[*/ 0x7A /*::]*/: 0x3A, + /*::[*/ 0x5B /*::]*/: 0x3B, /*::[*/ 0x7B /*::]*/: 0x3B, + /*::[*/ 0x5C /*::]*/: 0x3C, /*::[*/ 0x7C /*::]*/: 0x3C, + /*::[*/ 0x5D /*::]*/: 0x3D, /*::[*/ 0x7D /*::]*/: 0x3D +}; +var Ptg18 = { + /*::[*/ 0x01 /*::]*/: { n: 'PtgElfLel', f: parse_PtgElfLel }, + /*::[*/ 0x02 /*::]*/: { n: 'PtgElfRw', f: parse_PtgElfRw }, + /*::[*/ 0x03 /*::]*/: { n: 'PtgElfCol', f: parse_PtgElfCol }, + /*::[*/ 0x06 /*::]*/: { n: 'PtgElfRwV', f: parse_PtgElfRwV }, + /*::[*/ 0x07 /*::]*/: { n: 'PtgElfColV', f: parse_PtgElfColV }, + /*::[*/ 0x0A /*::]*/: { n: 'PtgElfRadical', f: parse_PtgElfRadical }, + /*::[*/ 0x0B /*::]*/: { n: 'PtgElfRadicalS', f: parse_PtgElfRadicalS }, + /*::[*/ 0x0D /*::]*/: { n: 'PtgElfColS', f: parse_PtgElfColS }, + /*::[*/ 0x0F /*::]*/: { n: 'PtgElfColSV', f: parse_PtgElfColSV }, + /*::[*/ 0x10 /*::]*/: { n: 'PtgElfRadicalLel', f: parse_PtgElfRadicalLel }, + /*::[*/ 0x19 /*::]*/: { n: 'PtgList', f: parse_PtgList }, + /*::[*/ 0x1D /*::]*/: { n: 'PtgSxName', f: parse_PtgSxName }, + /*::[*/ 0xFF /*::]*/: {} +}; +var Ptg19 = { + /*::[*/ 0x00 /*::]*/: { n: 'PtgAttrNoop', f: parse_PtgAttrNoop }, + /*::[*/ 0x01 /*::]*/: { n: 'PtgAttrSemi', f: parse_PtgAttrSemi }, + /*::[*/ 0x02 /*::]*/: { n: 'PtgAttrIf', f: parse_PtgAttrIf }, + /*::[*/ 0x04 /*::]*/: { n: 'PtgAttrChoose', f: parse_PtgAttrChoose }, + /*::[*/ 0x08 /*::]*/: { n: 'PtgAttrGoto', f: parse_PtgAttrGoto }, + /*::[*/ 0x10 /*::]*/: { n: 'PtgAttrSum', f: parse_PtgAttrSum }, + /*::[*/ 0x20 /*::]*/: { n: 'PtgAttrBaxcel', f: parse_PtgAttrBaxcel }, + /*::[*/ 0x21 /*::]*/: { n: 'PtgAttrBaxcel', f: parse_PtgAttrBaxcel }, + /*::[*/ 0x40 /*::]*/: { n: 'PtgAttrSpace', f: parse_PtgAttrSpace }, + /*::[*/ 0x41 /*::]*/: { n: 'PtgAttrSpaceSemi', f: parse_PtgAttrSpaceSemi }, + /*::[*/ 0x80 /*::]*/: { n: 'PtgAttrIfError', f: parse_PtgAttrIfError }, + /*::[*/ 0xFF /*::]*/: {} +}; +/* [MS-XLS] 2.5.198.103 ; [MS-XLSB] 2.5.97.87 */ +function parse_RgbExtra(blob, length, rgce, opts) { + if (opts.biff < 8) + return parsenoop(blob, length); + var target = blob.l + length; + var o = []; + for (var i = 0; i !== rgce.length; ++i) { + switch (rgce[i][0]) { + case 'PtgArray': /* PtgArray -> PtgExtraArray */ + rgce[i][1] = parse_PtgExtraArray(blob, 0, opts); + o.push(rgce[i][1]); + break; + case 'PtgMemArea': /* PtgMemArea -> PtgExtraMem */ + rgce[i][2] = parse_PtgExtraMem(blob, rgce[i][1], opts); + o.push(rgce[i][2]); + break; + case 'PtgExp': /* PtgExp -> PtgExtraCol */ + if (opts && opts.biff == 12) { + rgce[i][1][1] = blob.read_shift(4); + o.push(rgce[i][1]); + } + break; + case 'PtgList': /* TODO: PtgList -> PtgExtraList */ + case 'PtgElfRadicalS': /* TODO: PtgElfRadicalS -> PtgExtraElf */ + case 'PtgElfColS': /* TODO: PtgElfColS -> PtgExtraElf */ + case 'PtgElfColSV': /* TODO: PtgElfColSV -> PtgExtraElf */ + throw "Unsupported " + rgce[i][0]; + default: break; + } + } + length = target - blob.l; + /* note: this is technically an error but Excel disregards */ + //if(target !== blob.l && blob.l !== target - length) throw new Error(target + " != " + blob.l); + if (length !== 0) + o.push(parsenoop(blob, length)); + return o; +} +/* [MS-XLS] 2.5.198.104 ; [MS-XLSB] 2.5.97.88 */ +function parse_Rgce(blob, length, opts) { + var target = blob.l + length; + var R, id, ptgs = []; + while (target != blob.l) { + length = target - blob.l; + id = blob[blob.l]; + R = PtgTypes[id] || PtgTypes[PtgDupes[id]]; + if (id === 0x18 || id === 0x19) + R = (id === 0x18 ? Ptg18 : Ptg19)[blob[blob.l + 1]]; + if (!R || !R.f) { /*ptgs.push*/ + (parsenoop(blob, length)); + } + else { + ptgs.push([R.n, R.f(blob, length, opts)]); + } + } + return ptgs; +} +function stringify_array(f /*:Array>*/) { + var o /*:Array*/ = []; + for (var i = 0; i < f.length; ++i) { + var x = f[i], r /*:Array*/ = []; + for (var j = 0; j < x.length; ++j) { + var y = x[j]; + if (y) + switch (y[0]) { + // TODO: handle embedded quotes + case 0x02: + /*:: if(typeof y[1] != 'string') throw "unreachable"; */ + r.push('"' + y[1].replace(/"/g, '""') + '"'); + break; + default: r.push(y[1]); + } + else + r.push(""); + } + o.push(r.join(",")); + } + return o.join(";"); +} +/* [MS-XLS] 2.2.2 ; [MS-XLSB] 2.2.2 TODO */ +var PtgBinOp = { + PtgAdd: "+", + PtgConcat: "&", + PtgDiv: "/", + PtgEq: "=", + PtgGe: ">=", + PtgGt: ">", + PtgLe: "<=", + PtgLt: "<", + PtgMul: "*", + PtgNe: "<>", + PtgPower: "^", + PtgSub: "-" +}; +// TODO: explore space +function make_3d_range(start, end) { + var s = start.lastIndexOf("!"), e = end.lastIndexOf("!"); + if (s == -1 && e == -1) + return start + ":" + end; + if (s > 0 && e > 0 && start.slice(0, s).toLowerCase() == end.slice(0, e).toLowerCase()) + return start + ":" + end.slice(e + 1); + console.error("Cannot hydrate range", start, end); + return start + ":" + end; +} +function get_ixti_raw(supbooks, ixti /*:number*/, opts) { + if (!supbooks) + return "SH33TJSERR0"; + if (opts.biff > 8 && (!supbooks.XTI || !supbooks.XTI[ixti])) + return supbooks.SheetNames[ixti]; + if (!supbooks.XTI) + return "SH33TJSERR6"; + var XTI = supbooks.XTI[ixti]; + if (opts.biff < 8) { + if (ixti > 10000) + ixti -= 65536; + if (ixti < 0) + ixti = -ixti; + return ixti == 0 ? "" : supbooks.XTI[ixti - 1]; + } + if (!XTI) + return "SH33TJSERR1"; + var o = ""; + if (opts.biff > 8) + switch (supbooks[XTI[0]][0]) { + case 0x0165: /* 'BrtSupSelf' */ + o = XTI[1] == -1 ? "#REF" : supbooks.SheetNames[XTI[1]]; + return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]]; + case 0x0166: /* 'BrtSupSame' */ + if (opts.SID != null) + return supbooks.SheetNames[opts.SID]; + return "SH33TJSSAME" + supbooks[XTI[0]][0]; + case 0x0163: /* 'BrtSupBookSrc' */ + /* falls through */ + default: return "SH33TJSSRC" + supbooks[XTI[0]][0]; + } + switch (supbooks[XTI[0]][0][0]) { + case 0x0401: + o = XTI[1] == -1 ? "#REF" : (supbooks.SheetNames[XTI[1]] || "SH33TJSERR3"); + return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]]; + case 0x3A01: return supbooks[XTI[0]].slice(1).map(function (name) { return name.Name; }).join(";;"); //return "SH33TJSERR8"; + default: + if (!supbooks[XTI[0]][0][3]) + return "SH33TJSERR2"; + o = XTI[1] == -1 ? "#REF" : (supbooks[XTI[0]][0][3][XTI[1]] || "SH33TJSERR4"); + return XTI[1] == XTI[2] ? o : o + ":" + supbooks[XTI[0]][0][3][XTI[2]]; + } +} +function get_ixti(supbooks, ixti /*:number*/, opts) { + var ixtiraw = get_ixti_raw(supbooks, ixti, opts); + return ixtiraw == "#REF" ? ixtiraw : formula_quote_sheet_name(ixtiraw, opts); +} +function stringify_formula(formula /*Array*/, range, cell /*:any*/, supbooks, opts) { + var biff = (opts && opts.biff) || 8; + var _range = /*range != null ? range :*/ { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } }; + var stack /*:Array*/ = [], e1, e2, /*::type,*/ c /*:CellAddress*/, ixti = 0, nameidx = 0, r, sname = ""; + if (!formula[0] || !formula[0][0]) + return ""; + var last_sp = -1, sp = ""; + for (var ff = 0, fflen = formula[0].length; ff < fflen; ++ff) { + var f = formula[0][ff]; + switch (f[0]) { + case 'PtgUminus': /* [MS-XLS] 2.5.198.93 */ + stack.push("-" + stack.pop()); + break; + case 'PtgUplus': /* [MS-XLS] 2.5.198.95 */ + stack.push("+" + stack.pop()); + break; + case 'PtgPercent': /* [MS-XLS] 2.5.198.81 */ + stack.push(stack.pop() + "%"); + break; + case 'PtgAdd': /* [MS-XLS] 2.5.198.26 */ + case 'PtgConcat': /* [MS-XLS] 2.5.198.43 */ + case 'PtgDiv': /* [MS-XLS] 2.5.198.45 */ + case 'PtgEq': /* [MS-XLS] 2.5.198.56 */ + case 'PtgGe': /* [MS-XLS] 2.5.198.64 */ + case 'PtgGt': /* [MS-XLS] 2.5.198.65 */ + case 'PtgLe': /* [MS-XLS] 2.5.198.68 */ + case 'PtgLt': /* [MS-XLS] 2.5.198.69 */ + case 'PtgMul': /* [MS-XLS] 2.5.198.75 */ + case 'PtgNe': /* [MS-XLS] 2.5.198.78 */ + case 'PtgPower': /* [MS-XLS] 2.5.198.82 */ + case 'PtgSub': /* [MS-XLS] 2.5.198.90 */ + e1 = stack.pop(); + e2 = stack.pop(); + if (last_sp >= 0) { + switch (formula[0][last_sp][1][0]) { + case 0: + // $FlowIgnore + sp = fill(" ", formula[0][last_sp][1][1]); + break; + case 1: + // $FlowIgnore + sp = fill("\r", formula[0][last_sp][1][1]); + break; + default: + sp = ""; + // $FlowIgnore + if (opts.WTF) + throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]); + } + e2 = e2 + sp; + last_sp = -1; + } + stack.push(e2 + PtgBinOp[f[0]] + e1); + break; + case 'PtgIsect': /* [MS-XLS] 2.5.198.67 */ + e1 = stack.pop(); + e2 = stack.pop(); + stack.push(e2 + " " + e1); + break; + case 'PtgUnion': /* [MS-XLS] 2.5.198.94 */ + e1 = stack.pop(); + e2 = stack.pop(); + stack.push(e2 + "," + e1); + break; + case 'PtgRange': /* [MS-XLS] 2.5.198.83 */ + e1 = stack.pop(); + e2 = stack.pop(); + stack.push(make_3d_range(e2, e1)); + break; + case 'PtgAttrChoose': /* [MS-XLS] 2.5.198.34 */ + break; + case 'PtgAttrGoto': /* [MS-XLS] 2.5.198.35 */ + break; + case 'PtgAttrIf': /* [MS-XLS] 2.5.198.36 */ + break; + case 'PtgAttrIfError': /* [MS-XLSB] 2.5.97.28 */ + break; + case 'PtgRef': /* [MS-XLS] 2.5.198.84 */ + /*::type = f[1][0]; */ c = shift_cell_xls((f[1][1] /*:any*/), _range, opts); + stack.push(encode_cell_xls(c, biff)); + break; + case 'PtgRefN': /* [MS-XLS] 2.5.198.88 */ + /*::type = f[1][0]; */ c = cell ? shift_cell_xls((f[1][1] /*:any*/), cell, opts) : (f[1][1] /*:any*/); + stack.push(encode_cell_xls(c, biff)); + break; + case 'PtgRef3d': /* [MS-XLS] 2.5.198.85 */ + /*::type = f[1][0]; */ ixti = /*::Number(*/ f[1][1] /*::)*/; + c = shift_cell_xls((f[1][2] /*:any*/), _range, opts); + sname = get_ixti(supbooks, ixti, opts); + var w = sname; /* IE9 fails on defined names */ // eslint-disable-line no-unused-vars + stack.push(sname + "!" + encode_cell_xls(c, biff)); + break; + case 'PtgFunc': /* [MS-XLS] 2.5.198.62 */ + case 'PtgFuncVar': /* [MS-XLS] 2.5.198.63 */ + /* f[1] = [argc, func, type] */ + var argc /*:number*/ = (f[1][0] /*:any*/), func /*:string*/ = (f[1][1] /*:any*/); + if (!argc) + argc = 0; + argc &= 0x7F; + var args = argc == 0 ? [] : stack.slice(-argc); + stack.length -= argc; + if (func === 'User') + func = args.shift(); + stack.push(func + "(" + args.join(",") + ")"); + break; + case 'PtgBool': /* [MS-XLS] 2.5.198.42 */ + stack.push(f[1] ? "TRUE" : "FALSE"); + break; + case 'PtgInt': /* [MS-XLS] 2.5.198.66 */ + stack.push(/*::String(*/ f[1] /*::)*/); + break; + case 'PtgNum': /* [MS-XLS] 2.5.198.79 TODO: precision? */ + stack.push(String(f[1])); + break; + case 'PtgStr': /* [MS-XLS] 2.5.198.89 */ + // $FlowIgnore + stack.push('"' + f[1].replace(/"/g, '""') + '"'); + break; + case 'PtgErr': /* [MS-XLS] 2.5.198.57 */ + stack.push(/*::String(*/ f[1] /*::)*/); + break; + case 'PtgAreaN': /* [MS-XLS] 2.5.198.31 TODO */ + /*::type = f[1][0]; */ r = shift_range_xls(f[1][1], cell ? { s: cell } : _range, opts); + stack.push(encode_range_xls((r /*:any*/), opts)); + break; + case 'PtgArea': /* [MS-XLS] 2.5.198.27 TODO: fixed points */ + /*::type = f[1][0]; */ r = shift_range_xls(f[1][1], _range, opts); + stack.push(encode_range_xls((r /*:any*/), opts)); + break; + case 'PtgArea3d': /* [MS-XLS] 2.5.198.28 TODO */ + /*::type = f[1][0]; */ ixti = /*::Number(*/ f[1][1] /*::)*/; + r = f[1][2]; + sname = get_ixti(supbooks, ixti, opts); + stack.push(sname + "!" + encode_range_xls((r /*:any*/), opts)); + break; + case 'PtgAttrSum': /* [MS-XLS] 2.5.198.41 */ + stack.push("SUM(" + stack.pop() + ")"); + break; + case 'PtgAttrBaxcel': /* [MS-XLS] 2.5.198.33 */ + case 'PtgAttrSemi': /* [MS-XLS] 2.5.198.37 */ + break; + case 'PtgName': /* [MS-XLS] 2.5.198.76 ; [MS-XLSB] 2.5.97.60 TODO: revisions */ + /* f[1] = type, 0, nameindex */ + nameidx = (f[1][2] /*:any*/); + var lbl = (supbooks.names || [])[nameidx - 1] || (supbooks[0] || [])[nameidx]; + var name = lbl ? lbl.Name : "SH33TJSNAME" + String(nameidx); + /* [MS-XLSB] 2.5.97.10 Ftab -- last verified 20220204 */ + if (name && name.slice(0, 6) == "_xlfn." && !opts.xlfn) + name = name.slice(6); + stack.push(name); + break; + case 'PtgNameX': /* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 TODO: revisions */ + /* f[1] = type, ixti, nameindex */ + var bookidx /*:number*/ = (f[1][1] /*:any*/); + nameidx = (f[1][2] /*:any*/); + var externbook; + /* TODO: Properly handle missing values -- this should be using get_ixti_raw primarily */ + if (opts.biff <= 5) { + if (bookidx < 0) + bookidx = -bookidx; + if (supbooks[bookidx]) + externbook = supbooks[bookidx][nameidx]; + } + else { + var o = ""; + if (((supbooks[bookidx] || [])[0] || [])[0] == 0x3A01) { /* empty */ } + else if (((supbooks[bookidx] || [])[0] || [])[0] == 0x0401) { + if (supbooks[bookidx][nameidx] && supbooks[bookidx][nameidx].itab > 0) { + o = supbooks.SheetNames[supbooks[bookidx][nameidx].itab - 1] + "!"; + } + } + else + o = supbooks.SheetNames[nameidx - 1] + "!"; + if (supbooks[bookidx] && supbooks[bookidx][nameidx]) + o += supbooks[bookidx][nameidx].Name; + else if (supbooks[0] && supbooks[0][nameidx]) + o += supbooks[0][nameidx].Name; + else { + var ixtidata = (get_ixti_raw(supbooks, bookidx, opts) || "").split(";;"); + if (ixtidata[nameidx - 1]) + o = ixtidata[nameidx - 1]; // TODO: confirm this is correct + else + o += "SH33TJSERRX"; + } + stack.push(o); + break; + } + if (!externbook) + externbook = { Name: "SH33TJSERRY" }; + stack.push(externbook.Name); + break; + case 'PtgParen': /* [MS-XLS] 2.5.198.80 */ + var lp = '(', rp = ')'; + if (last_sp >= 0) { + sp = ""; + switch (formula[0][last_sp][1][0]) { + // $FlowIgnore + case 2: + lp = fill(" ", formula[0][last_sp][1][1]) + lp; + break; + // $FlowIgnore + case 3: + lp = fill("\r", formula[0][last_sp][1][1]) + lp; + break; + // $FlowIgnore + case 4: + rp = fill(" ", formula[0][last_sp][1][1]) + rp; + break; + // $FlowIgnore + case 5: + rp = fill("\r", formula[0][last_sp][1][1]) + rp; + break; + default: + // $FlowIgnore + if (opts.WTF) + throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]); + } + last_sp = -1; + } + stack.push(lp + stack.pop() + rp); + break; + case 'PtgRefErr': /* [MS-XLS] 2.5.198.86 */ + stack.push('#REF!'); + break; + case 'PtgRefErr3d': /* [MS-XLS] 2.5.198.87 */ + stack.push('#REF!'); + break; + case 'PtgExp': /* [MS-XLS] 2.5.198.58 TODO */ + c = { c: (f[1][1] /*:any*/), r: (f[1][0] /*:any*/) }; + var q = ({ c: cell.c, r: cell.r } /*:any*/); + if (supbooks.sharedf[encode_cell(c)]) { + var parsedf = (supbooks.sharedf[encode_cell(c)]); + stack.push(stringify_formula(parsedf, _range, q, supbooks, opts)); + } + else { + var fnd = false; + for (e1 = 0; e1 != supbooks.arrayf.length; ++e1) { + /* TODO: should be something like range_has */ + e2 = supbooks.arrayf[e1]; + if (c.c < e2[0].s.c || c.c > e2[0].e.c) + continue; + if (c.r < e2[0].s.r || c.r > e2[0].e.r) + continue; + stack.push(stringify_formula(e2[1], _range, q, supbooks, opts)); + fnd = true; + break; + } + if (!fnd) + stack.push(/*::String(*/ f[1] /*::)*/); + } + break; + case 'PtgArray': /* [MS-XLS] 2.5.198.32 TODO */ + stack.push("{" + stringify_array(/*::(*/ f[1] /*:: :any)*/) + "}"); + break; + case 'PtgMemArea': /* [MS-XLS] 2.5.198.70 TODO: confirm this is a non-display */ + //stack.push("(" + f[2].map(encode_range).join(",") + ")"); + break; + case 'PtgAttrSpace': /* [MS-XLS] 2.5.198.38 */ + case 'PtgAttrSpaceSemi': /* [MS-XLS] 2.5.198.39 */ + last_sp = ff; + break; + case 'PtgTbl': /* [MS-XLS] 2.5.198.92 TODO */ + break; + case 'PtgMemErr': /* [MS-XLS] 2.5.198.71 */ + break; + case 'PtgMissArg': /* [MS-XLS] 2.5.198.74 */ + stack.push(""); + break; + case 'PtgAreaErr': /* [MS-XLS] 2.5.198.29 */ + stack.push("#REF!"); + break; + case 'PtgAreaErr3d': /* [MS-XLS] 2.5.198.30 */ + stack.push("#REF!"); + break; + case 'PtgList': /* [MS-XLSB] 2.5.97.52 */ + // $FlowIgnore + stack.push("Table" + f[1].idx + "[#" + f[1].rt + "]"); + break; + case 'PtgMemAreaN': + case 'PtgMemNoMemN': + case 'PtgAttrNoop': + case 'PtgSheet': + case 'PtgEndSheet': + break; + case 'PtgMemFunc': /* [MS-XLS] 2.5.198.72 TODO */ + break; + case 'PtgMemNoMem': /* [MS-XLS] 2.5.198.73 TODO */ + break; + case 'PtgElfCol': /* [MS-XLS] 2.5.198.46 */ + case 'PtgElfColS': /* [MS-XLS] 2.5.198.47 */ + case 'PtgElfColSV': /* [MS-XLS] 2.5.198.48 */ + case 'PtgElfColV': /* [MS-XLS] 2.5.198.49 */ + case 'PtgElfLel': /* [MS-XLS] 2.5.198.50 */ + case 'PtgElfRadical': /* [MS-XLS] 2.5.198.51 */ + case 'PtgElfRadicalLel': /* [MS-XLS] 2.5.198.52 */ + case 'PtgElfRadicalS': /* [MS-XLS] 2.5.198.53 */ + case 'PtgElfRw': /* [MS-XLS] 2.5.198.54 */ + case 'PtgElfRwV': /* [MS-XLS] 2.5.198.55 */ + throw new Error("Unsupported ELFs"); + case 'PtgSxName': /* [MS-XLS] 2.5.198.91 TODO -- find a test case */ + throw new Error('Unrecognized Formula Token: ' + String(f)); + default: throw new Error('Unrecognized Formula Token: ' + String(f)); + } + var PtgNonDisp = ['PtgAttrSpace', 'PtgAttrSpaceSemi', 'PtgAttrGoto']; + if (opts.biff != 3) + if (last_sp >= 0 && PtgNonDisp.indexOf(formula[0][ff][0]) == -1) { + f = formula[0][last_sp]; + var _left = true; + switch (f[1][0]) { + /* note: some bad XLSB files omit the PtgParen */ + case 4: _left = false; + /* falls through */ + case 0: + // $FlowIgnore + sp = fill(" ", f[1][1]); + break; + case 5: _left = false; + /* falls through */ + case 1: + // $FlowIgnore + sp = fill("\r", f[1][1]); + break; + default: + sp = ""; + // $FlowIgnore + if (opts.WTF) + throw new Error("Unexpected PtgAttrSpaceType " + f[1][0]); + } + stack.push((_left ? sp : "") + stack.pop() + (_left ? "" : sp)); + last_sp = -1; + } + } + if (stack.length > 1 && opts.WTF) + throw new Error("bad formula stack"); + if (stack[0] == "TRUE") + return true; + if (stack[0] == "FALSE") + return false; + return stack[0]; +} +/* [MS-XLS] 2.5.198.1 TODO */ +function parse_ArrayParsedFormula(blob, length, opts /*::, ref*/) { + var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; + var rgcb, cce = blob.read_shift(len); // length of rgce + if (cce == 0xFFFF) + return [[], parsenoop(blob, length - 2)]; + var rgce = parse_Rgce(blob, cce, opts); + if (length !== cce + len) + rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); + blob.l = target; + return [rgce, rgcb]; +} +/* [MS-XLS] 2.5.198.3 TODO */ +function parse_XLSCellParsedFormula(blob, length, opts) { + var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; + var rgcb, cce = blob.read_shift(len); // length of rgce + if (cce == 0xFFFF) + return [[], parsenoop(blob, length - 2)]; + var rgce = parse_Rgce(blob, cce, opts); + if (length !== cce + len) + rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); + blob.l = target; + return [rgce, rgcb]; +} +/* [MS-XLS] 2.5.198.21 */ +function parse_NameParsedFormula(blob, length, opts, cce) { + var target = blob.l + length; + var rgce = parse_Rgce(blob, cce, opts); + var rgcb; + if (target !== blob.l) + rgcb = parse_RgbExtra(blob, target - blob.l, rgce, opts); + return [rgce, rgcb]; +} +/* [MS-XLS] 2.5.198.118 TODO */ +function parse_SharedParsedFormula(blob, length, opts) { + var target = blob.l + length; + var rgcb, cce = blob.read_shift(2); // length of rgce + var rgce = parse_Rgce(blob, cce, opts); + if (cce == 0xFFFF) + return [[], parsenoop(blob, length - 2)]; + if (length !== cce + 2) + rgcb = parse_RgbExtra(blob, target - cce - 2, rgce, opts); + return [rgce, rgcb]; +} +/* [MS-XLS] 2.5.133 TODO: how to emit empty strings? */ +function parse_FormulaValue(blob /*::, length*/) { + var b; + if (__readUInt16LE(blob, blob.l + 6) !== 0xFFFF) + return [parse_Xnum(blob), 'n']; + switch (blob[blob.l]) { + case 0x00: + blob.l += 8; + return ["String", 's']; + case 0x01: + b = blob[blob.l + 2] === 0x1; + blob.l += 8; + return [b, 'b']; + case 0x02: + b = blob[blob.l + 2]; + blob.l += 8; + return [b, 'e']; + case 0x03: + blob.l += 8; + return ["", 's']; + } + return []; +} +function write_FormulaValue(value) { + if (value == null) { + // Blank String Value + var o = new_buf(8); + o.write_shift(1, 0x03); + o.write_shift(1, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0xFFFF); + return o; + } + else if (typeof value == "number") + return write_Xnum(value); + return write_Xnum(0); +} +/* [MS-XLS] 2.4.127 TODO */ +function parse_Formula(blob, length, opts) { + var end = blob.l + length; + var cell = parse_XLSCell(blob, 6, opts); + var val = parse_FormulaValue(blob, 8); + var flags = blob.read_shift(1); + if (opts.biff != 2) { + blob.read_shift(1); + if (opts.biff >= 5) { + /*var chn = */ blob.read_shift(4); + } + } + var cbf = parse_XLSCellParsedFormula(blob, end - blob.l, opts); + return { cell: cell, val: val[0], formula: cbf, shared: (flags >> 3) & 1, tt: val[1] }; +} +function write_Formula(cell /*:Cell*/, R /*:number*/, C /*:number*/, opts, os /*:number*/) { + // Cell + var o1 = write_XLSCell(R, C, os); + // FormulaValue + var o2 = write_FormulaValue(cell.v); + // flags + cache + var o3 = new_buf(6); + var flags = 0x01 | 0x20; + o3.write_shift(2, flags); + o3.write_shift(4, 0); + // CellParsedFormula + var bf = new_buf(cell.bf.length); + for (var i = 0; i < cell.bf.length; ++i) + bf[i] = cell.bf[i]; + var out = bconcat([o1, o2, o3, bf]); + return out; +} +/* XLSB Parsed Formula records have the same shape */ +function parse_XLSBParsedFormula(data, length, opts) { + var cce = data.read_shift(4); + var rgce = parse_Rgce(data, cce, opts); + var cb = data.read_shift(4); + var rgcb = cb > 0 ? parse_RgbExtra(data, cb, rgce, opts) : null; + return [rgce, rgcb]; +} +/* [MS-XLSB] 2.5.97.1 ArrayParsedFormula */ +var parse_XLSBArrayParsedFormula = parse_XLSBParsedFormula; +/* [MS-XLSB] 2.5.97.4 CellParsedFormula */ +var parse_XLSBCellParsedFormula = parse_XLSBParsedFormula; +/* [MS-XLSB] 2.5.97.8 DVParsedFormula */ +//var parse_XLSBDVParsedFormula = parse_XLSBParsedFormula; +/* [MS-XLSB] 2.5.97.9 FRTParsedFormula */ +//var parse_XLSBFRTParsedFormula = parse_XLSBParsedFormula2; +/* [MS-XLSB] 2.5.97.12 NameParsedFormula */ +var parse_XLSBNameParsedFormula = parse_XLSBParsedFormula; +/* [MS-XLSB] 2.5.97.98 SharedParsedFormula */ +var parse_XLSBSharedParsedFormula = parse_XLSBParsedFormula; +/* Writes a PtgNum or PtgInt */ +function write_XLSBFormulaNum(val /*:number*/) { + if ((val | 0) == val && val < Math.pow(2, 16) && val >= 0) { + var oint = new_buf(11); + oint.write_shift(4, 3); + oint.write_shift(1, 0x1e); + oint.write_shift(2, val); + oint.write_shift(4, 0); + return oint; + } + var num = new_buf(17); + num.write_shift(4, 11); + num.write_shift(1, 0x1f); + num.write_shift(8, val); + num.write_shift(4, 0); + return num; +} +/* Writes a PtgErr */ +function write_XLSBFormulaErr(val /*:number*/) { + var oint = new_buf(10); + oint.write_shift(4, 2); + oint.write_shift(1, 0x1C); + oint.write_shift(1, val); + oint.write_shift(4, 0); + return oint; +} +/* Writes a PtgBool */ +function write_XLSBFormulaBool(val /*:boolean*/) { + var oint = new_buf(10); + oint.write_shift(4, 2); + oint.write_shift(1, 0x1D); + oint.write_shift(1, val ? 1 : 0); + oint.write_shift(4, 0); + return oint; +} +/* Writes a PtgStr */ +function write_XLSBFormulaStr(val /*:string*/) { + var preamble = new_buf(7); + preamble.write_shift(4, 3 + 2 * val.length); + preamble.write_shift(1, 0x17); + preamble.write_shift(2, val.length); + var body = new_buf(2 * val.length); + body.write_shift(2 * val.length, val, "utf16le"); + var postamble = new_buf(4); + postamble.write_shift(4, 0); + return bconcat([preamble, body, postamble]); +} +/* Writes a PtgRef */ +function write_XLSBFormulaRef(str) { + var cell = decode_cell(str); + var out = new_buf(15); + out.write_shift(4, 7); + out.write_shift(1, 0x04 | ((1) << 5)); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1) << 14) | ((str.match(/\$\d/) ? 0 : 1) << 15)); // <== ColRelShort + out.write_shift(4, 0); + return out; +} +/* Writes a PtgRef3d */ +function write_XLSBFormulaRef3D(str, wb) { + var lastbang = str.lastIndexOf("!"); + var sname = str.slice(0, lastbang); + str = str.slice(lastbang + 1); + var cell = decode_cell(str); + if (sname.charAt(0) == "'") + sname = sname.slice(1, -1).replace(/''/g, "'"); + var out = new_buf(17); + out.write_shift(4, 9); + out.write_shift(1, 0x1A | ((1) << 5)); + out.write_shift(2, 2 + wb.SheetNames.map(function (n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1) << 14) | ((str.match(/\$\d/) ? 0 : 1) << 15)); // <== ColRelShort + out.write_shift(4, 0); + return out; +} +/* Writes a PtgRefErr3d */ +function write_XLSBFormulaRefErr3D(str, wb) { + var lastbang = str.lastIndexOf("!"); + var sname = str.slice(0, lastbang); + str = str.slice(lastbang + 1); + if (sname.charAt(0) == "'") + sname = sname.slice(1, -1).replace(/''/g, "'"); + var out = new_buf(17); + out.write_shift(4, 9); + out.write_shift(1, 0x1C | ((1) << 5)); + out.write_shift(2, 2 + wb.SheetNames.map(function (n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, 0); + out.write_shift(2, 0); // <== ColRelShort + out.write_shift(4, 0); + return out; +} +/* Writes a single sheet range [PtgRef PtgRef PtgRange] */ +function write_XLSBFormulaRange(_str) { + var parts = _str.split(":"), str = parts[0]; + var out = new_buf(23); + out.write_shift(4, 15); + /* start cell */ + str = parts[0]; + var cell = decode_cell(str); + out.write_shift(1, 0x04 | ((1) << 5)); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1) << 14) | ((str.match(/\$\d/) ? 0 : 1) << 15)); // <== ColRelShort + out.write_shift(4, 0); + /* end cell */ + str = parts[1]; + cell = decode_cell(str); + out.write_shift(1, 0x04 | ((1) << 5)); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1) << 14) | ((str.match(/\$\d/) ? 0 : 1) << 15)); // <== ColRelShort + out.write_shift(4, 0); + /* PtgRange */ + out.write_shift(1, 0x11); + out.write_shift(4, 0); + return out; +} +/* Writes a range with explicit sheet name [PtgRef3D PtgRef3D PtgRange] */ +function write_XLSBFormulaRangeWS(_str, wb) { + var lastbang = _str.lastIndexOf("!"); + var sname = _str.slice(0, lastbang); + _str = _str.slice(lastbang + 1); + if (sname.charAt(0) == "'") + sname = sname.slice(1, -1).replace(/''/g, "'"); + var parts = _str.split(":"); + var out = new_buf(27); + out.write_shift(4, 19); + /* start cell */ + var str = parts[0], cell = decode_cell(str); + out.write_shift(1, 0x1A | ((1) << 5)); + out.write_shift(2, 2 + wb.SheetNames.map(function (n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1) << 14) | ((str.match(/\$\d/) ? 0 : 1) << 15)); // <== ColRelShort + /* end cell */ + str = parts[1]; + cell = decode_cell(str); + out.write_shift(1, 0x1A | ((1) << 5)); + out.write_shift(2, 2 + wb.SheetNames.map(function (n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1) << 14) | ((str.match(/\$\d/) ? 0 : 1) << 15)); // <== ColRelShort + /* PtgRange */ + out.write_shift(1, 0x11); + out.write_shift(4, 0); + return out; +} +/* Writes a range with explicit sheet name [PtgArea3d] */ +function write_XLSBFormulaArea3D(_str, wb) { + var lastbang = _str.lastIndexOf("!"); + var sname = _str.slice(0, lastbang); + _str = _str.slice(lastbang + 1); + if (sname.charAt(0) == "'") + sname = sname.slice(1, -1).replace(/''/g, "'"); + var range = decode_range(_str); + var out = new_buf(23); + out.write_shift(4, 15); + out.write_shift(1, 0x1B | ((1) << 5)); + out.write_shift(2, 2 + wb.SheetNames.map(function (n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, range.s.r); + out.write_shift(4, range.e.r); + out.write_shift(2, range.s.c); + out.write_shift(2, range.e.c); + out.write_shift(4, 0); + return out; +} +/* General Formula */ +function write_XLSBFormula(val /*:string|number*/, wb) { + if (typeof val == "number") + return write_XLSBFormulaNum(val); + if (typeof val == "boolean") + return write_XLSBFormulaBool(val); + if (/^#(DIV\/0!|GETTING_DATA|N\/A|NAME\?|NULL!|NUM!|REF!|VALUE!)$/.test(val)) + return write_XLSBFormulaErr(+RBErr[val]); + if (val.match(/^\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) + return write_XLSBFormulaRef(val); + if (val.match(/^\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5}):\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) + return write_XLSBFormulaRange(val); + if (val.match(/^#REF!\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5}):\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) + return write_XLSBFormulaArea3D(val, wb); + if (val.match(/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) + return write_XLSBFormulaRef3D(val, wb); + if (val.match(/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5}):\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) + return write_XLSBFormulaRangeWS(val, wb); + if (/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!#REF!$/.test(val)) + return write_XLSBFormulaRefErr3D(val, wb); + if (/^".*"$/.test(val)) + return write_XLSBFormulaStr(val); + if (/^[+-]\d+$/.test(val)) + return write_XLSBFormulaNum(parseInt(val, 10)); + throw "Formula |" + val + "| not supported for XLSB"; +} +var write_XLSBNameParsedFormula = write_XLSBFormula; +var Cetab = { + 0: "BEEP", + 1: "OPEN", + 2: "OPEN.LINKS", + 3: "CLOSE.ALL", + 4: "SAVE", + 5: "SAVE.AS", + 6: "FILE.DELETE", + 7: "PAGE.SETUP", + 8: "PRINT", + 9: "PRINTER.SETUP", + 10: "QUIT", + 11: "NEW.WINDOW", + 12: "ARRANGE.ALL", + 13: "WINDOW.SIZE", + 14: "WINDOW.MOVE", + 15: "FULL", + 16: "CLOSE", + 17: "RUN", + 22: "SET.PRINT.AREA", + 23: "SET.PRINT.TITLES", + 24: "SET.PAGE.BREAK", + 25: "REMOVE.PAGE.BREAK", + 26: "FONT", + 27: "DISPLAY", + 28: "PROTECT.DOCUMENT", + 29: "PRECISION", + 30: "A1.R1C1", + 31: "CALCULATE.NOW", + 32: "CALCULATION", + 34: "DATA.FIND", + 35: "EXTRACT", + 36: "DATA.DELETE", + 37: "SET.DATABASE", + 38: "SET.CRITERIA", + 39: "SORT", + 40: "DATA.SERIES", + 41: "TABLE", + 42: "FORMAT.NUMBER", + 43: "ALIGNMENT", + 44: "STYLE", + 45: "BORDER", + 46: "CELL.PROTECTION", + 47: "COLUMN.WIDTH", + 48: "UNDO", + 49: "CUT", + 50: "COPY", + 51: "PASTE", + 52: "CLEAR", + 53: "PASTE.SPECIAL", + 54: "EDIT.DELETE", + 55: "INSERT", + 56: "FILL.RIGHT", + 57: "FILL.DOWN", + 61: "DEFINE.NAME", + 62: "CREATE.NAMES", + 63: "FORMULA.GOTO", + 64: "FORMULA.FIND", + 65: "SELECT.LAST.CELL", + 66: "SHOW.ACTIVE.CELL", + 67: "GALLERY.AREA", + 68: "GALLERY.BAR", + 69: "GALLERY.COLUMN", + 70: "GALLERY.LINE", + 71: "GALLERY.PIE", + 72: "GALLERY.SCATTER", + 73: "COMBINATION", + 74: "PREFERRED", + 75: "ADD.OVERLAY", + 76: "GRIDLINES", + 77: "SET.PREFERRED", + 78: "AXES", + 79: "LEGEND", + 80: "ATTACH.TEXT", + 81: "ADD.ARROW", + 82: "SELECT.CHART", + 83: "SELECT.PLOT.AREA", + 84: "PATTERNS", + 85: "MAIN.CHART", + 86: "OVERLAY", + 87: "SCALE", + 88: "FORMAT.LEGEND", + 89: "FORMAT.TEXT", + 90: "EDIT.REPEAT", + 91: "PARSE", + 92: "JUSTIFY", + 93: "HIDE", + 94: "UNHIDE", + 95: "WORKSPACE", + 96: "FORMULA", + 97: "FORMULA.FILL", + 98: "FORMULA.ARRAY", + 99: "DATA.FIND.NEXT", + 100: "DATA.FIND.PREV", + 101: "FORMULA.FIND.NEXT", + 102: "FORMULA.FIND.PREV", + 103: "ACTIVATE", + 104: "ACTIVATE.NEXT", + 105: "ACTIVATE.PREV", + 106: "UNLOCKED.NEXT", + 107: "UNLOCKED.PREV", + 108: "COPY.PICTURE", + 109: "SELECT", + 110: "DELETE.NAME", + 111: "DELETE.FORMAT", + 112: "VLINE", + 113: "HLINE", + 114: "VPAGE", + 115: "HPAGE", + 116: "VSCROLL", + 117: "HSCROLL", + 118: "ALERT", + 119: "NEW", + 120: "CANCEL.COPY", + 121: "SHOW.CLIPBOARD", + 122: "MESSAGE", + 124: "PASTE.LINK", + 125: "APP.ACTIVATE", + 126: "DELETE.ARROW", + 127: "ROW.HEIGHT", + 128: "FORMAT.MOVE", + 129: "FORMAT.SIZE", + 130: "FORMULA.REPLACE", + 131: "SEND.KEYS", + 132: "SELECT.SPECIAL", + 133: "APPLY.NAMES", + 134: "REPLACE.FONT", + 135: "FREEZE.PANES", + 136: "SHOW.INFO", + 137: "SPLIT", + 138: "ON.WINDOW", + 139: "ON.DATA", + 140: "DISABLE.INPUT", + 142: "OUTLINE", + 143: "LIST.NAMES", + 144: "FILE.CLOSE", + 145: "SAVE.WORKBOOK", + 146: "DATA.FORM", + 147: "COPY.CHART", + 148: "ON.TIME", + 149: "WAIT", + 150: "FORMAT.FONT", + 151: "FILL.UP", + 152: "FILL.LEFT", + 153: "DELETE.OVERLAY", + 155: "SHORT.MENUS", + 159: "SET.UPDATE.STATUS", + 161: "COLOR.PALETTE", + 162: "DELETE.STYLE", + 163: "WINDOW.RESTORE", + 164: "WINDOW.MAXIMIZE", + 166: "CHANGE.LINK", + 167: "CALCULATE.DOCUMENT", + 168: "ON.KEY", + 169: "APP.RESTORE", + 170: "APP.MOVE", + 171: "APP.SIZE", + 172: "APP.MINIMIZE", + 173: "APP.MAXIMIZE", + 174: "BRING.TO.FRONT", + 175: "SEND.TO.BACK", + 185: "MAIN.CHART.TYPE", + 186: "OVERLAY.CHART.TYPE", + 187: "SELECT.END", + 188: "OPEN.MAIL", + 189: "SEND.MAIL", + 190: "STANDARD.FONT", + 191: "CONSOLIDATE", + 192: "SORT.SPECIAL", + 193: "GALLERY.3D.AREA", + 194: "GALLERY.3D.COLUMN", + 195: "GALLERY.3D.LINE", + 196: "GALLERY.3D.PIE", + 197: "VIEW.3D", + 198: "GOAL.SEEK", + 199: "WORKGROUP", + 200: "FILL.GROUP", + 201: "UPDATE.LINK", + 202: "PROMOTE", + 203: "DEMOTE", + 204: "SHOW.DETAIL", + 206: "UNGROUP", + 207: "OBJECT.PROPERTIES", + 208: "SAVE.NEW.OBJECT", + 209: "SHARE", + 210: "SHARE.NAME", + 211: "DUPLICATE", + 212: "APPLY.STYLE", + 213: "ASSIGN.TO.OBJECT", + 214: "OBJECT.PROTECTION", + 215: "HIDE.OBJECT", + 216: "SET.EXTRACT", + 217: "CREATE.PUBLISHER", + 218: "SUBSCRIBE.TO", + 219: "ATTRIBUTES", + 220: "SHOW.TOOLBAR", + 222: "PRINT.PREVIEW", + 223: "EDIT.COLOR", + 224: "SHOW.LEVELS", + 225: "FORMAT.MAIN", + 226: "FORMAT.OVERLAY", + 227: "ON.RECALC", + 228: "EDIT.SERIES", + 229: "DEFINE.STYLE", + 240: "LINE.PRINT", + 243: "ENTER.DATA", + 249: "GALLERY.RADAR", + 250: "MERGE.STYLES", + 251: "EDITION.OPTIONS", + 252: "PASTE.PICTURE", + 253: "PASTE.PICTURE.LINK", + 254: "SPELLING", + 256: "ZOOM", + 259: "INSERT.OBJECT", + 260: "WINDOW.MINIMIZE", + 265: "SOUND.NOTE", + 266: "SOUND.PLAY", + 267: "FORMAT.SHAPE", + 268: "EXTEND.POLYGON", + 269: "FORMAT.AUTO", + 272: "GALLERY.3D.BAR", + 273: "GALLERY.3D.SURFACE", + 274: "FILL.AUTO", + 276: "CUSTOMIZE.TOOLBAR", + 277: "ADD.TOOL", + 278: "EDIT.OBJECT", + 279: "ON.DOUBLECLICK", + 280: "ON.ENTRY", + 281: "WORKBOOK.ADD", + 282: "WORKBOOK.MOVE", + 283: "WORKBOOK.COPY", + 284: "WORKBOOK.OPTIONS", + 285: "SAVE.WORKSPACE", + 288: "CHART.WIZARD", + 289: "DELETE.TOOL", + 290: "MOVE.TOOL", + 291: "WORKBOOK.SELECT", + 292: "WORKBOOK.ACTIVATE", + 293: "ASSIGN.TO.TOOL", + 295: "COPY.TOOL", + 296: "RESET.TOOL", + 297: "CONSTRAIN.NUMERIC", + 298: "PASTE.TOOL", + 302: "WORKBOOK.NEW", + 305: "SCENARIO.CELLS", + 306: "SCENARIO.DELETE", + 307: "SCENARIO.ADD", + 308: "SCENARIO.EDIT", + 309: "SCENARIO.SHOW", + 310: "SCENARIO.SHOW.NEXT", + 311: "SCENARIO.SUMMARY", + 312: "PIVOT.TABLE.WIZARD", + 313: "PIVOT.FIELD.PROPERTIES", + 314: "PIVOT.FIELD", + 315: "PIVOT.ITEM", + 316: "PIVOT.ADD.FIELDS", + 318: "OPTIONS.CALCULATION", + 319: "OPTIONS.EDIT", + 320: "OPTIONS.VIEW", + 321: "ADDIN.MANAGER", + 322: "MENU.EDITOR", + 323: "ATTACH.TOOLBARS", + 324: "VBAActivate", + 325: "OPTIONS.CHART", + 328: "VBA.INSERT.FILE", + 330: "VBA.PROCEDURE.DEFINITION", + 336: "ROUTING.SLIP", + 338: "ROUTE.DOCUMENT", + 339: "MAIL.LOGON", + 342: "INSERT.PICTURE", + 343: "EDIT.TOOL", + 344: "GALLERY.DOUGHNUT", + 350: "CHART.TREND", + 352: "PIVOT.ITEM.PROPERTIES", + 354: "WORKBOOK.INSERT", + 355: "OPTIONS.TRANSITION", + 356: "OPTIONS.GENERAL", + 370: "FILTER.ADVANCED", + 373: "MAIL.ADD.MAILER", + 374: "MAIL.DELETE.MAILER", + 375: "MAIL.REPLY", + 376: "MAIL.REPLY.ALL", + 377: "MAIL.FORWARD", + 378: "MAIL.NEXT.LETTER", + 379: "DATA.LABEL", + 380: "INSERT.TITLE", + 381: "FONT.PROPERTIES", + 382: "MACRO.OPTIONS", + 383: "WORKBOOK.HIDE", + 384: "WORKBOOK.UNHIDE", + 385: "WORKBOOK.DELETE", + 386: "WORKBOOK.NAME", + 388: "GALLERY.CUSTOM", + 390: "ADD.CHART.AUTOFORMAT", + 391: "DELETE.CHART.AUTOFORMAT", + 392: "CHART.ADD.DATA", + 393: "AUTO.OUTLINE", + 394: "TAB.ORDER", + 395: "SHOW.DIALOG", + 396: "SELECT.ALL", + 397: "UNGROUP.SHEETS", + 398: "SUBTOTAL.CREATE", + 399: "SUBTOTAL.REMOVE", + 400: "RENAME.OBJECT", + 412: "WORKBOOK.SCROLL", + 413: "WORKBOOK.NEXT", + 414: "WORKBOOK.PREV", + 415: "WORKBOOK.TAB.SPLIT", + 416: "FULL.SCREEN", + 417: "WORKBOOK.PROTECT", + 420: "SCROLLBAR.PROPERTIES", + 421: "PIVOT.SHOW.PAGES", + 422: "TEXT.TO.COLUMNS", + 423: "FORMAT.CHARTTYPE", + 424: "LINK.FORMAT", + 425: "TRACER.DISPLAY", + 430: "TRACER.NAVIGATE", + 431: "TRACER.CLEAR", + 432: "TRACER.ERROR", + 433: "PIVOT.FIELD.GROUP", + 434: "PIVOT.FIELD.UNGROUP", + 435: "CHECKBOX.PROPERTIES", + 436: "LABEL.PROPERTIES", + 437: "LISTBOX.PROPERTIES", + 438: "EDITBOX.PROPERTIES", + 439: "PIVOT.REFRESH", + 440: "LINK.COMBO", + 441: "OPEN.TEXT", + 442: "HIDE.DIALOG", + 443: "SET.DIALOG.FOCUS", + 444: "ENABLE.OBJECT", + 445: "PUSHBUTTON.PROPERTIES", + 446: "SET.DIALOG.DEFAULT", + 447: "FILTER", + 448: "FILTER.SHOW.ALL", + 449: "CLEAR.OUTLINE", + 450: "FUNCTION.WIZARD", + 451: "ADD.LIST.ITEM", + 452: "SET.LIST.ITEM", + 453: "REMOVE.LIST.ITEM", + 454: "SELECT.LIST.ITEM", + 455: "SET.CONTROL.VALUE", + 456: "SAVE.COPY.AS", + 458: "OPTIONS.LISTS.ADD", + 459: "OPTIONS.LISTS.DELETE", + 460: "SERIES.AXES", + 461: "SERIES.X", + 462: "SERIES.Y", + 463: "ERRORBAR.X", + 464: "ERRORBAR.Y", + 465: "FORMAT.CHART", + 466: "SERIES.ORDER", + 467: "MAIL.LOGOFF", + 468: "CLEAR.ROUTING.SLIP", + 469: "APP.ACTIVATE.MICROSOFT", + 470: "MAIL.EDIT.MAILER", + 471: "ON.SHEET", + 472: "STANDARD.WIDTH", + 473: "SCENARIO.MERGE", + 474: "SUMMARY.INFO", + 475: "FIND.FILE", + 476: "ACTIVE.CELL.FONT", + 477: "ENABLE.TIPWIZARD", + 478: "VBA.MAKE.ADDIN", + 480: "INSERTDATATABLE", + 481: "WORKGROUP.OPTIONS", + 482: "MAIL.SEND.MAILER", + 485: "AUTOCORRECT", + 489: "POST.DOCUMENT", + 491: "PICKLIST", + 493: "VIEW.SHOW", + 494: "VIEW.DEFINE", + 495: "VIEW.DELETE", + 509: "SHEET.BACKGROUND", + 510: "INSERT.MAP.OBJECT", + 511: "OPTIONS.MENONO", + 517: "MSOCHECKS", + 518: "NORMAL", + 519: "LAYOUT", + 520: "RM.PRINT.AREA", + 521: "CLEAR.PRINT.AREA", + 522: "ADD.PRINT.AREA", + 523: "MOVE.BRK", + 545: "HIDECURR.NOTE", + 546: "HIDEALL.NOTES", + 547: "DELETE.NOTE", + 548: "TRAVERSE.NOTES", + 549: "ACTIVATE.NOTES", + 620: "PROTECT.REVISIONS", + 621: "UNPROTECT.REVISIONS", + 647: "OPTIONS.ME", + 653: "WEB.PUBLISH", + 667: "NEWWEBQUERY", + 673: "PIVOT.TABLE.CHART", + 753: "OPTIONS.SAVE", + 755: "OPTIONS.SPELL", + 808: "HIDEALL.INKANNOTS" +}; +var Ftab = { + 0: "COUNT", + 1: "IF", + 2: "ISNA", + 3: "ISERROR", + 4: "SUM", + 5: "AVERAGE", + 6: "MIN", + 7: "MAX", + 8: "ROW", + 9: "COLUMN", + 10: "NA", + 11: "NPV", + 12: "STDEV", + 13: "DOLLAR", + 14: "FIXED", + 15: "SIN", + 16: "COS", + 17: "TAN", + 18: "ATAN", + 19: "PI", + 20: "SQRT", + 21: "EXP", + 22: "LN", + 23: "LOG10", + 24: "ABS", + 25: "INT", + 26: "SIGN", + 27: "ROUND", + 28: "LOOKUP", + 29: "INDEX", + 30: "REPT", + 31: "MID", + 32: "LEN", + 33: "VALUE", + 34: "TRUE", + 35: "FALSE", + 36: "AND", + 37: "OR", + 38: "NOT", + 39: "MOD", + 40: "DCOUNT", + 41: "DSUM", + 42: "DAVERAGE", + 43: "DMIN", + 44: "DMAX", + 45: "DSTDEV", + 46: "VAR", + 47: "DVAR", + 48: "TEXT", + 49: "LINEST", + 50: "TREND", + 51: "LOGEST", + 52: "GROWTH", + 53: "GOTO", + 54: "HALT", + 55: "RETURN", + 56: "PV", + 57: "FV", + 58: "NPER", + 59: "PMT", + 60: "RATE", + 61: "MIRR", + 62: "IRR", + 63: "RAND", + 64: "MATCH", + 65: "DATE", + 66: "TIME", + 67: "DAY", + 68: "MONTH", + 69: "YEAR", + 70: "WEEKDAY", + 71: "HOUR", + 72: "MINUTE", + 73: "SECOND", + 74: "NOW", + 75: "AREAS", + 76: "ROWS", + 77: "COLUMNS", + 78: "OFFSET", + 79: "ABSREF", + 80: "RELREF", + 81: "ARGUMENT", + 82: "SEARCH", + 83: "TRANSPOSE", + 84: "ERROR", + 85: "STEP", + 86: "TYPE", + 87: "ECHO", + 88: "SET.NAME", + 89: "CALLER", + 90: "DEREF", + 91: "WINDOWS", + 92: "SERIES", + 93: "DOCUMENTS", + 94: "ACTIVE.CELL", + 95: "SELECTION", + 96: "RESULT", + 97: "ATAN2", + 98: "ASIN", + 99: "ACOS", + 100: "CHOOSE", + 101: "HLOOKUP", + 102: "VLOOKUP", + 103: "LINKS", + 104: "INPUT", + 105: "ISREF", + 106: "GET.FORMULA", + 107: "GET.NAME", + 108: "SET.VALUE", + 109: "LOG", + 110: "EXEC", + 111: "CHAR", + 112: "LOWER", + 113: "UPPER", + 114: "PROPER", + 115: "LEFT", + 116: "RIGHT", + 117: "EXACT", + 118: "TRIM", + 119: "REPLACE", + 120: "SUBSTITUTE", + 121: "CODE", + 122: "NAMES", + 123: "DIRECTORY", + 124: "FIND", + 125: "CELL", + 126: "ISERR", + 127: "ISTEXT", + 128: "ISNUMBER", + 129: "ISBLANK", + 130: "T", + 131: "N", + 132: "FOPEN", + 133: "FCLOSE", + 134: "FSIZE", + 135: "FREADLN", + 136: "FREAD", + 137: "FWRITELN", + 138: "FWRITE", + 139: "FPOS", + 140: "DATEVALUE", + 141: "TIMEVALUE", + 142: "SLN", + 143: "SYD", + 144: "DDB", + 145: "GET.DEF", + 146: "REFTEXT", + 147: "TEXTREF", + 148: "INDIRECT", + 149: "REGISTER", + 150: "CALL", + 151: "ADD.BAR", + 152: "ADD.MENU", + 153: "ADD.COMMAND", + 154: "ENABLE.COMMAND", + 155: "CHECK.COMMAND", + 156: "RENAME.COMMAND", + 157: "SHOW.BAR", + 158: "DELETE.MENU", + 159: "DELETE.COMMAND", + 160: "GET.CHART.ITEM", + 161: "DIALOG.BOX", + 162: "CLEAN", + 163: "MDETERM", + 164: "MINVERSE", + 165: "MMULT", + 166: "FILES", + 167: "IPMT", + 168: "PPMT", + 169: "COUNTA", + 170: "CANCEL.KEY", + 171: "FOR", + 172: "WHILE", + 173: "BREAK", + 174: "NEXT", + 175: "INITIATE", + 176: "REQUEST", + 177: "POKE", + 178: "EXECUTE", + 179: "TERMINATE", + 180: "RESTART", + 181: "HELP", + 182: "GET.BAR", + 183: "PRODUCT", + 184: "FACT", + 185: "GET.CELL", + 186: "GET.WORKSPACE", + 187: "GET.WINDOW", + 188: "GET.DOCUMENT", + 189: "DPRODUCT", + 190: "ISNONTEXT", + 191: "GET.NOTE", + 192: "NOTE", + 193: "STDEVP", + 194: "VARP", + 195: "DSTDEVP", + 196: "DVARP", + 197: "TRUNC", + 198: "ISLOGICAL", + 199: "DCOUNTA", + 200: "DELETE.BAR", + 201: "UNREGISTER", + 204: "USDOLLAR", + 205: "FINDB", + 206: "SEARCHB", + 207: "REPLACEB", + 208: "LEFTB", + 209: "RIGHTB", + 210: "MIDB", + 211: "LENB", + 212: "ROUNDUP", + 213: "ROUNDDOWN", + 214: "ASC", + 215: "DBCS", + 216: "RANK", + 219: "ADDRESS", + 220: "DAYS360", + 221: "TODAY", + 222: "VDB", + 223: "ELSE", + 224: "ELSE.IF", + 225: "END.IF", + 226: "FOR.CELL", + 227: "MEDIAN", + 228: "SUMPRODUCT", + 229: "SINH", + 230: "COSH", + 231: "TANH", + 232: "ASINH", + 233: "ACOSH", + 234: "ATANH", + 235: "DGET", + 236: "CREATE.OBJECT", + 237: "VOLATILE", + 238: "LAST.ERROR", + 239: "CUSTOM.UNDO", + 240: "CUSTOM.REPEAT", + 241: "FORMULA.CONVERT", + 242: "GET.LINK.INFO", + 243: "TEXT.BOX", + 244: "INFO", + 245: "GROUP", + 246: "GET.OBJECT", + 247: "DB", + 248: "PAUSE", + 251: "RESUME", + 252: "FREQUENCY", + 253: "ADD.TOOLBAR", + 254: "DELETE.TOOLBAR", + 255: "User", + 256: "RESET.TOOLBAR", + 257: "EVALUATE", + 258: "GET.TOOLBAR", + 259: "GET.TOOL", + 260: "SPELLING.CHECK", + 261: "ERROR.TYPE", + 262: "APP.TITLE", + 263: "WINDOW.TITLE", + 264: "SAVE.TOOLBAR", + 265: "ENABLE.TOOL", + 266: "PRESS.TOOL", + 267: "REGISTER.ID", + 268: "GET.WORKBOOK", + 269: "AVEDEV", + 270: "BETADIST", + 271: "GAMMALN", + 272: "BETAINV", + 273: "BINOMDIST", + 274: "CHIDIST", + 275: "CHIINV", + 276: "COMBIN", + 277: "CONFIDENCE", + 278: "CRITBINOM", + 279: "EVEN", + 280: "EXPONDIST", + 281: "FDIST", + 282: "FINV", + 283: "FISHER", + 284: "FISHERINV", + 285: "FLOOR", + 286: "GAMMADIST", + 287: "GAMMAINV", + 288: "CEILING", + 289: "HYPGEOMDIST", + 290: "LOGNORMDIST", + 291: "LOGINV", + 292: "NEGBINOMDIST", + 293: "NORMDIST", + 294: "NORMSDIST", + 295: "NORMINV", + 296: "NORMSINV", + 297: "STANDARDIZE", + 298: "ODD", + 299: "PERMUT", + 300: "POISSON", + 301: "TDIST", + 302: "WEIBULL", + 303: "SUMXMY2", + 304: "SUMX2MY2", + 305: "SUMX2PY2", + 306: "CHITEST", + 307: "CORREL", + 308: "COVAR", + 309: "FORECAST", + 310: "FTEST", + 311: "INTERCEPT", + 312: "PEARSON", + 313: "RSQ", + 314: "STEYX", + 315: "SLOPE", + 316: "TTEST", + 317: "PROB", + 318: "DEVSQ", + 319: "GEOMEAN", + 320: "HARMEAN", + 321: "SUMSQ", + 322: "KURT", + 323: "SKEW", + 324: "ZTEST", + 325: "LARGE", + 326: "SMALL", + 327: "QUARTILE", + 328: "PERCENTILE", + 329: "PERCENTRANK", + 330: "MODE", + 331: "TRIMMEAN", + 332: "TINV", + 334: "MOVIE.COMMAND", + 335: "GET.MOVIE", + 336: "CONCATENATE", + 337: "POWER", + 338: "PIVOT.ADD.DATA", + 339: "GET.PIVOT.TABLE", + 340: "GET.PIVOT.FIELD", + 341: "GET.PIVOT.ITEM", + 342: "RADIANS", + 343: "DEGREES", + 344: "SUBTOTAL", + 345: "SUMIF", + 346: "COUNTIF", + 347: "COUNTBLANK", + 348: "SCENARIO.GET", + 349: "OPTIONS.LISTS.GET", + 350: "ISPMT", + 351: "DATEDIF", + 352: "DATESTRING", + 353: "NUMBERSTRING", + 354: "ROMAN", + 355: "OPEN.DIALOG", + 356: "SAVE.DIALOG", + 357: "VIEW.GET", + 358: "GETPIVOTDATA", + 359: "HYPERLINK", + 360: "PHONETIC", + 361: "AVERAGEA", + 362: "MAXA", + 363: "MINA", + 364: "STDEVPA", + 365: "VARPA", + 366: "STDEVA", + 367: "VARA", + 368: "BAHTTEXT", + 369: "THAIDAYOFWEEK", + 370: "THAIDIGIT", + 371: "THAIMONTHOFYEAR", + 372: "THAINUMSOUND", + 373: "THAINUMSTRING", + 374: "THAISTRINGLENGTH", + 375: "ISTHAIDIGIT", + 376: "ROUNDBAHTDOWN", + 377: "ROUNDBAHTUP", + 378: "THAIYEAR", + 379: "RTD", + 380: "CUBEVALUE", + 381: "CUBEMEMBER", + 382: "CUBEMEMBERPROPERTY", + 383: "CUBERANKEDMEMBER", + 384: "HEX2BIN", + 385: "HEX2DEC", + 386: "HEX2OCT", + 387: "DEC2BIN", + 388: "DEC2HEX", + 389: "DEC2OCT", + 390: "OCT2BIN", + 391: "OCT2HEX", + 392: "OCT2DEC", + 393: "BIN2DEC", + 394: "BIN2OCT", + 395: "BIN2HEX", + 396: "IMSUB", + 397: "IMDIV", + 398: "IMPOWER", + 399: "IMABS", + 400: "IMSQRT", + 401: "IMLN", + 402: "IMLOG2", + 403: "IMLOG10", + 404: "IMSIN", + 405: "IMCOS", + 406: "IMEXP", + 407: "IMARGUMENT", + 408: "IMCONJUGATE", + 409: "IMAGINARY", + 410: "IMREAL", + 411: "COMPLEX", + 412: "IMSUM", + 413: "IMPRODUCT", + 414: "SERIESSUM", + 415: "FACTDOUBLE", + 416: "SQRTPI", + 417: "QUOTIENT", + 418: "DELTA", + 419: "GESTEP", + 420: "ISEVEN", + 421: "ISODD", + 422: "MROUND", + 423: "ERF", + 424: "ERFC", + 425: "BESSELJ", + 426: "BESSELK", + 427: "BESSELY", + 428: "BESSELI", + 429: "XIRR", + 430: "XNPV", + 431: "PRICEMAT", + 432: "YIELDMAT", + 433: "INTRATE", + 434: "RECEIVED", + 435: "DISC", + 436: "PRICEDISC", + 437: "YIELDDISC", + 438: "TBILLEQ", + 439: "TBILLPRICE", + 440: "TBILLYIELD", + 441: "PRICE", + 442: "YIELD", + 443: "DOLLARDE", + 444: "DOLLARFR", + 445: "NOMINAL", + 446: "EFFECT", + 447: "CUMPRINC", + 448: "CUMIPMT", + 449: "EDATE", + 450: "EOMONTH", + 451: "YEARFRAC", + 452: "COUPDAYBS", + 453: "COUPDAYS", + 454: "COUPDAYSNC", + 455: "COUPNCD", + 456: "COUPNUM", + 457: "COUPPCD", + 458: "DURATION", + 459: "MDURATION", + 460: "ODDLPRICE", + 461: "ODDLYIELD", + 462: "ODDFPRICE", + 463: "ODDFYIELD", + 464: "RANDBETWEEN", + 465: "WEEKNUM", + 466: "AMORDEGRC", + 467: "AMORLINC", + 468: "CONVERT", + 724: "SHEETJS", + 469: "ACCRINT", + 470: "ACCRINTM", + 471: "WORKDAY", + 472: "NETWORKDAYS", + 473: "GCD", + 474: "MULTINOMIAL", + 475: "LCM", + 476: "FVSCHEDULE", + 477: "CUBEKPIMEMBER", + 478: "CUBESET", + 479: "CUBESETCOUNT", + 480: "IFERROR", + 481: "COUNTIFS", + 482: "SUMIFS", + 483: "AVERAGEIF", + 484: "AVERAGEIFS" +}; +var FtabArgc = { + 2: 1, + 3: 1, + 10: 0, + 15: 1, + 16: 1, + 17: 1, + 18: 1, + 19: 0, + 20: 1, + 21: 1, + 22: 1, + 23: 1, + 24: 1, + 25: 1, + 26: 1, + 27: 2, + 30: 2, + 31: 3, + 32: 1, + 33: 1, + 34: 0, + 35: 0, + 38: 1, + 39: 2, + 40: 3, + 41: 3, + 42: 3, + 43: 3, + 44: 3, + 45: 3, + 47: 3, + 48: 2, + 53: 1, + 61: 3, + 63: 0, + 65: 3, + 66: 3, + 67: 1, + 68: 1, + 69: 1, + 70: 1, + 71: 1, + 72: 1, + 73: 1, + 74: 0, + 75: 1, + 76: 1, + 77: 1, + 79: 2, + 80: 2, + 83: 1, + 85: 0, + 86: 1, + 89: 0, + 90: 1, + 94: 0, + 95: 0, + 97: 2, + 98: 1, + 99: 1, + 101: 3, + 102: 3, + 105: 1, + 106: 1, + 108: 2, + 111: 1, + 112: 1, + 113: 1, + 114: 1, + 117: 2, + 118: 1, + 119: 4, + 121: 1, + 126: 1, + 127: 1, + 128: 1, + 129: 1, + 130: 1, + 131: 1, + 133: 1, + 134: 1, + 135: 1, + 136: 2, + 137: 2, + 138: 2, + 140: 1, + 141: 1, + 142: 3, + 143: 4, + 144: 4, + 161: 1, + 162: 1, + 163: 1, + 164: 1, + 165: 2, + 172: 1, + 175: 2, + 176: 2, + 177: 3, + 178: 2, + 179: 1, + 184: 1, + 186: 1, + 189: 3, + 190: 1, + 195: 3, + 196: 3, + 197: 1, + 198: 1, + 199: 3, + 201: 1, + 207: 4, + 210: 3, + 211: 1, + 212: 2, + 213: 2, + 214: 1, + 215: 1, + 225: 0, + 229: 1, + 230: 1, + 231: 1, + 232: 1, + 233: 1, + 234: 1, + 235: 3, + 244: 1, + 247: 4, + 252: 2, + 257: 1, + 261: 1, + 271: 1, + 273: 4, + 274: 2, + 275: 2, + 276: 2, + 277: 3, + 278: 3, + 279: 1, + 280: 3, + 281: 3, + 282: 3, + 283: 1, + 284: 1, + 285: 2, + 286: 4, + 287: 3, + 288: 2, + 289: 4, + 290: 3, + 291: 3, + 292: 3, + 293: 4, + 294: 1, + 295: 3, + 296: 1, + 297: 3, + 298: 1, + 299: 2, + 300: 3, + 301: 3, + 302: 4, + 303: 2, + 304: 2, + 305: 2, + 306: 2, + 307: 2, + 308: 2, + 309: 3, + 310: 2, + 311: 2, + 312: 2, + 313: 2, + 314: 2, + 315: 2, + 316: 4, + 325: 2, + 326: 2, + 327: 2, + 328: 2, + 331: 2, + 332: 2, + 337: 2, + 342: 1, + 343: 1, + 346: 2, + 347: 1, + 350: 4, + 351: 3, + 352: 1, + 353: 2, + 360: 1, + 368: 1, + 369: 1, + 370: 1, + 371: 1, + 372: 1, + 373: 1, + 374: 1, + 375: 1, + 376: 1, + 377: 1, + 378: 1, + 382: 3, + 385: 1, + 392: 1, + 393: 1, + 396: 2, + 397: 2, + 398: 2, + 399: 1, + 400: 1, + 401: 1, + 402: 1, + 403: 1, + 404: 1, + 405: 1, + 406: 1, + 407: 1, + 408: 1, + 409: 1, + 410: 1, + 414: 4, + 415: 1, + 416: 1, + 417: 2, + 420: 1, + 421: 1, + 422: 2, + 424: 1, + 425: 2, + 426: 2, + 427: 2, + 428: 2, + 430: 3, + 438: 3, + 439: 3, + 440: 3, + 443: 2, + 444: 2, + 445: 2, + 446: 2, + 447: 6, + 448: 6, + 449: 2, + 450: 2, + 464: 2, + 468: 3, + 476: 2, + 479: 1, + 480: 2, + 65535: 0 +}; +/* Part 3 TODO: actually parse formulae */ +function ods_to_csf_formula(f /*:string*/) { + if (f.slice(0, 3) == "of:") + f = f.slice(3); + /* 5.2 Basic Expressions */ + if (f.charCodeAt(0) == 61) { + f = f.slice(1); + if (f.charCodeAt(0) == 61) + f = f.slice(1); + } + f = f.replace(/COM\.MICROSOFT\./g, ""); + /* Part 3 Section 5.8 References */ + f = f.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g, function ($$, $1) { return $1.replace(/\./g, ""); }); + f = f.replace(/\$'([^']|'')+'/g, function ($$) { return $$.slice(1); }); + f = f.replace(/\$([^\]\. #$]+)/g, function ($$, $1) { return ($1).match(/^([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])?(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})?$/) ? $$ : $1; }); + /* TODO: something other than this */ + f = f.replace(/\[.(#[A-Z]*[?!])\]/g, "$1"); + return f.replace(/[;~]/g, ",").replace(/\|/g, ";"); +} +function csf_to_ods_formula(f /*:string*/) { + var o = "of:=" + f.replace(crefregex, "$1[.$2$3$4$5]").replace(/\]:\[/g, ":"); + /* TODO: something other than this */ + return o.replace(/;/g, "|").replace(/,/g, ";"); +} +function ods_to_csf_3D(r /*:string*/) { + r = r.replace(/\$'([^']|'')+'/g, function ($$) { return $$.slice(1); }); + r = r.replace(/\$([^\]\. #$]+)/g, function ($$, $1) { return ($1).match(/^([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])?(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})?$/) ? $$ : $1; }); + var a = r.split(":"); + var s = a[0].split(".")[0]; + return [s, a[0].split(".")[1] + (a.length > 1 ? (":" + (a[1].split(".")[1] || a[1].split(".")[0])) : "")]; +} +function csf_to_ods_3D(r /*:string*/) { + return r.replace(/!/, ".").replace(/:/, ":."); +} +var strs = {}; // shared strings +var _ssfopts = {}; // spreadsheet formatting options +/*global Map */ +var browser_has_Map = typeof Map !== 'undefined'; +function get_sst_id(sst /*:SST*/, str /*:string*/, rev) { + var i = 0, len = sst.length; + if (rev) { + if (browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) { + var revarr = browser_has_Map ? rev.get(str) : rev[str]; + for (; i < revarr.length; ++i) { + if (sst[revarr[i]].t === str) { + sst.Count++; + return revarr[i]; + } + } + } + } + else + for (; i < len; ++i) { + if (sst[i].t === str) { + sst.Count++; + return i; + } + } + sst[len] = ({ t: str } /*:any*/); + sst.Count++; + sst.Unique++; + if (rev) { + if (browser_has_Map) { + if (!rev.has(str)) + rev.set(str, []); + rev.get(str).push(len); + } + else { + if (!Object.prototype.hasOwnProperty.call(rev, str)) + rev[str] = []; + rev[str].push(len); + } + } + return len; +} +function col_obj_w(C /*:number*/, col) { + var p = ({ min: C + 1, max: C + 1 } /*:any*/); + /* wch (chars), wpx (pixels) */ + var wch = -1; + if (col.MDW) + MDW = col.MDW; + if (col.width != null) + p.customWidth = 1; + else if (col.wpx != null) + wch = px2char(col.wpx); + else if (col.wch != null) + wch = col.wch; + if (wch > -1) { + p.width = char2width(wch); + p.customWidth = 1; + } + else if (col.width != null) + p.width = col.width; + if (col.hidden) + p.hidden = true; + if (col.level != null) { + p.outlineLevel = p.level = col.level; + } + return p; +} +function default_margins(margins /*:Margins*/, mode /*:?string*/) { + if (!margins) + return; + var defs = [0.7, 0.7, 0.75, 0.75, 0.3, 0.3]; + if (mode == 'xlml') + defs = [1, 1, 1, 1, 0.5, 0.5]; + if (margins.left == null) + margins.left = defs[0]; + if (margins.right == null) + margins.right = defs[1]; + if (margins.top == null) + margins.top = defs[2]; + if (margins.bottom == null) + margins.bottom = defs[3]; + if (margins.header == null) + margins.header = defs[4]; + if (margins.footer == null) + margins.footer = defs[5]; +} +function get_cell_style(styles /*:Array*/, cell /*:Cell*/, opts) { + var z = opts.revssf[cell.z != null ? cell.z : "General"]; + var i = 0x3c, len = styles.length; + if (z == null && opts.ssf) { + for (; i < 0x188; ++i) + if (opts.ssf[i] == null) { + SSF__load(cell.z, i); + // $FlowIgnore + opts.ssf[i] = cell.z; + opts.revssf[cell.z] = z = i; + break; + } + } + for (i = 0; i != len; ++i) + if (styles[i].numFmtId === z) + return i; + styles[len] = { + numFmtId: z, + fontId: 0, + fillId: 0, + borderId: 0, + xfId: 0, + applyNumberFormat: 1 + }; + return len; +} +function safe_format(p /*:Cell*/, fmtid /*:number*/, fillid /*:?number*/, opts, themes, styles, date1904) { + try { + if (opts.cellNF) + p.z = table_fmt[fmtid]; + } + catch (e) { + if (opts.WTF) + throw e; + } + if (p.t === 'z' && !opts.cellStyles) + return; + if (p.t === 'd' && typeof p.v === 'string') + p.v = parseDate(p.v); + if ((!opts || opts.cellText !== false) && p.t !== 'z') + try { + if (table_fmt[fmtid] == null) + SSF__load(SSFImplicit[fmtid] || "General", fmtid); + if (p.t === 'e') + p.w = p.w || BErr[p.v]; + else if (fmtid === 0) { + if (p.t === 'n') { + if ((p.v | 0) === p.v) + p.w = p.v.toString(10); + else + p.w = SSF_general_num(p.v); + } + else if (p.t === 'd') { + var dd = datenum(p.v, !!date1904); + if ((dd | 0) === dd) + p.w = dd.toString(10); + else + p.w = SSF_general_num(dd); + } + else if (p.v === undefined) + return ""; + else + p.w = SSF_general(p.v, _ssfopts); + } + else if (p.t === 'd') + p.w = SSF_format(fmtid, datenum(p.v, !!date1904), _ssfopts); + else + p.w = SSF_format(fmtid, p.v, _ssfopts); + } + catch (e) { + if (opts.WTF) + throw e; + } + if (!opts.cellStyles) + return; + if (fillid != null) + try { + p.s = styles.Fills[fillid]; + if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) { + p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0); + if (opts.WTF) + p.s.fgColor.raw_rgb = themes.themeElements.clrScheme[p.s.fgColor.theme].rgb; + } + if (p.s.bgColor && p.s.bgColor.theme) { + p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0); + if (opts.WTF) + p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb; + } + } + catch (e) { + if (opts.WTF && styles.Fills) + throw e; + } +} +function check_ws(ws /*:Worksheet*/, sname /*:string*/, i /*:number*/) { + if (ws && ws['!ref']) { + var range = safe_decode_range(ws['!ref']); + if (range.e.c < range.s.c || range.e.r < range.s.r) + throw new Error("Bad range (" + i + "): " + ws['!ref']); + } +} +function parse_ws_xml_dim(ws /*:Worksheet*/, s /*:string*/) { + var d = safe_decode_range(s); + if (d.s.r <= d.e.r && d.s.c <= d.e.c && d.s.r >= 0 && d.s.c >= 0) + ws["!ref"] = encode_range(d); +} +var mergecregex = /<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g; +var sheetdataregex = /<(?:\w+:)?sheetData[^>]*>([\s\S]*)<\/(?:\w+:)?sheetData>/; +var hlinkregex = /<(?:\w:)?hyperlink [^>]*>/mg; +var dimregex = /"(\w*:\w*)"/; +var colregex = /<(?:\w:)?col\b[^>]*[\/]?>/g; +var afregex = /<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g; +var marginregex = /<(?:\w:)?pageMargins[^>]*\/>/g; +var sheetprregex = /<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/; +var sheetprregex2 = /<(?:\w:)?sheetPr[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetPr)>/; +var svsregex = /<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/; +/* 18.3 Worksheets */ +function parse_ws_xml(data /*:?string*/, opts, idx /*:number*/, rels, wb /*:WBWBProps*/, themes, styles) { + if (!data) + return data; + if (!rels) + rels = { '!id': {} }; + if (DENSE != null && opts.dense == null) + opts.dense = DENSE; + /* 18.3.1.99 worksheet CT_Worksheet */ + var s = ({} /*:any*/); + if (opts.dense) + s["!data"] = []; + var refguess /*:Range*/ = ({ s: { r: 2000000, c: 2000000 }, e: { r: 0, c: 0 } } /*:any*/); + var data1 = "", data2 = ""; + var mtch /*:?any*/ = data.match(sheetdataregex); + if (mtch) { + data1 = data.slice(0, mtch.index); + data2 = data.slice(mtch.index + mtch[0].length); + } + else + data1 = data2 = data; + /* 18.3.1.82 sheetPr CT_SheetPr */ + var sheetPr = data1.match(sheetprregex); + if (sheetPr) + parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx); + else if ((sheetPr = data1.match(sheetprregex2))) + parse_ws_xml_sheetpr2(sheetPr[0], sheetPr[1] || "", s, wb, idx, styles, themes); + /* 18.3.1.35 dimension CT_SheetDimension */ + var ridx = (data1.match(/<(?:\w*:)?dimension/) || { index: -1 }).index; + if (ridx > 0) { + var ref = data1.slice(ridx, ridx + 50).match(dimregex); + if (ref && !(opts && opts.nodim)) + parse_ws_xml_dim(s, ref[1]); + } + /* 18.3.1.88 sheetViews CT_SheetViews */ + var svs = data1.match(svsregex); + if (svs && svs[1]) + parse_ws_xml_sheetviews(svs[1], wb); + /* 18.3.1.17 cols CT_Cols */ + var columns /*:Array*/ = []; + if (opts.cellStyles) { + /* 18.3.1.13 col CT_Col */ + var cols = data1.match(colregex); + if (cols) + parse_ws_xml_cols(columns, cols); + } + /* 18.3.1.80 sheetData CT_SheetData ? */ + if (mtch) + parse_ws_xml_data(mtch[1], s, opts, refguess, themes, styles, wb); + /* 18.3.1.2 autoFilter CT_AutoFilter */ + var afilter = data2.match(afregex); + if (afilter) + s['!autofilter'] = parse_ws_xml_autofilter(afilter[0]); + /* 18.3.1.55 mergeCells CT_MergeCells */ + var merges /*:Array*/ = []; + var _merge = data2.match(mergecregex); + if (_merge) + for (ridx = 0; ridx != _merge.length; ++ridx) + merges[ridx] = safe_decode_range(_merge[ridx].slice(_merge[ridx].indexOf("\"") + 1)); + /* 18.3.1.48 hyperlinks CT_Hyperlinks */ + var hlink = data2.match(hlinkregex); + if (hlink) + parse_ws_xml_hlinks(s, hlink, rels); + /* 18.3.1.62 pageMargins CT_PageMargins */ + var margins = data2.match(marginregex); + if (margins) + s['!margins'] = parse_ws_xml_margins(parsexmltag(margins[0])); + /* legacyDrawing */ + var m; + if ((m = data2.match(/legacyDrawing r:id="(.*?)"/))) + s['!legrel'] = m[1]; + if (opts && opts.nodim) + refguess.s.c = refguess.s.r = 0; + if (!s["!ref"] && refguess.e.c >= refguess.s.c && refguess.e.r >= refguess.s.r) + s["!ref"] = encode_range(refguess); + if (opts.sheetRows > 0 && s["!ref"]) { + var tmpref = safe_decode_range(s["!ref"]); + if (opts.sheetRows <= +tmpref.e.r) { + tmpref.e.r = opts.sheetRows - 1; + if (tmpref.e.r > refguess.e.r) + tmpref.e.r = refguess.e.r; + if (tmpref.e.r < tmpref.s.r) + tmpref.s.r = tmpref.e.r; + if (tmpref.e.c > refguess.e.c) + tmpref.e.c = refguess.e.c; + if (tmpref.e.c < tmpref.s.c) + tmpref.s.c = tmpref.e.c; + s["!fullref"] = s["!ref"]; + s["!ref"] = encode_range(tmpref); + } + } + if (columns.length > 0) + s["!cols"] = columns; + if (merges.length > 0) + s["!merges"] = merges; + if (rels['!id'][s['!legrel']]) + s['!legdrawel'] = rels['!id'][s['!legrel']]; + return s; +} +function write_ws_xml_merges(merges /*:Array*/) { + if (merges.length === 0) + return ""; + var o = ''; + for (var i = 0; i != merges.length; ++i) + o += ''; + return o + ''; +} +/* 18.3.1.82-3 sheetPr CT_ChartsheetPr / CT_SheetPr */ +function parse_ws_xml_sheetpr(sheetPr /*:string*/, s, wb /*:WBWBProps*/, idx /*:number*/) { + var data = parsexmltag(sheetPr); + if (!wb.Sheets[idx]) + wb.Sheets[idx] = {}; + if (data.codeName) + wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName)); +} +function parse_ws_xml_sheetpr2(sheetPr /*:string*/, body /*:string*/, s, wb /*:WBWBProps*/, idx /*:number*/) { + parse_ws_xml_sheetpr(sheetPr.slice(0, sheetPr.indexOf(">")), s, wb, idx); +} +function write_ws_xml_sheetpr(ws, wb, idx, opts, o) { + var needed = false; + var props = {}, payload = null; + if (opts.bookType !== 'xlsx' && wb.vbaraw) { + var cname = wb.SheetNames[idx]; + try { + if (wb.Workbook) + cname = wb.Workbook.Sheets[idx].CodeName || cname; + } + catch (e) { } + needed = true; + props.codeName = utf8write(escapexml(cname)); + } + if (ws && ws["!outline"]) { + var outlineprops = { summaryBelow: 1, summaryRight: 1 }; + if (ws["!outline"].above) + outlineprops.summaryBelow = 0; + if (ws["!outline"].left) + outlineprops.summaryRight = 0; + payload = (payload || "") + writextag('outlinePr', null, outlineprops); + } + if (!needed && !payload) + return; + o[o.length] = (writextag('sheetPr', payload, props)); +} +/* 18.3.1.85 sheetProtection CT_SheetProtection */ +var sheetprot_deffalse = ["objects", "scenarios", "selectLockedCells", "selectUnlockedCells"]; +var sheetprot_deftrue = [ + "formatColumns", "formatRows", "formatCells", + "insertColumns", "insertRows", "insertHyperlinks", + "deleteColumns", "deleteRows", + "sort", "autoFilter", "pivotTables" +]; +function write_ws_xml_protection(sp) { + // algorithmName, hashValue, saltValue, spinCount + var o = ({ sheet: 1 } /*:any*/); + sheetprot_deffalse.forEach(function (n) { if (sp[n] != null && sp[n]) + o[n] = "1"; }); + sheetprot_deftrue.forEach(function (n) { if (sp[n] != null && !sp[n]) + o[n] = "0"; }); + /* TODO: algorithm */ + if (sp.password) + o.password = crypto_CreatePasswordVerifier_Method1(sp.password).toString(16).toUpperCase(); + return writextag('sheetProtection', null, o); +} +function parse_ws_xml_hlinks(s, data /*:Array*/, rels) { + var dense = s["!data"] != null; + for (var i = 0; i != data.length; ++i) { + var val = parsexmltag(utf8read(data[i]), true); + if (!val.ref) + return; + var rel = ((rels || {})['!id'] || [])[val.id]; + if (rel) { + val.Target = rel.Target; + if (val.location) + val.Target += "#" + unescapexml(val.location); + } + else { + val.Target = "#" + unescapexml(val.location); + rel = { Target: val.Target, TargetMode: 'Internal' }; + } + val.Rel = rel; + if (val.tooltip) { + val.Tooltip = val.tooltip; + delete val.tooltip; + } + var rng = safe_decode_range(val.ref); + for (var R = rng.s.r; R <= rng.e.r; ++R) + for (var C = rng.s.c; C <= rng.e.c; ++C) { + var addr = encode_col(C) + encode_row(R); + if (dense) { + if (!s["!data"][R]) + s["!data"][R] = []; + if (!s["!data"][R][C]) + s["!data"][R][C] = { t: "z", v: undefined }; + s["!data"][R][C].l = val; + } + else { + if (!s[addr]) + s[addr] = { t: "z", v: undefined }; + s[addr].l = val; + } + } + } +} +function parse_ws_xml_margins(margin) { + var o = {}; + ["left", "right", "top", "bottom", "header", "footer"].forEach(function (k) { + if (margin[k]) + o[k] = parseFloat(margin[k]); + }); + return o; +} +function write_ws_xml_margins(margin) { + default_margins(margin); + return writextag('pageMargins', null, margin); +} +function parse_ws_xml_cols(columns, cols) { + var seencol = false; + for (var coli = 0; coli != cols.length; ++coli) { + var coll = parsexmltag(cols[coli], true); + if (coll.hidden) + coll.hidden = parsexmlbool(coll.hidden); + var colm = parseInt(coll.min, 10) - 1, colM = parseInt(coll.max, 10) - 1; + if (coll.outlineLevel) + coll.level = (+coll.outlineLevel || 0); + delete coll.min; + delete coll.max; + coll.width = +coll.width; + if (!seencol && coll.width) { + seencol = true; + find_mdw_colw(coll.width); + } + process_col(coll); + while (colm <= colM) + columns[colm++] = dup(coll); + } +} +function write_ws_xml_cols(ws, cols) { + var o = [""], col; + for (var i = 0; i != cols.length; ++i) { + if (!(col = cols[i])) + continue; + o[o.length] = (writextag('col', null, col_obj_w(i, col))); + } + o[o.length] = ""; + return o.join(""); +} +function parse_ws_xml_autofilter(data /*:string*/) { + var o = { ref: (data.match(/ref="([^"]*)"/) || [])[1] }; + return o; +} +function write_ws_xml_autofilter(data, ws, wb, idx) { + var ref = typeof data.ref == "string" ? data.ref : encode_range(data.ref); + if (!wb.Workbook) + wb.Workbook = ({ Sheets: [] } /*:any*/); + if (!wb.Workbook.Names) + wb.Workbook.Names = []; + var names /*: Array */ = wb.Workbook.Names; + var range = decode_range(ref); + if (range.s.r == range.e.r) { + range.e.r = decode_range(ws["!ref"]).e.r; + ref = encode_range(range); + } + for (var i = 0; i < names.length; ++i) { + var name = names[i]; + if (name.Name != '_xlnm._FilterDatabase') + continue; + if (name.Sheet != idx) + continue; + name.Ref = formula_quote_sheet_name(wb.SheetNames[idx]) + "!" + fix_range(ref); + break; + } + if (i == names.length) + names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: "'" + wb.SheetNames[idx] + "'!" + ref }); + return writextag("autoFilter", null, { ref: ref }); +} +/* 18.3.1.88 sheetViews CT_SheetViews */ +/* 18.3.1.87 sheetView CT_SheetView */ +var sviewregex = /<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/?>/g; +function parse_ws_xml_sheetviews(data, wb /*:WBWBProps*/) { + if (!wb.Views) + wb.Views = [{}]; + (data.match(sviewregex) || []).forEach(function (r /*:string*/, i /*:number*/) { + var tag = parsexmltag(r); + // $FlowIgnore + if (!wb.Views[i]) + wb.Views[i] = {}; + // $FlowIgnore + if (+tag.zoomScale) + wb.Views[i].zoom = +tag.zoomScale; + // $FlowIgnore + if (tag.rightToLeft && parsexmlbool(tag.rightToLeft)) + wb.Views[i].RTL = true; + }); +} +function write_ws_xml_sheetviews(ws, opts, idx, wb) { + var sview = ({ workbookViewId: "0" } /*:any*/); + // $FlowIgnore + if ((((wb || {}).Workbook || {}).Views || [])[0]) + sview.rightToLeft = wb.Workbook.Views[0].RTL ? "1" : "0"; + return writextag("sheetViews", writextag("sheetView", null, sview), {}); +} +function write_ws_xml_cell(cell /*:Cell*/, ref, ws, opts, idx, wb, date1904) { + if (cell.c) + ws['!comments'].push([ref, cell.c]); + if ((cell.v === undefined || cell.t === "z" && !(opts || {}).sheetStubs) && typeof cell.f !== "string" && typeof cell.z == "undefined") + return ""; + var vv = ""; + var oldt = cell.t, oldv = cell.v; + if (cell.t !== "z") + switch (cell.t) { + case 'b': + vv = cell.v ? "1" : "0"; + break; + case 'n': + if (isNaN(cell.v)) { + cell.t = "e"; + vv = BErr[cell.v = 0x24]; + } // #NUM! + else if (!isFinite(cell.v)) { + cell.t = "e"; + vv = BErr[cell.v = 0x07]; + } // #DIV/0! + else + vv = '' + cell.v; + break; + case 'e': + vv = BErr[cell.v]; + break; + case 'd': + if (opts && opts.cellDates) { + var _vv = parseDate(cell.v, date1904); + vv = _vv.toISOString(); + if (_vv.getUTCFullYear() < 1900) + vv = vv.slice(vv.indexOf("T") + 1).replace("Z", ""); + } + else { + cell = dup(cell); + cell.t = 'n'; + vv = '' + (cell.v = datenum(parseDate(cell.v, date1904), date1904)); + } + if (typeof cell.z === 'undefined') + cell.z = table_fmt[14]; + break; + default: + vv = cell.v; + break; + } + var v = (cell.t == "z" || cell.v == null) ? "" : writetag('v', escapexml(vv)), o = ({ r: ref } /*:any*/); + /* TODO: cell style */ + var os = get_cell_style(opts.cellXfs, cell, opts); + if (os !== 0) + o.s = os; + switch (cell.t) { + case 'n': break; + case 'd': + o.t = "d"; + break; + case 'b': + o.t = "b"; + break; + case 'e': + o.t = "e"; + break; + case 'z': break; + default: + if (cell.v == null) { + delete cell.t; + break; + } + if (cell.v.length > 32767) + throw new Error("Text length must not exceed 32767 characters"); + if (opts && opts.bookSST) { + v = writetag('v', '' + get_sst_id(opts.Strings, cell.v, opts.revStrings)); + o.t = "s"; + break; + } + else + o.t = "str"; + break; + } + if (cell.t != oldt) { + cell.t = oldt; + cell.v = oldv; + } + if (typeof cell.f == "string" && cell.f) { + var ff = cell.F && cell.F.slice(0, ref.length) == ref ? { t: "array", ref: cell.F } : null; + v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : ""); + } + if (cell.l) { + cell.l.display = escapexml(vv); + ws['!links'].push([ref, cell.l]); + } + if (cell.D) + o.cm = 1; + return writextag('c', v, o); +} +var parse_ws_xml_data = /*#__PURE__*/ (function () { + var cellregex = /<(?:\w+:)?c[ \/>]/, rowregex = /<\/(?:\w+:)?row>/; + var rregex = /r=["']([^"']*)["']/, isregex = /<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/; + var refregex = /ref=["']([^"']*)["']/; + var match_v = matchtag("v"), match_f = matchtag("f"); + return function parse_ws_xml_data(sdata /*:string*/, s, opts, guess /*:Range*/, themes, styles, wb) { + var ri = 0, x = "", cells /*:Array*/ = [], cref /*:?Array*/ = [], idx = 0, i = 0, cc = 0, d = "", p /*:any*/; + var tag, tagr = 0, tagc = 0; + var sstr, ftag; + var fmtid = 0, fillid = 0; + var do_format = Array.isArray(styles.CellXf), cf; + var arrayf /*:Array<[Range, string]>*/ = []; + var sharedf = []; + var dense = s["!data"] != null; + var rows /*:Array*/ = [], rowobj = {}, rowrite = false; + var sheetStubs = !!opts.sheetStubs; + var date1904 = !!((wb || {}).WBProps || {}).date1904; + for (var marr = sdata.split(rowregex), mt = 0, marrlen = marr.length; mt != marrlen; ++mt) { + x = marr[mt].trim(); + var xlen = x.length; + if (xlen === 0) + continue; + /* 18.3.1.73 row CT_Row */ + var rstarti = 0; + outa: for (ri = 0; ri < xlen; ++ri) + switch ( /*x.charCodeAt(ri)*/x[ri]) { + case ">" /*62*/: + if ( /*x.charCodeAt(ri-1) != 47*/x[ri - 1] != "/") { + ++ri; + break outa; + } + if (opts && opts.cellStyles) { + // TODO: avoid duplication + tag = parsexmltag(x.slice(rstarti, ri), true); + tagr = tag.r != null ? parseInt(tag.r, 10) : tagr + 1; + tagc = -1; + if (opts.sheetRows && opts.sheetRows < tagr) + continue; + rowobj = {}; + rowrite = false; + if (tag.ht) { + rowrite = true; + rowobj.hpt = parseFloat(tag.ht); + rowobj.hpx = pt2px(rowobj.hpt); + } + if (tag.hidden && parsexmlbool(tag.hidden)) { + rowrite = true; + rowobj.hidden = true; + } + if (tag.outlineLevel != null) { + rowrite = true; + rowobj.level = +tag.outlineLevel; + } + if (rowrite) + rows[tagr - 1] = rowobj; + } + break; + case "<" /*60*/: + rstarti = ri; + break; + } + if (rstarti >= ri) + break; + tag = parsexmltag(x.slice(rstarti, ri), true); + tagr = tag.r != null ? parseInt(tag.r, 10) : tagr + 1; + tagc = -1; + if (opts.sheetRows && opts.sheetRows < tagr) + continue; + if (!opts.nodim) { + if (guess.s.r > tagr - 1) + guess.s.r = tagr - 1; + if (guess.e.r < tagr - 1) + guess.e.r = tagr - 1; + } + if (opts && opts.cellStyles) { + rowobj = {}; + rowrite = false; + if (tag.ht) { + rowrite = true; + rowobj.hpt = parseFloat(tag.ht); + rowobj.hpx = pt2px(rowobj.hpt); + } + if (tag.hidden && parsexmlbool(tag.hidden)) { + rowrite = true; + rowobj.hidden = true; + } + if (tag.outlineLevel != null) { + rowrite = true; + rowobj.level = +tag.outlineLevel; + } + if (rowrite) + rows[tagr - 1] = rowobj; + } + /* 18.3.1.4 c CT_Cell */ + cells = x.slice(ri).split(cellregex); + for (var rslice = 0; rslice != cells.length; ++rslice) + if (cells[rslice].trim().charAt(0) != "<") + break; + cells = cells.slice(rslice); + for (ri = 0; ri != cells.length; ++ri) { + x = cells[ri].trim(); + if (x.length === 0) + continue; + cref = x.match(rregex); + idx = ri; + i = 0; + cc = 0; + x = "" : "") + x; + if (cref != null && cref.length === 2) { + idx = 0; + d = cref[1]; + for (i = 0; i != d.length; ++i) { + if ((cc = d.charCodeAt(i) - 64) < 1 || cc > 26) + break; + idx = 26 * idx + cc; + } + --idx; + tagc = idx; + } + else + ++tagc; + for (i = 0; i != x.length; ++i) + if (x.charCodeAt(i) === 62) + break; + ++i; + tag = parsexmltag(x.slice(0, i), true); + if (!tag.r) + tag.r = encode_cell({ r: tagr - 1, c: tagc }); + d = x.slice(i); + p = ({ t: "" } /*:any*/); + if ((cref = d.match(match_v)) != null && /*::cref != null && */ cref[1] !== '') + p.v = unescapexml(cref[1]); + if (opts.cellFormula) { + if ((cref = d.match(match_f)) != null /*:: && cref != null*/) { + if (cref[1] == "") { + if ( /*::cref != null && cref[0] != null && */cref[0].indexOf('t="shared"') > -1) { + // TODO: parse formula + ftag = parsexmltag(cref[0]); + if (sharedf[ftag.si]) + p.f = shift_formula_xlsx(sharedf[ftag.si][1], sharedf[ftag.si][2] /*[0].ref*/, tag.r); + } + } + else { + /* TODO: match against XLSXFutureFunctions */ + p.f = unescapexml(utf8read(cref[1]), true); + if (!opts.xlfn) + p.f = _xlfn(p.f); + if ( /*::cref != null && cref[0] != null && */cref[0].indexOf('t="array"') > -1) { + p.F = (d.match(refregex) || [])[1]; + if (p.F.indexOf(":") > -1) + arrayf.push([safe_decode_range(p.F), p.F]); + } + else if ( /*::cref != null && cref[0] != null && */cref[0].indexOf('t="shared"') > -1) { + // TODO: parse formula + ftag = parsexmltag(cref[0]); + var ___f = unescapexml(utf8read(cref[1])); + if (!opts.xlfn) + ___f = _xlfn(___f); + sharedf[parseInt(ftag.si, 10)] = [ftag, ___f, tag.r]; + } + } + } + else if ((cref = d.match(/]*\/>/))) { + ftag = parsexmltag(cref[0]); + if (sharedf[ftag.si]) + p.f = shift_formula_xlsx(sharedf[ftag.si][1], sharedf[ftag.si][2] /*[0].ref*/, tag.r); + } + /* TODO: factor out contains logic */ + var _tag = decode_cell(tag.r); + for (i = 0; i < arrayf.length; ++i) + if (_tag.r >= arrayf[i][0].s.r && _tag.r <= arrayf[i][0].e.r) + if (_tag.c >= arrayf[i][0].s.c && _tag.c <= arrayf[i][0].e.c) + p.F = arrayf[i][1]; + } + if (tag.t == null && p.v === undefined) { + if (p.f || p.F) { + p.v = 0; + p.t = "n"; + } + else if (!sheetStubs) + continue; + else + p.t = "z"; + } + else + p.t = tag.t || "n"; + if (guess.s.c > tagc) + guess.s.c = tagc; + if (guess.e.c < tagc) + guess.e.c = tagc; + /* 18.18.11 t ST_CellType */ + switch (p.t) { + case 'n': + if (p.v == "" || p.v == null) { + if (!sheetStubs) + continue; + p.t = 'z'; + } + else + p.v = parseFloat(p.v); + break; + case 's': + if (typeof p.v == 'undefined') { + if (!sheetStubs) + continue; + p.t = 'z'; + } + else { + sstr = strs[parseInt(p.v, 10)]; + p.v = sstr.t; + p.r = sstr.r; + if (opts.cellHTML) + p.h = sstr.h; + } + break; + case 'str': + p.t = "s"; + p.v = (p.v != null) ? unescapexml(utf8read(p.v), true) : ''; + if (opts.cellHTML) + p.h = escapehtml(p.v); + break; + case 'inlineStr': + cref = d.match(isregex); + p.t = 's'; + if (cref != null && (sstr = parse_si(cref[1]))) { + p.v = sstr.t; + if (opts.cellHTML) + p.h = sstr.h; + } + else + p.v = ""; + break; + case 'b': + p.v = parsexmlbool(p.v); + break; + case 'd': + if (opts.cellDates) + p.v = parseDate(p.v, date1904); + else { + p.v = datenum(parseDate(p.v, date1904), date1904); + p.t = 'n'; + } + break; + /* error string in .w, number in .v */ + case 'e': + if (!opts || opts.cellText !== false) + p.w = p.v; + p.v = RBErr[p.v]; + break; + } + /* formatting */ + fmtid = fillid = 0; + cf = null; + if (do_format && tag.s !== undefined) { + cf = styles.CellXf[tag.s]; + if (cf != null) { + if (cf.numFmtId != null) + fmtid = cf.numFmtId; + if (opts.cellStyles) { + if (cf.fillId != null) + fillid = cf.fillId; + } + } + } + safe_format(p, fmtid, fillid, opts, themes, styles, date1904); + if (opts.cellDates && do_format && p.t == 'n' && fmt_is_date(table_fmt[fmtid])) { + p.v = numdate(p.v + (date1904 ? 1462 : 0)); + p.t = typeof p.v == "number" ? 'n' : 'd'; + } + if (tag.cm && opts.xlmeta) { + var cm = (opts.xlmeta.Cell || [])[+tag.cm - 1]; + if (cm && cm.type == 'XLDAPR') + p.D = true; + } + var _r; + if (opts.nodim) { + _r = decode_cell(tag.r); + if (guess.s.r > _r.r) + guess.s.r = _r.r; + if (guess.e.r < _r.r) + guess.e.r = _r.r; + } + if (dense) { + _r = decode_cell(tag.r); + if (!s["!data"][_r.r]) + s["!data"][_r.r] = []; + s["!data"][_r.r][_r.c] = p; + } + else + s[tag.r] = p; + } + } + if (rows.length > 0) + s['!rows'] = rows; + }; +})(); +function write_ws_xml_data(ws /*:Worksheet*/, opts, idx /*:number*/, wb /*:Workbook*/ /*::, rels*/) { + var o /*:Array*/ = [], r /*:Array*/ = [], range = safe_decode_range(ws['!ref']), cell = "", ref, rr = "", cols /*:Array*/ = [], R = 0, C = 0, rows = ws['!rows']; + var dense = ws["!data"] != null; + var params = ({ r: rr } /*:any*/), row /*:RowInfo*/, height = -1; + var date1904 = (((wb || {}).Workbook || {}).WBProps || {}).date1904; + for (C = range.s.c; C <= range.e.c; ++C) + cols[C] = encode_col(C); + for (R = range.s.r; R <= range.e.r; ++R) { + r = []; + rr = encode_row(R); + for (C = range.s.c; C <= range.e.c; ++C) { + ref = cols[C] + rr; + var _cell = dense ? (ws["!data"][R] || [])[C] : ws[ref]; + if (_cell === undefined) + continue; + if ((cell = write_ws_xml_cell(_cell, ref, ws, opts, idx, wb, date1904)) != null) + r.push(cell); + } + if (r.length > 0 || (rows && rows[R])) { + params = ({ r: rr } /*:any*/); + if (rows && rows[R]) { + row = rows[R]; + if (row.hidden) + params.hidden = 1; + height = -1; + if (row.hpx) + height = px2pt(row.hpx); + else if (row.hpt) + height = row.hpt; + if (height > -1) { + params.ht = height; + params.customHeight = 1; + } + if (row.level) { + params.outlineLevel = row.level; + } + } + o[o.length] = (writextag('row', r.join(""), params)); + } + } + if (rows) + for (; R < rows.length; ++R) { + if (rows && rows[R]) { + params = ({ r: R + 1 } /*:any*/); + row = rows[R]; + if (row.hidden) + params.hidden = 1; + height = -1; + if (row.hpx) + height = px2pt(row.hpx); + else if (row.hpt) + height = row.hpt; + if (height > -1) { + params.ht = height; + params.customHeight = 1; + } + if (row.level) { + params.outlineLevel = row.level; + } + o[o.length] = (writextag('row', "", params)); + } + } + return o.join(""); +} +function write_ws_xml(idx /*:number*/, opts, wb /*:Workbook*/, rels) { + var o = [XML_HEADER, writextag('worksheet', null, { + 'xmlns': XMLNS_main[0], + 'xmlns:r': XMLNS.r + })]; + var s = wb.SheetNames[idx], sidx = 0, rdata = ""; + var ws = wb.Sheets[s]; + if (ws == null) + ws = {}; + var ref = ws['!ref'] || 'A1'; + var range = safe_decode_range(ref); + if (range.e.c > 0x3FFF || range.e.r > 0xFFFFF) { + if (opts.WTF) + throw new Error("Range " + ref + " exceeds format limit A1:XFD1048576"); + range.e.c = Math.min(range.e.c, 0x3FFF); + range.e.r = Math.min(range.e.c, 0xFFFFF); + ref = encode_range(range); + } + if (!rels) + rels = {}; + ws['!comments'] = []; + var _drawing = []; + write_ws_xml_sheetpr(ws, wb, idx, opts, o); + o[o.length] = (writextag('dimension', null, { 'ref': ref })); + o[o.length] = write_ws_xml_sheetviews(ws, opts, idx, wb); + /* TODO: store in WB, process styles */ + if (opts.sheetFormat) + o[o.length] = (writextag('sheetFormatPr', null, { + defaultRowHeight: opts.sheetFormat.defaultRowHeight || '16', + baseColWidth: opts.sheetFormat.baseColWidth || '10', + outlineLevelRow: opts.sheetFormat.outlineLevelRow || '7' + })); + if (ws['!cols'] != null && ws['!cols'].length > 0) + o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); + o[sidx = o.length] = ''; + ws['!links'] = []; + if (ws['!ref'] != null) { + rdata = write_ws_xml_data(ws, opts, idx, wb, rels); + if (rdata.length > 0) + o[o.length] = (rdata); + } + if (o.length > sidx + 1) { + o[o.length] = (''); + o[sidx] = o[sidx].replace("/>", ">"); + } + /* sheetCalcPr */ + if (ws['!protect']) + o[o.length] = write_ws_xml_protection(ws['!protect']); + /* protectedRanges */ + /* scenarios */ + if (ws['!autofilter'] != null) + o[o.length] = write_ws_xml_autofilter(ws['!autofilter'], ws, wb, idx); + /* sortState */ + /* dataConsolidate */ + /* customSheetViews */ + if (ws['!merges'] != null && ws['!merges'].length > 0) + o[o.length] = (write_ws_xml_merges(ws['!merges'])); + /* phoneticPr */ + /* conditionalFormatting */ + /* dataValidations */ + var relc = -1, rel, rId = -1; + if ( /*::(*/ws['!links'] /*::||[])*/.length > 0) { + o[o.length] = ""; + /*::(*/ ws['!links'] /*::||[])*/.forEach(function (l) { + if (!l[1].Target) + return; + rel = ({ "ref": l[0] } /*:any*/); + if (l[1].Target.charAt(0) != "#") { + rId = add_rels(rels, -1, escapexml(l[1].Target).replace(/#.*$/, ""), RELS.HLINK); + rel["r:id"] = "rId" + rId; + } + if ((relc = l[1].Target.indexOf("#")) > -1) + rel.location = escapexml(l[1].Target.slice(relc + 1)); + if (l[1].Tooltip) + rel.tooltip = escapexml(l[1].Tooltip); + rel.display = l[1].display; + o[o.length] = writextag("hyperlink", null, rel); + }); + o[o.length] = ""; + } + delete ws['!links']; + /* printOptions */ + if (ws['!margins'] != null) + o[o.length] = write_ws_xml_margins(ws['!margins']); + /* pageSetup */ + /* headerFooter */ + /* rowBreaks */ + /* colBreaks */ + /* customProperties */ + /* cellWatches */ + if (!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) + o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, { numberStoredAsText: 1, sqref: ref })); + /* smartTags */ + if (_drawing.length > 0) { + rId = add_rels(rels, -1, "../drawings/drawing" + (idx + 1) + ".xml", RELS.DRAW); + o[o.length] = writextag("drawing", null, { "r:id": "rId" + rId }); + ws['!drawing'] = _drawing; + } + if (ws['!comments'].length > 0) { + rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx + 1) + ".vml", RELS.VML); + o[o.length] = writextag("legacyDrawing", null, { "r:id": "rId" + rId }); + ws['!legacy'] = rId; + } + /* legacyDrawingHF */ + /* picture */ + /* oleObjects */ + /* controls */ + /* webPublishItems */ + /* tableParts */ + /* extLst */ + if (o.length > 1) { + o[o.length] = (''); + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* [MS-XLSB] 2.4.726 BrtRowHdr */ +function parse_BrtRowHdr(data, length) { + var z = ({} /*:any*/); + var tgt = data.l + length; + z.r = data.read_shift(4); + data.l += 4; // TODO: ixfe + var miyRw = data.read_shift(2); + data.l += 1; // TODO: top/bot padding + var flags = data.read_shift(1); + data.l = tgt; + if (flags & 0x07) + z.level = flags & 0x07; + if (flags & 0x10) + z.hidden = true; + if (flags & 0x20) + z.hpt = miyRw / 20; + return z; +} +function write_BrtRowHdr(R /*:number*/, range, ws) { + var o = new_buf(17 + 8 * 16); + var row = (ws['!rows'] || [])[R] || {}; + o.write_shift(4, R); + o.write_shift(4, 0); /* TODO: ixfe */ + var miyRw = 0x0140; + if (row.hpx) + miyRw = px2pt(row.hpx) * 20; + else if (row.hpt) + miyRw = row.hpt * 20; + o.write_shift(2, miyRw); + o.write_shift(1, 0); /* top/bot padding */ + var flags = 0x0; + if (row.level) + flags |= row.level; + if (row.hidden) + flags |= 0x10; + if (row.hpx || row.hpt) + flags |= 0x20; + o.write_shift(1, flags); + o.write_shift(1, 0); /* phonetic guide */ + /* [MS-XLSB] 2.5.8 BrtColSpan explains the mechanism */ + var ncolspan = 0, lcs = o.l; + o.l += 4; + var caddr = { r: R, c: 0 }; + var dense = ws["!data"] != null; + for (var i = 0; i < 16; ++i) { + if ((range.s.c > ((i + 1) << 10)) || (range.e.c < (i << 10))) + continue; + var first = -1, last = -1; + for (var j = (i << 10); j < ((i + 1) << 10); ++j) { + caddr.c = j; + var cell = dense ? (ws["!data"][caddr.r] || [])[caddr.c] : ws[encode_cell(caddr)]; + if (cell) { + if (first < 0) + first = j; + last = j; + } + } + if (first < 0) + continue; + ++ncolspan; + o.write_shift(4, first); + o.write_shift(4, last); + } + var l = o.l; + o.l = lcs; + o.write_shift(4, ncolspan); + o.l = l; + return o.length > o.l ? o.slice(0, o.l) : o; +} +function write_row_header(ba, ws, range, R) { + var o = write_BrtRowHdr(R, range, ws); + if ((o.length > 17) || (ws['!rows'] || [])[R]) + write_record(ba, 0x0000 /* BrtRowHdr */, o); +} +/* [MS-XLSB] 2.4.820 BrtWsDim */ +var parse_BrtWsDim = parse_UncheckedRfX; +var write_BrtWsDim = write_UncheckedRfX; +/* [MS-XLSB] 2.4.821 BrtWsFmtInfo */ +function parse_BrtWsFmtInfo( /*::data, length*/) { +} +//function write_BrtWsFmtInfo(ws, o) { } +/* [MS-XLSB] 2.4.823 BrtWsProp */ +function parse_BrtWsProp(data, length) { + var z = {}; + var f = data[data.l]; + ++data.l; + z.above = !(f & 0x40); + z.left = !(f & 0x80); + /* TODO: pull flags */ + data.l += 18; + z.name = parse_XLSBCodeName(data, length - 19); + return z; +} +function write_BrtWsProp(str, outl, o) { + if (o == null) + o = new_buf(84 + 4 * str.length); + var f = 0xC0; + if (outl) { + if (outl.above) + f &= ~0x40; + if (outl.left) + f &= ~0x80; + } + o.write_shift(1, f); + for (var i = 1; i < 3; ++i) + o.write_shift(1, 0); + write_BrtColor({ auto: 1 }, o); + o.write_shift(-4, -1); + o.write_shift(-4, -1); + write_XLSBCodeName(str, o); + return o.slice(0, o.l); +} +/* [MS-XLSB] 2.4.306 BrtCellBlank */ +function parse_BrtCellBlank(data) { + var cell = parse_XLSBCell(data); + return [cell]; +} +function write_BrtCellBlank(cell, ncell, o) { + if (o == null) + o = new_buf(8); + return write_XLSBCell(ncell, o); +} +function parse_BrtShortBlank(data) { + var cell = parse_XLSBShortCell(data); + return [cell]; +} +function write_BrtShortBlank(cell, ncell, o) { + if (o == null) + o = new_buf(4); + return write_XLSBShortCell(ncell, o); +} +/* [MS-XLSB] 2.4.307 BrtCellBool */ +function parse_BrtCellBool(data) { + var cell = parse_XLSBCell(data); + var fBool = data.read_shift(1); + return [cell, fBool, 'b']; +} +function write_BrtCellBool(cell, ncell, o) { + if (o == null) + o = new_buf(9); + write_XLSBCell(ncell, o); + o.write_shift(1, cell.v ? 1 : 0); + return o; +} +function parse_BrtShortBool(data) { + var cell = parse_XLSBShortCell(data); + var fBool = data.read_shift(1); + return [cell, fBool, 'b']; +} +function write_BrtShortBool(cell, ncell, o) { + if (o == null) + o = new_buf(5); + write_XLSBShortCell(ncell, o); + o.write_shift(1, cell.v ? 1 : 0); + return o; +} +/* [MS-XLSB] 2.4.308 BrtCellError */ +function parse_BrtCellError(data) { + var cell = parse_XLSBCell(data); + var bError = data.read_shift(1); + return [cell, bError, 'e']; +} +function write_BrtCellError(cell, ncell, o) { + if (o == null) + o = new_buf(9); + write_XLSBCell(ncell, o); + o.write_shift(1, cell.v); + return o; +} +function parse_BrtShortError(data) { + var cell = parse_XLSBShortCell(data); + var bError = data.read_shift(1); + return [cell, bError, 'e']; +} +function write_BrtShortError(cell, ncell, o) { + if (o == null) + o = new_buf(8); + write_XLSBShortCell(ncell, o); + o.write_shift(1, cell.v); + o.write_shift(2, 0); + o.write_shift(1, 0); + return o; +} +/* [MS-XLSB] 2.4.311 BrtCellIsst */ +function parse_BrtCellIsst(data) { + var cell = parse_XLSBCell(data); + var isst = data.read_shift(4); + return [cell, isst, 's']; +} +function write_BrtCellIsst(cell, ncell, o) { + if (o == null) + o = new_buf(12); + write_XLSBCell(ncell, o); + o.write_shift(4, ncell.v); + return o; +} +function parse_BrtShortIsst(data) { + var cell = parse_XLSBShortCell(data); + var isst = data.read_shift(4); + return [cell, isst, 's']; +} +function write_BrtShortIsst(cell, ncell, o) { + if (o == null) + o = new_buf(8); + write_XLSBShortCell(ncell, o); + o.write_shift(4, ncell.v); + return o; +} +/* [MS-XLSB] 2.4.313 BrtCellReal */ +function parse_BrtCellReal(data) { + var cell = parse_XLSBCell(data); + var value = parse_Xnum(data); + return [cell, value, 'n']; +} +function write_BrtCellReal(cell, ncell, o) { + if (o == null) + o = new_buf(16); + write_XLSBCell(ncell, o); + write_Xnum(cell.v, o); + return o; +} +function parse_BrtShortReal(data) { + var cell = parse_XLSBShortCell(data); + var value = parse_Xnum(data); + return [cell, value, 'n']; +} +function write_BrtShortReal(cell, ncell, o) { + if (o == null) + o = new_buf(12); + write_XLSBShortCell(ncell, o); + write_Xnum(cell.v, o); + return o; +} +/* [MS-XLSB] 2.4.314 BrtCellRk */ +function parse_BrtCellRk(data) { + var cell = parse_XLSBCell(data); + var value = parse_RkNumber(data); + return [cell, value, 'n']; +} +function write_BrtCellRk(cell, ncell, o) { + if (o == null) + o = new_buf(12); + write_XLSBCell(ncell, o); + write_RkNumber(cell.v, o); + return o; +} +function parse_BrtShortRk(data) { + var cell = parse_XLSBShortCell(data); + var value = parse_RkNumber(data); + return [cell, value, 'n']; +} +function write_BrtShortRk(cell, ncell, o) { + if (o == null) + o = new_buf(8); + write_XLSBShortCell(ncell, o); + write_RkNumber(cell.v, o); + return o; +} +/* [MS-XLSB] 2.4.323 BrtCellRString */ +function parse_BrtCellRString(data) { + var cell = parse_XLSBCell(data); + var value = parse_RichStr(data); + return [cell, value, 'is']; +} +/* [MS-XLSB] 2.4.317 BrtCellSt */ +function parse_BrtCellSt(data) { + var cell = parse_XLSBCell(data); + var value = parse_XLWideString(data); + return [cell, value, 'str']; +} +function write_BrtCellSt(cell, ncell, o) { + var data = cell.v == null ? "" : String(cell.v); + if (o == null) + o = new_buf(12 + 4 * cell.v.length); + write_XLSBCell(ncell, o); + write_XLWideString(data, o); + return o.length > o.l ? o.slice(0, o.l) : o; +} +function parse_BrtShortSt(data) { + var cell = parse_XLSBShortCell(data); + var value = parse_XLWideString(data); + return [cell, value, 'str']; +} +function write_BrtShortSt(cell, ncell, o) { + var data = cell.v == null ? "" : String(cell.v); + if (o == null) + o = new_buf(8 + 4 * data.length); + write_XLSBShortCell(ncell, o); + write_XLWideString(data, o); + return o.length > o.l ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.653 BrtFmlaBool */ +function parse_BrtFmlaBool(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = data.read_shift(1); + var o = [cell, value, 'b']; + if (opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null /*range*/, cell, opts.supbooks, opts); /* TODO */ + } + else + data.l = end; + return o; +} +/* [MS-XLSB] 2.4.654 BrtFmlaError */ +function parse_BrtFmlaError(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = data.read_shift(1); + var o = [cell, value, 'e']; + if (opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null /*range*/, cell, opts.supbooks, opts); /* TODO */ + } + else + data.l = end; + return o; +} +/* [MS-XLSB] 2.4.655 BrtFmlaNum */ +function parse_BrtFmlaNum(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = parse_Xnum(data); + var o = [cell, value, 'n']; + if (opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null /*range*/, cell, opts.supbooks, opts); /* TODO */ + } + else + data.l = end; + return o; +} +/* [MS-XLSB] 2.4.656 BrtFmlaString */ +function parse_BrtFmlaString(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = parse_XLWideString(data); + var o = [cell, value, 'str']; + if (opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null /*range*/, cell, opts.supbooks, opts); /* TODO */ + } + else + data.l = end; + return o; +} +/* [MS-XLSB] 2.4.682 BrtMergeCell */ +var parse_BrtMergeCell = parse_UncheckedRfX; +var write_BrtMergeCell = write_UncheckedRfX; +/* [MS-XLSB] 2.4.107 BrtBeginMergeCells */ +function write_BrtBeginMergeCells(cnt, o) { + if (o == null) + o = new_buf(4); + o.write_shift(4, cnt); + return o; +} +/* [MS-XLSB] 2.4.662 BrtHLink */ +function parse_BrtHLink(data, length /*::, opts*/) { + var end = data.l + length; + var rfx = parse_UncheckedRfX(data, 16); + var relId = parse_XLNullableWideString(data); + var loc = parse_XLWideString(data); + var tooltip = parse_XLWideString(data); + var display = parse_XLWideString(data); + data.l = end; + var o = ({ rfx: rfx, relId: relId, loc: loc, display: display } /*:any*/); + if (tooltip) + o.Tooltip = tooltip; + return o; +} +function write_BrtHLink(l, rId) { + var o = new_buf(50 + 4 * (l[1].Target.length + (l[1].Tooltip || "").length)); + write_UncheckedRfX({ s: decode_cell(l[0]), e: decode_cell(l[0]) }, o); + write_RelID("rId" + rId, o); + var locidx = l[1].Target.indexOf("#"); + var loc = locidx == -1 ? "" : l[1].Target.slice(locidx + 1); + write_XLWideString(loc || "", o); + write_XLWideString(l[1].Tooltip || "", o); + write_XLWideString("", o); + return o.slice(0, o.l); +} +/* [MS-XLSB] 2.4.692 BrtPane */ +function parse_BrtPane( /*data, length, opts*/) { +} +/* [MS-XLSB] 2.4.6 BrtArrFmla */ +function parse_BrtArrFmla(data, length, opts) { + var end = data.l + length; + var rfx = parse_RfX(data, 16); + var fAlwaysCalc = data.read_shift(1); + var o = [rfx]; + o[2] = fAlwaysCalc; + if (opts.cellFormula) { + var formula = parse_XLSBArrayParsedFormula(data, end - data.l, opts); + o[1] = formula; + } + else + data.l = end; + return o; +} +/* [MS-XLSB] 2.4.750 BrtShrFmla */ +function parse_BrtShrFmla(data, length, opts) { + var end = data.l + length; + var rfx = parse_UncheckedRfX(data, 16); + var o = [rfx]; + if (opts.cellFormula) { + var formula = parse_XLSBSharedParsedFormula(data, end - data.l, opts); + o[1] = formula; + data.l = end; + } + else + data.l = end; + return o; +} +/* [MS-XLSB] 2.4.323 BrtColInfo */ +/* TODO: once XLS ColInfo is set, combine the functions */ +function write_BrtColInfo(C /*:number*/, col, o) { + if (o == null) + o = new_buf(18); + var p = col_obj_w(C, col); + o.write_shift(-4, C); + o.write_shift(-4, C); + o.write_shift(4, (p.width || 10) * 256); + o.write_shift(4, 0 /*ixfe*/); // style + var flags = 0; + if (col.hidden) + flags |= 0x01; + if (typeof p.width == 'number') + flags |= 0x02; + if (col.level) + flags |= (col.level << 8); + o.write_shift(2, flags); // bit flag + return o; +} +/* [MS-XLSB] 2.4.678 BrtMargins */ +var BrtMarginKeys = ["left", "right", "top", "bottom", "header", "footer"]; +function parse_BrtMargins(data /*::, length, opts*/) { + var margins = ({} /*:any*/); + BrtMarginKeys.forEach(function (k) { margins[k] = parse_Xnum(data, 8); }); + return margins; +} +function write_BrtMargins(margins /*:Margins*/, o) { + if (o == null) + o = new_buf(6 * 8); + default_margins(margins); + BrtMarginKeys.forEach(function (k) { write_Xnum((margins /*:any*/)[k], o); }); + return o; +} +/* [MS-XLSB] 2.4.299 BrtBeginWsView */ +function parse_BrtBeginWsView(data /*::, length, opts*/) { + var f = data.read_shift(2); + data.l += 28; + return { RTL: f & 0x20 }; +} +function write_BrtBeginWsView(ws, Workbook, o) { + if (o == null) + o = new_buf(30); + var f = 0x39c; + if ((((Workbook || {}).Views || [])[0] || {}).RTL) + f |= 0x20; + o.write_shift(2, f); // bit flag + o.write_shift(4, 0); + o.write_shift(4, 0); // view first row + o.write_shift(4, 0); // view first col + o.write_shift(1, 0); // gridline color ICV + o.write_shift(1, 0); + o.write_shift(2, 0); + o.write_shift(2, 100); // zoom scale + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(4, 0); // workbook view id + return o; +} +/* [MS-XLSB] 2.4.309 BrtCellIgnoreEC */ +function write_BrtCellIgnoreEC(ref) { + var o = new_buf(24); + o.write_shift(4, 4); + o.write_shift(4, 1); + write_UncheckedRfX(ref, o); + return o; +} +/* [MS-XLSB] 2.4.748 BrtSheetProtection */ +function write_BrtSheetProtection(sp, o) { + if (o == null) + o = new_buf(16 * 4 + 2); + o.write_shift(2, sp.password ? crypto_CreatePasswordVerifier_Method1(sp.password) : 0); + o.write_shift(4, 1); // this record should not be written if no protection + [ + ["objects", false], + ["scenarios", false], + ["formatCells", true], + ["formatColumns", true], + ["formatRows", true], + ["insertColumns", true], + ["insertRows", true], + ["insertHyperlinks", true], + ["deleteColumns", true], + ["deleteRows", true], + ["selectLockedCells", false], + ["sort", true], + ["autoFilter", true], + ["pivotTables", true], + ["selectUnlockedCells", false] // fSelUnlockedCells + ].forEach(function (n) { + /*:: if(o == null) throw "unreachable"; */ + if (n[1]) + o.write_shift(4, sp[n[0]] != null && !sp[n[0]] ? 1 : 0); + else + o.write_shift(4, sp[n[0]] != null && sp[n[0]] ? 0 : 1); + }); + return o; +} +function parse_BrtDVal( /*data, length, opts*/) { +} +function parse_BrtDVal14( /*data, length, opts*/) { +} +/* [MS-XLSB] 2.1.7.61 Worksheet */ +function parse_ws_bin(data, _opts, idx, rels, wb /*:WBWBProps*/, themes, styles) { + if (!data) + return data; + var opts = _opts || {}; + if (!rels) + rels = { '!id': {} }; + if (DENSE != null && opts.dense == null) + opts.dense = DENSE; + var s /*:Worksheet*/ = ({}); + if (opts.dense) + s["!data"] = []; + var ref; + var refguess = { s: { r: 2000000, c: 2000000 }, e: { r: 0, c: 0 } }; + var state /*:Array*/ = []; + var pass = false, end = false; + var row, p, cf, R, C, addr, sstr, rr, cell /*:Cell*/; + var merges /*:Array*/ = []; + opts.biff = 12; + opts['!row'] = 0; + var ai = 0, af = false; + var arrayf /*:Array<[Range, string]>*/ = []; + var sharedf = {}; + var supbooks = opts.supbooks || /*::(*/ wb /*:: :any)*/.supbooks || ([[]] /*:any*/); + supbooks.sharedf = sharedf; + supbooks.arrayf = arrayf; + supbooks.SheetNames = wb.SheetNames || wb.Sheets.map(function (x) { return x.name; }); + if (!opts.supbooks) { + opts.supbooks = supbooks; + if (wb.Names) + for (var i = 0; i < wb.Names.length; ++i) + supbooks[0][i + 1] = wb.Names[i]; + } + var colinfo /*:Array*/ = [], rowinfo /*:Array*/ = []; + var seencol = false; + XLSBRecordEnum[0x0010] = { n: "BrtShortReal", f: parse_BrtShortReal }; + var cm, vm; + var date1904 = 1462 * +!!((wb || {}).WBProps || {}).date1904; + recordhopper(data, function ws_parse(val, RR, RT) { + if (end) + return; + switch (RT) { + case 0x0094: /* 'BrtWsDim' */ + ref = val; + break; + case 0x0000: /* 'BrtRowHdr' */ + row = val; + if (opts.sheetRows && opts.sheetRows <= row.r) + end = true; + rr = encode_row(R = row.r); + opts['!row'] = row.r; + if (val.hidden || val.hpt || val.level != null) { + if (val.hpt) + val.hpx = pt2px(val.hpt); + rowinfo[val.r] = val; + } + break; + case 0x0002: /* 'BrtCellRk' */ + case 0x0003: /* 'BrtCellError' */ + case 0x0004: /* 'BrtCellBool' */ + case 0x0005: /* 'BrtCellReal' */ + case 0x0006: /* 'BrtCellSt' */ + case 0x0007: /* 'BrtCellIsst' */ + case 0x0008: /* 'BrtFmlaString' */ + case 0x0009: /* 'BrtFmlaNum' */ + case 0x000A: /* 'BrtFmlaBool' */ + case 0x000B: /* 'BrtFmlaError' */ + case 0x000D: /* 'BrtShortRk' */ + case 0x000E: /* 'BrtShortError' */ + case 0x000F: /* 'BrtShortBool' */ + case 0x0010: /* 'BrtShortReal' */ + case 0x0011: /* 'BrtShortSt' */ + case 0x0012: /* 'BrtShortIsst' */ + case 0x003E: /* 'BrtCellRString' */ + p = ({ t: val[2] } /*:any*/); + switch (val[2]) { + case 'n': + p.v = val[1]; + break; + case 's': + sstr = strs[val[1]]; + p.v = sstr.t; + p.r = sstr.r; + break; + case 'b': + p.v = val[1] ? true : false; + break; + case 'e': + p.v = val[1]; + if (opts.cellText !== false) + p.w = BErr[p.v]; + break; + case 'str': + p.t = 's'; + p.v = val[1]; + break; + case 'is': + p.t = 's'; + p.v = val[1].t; + break; + } + if ((cf = styles.CellXf[val[0].iStyleRef])) + safe_format(p, cf.numFmtId, null, opts, themes, styles, date1904 > 0); + C = val[0].c == -1 ? C + 1 : val[0].c; + if (opts.dense) { + if (!s["!data"][R]) + s["!data"][R] = []; + s["!data"][R][C] = p; + } + else + s[encode_col(C) + rr] = p; + if (opts.cellFormula) { + af = false; + for (ai = 0; ai < arrayf.length; ++ai) { + var aii = arrayf[ai]; + if (row.r >= aii[0].s.r && row.r <= aii[0].e.r) + if (C >= aii[0].s.c && C <= aii[0].e.c) { + p.F = encode_range(aii[0]); + af = true; + } + } + if (!af && val.length > 3) + p.f = val[3]; + } + if (refguess.s.r > row.r) + refguess.s.r = row.r; + if (refguess.s.c > C) + refguess.s.c = C; + if (refguess.e.r < row.r) + refguess.e.r = row.r; + if (refguess.e.c < C) + refguess.e.c = C; + if (opts.cellDates && cf && p.t == 'n' && fmt_is_date(table_fmt[cf.numFmtId])) { + var _d = SSF_parse_date_code(p.v + date1904); + if (_d) { + p.t = 'd'; + p.v = new Date(Date.UTC(_d.y, _d.m - 1, _d.d, _d.H, _d.M, _d.S, _d.u)); + } + } + if (cm) { + if (cm.type == 'XLDAPR') + p.D = true; + cm = void 0; + } + if (vm) + vm = void 0; + break; + case 0x0001: /* 'BrtCellBlank' */ + case 0x000C: /* 'BrtShortBlank' */ + if (!opts.sheetStubs || pass) + break; + p = ({ t: 'z', v: void 0 } /*:any*/); + C = val[0].c == -1 ? C + 1 : val[0].c; + if (opts.dense) { + if (!s["!data"][R]) + s["!data"][R] = []; + s["!data"][R][C] = p; + } + else + s[encode_col(C) + rr] = p; + if (refguess.s.r > row.r) + refguess.s.r = row.r; + if (refguess.s.c > C) + refguess.s.c = C; + if (refguess.e.r < row.r) + refguess.e.r = row.r; + if (refguess.e.c < C) + refguess.e.c = C; + if (cm) { + if (cm.type == 'XLDAPR') + p.D = true; + cm = void 0; + } + if (vm) + vm = void 0; + break; + case 0x00B0: /* 'BrtMergeCell' */ + merges.push(val); + break; + case 0x0031: + { /* 'BrtCellMeta' */ + cm = ((opts.xlmeta || {}).Cell || [])[val - 1]; + } + break; + case 0x01EE: /* 'BrtHLink' */ + var rel = rels['!id'][val.relId]; + if (rel) { + val.Target = rel.Target; + if (val.loc) + val.Target += "#" + val.loc; + val.Rel = rel; + } + else if (val.relId == '') { + val.Target = "#" + val.loc; + } + for (R = val.rfx.s.r; R <= val.rfx.e.r; ++R) + for (C = val.rfx.s.c; C <= val.rfx.e.c; ++C) { + if (opts.dense) { + if (!s["!data"][R]) + s["!data"][R] = []; + if (!s["!data"][R][C]) + s["!data"][R][C] = { t: 'z', v: undefined }; + s["!data"][R][C].l = val; + } + else { + addr = encode_col(C) + encode_row(R); + if (!s[addr]) + s[addr] = { t: 'z', v: undefined }; + s[addr].l = val; + } + } + break; + case 0x01AA: /* 'BrtArrFmla' */ + if (!opts.cellFormula) + break; + arrayf.push(val); + cell = ((opts.dense ? s["!data"][R][C] : s[encode_col(C) + rr]) /*:any*/); + cell.f = stringify_formula(val[1], refguess, { r: row.r, c: C }, supbooks, opts); + cell.F = encode_range(val[0]); + break; + case 0x01AB: /* 'BrtShrFmla' */ + if (!opts.cellFormula) + break; + sharedf[encode_cell(val[0].s)] = val[1]; + cell = (opts.dense ? s["!data"][R][C] : s[encode_col(C) + rr]); + cell.f = stringify_formula(val[1], refguess, { r: row.r, c: C }, supbooks, opts); + break; + /* identical to 'ColInfo' in XLS */ + case 0x003C: /* 'BrtColInfo' */ + if (!opts.cellStyles) + break; + while (val.e >= val.s) { + colinfo[val.e--] = { width: val.w / 256, hidden: !!(val.flags & 0x01), level: val.level }; + if (!seencol) { + seencol = true; + find_mdw_colw(val.w / 256); + } + process_col(colinfo[val.e + 1]); + } + break; + case 0x0227: /* 'BrtLegacyDrawing' */ + if (val) + s["!legrel"] = val; + break; + case 0x00A1: /* 'BrtBeginAFilter' */ + s['!autofilter'] = { ref: encode_range(val) }; + break; + case 0x01DC: /* 'BrtMargins' */ + s['!margins'] = val; + break; + case 0x0093: /* 'BrtWsProp' */ + if (!wb.Sheets[idx]) + wb.Sheets[idx] = {}; + if (val.name) + wb.Sheets[idx].CodeName = val.name; + if (val.above || val.left) + s['!outline'] = { above: val.above, left: val.left }; + break; + case 0x0089: /* 'BrtBeginWsView' */ + if (!wb.Views) + wb.Views = [{}]; + if (!wb.Views[0]) + wb.Views[0] = {}; + if (val.RTL) + wb.Views[0].RTL = true; + break; + case 0x01E5: /* 'BrtWsFmtInfo' */ + break; + case 0x0040: /* 'BrtDVal' */ + case 0x041D: /* 'BrtDVal14' */ + break; + case 0x0097: /* 'BrtPane' */ + break; + case 0x0098: /* 'BrtSel' */ + case 0x00AF: /* 'BrtAFilterDateGroupItem' */ + case 0x0284: /* 'BrtActiveX' */ + case 0x0271: /* 'BrtBigName' */ + case 0x0232: /* 'BrtBkHim' */ + case 0x018C: /* 'BrtBrk' */ + case 0x0458: /* 'BrtCFIcon' */ + case 0x047A: /* 'BrtCFRuleExt' */ + case 0x01D7: /* 'BrtCFVO' */ + case 0x041A: /* 'BrtCFVO14' */ + case 0x0289: /* 'BrtCellIgnoreEC' */ + case 0x0451: /* 'BrtCellIgnoreEC14' */ + case 0x024D: /* 'BrtCellSmartTagProperty' */ + case 0x025F: /* 'BrtCellWatch' */ + case 0x0234: /* 'BrtColor' */ + case 0x041F: /* 'BrtColor14' */ + case 0x00A8: /* 'BrtColorFilter' */ + case 0x00AE: /* 'BrtCustomFilter' */ + case 0x049C: /* 'BrtCustomFilter14' */ + case 0x01F3: /* 'BrtDRef' */ + case 0x01FB: /* 'BrtDXF' */ + case 0x0226: /* 'BrtDrawing' */ + case 0x00AB: /* 'BrtDynamicFilter' */ + case 0x00A7: /* 'BrtFilter' */ + case 0x0499: /* 'BrtFilter14' */ + case 0x00A9: /* 'BrtIconFilter' */ + case 0x049D: /* 'BrtIconFilter14' */ + case 0x0228: /* 'BrtLegacyDrawingHF' */ + case 0x0295: /* 'BrtListPart' */ + case 0x027F: /* 'BrtOleObject' */ + case 0x01DE: /* 'BrtPageSetup' */ + case 0x0219: /* 'BrtPhoneticInfo' */ + case 0x01DD: /* 'BrtPrintOptions' */ + case 0x0218: /* 'BrtRangeProtection' */ + case 0x044F: /* 'BrtRangeProtection14' */ + case 0x02A8: /* 'BrtRangeProtectionIso' */ + case 0x0450: /* 'BrtRangeProtectionIso14' */ + case 0x0400: /* 'BrtRwDescent' */ + case 0x0297: /* 'BrtSheetCalcProp' */ + case 0x0217: /* 'BrtSheetProtection' */ + case 0x02A6: /* 'BrtSheetProtectionIso' */ + case 0x01F8: /* 'BrtSlc' */ + case 0x0413: /* 'BrtSparkline' */ + case 0x01AC: /* 'BrtTable' */ + case 0x00AA: /* 'BrtTop10Filter' */ + case 0x0C00: /* 'BrtUid' */ + case 0x0032: /* 'BrtValueMeta' */ + case 0x0816: /* 'BrtWebExtension' */ + case 0x0415: /* 'BrtWsFmtInfoEx14' */ + break; + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; + break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; + break; + case 0x0025: /* 'BrtACBegin' */ + state.push(RT); + pass = true; + break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); + pass = false; + break; + default: + if (RR.T) { /* empty */ } + else if (!pass || opts.WTF) + throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }, opts); + delete opts.supbooks; + delete opts['!row']; + if (!s["!ref"] && (refguess.s.r < 2000000 || ref && (ref.e.r > 0 || ref.e.c > 0 || ref.s.r > 0 || ref.s.c > 0))) + s["!ref"] = encode_range(ref || refguess); + if (opts.sheetRows && s["!ref"]) { + var tmpref = safe_decode_range(s["!ref"]); + if (opts.sheetRows <= +tmpref.e.r) { + tmpref.e.r = opts.sheetRows - 1; + if (tmpref.e.r > refguess.e.r) + tmpref.e.r = refguess.e.r; + if (tmpref.e.r < tmpref.s.r) + tmpref.s.r = tmpref.e.r; + if (tmpref.e.c > refguess.e.c) + tmpref.e.c = refguess.e.c; + if (tmpref.e.c < tmpref.s.c) + tmpref.s.c = tmpref.e.c; + s["!fullref"] = s["!ref"]; + s["!ref"] = encode_range(tmpref); + } + } + if (merges.length > 0) + s["!merges"] = merges; + if (colinfo.length > 0) + s["!cols"] = colinfo; + if (rowinfo.length > 0) + s["!rows"] = rowinfo; + if (rels['!id'][s['!legrel']]) + s['!legdrawel'] = rels['!id'][s['!legrel']]; + return s; +} +/* TODO: something useful -- this is a stub */ +function write_ws_bin_cell(ba /*:BufArray*/, cell /*:Cell*/, R /*:number*/, C /*:number*/, opts, ws /*:Worksheet*/, last_seen /*:boolean*/, date1904 /*:boolean*/) { + var o /*:any*/ = ({ r: R, c: C } /*:any*/); + if (cell.c) + ws['!comments'].push([encode_cell(o), cell.c]); + if (cell.v === undefined) + return false; + var vv = ""; + switch (cell.t) { + case 'b': + vv = cell.v ? "1" : "0"; + break; + case 'd': // no BrtCellDate :( + cell = dup(cell); + cell.z = cell.z || table_fmt[14]; + cell.v = datenum(parseDate(cell.v, date1904), date1904); + cell.t = 'n'; + break; + /* falls through */ + case 'n': + case 'e': + vv = '' + cell.v; + break; + default: + vv = cell.v; + break; + } + /* TODO: cell style */ + o.s = get_cell_style(opts.cellXfs, cell, opts); + if (cell.l) + ws['!links'].push([encode_cell(o), cell.l]); + switch (cell.t) { + case 's': + case 'str': + if (opts.bookSST) { + vv = get_sst_id(opts.Strings, (cell.v == null ? "" : String(cell.v) /*:any*/), opts.revStrings); + o.t = "s"; + o.v = vv; + if (last_seen) + write_record(ba, 0x0012 /* BrtShortIsst */, write_BrtShortIsst(cell, o)); + else + write_record(ba, 0x0007 /* BrtCellIsst */, write_BrtCellIsst(cell, o)); + } + else { + o.t = "str"; + if (last_seen) + write_record(ba, 0x0011 /* BrtShortSt */, write_BrtShortSt(cell, o)); + else + write_record(ba, 0x0006 /* BrtCellSt */, write_BrtCellSt(cell, o)); + } + return true; + case 'n': + /* TODO: determine threshold for Real vs RK */ + if (cell.v == (cell.v | 0) && cell.v > -1000 && cell.v < 1000) { + if (last_seen) + write_record(ba, 0x000D /* BrtShortRk */, write_BrtShortRk(cell, o)); + else + write_record(ba, 0x0002 /* BrtCellRk */, write_BrtCellRk(cell, o)); + } + else if (isNaN(cell.v)) { + if (last_seen) + write_record(ba, 0x000E /* BrtShortError */, write_BrtShortError({ t: "e", v: 0x24 }, o)); // #NUM! + else + write_record(ba, 0x0003 /* BrtCellError */, write_BrtCellError({ t: "e", v: 0x24 }, o)); // #NUM! + } + else if (!isFinite(cell.v)) { + if (last_seen) + write_record(ba, 0x000E /* BrtShortError */, write_BrtShortError({ t: "e", v: 0x07 }, o)); // #DIV/0! + else + write_record(ba, 0x0003 /* BrtCellError */, write_BrtCellError({ t: "e", v: 0x07 }, o)); // #DIV/0! + } + else { + if (last_seen) + write_record(ba, 0x0010 /* BrtShortReal */, write_BrtShortReal(cell, o)); + else + write_record(ba, 0x0005 /* BrtCellReal */, write_BrtCellReal(cell, o)); + } + return true; + case 'b': + o.t = "b"; + if (last_seen) + write_record(ba, 0x000F /* BrtShortBool */, write_BrtShortBool(cell, o)); + else + write_record(ba, 0x0004 /* BrtCellBool */, write_BrtCellBool(cell, o)); + return true; + case 'e': + o.t = "e"; + if (last_seen) + write_record(ba, 0x000E /* BrtShortError */, write_BrtShortError(cell, o)); + else + write_record(ba, 0x0003 /* BrtCellError */, write_BrtCellError(cell, o)); + return true; + } + if (last_seen) + write_record(ba, 0x000C /* BrtShortBlank */, write_BrtShortBlank(cell, o)); + else + write_record(ba, 0x0001 /* BrtCellBlank */, write_BrtCellBlank(cell, o)); + return true; +} +function write_CELLTABLE(ba, ws /*:Worksheet*/, idx /*:number*/, opts, wb /*:Workbook*/) { + var range = safe_decode_range(ws['!ref'] || "A1"), ref, rr = "", cols /*:Array*/ = []; + var date1904 = (((wb || {}).Workbook || {}).WBProps || {}).date1904; + write_record(ba, 0x0091 /* BrtBeginSheetData */); + var dense = ws["!data"] != null; + var cap = range.e.r; + if (ws['!rows']) + cap = Math.max(range.e.r, ws['!rows'].length - 1); + for (var R = range.s.r; R <= cap; ++R) { + rr = encode_row(R); + /* [ACCELLTABLE] */ + /* BrtRowHdr */ + write_row_header(ba, ws, range, R); + var last_seen = false; + if (R <= range.e.r) + for (var C = range.s.c; C <= range.e.c; ++C) { + /* *16384CELL */ + if (R === range.s.r) + cols[C] = encode_col(C); + ref = cols[C] + rr; + var cell = dense ? (ws["!data"][R] || [])[C] : ws[ref]; + if (!cell) { + last_seen = false; + continue; + } + /* write cell */ + last_seen = write_ws_bin_cell(ba, cell, R, C, opts, ws, last_seen, date1904); + } + } + write_record(ba, 0x0092 /* BrtEndSheetData */); +} +function write_MERGECELLS(ba, ws /*:Worksheet*/) { + if (!ws || !ws['!merges']) + return; + write_record(ba, 0x00B1 /* BrtBeginMergeCells */, write_BrtBeginMergeCells(ws['!merges'].length)); + ws['!merges'].forEach(function (m) { write_record(ba, 0x00B0 /* BrtMergeCell */, write_BrtMergeCell(m)); }); + write_record(ba, 0x00B2 /* BrtEndMergeCells */); +} +function write_COLINFOS(ba, ws /*:Worksheet*/ /*::, idx:number, opts, wb:Workbook*/) { + if (!ws || !ws['!cols']) + return; + write_record(ba, 0x0186 /* BrtBeginColInfos */); + ws['!cols'].forEach(function (m, i) { if (m) + write_record(ba, 0x003C /* 'BrtColInfo' */, write_BrtColInfo(i, m)); }); + write_record(ba, 0x0187 /* BrtEndColInfos */); +} +function write_IGNOREECS(ba, ws /*:Worksheet*/) { + if (!ws || !ws['!ref']) + return; + write_record(ba, 0x0288 /* BrtBeginCellIgnoreECs */); + write_record(ba, 0x0289 /* BrtCellIgnoreEC */, write_BrtCellIgnoreEC(safe_decode_range(ws['!ref']))); + write_record(ba, 0x028A /* BrtEndCellIgnoreECs */); +} +function write_HLINKS(ba, ws /*:Worksheet*/, rels) { + /* *BrtHLink */ + ws['!links'].forEach(function (l) { + if (!l[1].Target) + return; + var rId = add_rels(rels, -1, l[1].Target.replace(/#.*$/, ""), RELS.HLINK); + write_record(ba, 0x01EE /* BrtHLink */, write_BrtHLink(l, rId)); + }); + delete ws['!links']; +} +function write_LEGACYDRAWING(ba, ws /*:Worksheet*/, idx /*:number*/, rels) { + /* [BrtLegacyDrawing] */ + if (ws['!comments'].length > 0) { + var rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx + 1) + ".vml", RELS.VML); + write_record(ba, 0x0227 /* BrtLegacyDrawing */, write_RelID("rId" + rId)); + ws['!legacy'] = rId; + } +} +function write_AUTOFILTER(ba, ws, wb, idx) { + if (!ws['!autofilter']) + return; + var data = ws['!autofilter']; + var ref = typeof data.ref === "string" ? data.ref : encode_range(data.ref); + /* Update FilterDatabase defined name for the worksheet */ + if (!wb.Workbook) + wb.Workbook = ({ Sheets: [] } /*:any*/); + if (!wb.Workbook.Names) + wb.Workbook.Names = []; + var names /*: Array */ = wb.Workbook.Names; + var range = decode_range(ref); + if (range.s.r == range.e.r) { + range.e.r = decode_range(ws["!ref"]).e.r; + ref = encode_range(range); + } + for (var i = 0; i < names.length; ++i) { + var name = names[i]; + if (name.Name != '_xlnm._FilterDatabase') + continue; + if (name.Sheet != idx) + continue; + name.Ref = formula_quote_sheet_name(wb.SheetNames[idx]) + "!" + fix_range(ref); + break; + } + if (i == names.length) + names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: formula_quote_sheet_name(wb.SheetNames[idx]) + "!" + fix_range(ref) }); + write_record(ba, 0x00A1 /* BrtBeginAFilter */, write_UncheckedRfX(safe_decode_range(ref))); + /* *FILTERCOLUMN */ + /* [SORTSTATE] */ + /* BrtEndAFilter */ + write_record(ba, 0x00A2 /* BrtEndAFilter */); +} +function write_WSVIEWS2(ba, ws, Workbook) { + write_record(ba, 0x0085 /* BrtBeginWsViews */); + { /* 1*WSVIEW2 */ + /* [ACUID] */ + write_record(ba, 0x0089 /* BrtBeginWsView */, write_BrtBeginWsView(ws, Workbook)); + /* [BrtPane] */ + /* *4BrtSel */ + /* *4SXSELECT */ + /* *FRT */ + write_record(ba, 0x008A /* BrtEndWsView */); + } + /* *FRT */ + write_record(ba, 0x0086 /* BrtEndWsViews */); +} +function write_WSFMTINFO( /*::ba, ws*/) { + /* [ACWSFMTINFO] */ + // write_record(ba, 0x01E5 /* BrtWsFmtInfo */, write_BrtWsFmtInfo(ws)); +} +function write_SHEETPROTECT(ba, ws) { + if (!ws['!protect']) + return; + /* [BrtSheetProtectionIso] */ + write_record(ba, 0x0217 /* BrtSheetProtection */, write_BrtSheetProtection(ws['!protect'])); +} +function write_ws_bin(idx /*:number*/, opts, wb /*:Workbook*/, rels) { + var ba = buf_array(); + var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {}; + var c /*:string*/ = s; + try { + if (wb && wb.Workbook) + c = wb.Workbook.Sheets[idx].CodeName || c; + } + catch (e) { } + var r = safe_decode_range(ws['!ref'] || "A1"); + if (r.e.c > 0x3FFF || r.e.r > 0xFFFFF) { + if (opts.WTF) + throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:XFD1048576"); + r.e.c = Math.min(r.e.c, 0x3FFF); + r.e.r = Math.min(r.e.c, 0xFFFFF); + } + ws['!links'] = []; + /* passed back to write_zip and removed there */ + ws['!comments'] = []; + write_record(ba, 0x0081 /* BrtBeginSheet */); + if (wb.vbaraw || ws['!outline']) + write_record(ba, 0x0093 /* BrtWsProp */, write_BrtWsProp(c, ws['!outline'])); + write_record(ba, 0x0094 /* BrtWsDim */, write_BrtWsDim(r)); + write_WSVIEWS2(ba, ws, wb.Workbook); + write_WSFMTINFO(ba, ws); + write_COLINFOS(ba, ws, idx, opts, wb); + write_CELLTABLE(ba, ws, idx, opts, wb); + /* [BrtSheetCalcProp] */ + write_SHEETPROTECT(ba, ws); + /* *([BrtRangeProtectionIso] BrtRangeProtection) */ + /* [SCENMAN] */ + write_AUTOFILTER(ba, ws, wb, idx); + /* [SORTSTATE] */ + /* [DCON] */ + /* [USERSHVIEWS] */ + write_MERGECELLS(ba, ws); + /* [BrtPhoneticInfo] */ + /* *CONDITIONALFORMATTING */ + /* [DVALS] */ + write_HLINKS(ba, ws, rels); + /* [BrtPrintOptions] */ + if (ws['!margins']) + write_record(ba, 0x01DC /* BrtMargins */, write_BrtMargins(ws['!margins'])); + /* [BrtPageSetup] */ + /* [HEADERFOOTER] */ + /* [RWBRK] */ + /* [COLBRK] */ + /* *BrtBigName */ + /* [CELLWATCHES] */ + if (!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) + write_IGNOREECS(ba, ws); + /* [SMARTTAGS] */ + /* [BrtDrawing] */ + write_LEGACYDRAWING(ba, ws, idx, rels); + /* [BrtLegacyDrawingHF] */ + /* [BrtBkHim] */ + /* [OLEOBJECTS] */ + /* [ACTIVEXCONTROLS] */ + /* [WEBPUBITEMS] */ + /* [LISTPARTS] */ + /* FRTWORKSHEET */ + write_record(ba, 0x0082 /* BrtEndSheet */); + return ba.end(); +} +function parse_Cache(data /*:string*/) { + var col /*:Array*/ = []; + var num = data.match(/^/); + var f; + /* 21.2.2.150 pt CT_NumVal */ + (data.match(/(.*?)<\/c:pt>/mg) || []).forEach(function (pt) { + var q = pt.match(/(.*)<\/c:v><\/c:pt>/); + if (!q) + return; + col[+q[1]] = num ? +q[2] : q[2]; + }); + /* 21.2.2.71 formatCode CT_Xstring */ + var nf = unescapexml((data.match(/([\s\S]*?)<\/c:formatCode>/) || ["", "General"])[1]); + (data.match(/(.*?)<\/c:f>/mg) || []).forEach(function (F) { f = F.replace(/<.*?>/g, ""); }); + return [col, nf, f]; +} +/* 21.2 DrawingML - Charts */ +function parse_chart(data /*:?string*/, name /*:string*/, opts, rels, wb, csheet) { + var cs /*:Worksheet*/ = ((csheet || { "!type": "chart" }) /*:any*/); + if (!data) + return csheet; + /* 21.2.2.27 chart CT_Chart */ + var C = 0, R = 0, col = "A"; + var refguess = { s: { r: 2000000, c: 2000000 }, e: { r: 0, c: 0 } }; + /* 21.2.2.120 numCache CT_NumData */ + (data.match(/[\s\S]*?<\/c:numCache>/gm) || []).forEach(function (nc) { + var cache = parse_Cache(nc); + refguess.s.r = refguess.s.c = 0; + refguess.e.c = C; + col = encode_col(C); + cache[0].forEach(function (n, i) { + if (cs["!data"]) { + if (!cs["!data"][i]) + cs["!data"][i] = []; + cs["!data"][i][C] = { t: 'n', v: n, z: cache[1] }; + } + else + cs[col + encode_row(i)] = { t: 'n', v: n, z: cache[1] }; + R = i; + }); + if (refguess.e.r < R) + refguess.e.r = R; + ++C; + }); + if (C > 0) + cs["!ref"] = encode_range(refguess); + return cs; +} +/* 18.3 Worksheets also covers Chartsheets */ +function parse_cs_xml(data /*:?string*/, opts, idx /*:number*/, rels, wb /*::, themes, styles*/) { + if (!data) + return data; + /* 18.3.1.12 chartsheet CT_ChartSheet */ + if (!rels) + rels = { '!id': {} }; + var s = ({ '!type': "chart", '!drawel': null, '!rel': "" } /*:any*/); + var m; + /* 18.3.1.83 sheetPr CT_ChartsheetPr */ + var sheetPr = data.match(sheetprregex); + if (sheetPr) + parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx); + /* 18.3.1.36 drawing CT_Drawing */ + if ((m = data.match(/drawing r:id="(.*?)"/))) + s['!rel'] = m[1]; + if (rels['!id'][s['!rel']]) + s['!drawel'] = rels['!id'][s['!rel']]; + return s; +} +//function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ { +// var o = [XML_HEADER, writextag('chartsheet', null, { +// 'xmlns': XMLNS_main[0], +// 'xmlns:r': XMLNS.r +// })]; +// o[o.length] = writextag("drawing", null, {"r:id": "rId1"}); +// add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW); +// if(o.length>2) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } +// return o.join(""); +//} +/* [MS-XLSB] 2.4.331 BrtCsProp */ +function parse_BrtCsProp(data, length /*:number*/) { + data.l += 10; + var name = parse_XLWideString(data, length - 10); + return { name: name }; +} +/* [MS-XLSB] 2.1.7.7 Chart Sheet */ +function parse_cs_bin(data, opts, idx /*:number*/, rels, wb /*::, themes, styles*/) { + if (!data) + return data; + if (!rels) + rels = { '!id': {} }; + var s = { '!type': "chart", '!drawel': null, '!rel': "" }; + var state /*:Array*/ = []; + var pass = false; + recordhopper(data, function cs_parse(val, R, RT) { + switch (RT) { + case 0x0226: /* 'BrtDrawing' */ + s['!rel'] = val; + break; + case 0x028B: /* 'BrtCsProp' */ + if (!wb.Sheets[idx]) + wb.Sheets[idx] = {}; + if (val.name) + wb.Sheets[idx].CodeName = val.name; + break; + case 0x0232: /* 'BrtBkHim' */ + case 0x028C: /* 'BrtCsPageSetup' */ + case 0x029D: /* 'BrtCsProtection' */ + case 0x02A7: /* 'BrtCsProtectionIso' */ + case 0x0227: /* 'BrtLegacyDrawing' */ + case 0x0228: /* 'BrtLegacyDrawingHF' */ + case 0x01DC: /* 'BrtMargins' */ + case 0x0C00: /* 'BrtUid' */ + break; + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; + break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; + break; + case 0x0025: /* 'BrtACBegin' */ + state.push(RT); + break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); + break; + default: + if (R.T > 0) + state.push(RT); + else if (R.T < 0) + state.pop(); + else if (!pass || opts.WTF) + throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }, opts); + if (rels['!id'][s['!rel']]) + s['!drawel'] = rels['!id'][s['!rel']]; + return s; +} +//function write_cs_bin(/*::idx:number, opts, wb:Workbook, rels*/) { +// var ba = buf_array(); +// write_record(ba, 0x0081 /* BrtBeginSheet */); +// /* [BrtCsProp] */ +// /* CSVIEWS */ +// /* [[BrtCsProtectionIso] BrtCsProtection] */ +// /* [USERCSVIEWS] */ +// /* [BrtMargins] */ +// /* [BrtCsPageSetup] */ +// /* [HEADERFOOTER] */ +// /* BrtDrawing */ +// /* [BrtLegacyDrawing] */ +// /* [BrtLegacyDrawingHF] */ +// /* [BrtBkHim] */ +// /* [WEBPUBITEMS] */ +// /* FRTCHARTSHEET */ +// write_record(ba, 0x0082 /* BrtEndSheet */); +// return ba.end(); +//} +/* 18.2.28 (CT_WorkbookProtection) Defaults */ +var WBPropsDef = [ + ['allowRefreshQuery', false, "bool"], + ['autoCompressPictures', true, "bool"], + ['backupFile', false, "bool"], + ['checkCompatibility', false, "bool"], + ['CodeName', ''], + ['date1904', false, "bool"], + ['defaultThemeVersion', 0, "int"], + ['filterPrivacy', false, "bool"], + ['hidePivotFieldList', false, "bool"], + ['promptedSolutions', false, "bool"], + ['publishItems', false, "bool"], + ['refreshAllConnections', false, "bool"], + ['saveExternalLinkValues', true, "bool"], + ['showBorderUnselectedTables', true, "bool"], + ['showInkAnnotation', true, "bool"], + ['showObjects', 'all'], + ['showPivotChartFilter', false, "bool"], + ['updateLinks', 'userSet'] +]; +/* 18.2.30 (CT_BookView) Defaults */ +var WBViewDef = [ + ['activeTab', 0, "int"], + ['autoFilterDateGrouping', true, "bool"], + ['firstSheet', 0, "int"], + ['minimized', false, "bool"], + ['showHorizontalScroll', true, "bool"], + ['showSheetTabs', true, "bool"], + ['showVerticalScroll', true, "bool"], + ['tabRatio', 600, "int"], + ['visibility', 'visible'] + //window{Height,Width}, {x,y}Window +]; +/* 18.2.19 (CT_Sheet) Defaults */ +var SheetDef = [ +//['state', 'visible'] +]; +/* 18.2.2 (CT_CalcPr) Defaults */ +var CalcPrDef = [ + ['calcCompleted', 'true'], + ['calcMode', 'auto'], + ['calcOnSave', 'true'], + ['concurrentCalc', 'true'], + ['fullCalcOnLoad', 'false'], + ['fullPrecision', 'true'], + ['iterate', 'false'], + ['iterateCount', '100'], + ['iterateDelta', '0.001'], + ['refMode', 'A1'] +]; +/* 18.2.3 (CT_CustomWorkbookView) Defaults */ +/*var CustomWBViewDef = [ + ['autoUpdate', 'false'], + ['changesSavedWin', 'false'], + ['includeHiddenRowCol', 'true'], + ['includePrintSettings', 'true'], + ['maximized', 'false'], + ['minimized', 'false'], + ['onlySync', 'false'], + ['personalView', 'false'], + ['showComments', 'commIndicator'], + ['showFormulaBar', 'true'], + ['showHorizontalScroll', 'true'], + ['showObjects', 'all'], + ['showSheetTabs', 'true'], + ['showStatusbar', 'true'], + ['showVerticalScroll', 'true'], + ['tabRatio', '600'], + ['xWindow', '0'], + ['yWindow', '0'] +];*/ +function push_defaults_array(target, defaults) { + for (var j = 0; j != target.length; ++j) { + var w = target[j]; + for (var i = 0; i != defaults.length; ++i) { + var z = defaults[i]; + if (w[z[0]] == null) + w[z[0]] = z[1]; + else + switch (z[2]) { + case "bool": + if (typeof w[z[0]] == "string") + w[z[0]] = parsexmlbool(w[z[0]]); + break; + case "int": + if (typeof w[z[0]] == "string") + w[z[0]] = parseInt(w[z[0]], 10); + break; + } + } + } +} +function push_defaults(target, defaults) { + for (var i = 0; i != defaults.length; ++i) { + var z = defaults[i]; + if (target[z[0]] == null) + target[z[0]] = z[1]; + else + switch (z[2]) { + case "bool": + if (typeof target[z[0]] == "string") + target[z[0]] = parsexmlbool(target[z[0]]); + break; + case "int": + if (typeof target[z[0]] == "string") + target[z[0]] = parseInt(target[z[0]], 10); + break; + } + } +} +function parse_wb_defaults(wb) { + push_defaults(wb.WBProps, WBPropsDef); + push_defaults(wb.CalcPr, CalcPrDef); + push_defaults_array(wb.WBView, WBViewDef); + push_defaults_array(wb.Sheets, SheetDef); + _ssfopts.date1904 = parsexmlbool(wb.WBProps.date1904); +} +function safe1904(wb /*:Workbook*/) { + /* TODO: store date1904 somewhere else */ + if (!wb.Workbook) + return "false"; + if (!wb.Workbook.WBProps) + return "false"; + return parsexmlbool(wb.Workbook.WBProps.date1904) ? "true" : "false"; +} +var badchars = /*#__PURE__*/ ":][*?\/\\".split(""); +function check_ws_name(n /*:string*/, safe /*:?boolean*/) { + try { + if (n == "") + throw new Error("Sheet name cannot be blank"); + if (n.length > 31) + throw new Error("Sheet name cannot exceed 31 chars"); + if (n.charCodeAt(0) == 0x27 || n.charCodeAt(n.length - 1) == 0x27) + throw new Error("Sheet name cannot start or end with apostrophe (')"); + if (n.toLowerCase() == "history") + throw new Error("Sheet name cannot be 'History'"); + badchars.forEach(function (c) { + if (n.indexOf(c) == -1) + return; + throw new Error("Sheet name cannot contain : \\ / ? * [ ]"); + }); + } + catch (e) { + if (safe) + return false; + throw e; + } + return true; +} +function check_wb_names(N, S, codes) { + N.forEach(function (n, i) { + check_ws_name(n); + for (var j = 0; j < i; ++j) + if (n == N[j]) + throw new Error("Duplicate Sheet Name: " + n); + if (codes) { + var cn = (S && S[i] && S[i].CodeName) || n; + if (cn.charCodeAt(0) == 95 && cn.length > 22) + throw new Error("Bad Code Name: Worksheet" + cn); + } + }); +} +function check_wb(wb) { + if (!wb || !wb.SheetNames || !wb.Sheets) + throw new Error("Invalid Workbook"); + if (!wb.SheetNames.length) + throw new Error("Workbook is empty"); + var Sheets = (wb.Workbook && wb.Workbook.Sheets) || []; + check_wb_names(wb.SheetNames, Sheets, !!wb.vbaraw); + for (var i = 0; i < wb.SheetNames.length; ++i) + check_ws(wb.Sheets[wb.SheetNames[i]], wb.SheetNames[i], i); + wb.SheetNames.forEach(function (n, i) { + var ws = wb.Sheets[n]; + if (!ws || !ws["!autofilter"]) + return; + var DN; + if (!wb.Workbook) + wb.Workbook = {}; + if (!wb.Workbook.Names) + wb.Workbook.Names = []; + wb.Workbook.Names.forEach(function (dn) { if (dn.Name == "_xlnm._FilterDatabase" && dn.Sheet == i) + DN = dn; }); + var nn = formula_quote_sheet_name(n) + "!" + fix_range(ws["!autofilter"].ref); + if (DN) + DN.Ref = nn; + else + wb.Workbook.Names.push({ Name: "_xlnm._FilterDatabase", Sheet: i, Ref: nn }); + }); + /* TODO: validate workbook */ +} +/* 18.2 Workbook */ +var wbnsregex = /<\w+:workbook/; +function parse_wb_xml(data, opts) { + if (!data) + throw new Error("Could not find file"); + var wb = /*::(*/ { AppVersion: {}, WBProps: {}, WBView: [], Sheets: [], CalcPr: {}, Names: [], xmlns: "" } /*::)*/; + var pass = false, xmlns = "xmlns"; + var dname = {}, dnstart = 0; + data.replace(tagregex, function xml_wb(x, idx) { + var y /*:any*/ = parsexmltag(x); + switch (strip_ns(y[0])) { + case '': break; + /* 18.2.13 fileVersion CT_FileVersion ? */ + case '': + case '': break; + /* 18.2.12 fileSharing CT_FileSharing ? */ + case '': break; + /* 18.2.28 workbookPr CT_WorkbookPr ? */ + case '': + WBPropsDef.forEach(function (w) { + if (y[w[0]] == null) + return; + switch (w[2]) { + case "bool": + wb.WBProps[w[0]] = parsexmlbool(y[w[0]]); + break; + case "int": + wb.WBProps[w[0]] = parseInt(y[w[0]], 10); + break; + default: wb.WBProps[w[0]] = y[w[0]]; + } + }); + if (y.codeName) + wb.WBProps.CodeName = utf8read(y.codeName); + break; + case '': break; + /* 18.2.29 workbookProtection CT_WorkbookProtection ? */ + case '': break; + /* 18.2.1 bookViews CT_BookViews ? */ + case '': + case '': break; + /* 18.2.30 workbookView CT_BookView + */ + case '': + delete y[0]; + wb.WBView.push(y); + break; + case '': break; + /* 18.2.20 sheets CT_Sheets 1 */ + case '': + case '': break; // aggregate sheet + /* 18.2.19 sheet CT_Sheet + */ + case '': break; + /* 18.2.15 functionGroups CT_FunctionGroups ? */ + case '': break; + /* 18.2.14 functionGroup CT_FunctionGroup + */ + case '': + case '': break; + /* 18.2.8 externalReference CT_ExternalReference + */ + case '': break; + case '': + case '': + pass = false; + break; + /* 18.2.5 definedName CT_DefinedName + */ + case '': + { + dname.Ref = unescapexml(utf8read(data.slice(dnstart, idx))); + wb.Names.push(dname); + } + break; + case '': break; + /* 18.2.2 calcPr CT_CalcPr ? */ + case '': + delete y[0]; + wb.CalcPr = y; + break; + case '': break; + /* 18.2.16 oleSize CT_OleSize ? (ref required) */ + case '': + case '': + case '': break; + /* 18.2.18 pivotCaches CT_PivotCaches ? */ + case '': + case '': + case '': break; + /* 18.2.23 smartTagTypes CT_SmartTagTypes ? */ + case '': + case '': break; + /* 18.2.22 smartTagType CT_SmartTagType ? */ + case '': break; + /* 18.2.11 fileRecoveryPr CT_FileRecoveryPr ? */ + case '': break; + /* 18.2.26 webPublishObjects CT_WebPublishObjects ? */ + case '': + case '': break; + /* 18.2.25 webPublishObject CT_WebPublishObject ? */ + case '': + case '': + case '': break; + /* 18.2.7 ext CT_Extension + */ + case '': + pass = false; + break; + /* Others */ + case '': + pass = true; + break; + case '': + pass = false; + break; + /* TODO */ + case ' 0); + /* fileVersion */ + /* fileSharing */ + var workbookPr /*:any*/ = ({ codeName: "ThisWorkbook" } /*:any*/); + if (wb.Workbook && wb.Workbook.WBProps) { + WBPropsDef.forEach(function (x) { + /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */ + if ((wb.Workbook.WBProps[x[0]] /*:any*/) == null) + return; + if ((wb.Workbook.WBProps[x[0]] /*:any*/) == x[1]) + return; + workbookPr[x[0]] = (wb.Workbook.WBProps[x[0]] /*:any*/); + }); + /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */ + if (wb.Workbook.WBProps.CodeName) { + workbookPr.codeName = wb.Workbook.WBProps.CodeName; + delete workbookPr.CodeName; + } + } + o[o.length] = (writextag('workbookPr', null, workbookPr)); + /* workbookProtection */ + var sheets = wb.Workbook && wb.Workbook.Sheets || []; + var i = 0; + /* bookViews only written if first worksheet is hidden */ + if (sheets && sheets[0] && !!sheets[0].Hidden) { + o[o.length] = ""; + for (i = 0; i != wb.SheetNames.length; ++i) { + if (!sheets[i]) + break; + if (!sheets[i].Hidden) + break; + } + if (i == wb.SheetNames.length) + i = 0; + o[o.length] = ''; + o[o.length] = ""; + } + o[o.length] = ""; + for (i = 0; i != wb.SheetNames.length; ++i) { + var sht = ({ name: escapexml(wb.SheetNames[i].slice(0, 31)) } /*:any*/); + sht.sheetId = "" + (i + 1); + sht["r:id"] = "rId" + (i + 1); + if (sheets[i]) + switch (sheets[i].Hidden) { + case 1: + sht.state = "hidden"; + break; + case 2: + sht.state = "veryHidden"; + break; + } + o[o.length] = (writextag('sheet', null, sht)); + } + o[o.length] = ""; + /* functionGroups */ + /* externalReferences */ + if (write_names) { + o[o.length] = ""; + if (wb.Workbook && wb.Workbook.Names) + wb.Workbook.Names.forEach(function (n) { + var d /*:any*/ = { name: n.Name }; + if (n.Comment) + d.comment = n.Comment; + if (n.Sheet != null) + d.localSheetId = "" + n.Sheet; + if (n.Hidden) + d.hidden = "1"; + if (!n.Ref) + return; + o[o.length] = writextag('definedName', escapexml(n.Ref), d); + }); + o[o.length] = ""; + } + /* calcPr */ + /* oleSize */ + /* customWorkbookViews */ + /* pivotCaches */ + /* smartTagPr */ + /* smartTagTypes */ + /* webPublishing */ + /* fileRecoveryPr */ + /* webPublishObjects */ + /* extLst */ + if (o.length > 2) { + o[o.length] = ''; + o[1] = o[1].replace("/>", ">"); + } + return o.join(""); +} +/* [MS-XLSB] 2.4.304 BrtBundleSh */ +function parse_BrtBundleSh(data, length /*:number*/) { + var z = {}; + z.Hidden = data.read_shift(4); //hsState ST_SheetState + z.iTabID = data.read_shift(4); + z.strRelID = parse_RelID(data, length - 8); + z.name = parse_XLWideString(data); + return z; +} +function write_BrtBundleSh(data, o) { + if (!o) + o = new_buf(127); + o.write_shift(4, data.Hidden); + o.write_shift(4, data.iTabID); + write_RelID(data.strRelID, o); + write_XLWideString(data.name.slice(0, 31), o); + return o.length > o.l ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.815 BrtWbProp */ +function parse_BrtWbProp(data, length) { + var o /*:WBProps*/ = ({} /*:any*/); + var flags = data.read_shift(4); + o.defaultThemeVersion = data.read_shift(4); + var strName = (length > 8) ? parse_XLWideString(data) : ""; + if (strName.length > 0) + o.CodeName = strName; + o.autoCompressPictures = !!(flags & 0x10000); + o.backupFile = !!(flags & 0x40); + o.checkCompatibility = !!(flags & 0x1000); + o.date1904 = !!(flags & 0x01); + o.filterPrivacy = !!(flags & 0x08); + o.hidePivotFieldList = !!(flags & 0x400); + o.promptedSolutions = !!(flags & 0x10); + o.publishItems = !!(flags & 0x800); + o.refreshAllConnections = !!(flags & 0x40000); + o.saveExternalLinkValues = !!(flags & 0x80); + o.showBorderUnselectedTables = !!(flags & 0x04); + o.showInkAnnotation = !!(flags & 0x20); + o.showObjects = ["all", "placeholders", "none"][(flags >> 13) & 0x03]; + o.showPivotChartFilter = !!(flags & 0x8000); + o.updateLinks = ["userSet", "never", "always"][(flags >> 8) & 0x03]; + return o; +} +function write_BrtWbProp(data /*:?WBProps*/, o) { + if (!o) + o = new_buf(72); + var flags = 0; + if (data) { + /* TODO: mirror parse_BrtWbProp fields */ + if (data.date1904) + flags |= 0x01; + if (data.filterPrivacy) + flags |= 0x08; + } + o.write_shift(4, flags); + o.write_shift(4, 0); + write_XLSBCodeName(data && data.CodeName || "ThisWorkbook", o); + return o.slice(0, o.l); +} +function parse_BrtFRTArchID$(data, length) { + var o = {}; + data.read_shift(4); + o.ArchID = data.read_shift(4); + data.l += length - 8; + return o; +} +/* [MS-XLSB] 2.4.687 BrtName */ +function parse_BrtName(data, length, opts) { + var end = data.l + length; + var flags = data.read_shift(4); + data.l += 1; //var chKey = data.read_shift(1); + var itab = data.read_shift(4); + var name = parse_XLNameWideString(data); + var formula = parse_XLSBNameParsedFormula(data, 0, opts); + var comment = parse_XLNullableWideString(data); + if (flags & 0x20) + name = "_xlnm." + name; + //if(0 /* fProc */) { + // unusedstring1: XLNullableWideString + // description: XLNullableWideString + // helpTopic: XLNullableWideString + // unusedstring2: XLNullableWideString + //} + data.l = end; + var out = ({ Name: name, Ptg: formula, Flags: flags } /*:any*/); + if (itab < 0xFFFFFFF) + out.Sheet = itab; + if (comment) + out.Comment = comment; + return out; +} +function write_BrtName(name, wb) { + var o = new_buf(9); + var flags = 0; + var dname = name.Name; + if (XLSLblBuiltIn.indexOf(dname) > -1) { + flags |= 0x20; + dname = dname.slice(6); + } + o.write_shift(4, flags); // flags + o.write_shift(1, 0); // chKey + o.write_shift(4, name.Sheet == null ? 0xFFFFFFFF : name.Sheet); + var arr = [ + o, + write_XLWideString(dname), + write_XLSBNameParsedFormula(name.Ref, wb) + ]; + if (name.Comment) + arr.push(write_XLNullableWideString(name.Comment)); + else { + var x = new_buf(4); + x.write_shift(4, 0xFFFFFFFF); + arr.push(x); + } + // if macro (flags & 0x0F): + // write_shift(4, 0xFFFFFFFF); + // write_XLNullableWideString(description) + // write_XLNullableWideString(helpTopic) + // write_shift(4, 0xFFFFFFFF); + return bconcat(arr); +} +/* [MS-XLSB] 2.1.7.61 Workbook */ +function parse_wb_bin(data, opts) { + var wb = { AppVersion: {}, WBProps: {}, WBView: [], Sheets: [], CalcPr: {}, xmlns: "" }; + var state /*:Array*/ = []; + var pass = false; + if (!opts) + opts = {}; + opts.biff = 12; + var Names = []; + var supbooks = ([[]] /*:any*/); + supbooks.SheetNames = []; + supbooks.XTI = []; + XLSBRecordEnum[0x0010] = { n: "BrtFRTArchID$", f: parse_BrtFRTArchID$ }; + recordhopper(data, function hopper_wb(val, R, RT) { + switch (RT) { + case 0x009C: /* 'BrtBundleSh' */ + supbooks.SheetNames.push(val.name); + wb.Sheets.push(val); + break; + case 0x0099: /* 'BrtWbProp' */ + wb.WBProps = val; + break; + case 0x0027: /* 'BrtName' */ + if (val.Sheet != null) + opts.SID = val.Sheet; + val.Ref = stringify_formula(val.Ptg, null, null, supbooks, opts); + delete opts.SID; + delete val.Ptg; + Names.push(val); + break; + case 0x040C: /* 'BrtNameExt' */ break; + case 0x0165: /* 'BrtSupSelf' */ + case 0x0166: /* 'BrtSupSame' */ + case 0x0163: /* 'BrtSupBookSrc' */ + case 0x029B: /* 'BrtSupAddin' */ + if (!supbooks[0].length) + supbooks[0] = [RT, val]; + else + supbooks.push([RT, val]); + supbooks[supbooks.length - 1].XTI = []; + break; + case 0x016A: /* 'BrtExternSheet' */ + if (supbooks.length === 0) { + supbooks[0] = []; + supbooks[0].XTI = []; + } + supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); + supbooks.XTI = supbooks.XTI.concat(val); + break; + case 0x0169: /* 'BrtPlaceholderName' */ + break; + case 0x0817: /* 'BrtAbsPath15' */ + case 0x009E: /* 'BrtBookView' */ + case 0x008F: /* 'BrtBeginBundleShs' */ + case 0x0298: /* 'BrtBeginFnGroup' */ + case 0x0161: /* 'BrtBeginExternals' */ + break; + /* case 'BrtModelTimeGroupingCalcCol' */ + case 0x0C00: /* 'BrtUid' */ + case 0x0C01: /* 'BrtRevisionPtr' */ + case 0x0216: /* 'BrtBookProtection' */ + case 0x02A5: /* 'BrtBookProtectionIso' */ + case 0x009D: /* 'BrtCalcProp' */ + case 0x0262: /* 'BrtCrashRecErr' */ + case 0x0802: /* 'BrtDecoupledPivotCacheID' */ + case 0x009B: /* 'BrtFileRecover' */ + case 0x0224: /* 'BrtFileSharing' */ + case 0x02A4: /* 'BrtFileSharingIso' */ + case 0x0080: /* 'BrtFileVersion' */ + case 0x0299: /* 'BrtFnGroup' */ + case 0x0850: /* 'BrtModelRelationship' */ + case 0x084D: /* 'BrtModelTable' */ + case 0x0225: /* 'BrtOleSize' */ + case 0x0805: /* 'BrtPivotTableRef' */ + case 0x0254: /* 'BrtSmartTagType' */ + case 0x081C: /* 'BrtTableSlicerCacheID' */ + case 0x081B: /* 'BrtTableSlicerCacheIDs' */ + case 0x0822: /* 'BrtTimelineCachePivotCacheID' */ + case 0x018D: /* 'BrtUserBookView' */ + case 0x009A: /* 'BrtWbFactoid' */ + case 0x045D: /* 'BrtWbProp14' */ + case 0x0229: /* 'BrtWebOpt' */ + case 0x082B: /* 'BrtWorkBookPr15' */ + break; + case 0x0023: /* 'BrtFRTBegin' */ + state.push(RT); + pass = true; + break; + case 0x0024: /* 'BrtFRTEnd' */ + state.pop(); + pass = false; + break; + case 0x0025: /* 'BrtACBegin' */ + state.push(RT); + pass = true; + break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); + pass = false; + break; + case 0x0010: /* 'BrtFRTArchID$' */ break; + default: + if (R.T) { /* empty */ } + else if (!pass || (opts.WTF && state[state.length - 1] != 0x0025 /* BrtACBegin */ && state[state.length - 1] != 0x0023 /* BrtFRTBegin */)) + throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }, opts); + parse_wb_defaults(wb); + // $FlowIgnore + wb.Names = Names; + (wb /*:any*/).supbooks = supbooks; + return wb; +} +function write_BUNDLESHS(ba, wb /*::, opts*/) { + write_record(ba, 0x008F /* BrtBeginBundleShs */); + for (var idx = 0; idx != wb.SheetNames.length; ++idx) { + var viz = wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx] && wb.Workbook.Sheets[idx].Hidden || 0; + var d = { Hidden: viz, iTabID: idx + 1, strRelID: 'rId' + (idx + 1), name: wb.SheetNames[idx] }; + write_record(ba, 0x009C /* BrtBundleSh */, write_BrtBundleSh(d)); + } + write_record(ba, 0x0090 /* BrtEndBundleShs */); +} +/* [MS-XLSB] 2.4.649 BrtFileVersion */ +function write_BrtFileVersion(data, o) { + if (!o) + o = new_buf(127); + for (var i = 0; i != 4; ++i) + o.write_shift(4, 0); + write_XLWideString("SheetJS", o); + write_XLWideString(XLSX.version, o); + write_XLWideString(XLSX.version, o); + write_XLWideString("7262", o); + return o.length > o.l ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.301 BrtBookView */ +function write_BrtBookView(idx, o) { + if (!o) + o = new_buf(29); + o.write_shift(-4, 0); + o.write_shift(-4, 460); + o.write_shift(4, 28800); + o.write_shift(4, 17600); + o.write_shift(4, 500); + o.write_shift(4, idx); + o.write_shift(4, idx); + var flags = 0x78; + o.write_shift(1, flags); + return o.length > o.l ? o.slice(0, o.l) : o; +} +function write_BOOKVIEWS(ba, wb /*::, opts*/) { + /* required if hidden tab appears before visible tab */ + if (!wb.Workbook || !wb.Workbook.Sheets) + return; + var sheets = wb.Workbook.Sheets; + var i = 0, vistab = -1, hidden = -1; + for (; i < sheets.length; ++i) { + if (!sheets[i] || !sheets[i].Hidden && vistab == -1) + vistab = i; + else if (sheets[i].Hidden == 1 && hidden == -1) + hidden = i; + } + if (hidden > vistab) + return; + write_record(ba, 0x0087 /* BrtBeginBookViews */); + write_record(ba, 0x009E /* BrtBookView */, write_BrtBookView(vistab)); + /* 1*(BrtBookView *FRT) */ + write_record(ba, 0x0088 /* BrtEndBookViews */); +} +function write_BRTNAMES(ba, wb) { + if (!wb.Workbook || !wb.Workbook.Names) + return; + wb.Workbook.Names.forEach(function (name) { + try { + if (name.Flags & 0x0e) + return; // TODO: macro name write + write_record(ba, 0x0027 /* BrtName */, write_BrtName(name, wb)); + } + catch (e) { + console.error("Could not serialize defined name " + JSON.stringify(name)); + } + }); +} +function write_SELF_EXTERNS_xlsb(wb) { + var L = wb.SheetNames.length; + var o = new_buf(12 * L + 28); + o.write_shift(4, L + 2); + o.write_shift(4, 0); + o.write_shift(4, -2); + o.write_shift(4, -2); // workbook-level reference + o.write_shift(4, 0); + o.write_shift(4, -1); + o.write_shift(4, -1); // #REF!... + for (var i = 0; i < L; ++i) { + o.write_shift(4, 0); + o.write_shift(4, i); + o.write_shift(4, i); + } + return o; +} +function write_EXTERNALS_xlsb(ba, wb) { + write_record(ba, 0x0161 /* BrtBeginExternals */); + write_record(ba, 0x0165 /* BrtSupSelf */); + write_record(ba, 0x016A /* BrtExternSheet */, write_SELF_EXTERNS_xlsb(wb, 0)); + write_record(ba, 0x0162 /* BrtEndExternals */); +} +/* [MS-XLSB] 2.4.305 BrtCalcProp */ +/*function write_BrtCalcProp(data, o) { + if(!o) o = new_buf(26); + o.write_shift(4,0); // force recalc + o.write_shift(4,1); + o.write_shift(4,0); + write_Xnum(0, o); + o.write_shift(-4, 1023); + o.write_shift(1, 0x33); + o.write_shift(1, 0x00); + return o; +}*/ +/* [MS-XLSB] 2.4.646 BrtFileRecover */ +/*function write_BrtFileRecover(data, o) { + if(!o) o = new_buf(1); + o.write_shift(1,0); + return o; +}*/ +/* [MS-XLSB] 2.1.7.61 Workbook */ +function write_wb_bin(wb, opts) { + var ba = buf_array(); + write_record(ba, 0x0083 /* BrtBeginBook */); + write_record(ba, 0x0080 /* BrtFileVersion */, write_BrtFileVersion()); + /* [[BrtFileSharingIso] BrtFileSharing] */ + write_record(ba, 0x0099 /* BrtWbProp */, write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null)); + /* [ACABSPATH] */ + /* [[BrtBookProtectionIso] BrtBookProtection] */ + write_BOOKVIEWS(ba, wb, opts); + write_BUNDLESHS(ba, wb, opts); + /* [FNGROUP] */ + write_EXTERNALS_xlsb(ba, wb); + if ((wb.Workbook || {}).Names) + write_BRTNAMES(ba, wb); + /* write_record(ba, 0x009D BrtCalcProp, write_BrtCalcProp()); */ + /* [BrtOleSize] */ + /* *(BrtUserBookView *FRT) */ + /* [PIVOTCACHEIDS] */ + /* [BrtWbFactoid] */ + /* [SMARTTAGTYPES] */ + /* [BrtWebOpt] */ + /* write_record(ba, 0x009B BrtFileRecover, write_BrtFileRecover()); */ + /* [WEBPUBITEMS] */ + /* [CRERRS] */ + /* FRTWORKBOOK */ + write_record(ba, 0x0084 /* BrtEndBook */); + return ba.end(); +} +function parse_wb(data, name /*:string*/, opts) { + if (name.slice(-4) === ".bin") + return parse_wb_bin((data /*:any*/), opts); + return parse_wb_xml((data /*:any*/), opts); +} +function parse_ws(data, name /*:string*/, idx /*:number*/, opts, rels, wb, themes, styles) { + if (name.slice(-4) === ".bin") + return parse_ws_bin((data /*:any*/), opts, idx, rels, wb, themes, styles); + return parse_ws_xml((data /*:any*/), opts, idx, rels, wb, themes, styles); +} +function parse_cs(data, name /*:string*/, idx /*:number*/, opts, rels, wb, themes, styles) { + if (name.slice(-4) === ".bin") + return parse_cs_bin((data /*:any*/), opts, idx, rels, wb, themes, styles); + return parse_cs_xml((data /*:any*/), opts, idx, rels, wb, themes, styles); +} +function parse_ms(data, name /*:string*/, idx /*:number*/, opts, rels, wb, themes, styles) { + if (name.slice(-4) === ".bin") + return parse_ms_bin((data /*:any*/), opts, idx, rels, wb, themes, styles); + return parse_ms_xml((data /*:any*/), opts, idx, rels, wb, themes, styles); +} +function parse_ds(data, name /*:string*/, idx /*:number*/, opts, rels, wb, themes, styles) { + if (name.slice(-4) === ".bin") + return parse_ds_bin((data /*:any*/), opts, idx, rels, wb, themes, styles); + return parse_ds_xml((data /*:any*/), opts, idx, rels, wb, themes, styles); +} +function parse_sty(data, name /*:string*/, themes, opts) { + if (name.slice(-4) === ".bin") + return parse_sty_bin((data /*:any*/), themes, opts); + return parse_sty_xml((data /*:any*/), themes, opts); +} +function parse_sst(data, name /*:string*/, opts) { + if (name.slice(-4) === ".bin") + return parse_sst_bin((data /*:any*/), opts); + return parse_sst_xml((data /*:any*/), opts); +} +function parse_cmnt(data, name /*:string*/, opts) { + if (name.slice(-4) === ".bin") + return parse_comments_bin((data /*:any*/), opts); + return parse_comments_xml((data /*:any*/), opts); +} +function parse_cc(data, name /*:string*/, opts) { + if (name.slice(-4) === ".bin") + return parse_cc_bin((data /*:any*/), name, opts); + return parse_cc_xml((data /*:any*/), name, opts); +} +function parse_xlink(data, rel, name /*:string*/, opts) { + if (name.slice(-4) === ".bin") + return parse_xlink_bin((data /*:any*/), rel, name, opts); + return parse_xlink_xml((data /*:any*/), rel, name, opts); +} +function parse_xlmeta(data, name /*:string*/, opts) { + if (name.slice(-4) === ".bin") + return parse_xlmeta_bin((data /*:any*/), name, opts); + return parse_xlmeta_xml((data /*:any*/), name, opts); +} +var attregexg2 = /([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g; +var attregex2 = /([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/; +function xlml_parsexmltag(tag /*:string*/, skip_root /*:?boolean*/) { + var words = tag.split(/\s+/); + var z /*:any*/ = ([] /*:any*/); + if (!skip_root) + z[0] = words[0]; + if (words.length === 1) + return z; + var m = tag.match(attregexg2), y, j, w, i; + if (m) + for (i = 0; i != m.length; ++i) { + y = m[i].match(attregex2); + /*:: if(!y || !y[2]) continue; */ + if ((j = y[1].indexOf(":")) === -1) + z[y[1]] = y[2].slice(1, y[2].length - 1); + else { + if (y[1].slice(0, 6) === "xmlns:") + w = "xmlns" + y[1].slice(6); + else + w = y[1].slice(j + 1); + z[w] = y[2].slice(1, y[2].length - 1); + } + } + return z; +} +function xlml_parsexmltagobj(tag /*:string*/) { + var words = tag.split(/\s+/); + var z = {}; + if (words.length === 1) + return z; + var m = tag.match(attregexg2), y, j, w, i; + if (m) + for (i = 0; i != m.length; ++i) { + y = m[i].match(attregex2); + /*:: if(!y || !y[2]) continue; */ + if ((j = y[1].indexOf(":")) === -1) + z[y[1]] = y[2].slice(1, y[2].length - 1); + else { + if (y[1].slice(0, 6) === "xmlns:") + w = "xmlns" + y[1].slice(6); + else + w = y[1].slice(j + 1); + z[w] = y[2].slice(1, y[2].length - 1); + } + } + return z; +} +// ---- +/* map from xlml named formats to SSF TODO: localize */ +var XLMLFormatMap /*: {[string]:string}*/; +function xlml_format(format, value, date1904) { + var fmt = XLMLFormatMap[format] || unescapexml(format); + if (fmt === "General") + return SSF_general(value); + return SSF_format(fmt, value, { date1904: !!date1904 }); +} +function xlml_set_custprop(Custprops, key, cp, val /*:string*/) { + var oval /*:any*/ = val; + switch ((cp[0].match(/dt:dt="([\w.]+)"/) || ["", ""])[1]) { + case "boolean": + oval = parsexmlbool(val); + break; + case "i2": + case "int": + oval = parseInt(val, 10); + break; + case "r4": + case "float": + oval = parseFloat(val); + break; + case "date": + case "dateTime.tz": + oval = parseDate(val); + break; + case "i8": + case "string": + case "fixed": + case "uuid": + case "bin.base64": break; + default: throw new Error("bad custprop:" + cp[0]); + } + Custprops[unescapexml(key)] = oval; +} +function safe_format_xlml(cell /*:Cell*/, nf, o, date1904) { + if (cell.t === 'z') + return; + if (!o || o.cellText !== false) + try { + if (cell.t === 'e') { + cell.w = cell.w || BErr[cell.v]; + } + else if (nf === "General") { + if (cell.t === 'n') { + if ((cell.v | 0) === cell.v) + cell.w = cell.v.toString(10); + else + cell.w = SSF_general_num(cell.v); + } + else + cell.w = SSF_general(cell.v); + } + else + cell.w = xlml_format(nf || "General", cell.v, date1904); + } + catch (e) { + if (o.WTF) + throw e; + } + try { + var z = XLMLFormatMap[nf] || nf || "General"; + if (o.cellNF) + cell.z = z; + if (o.cellDates && cell.t == 'n' && fmt_is_date(z)) { + var _d = SSF_parse_date_code(cell.v + (date1904 ? 1462 : 0)); + if (_d) { + cell.t = 'd'; + cell.v = new Date(Date.UTC(_d.y, _d.m - 1, _d.d, _d.H, _d.M, _d.S, _d.u)); + } + } + } + catch (e) { + if (o.WTF) + throw e; + } +} +function process_style_xlml(styles, stag, opts) { + if (opts.cellStyles) { + if (stag.Interior) { + var I = stag.Interior; + if (I.Pattern) + I.patternType = XLMLPatternTypeMap[I.Pattern] || I.Pattern; + } + } + styles[stag.ID] = stag; +} +/* TODO: there must exist some form of OSP-blessed spec */ +function parse_xlml_data(xml, ss, data, cell /*:any*/, base, styles, csty, row, arrayf, o, date1904) { + var nf = "General", sid = cell.StyleID, S = {}; + o = o || {}; + var interiors = []; + var i = 0; + if (sid === undefined && row) + sid = row.StyleID; + if (sid === undefined && csty) + sid = csty.StyleID; + while (styles[sid] !== undefined) { + if (styles[sid].nf) + nf = styles[sid].nf; + if (styles[sid].Interior) + interiors.push(styles[sid].Interior); + if (!styles[sid].Parent) + break; + sid = styles[sid].Parent; + } + switch (data.Type) { + case 'Boolean': + cell.t = 'b'; + cell.v = parsexmlbool(xml); + break; + case 'String': + cell.t = 's'; + cell.r = xlml_fixstr(unescapexml(xml)); + cell.v = (xml.indexOf("<") > -1 ? unescapexml(ss || xml).replace(/<.*?>/g, "") : cell.r); // todo: BR etc + break; + case 'DateTime': + if (xml.slice(-1) != "Z") + xml += "Z"; + cell.v = datenum(parseDate(xml, date1904), date1904); + if (cell.v !== cell.v) + cell.v = unescapexml(xml); + if (!nf || nf == "General") + nf = "yyyy-mm-dd"; + /* falls through */ + case 'Number': + if (cell.v === undefined) + cell.v = +xml; + if (!cell.t) + cell.t = 'n'; + break; + case 'Error': + cell.t = 'e'; + cell.v = RBErr[xml]; + if (o.cellText !== false) + cell.w = xml; + break; + default: + if (xml == "" && ss == "") { + cell.t = 'z'; + } + else { + cell.t = 's'; + cell.v = xlml_fixstr(ss || xml); + } + break; + } + safe_format_xlml(cell, nf, o, date1904); + if (o.cellFormula !== false) { + if (cell.Formula) { + var fstr = unescapexml(cell.Formula); + /* strictly speaking, the leading = is required but some writers omit */ + if (fstr.charCodeAt(0) == 61 /* = */) + fstr = fstr.slice(1); + cell.f = rc_to_a1(fstr, base); + delete cell.Formula; + if (cell.ArrayRange == "RC") + cell.F = rc_to_a1("RC:RC", base); + else if (cell.ArrayRange) { + cell.F = rc_to_a1(cell.ArrayRange, base); + arrayf.push([safe_decode_range(cell.F), cell.F]); + } + } + else { + for (i = 0; i < arrayf.length; ++i) + if (base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r) + if (base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c) + cell.F = arrayf[i][1]; + } + } + if (o.cellStyles) { + interiors.forEach(function (x) { + if (!S.patternType && x.patternType) + S.patternType = x.patternType; + }); + cell.s = S; + } + if (cell.StyleID !== undefined) + cell.ixfe = cell.StyleID; +} +function xlml_prefix_dname(dname) { + return XLSLblBuiltIn.indexOf("_xlnm." + dname) > -1 ? "_xlnm." + dname : dname; +} +function xlml_clean_comment(comment /*:any*/) { + comment.t = comment.v || ""; + comment.t = comment.t.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); + comment.v = comment.w = comment.ixfe = undefined; +} +/* TODO: Everything */ +function parse_xlml_xml(d, _opts) { + var opts = _opts || {}; + make_ssf(); + var str = debom(xlml_normalize(d)); + if (opts.type == 'binary' || opts.type == 'array' || opts.type == 'base64') { + if (typeof $cptable !== 'undefined') + str = $cptable.utils.decode(65001, char_codes(str)); + else + str = utf8read(str); + } + var opening = str.slice(0, 1024).toLowerCase(), ishtml = false; + opening = opening.replace(/".*?"/g, ""); + if ((opening.indexOf(">") & 1023) > Math.min((opening.indexOf(",") & 1023), (opening.indexOf(";") & 1023))) { + var _o = dup(opts); + _o.type = "string"; + return PRN.to_workbook(str, _o); + } + if (opening.indexOf("= 0) + ishtml = true; }); + if (ishtml) + return html_to_workbook(str, opts); + XLMLFormatMap = ({ + "General Number": "General", + "General Date": table_fmt[22], + "Long Date": "dddd, mmmm dd, yyyy", + "Medium Date": table_fmt[15], + "Short Date": table_fmt[14], + "Long Time": table_fmt[19], + "Medium Time": table_fmt[18], + "Short Time": table_fmt[20], + "Currency": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "Fixed": table_fmt[2], + "Standard": table_fmt[4], + "Percent": table_fmt[10], + "Scientific": table_fmt[11], + "Yes/No": '"Yes";"Yes";"No";@', + "True/False": '"True";"True";"False";@', + "On/Off": '"Yes";"Yes";"No";@' + } /*:any*/); + var Rn; + var state = [], tmp; + if (DENSE != null && opts.dense == null) + opts.dense = DENSE; + var sheets = {}, sheetnames /*:Array*/ = [], cursheet /*:Worksheet*/ = ({}), sheetname = ""; + if (opts.dense) + cursheet["!data"] = []; + var cell = ({} /*:any*/), row = {}; // eslint-disable-line no-unused-vars + var dtag = xlml_parsexmltag(''), didx = 0; + var c = 0, r = 0; + var refguess /*:Range*/ = { s: { r: 2000000, c: 2000000 }, e: { r: 0, c: 0 } }; + var styles = {}, stag = {}; + var ss = "", fidx = 0; + var merges /*:Array*/ = []; + var Props = {}, Custprops = {}, pidx = 0, cp = []; + var comments /*:Array*/ = [], comment /*:Comment*/ = ({} /*:any*/); + var cstys = [], csty, seencol = false; + var arrayf /*:Array<[Range, string]>*/ = []; + var rowinfo /*:Array*/ = [], rowobj = {}, cc = 0, rr = 0; + var Workbook /*:WBWBProps*/ = ({ Sheets: [], WBProps: { date1904: false } } /*:any*/), wsprops = {}; + xlmlregex.lastIndex = 0; + str = str.replace(//mg, ""); + var raw_Rn3 = ""; + while ((Rn = xlmlregex.exec(str))) + switch ((Rn[3] = (raw_Rn3 = Rn[3]).toLowerCase())) { + case 'data' /*case 'Data'*/: + if (raw_Rn3 == "data") { + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw new Error("Bad state: " + tmp.join("|")); + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') + state.push([Rn[3], true]); + break; + } + if (state[state.length - 1][1]) + break; + if (Rn[1] === '/') + parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length - 1][0] == /*"Comment"*/ "comment" ? comment : cell, { c: c, r: r }, styles, cstys[c], row, arrayf, opts, Workbook.WBProps.date1904); + else { + ss = ""; + dtag = xlml_parsexmltag(Rn[0]); + didx = Rn.index + Rn[0].length; + } + break; + case 'cell' /*case 'Cell'*/: + if (Rn[1] === '/') { + if (comments.length > 0) + cell.c = comments; + if ((!opts.sheetRows || opts.sheetRows > r) && cell.v !== void 0) { + if (opts.dense) { + if (!cursheet["!data"][r]) + cursheet["!data"][r] = []; + cursheet["!data"][r][c] = cell; + } + else + cursheet[encode_col(c) + encode_row(r)] = cell; + } + if (cell.HRef) { + cell.l = ({ Target: unescapexml(cell.HRef) } /*:any*/); + if (cell.HRefScreenTip) + cell.l.Tooltip = cell.HRefScreenTip; + delete cell.HRef; + delete cell.HRefScreenTip; + } + if (cell.MergeAcross || cell.MergeDown) { + cc = c + (parseInt(cell.MergeAcross, 10) | 0); + rr = r + (parseInt(cell.MergeDown, 10) | 0); + if (cc > c || rr > r) + merges.push({ s: { c: c, r: r }, e: { c: cc, r: rr } }); + } + if (!opts.sheetStubs) { + if (cell.MergeAcross) + c = cc + 1; + else + ++c; + } + else if (cell.MergeAcross || cell.MergeDown) { + /*:: if(!cc) cc = 0; if(!rr) rr = 0; */ + for (var cma = c; cma <= cc; ++cma) { + for (var cmd = r; cmd <= rr; ++cmd) { + if (cma > c || cmd > r) { + if (opts.dense) { + if (!cursheet["!data"][cmd]) + cursheet["!data"][cmd] = []; + cursheet["!data"][cmd][cma] = { t: 'z' }; + } + else + cursheet[encode_col(cma) + encode_row(cmd)] = { t: 'z' }; + } + } + } + c = cc + 1; + } + else + ++c; + } + else { + cell = xlml_parsexmltagobj(Rn[0]); + if (cell.Index) + c = +cell.Index - 1; + if (c < refguess.s.c) + refguess.s.c = c; + if (c > refguess.e.c) + refguess.e.c = c; + if (Rn[0].slice(-2) === "/>") + ++c; + comments = []; + } + break; + case 'row' /*case 'Row'*/: + if (Rn[1] === '/' || Rn[0].slice(-2) === "/>") { + if (r < refguess.s.r) + refguess.s.r = r; + if (r > refguess.e.r) + refguess.e.r = r; + if (Rn[0].slice(-2) === "/>") { + row = xlml_parsexmltag(Rn[0]); + if (row.Index) + r = +row.Index - 1; + } + c = 0; + ++r; + } + else { + row = xlml_parsexmltag(Rn[0]); + if (row.Index) + r = +row.Index - 1; + rowobj = {}; + if (row.AutoFitHeight == "0" || row.Height) { + rowobj.hpx = parseInt(row.Height, 10); + rowobj.hpt = px2pt(rowobj.hpx); + rowinfo[r] = rowobj; + } + if (row.Hidden == "1") { + rowobj.hidden = true; + rowinfo[r] = rowobj; + } + } + break; + case 'worksheet' /*case 'Worksheet'*/: /* TODO: read range from FullRows/FullColumns */ + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw new Error("Bad state: " + tmp.join("|")); + sheetnames.push(sheetname); + if (refguess.s.r <= refguess.e.r && refguess.s.c <= refguess.e.c) { + cursheet["!ref"] = encode_range(refguess); + if (opts.sheetRows && opts.sheetRows <= refguess.e.r) { + cursheet["!fullref"] = cursheet["!ref"]; + refguess.e.r = opts.sheetRows - 1; + cursheet["!ref"] = encode_range(refguess); + } + } + if (merges.length) + cursheet["!merges"] = merges; + if (cstys.length > 0) + cursheet["!cols"] = cstys; + if (rowinfo.length > 0) + cursheet["!rows"] = rowinfo; + sheets[sheetname] = cursheet; + } + else { + refguess = { s: { r: 2000000, c: 2000000 }, e: { r: 0, c: 0 } }; + r = c = 0; + state.push([Rn[3], false]); + tmp = xlml_parsexmltag(Rn[0]); + sheetname = unescapexml(tmp.Name); + cursheet = ({}); + if (opts.dense) + cursheet["!data"] = []; + merges = []; + arrayf = []; + rowinfo = []; + wsprops = { name: sheetname, Hidden: 0 }; + Workbook.Sheets.push(wsprops); + } + break; + case 'table' /*case 'Table'*/: + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw new Error("Bad state: " + tmp.join("|")); + } + else if (Rn[0].slice(-2) == "/>") + break; + else { + state.push([Rn[3], false]); + cstys = []; + seencol = false; + } + break; + case 'style' /*case 'Style'*/: + if (Rn[1] === '/') + process_style_xlml(styles, stag, opts); + else + stag = xlml_parsexmltag(Rn[0]); + break; + case 'numberformat' /*case 'NumberFormat'*/: + stag.nf = unescapexml(xlml_parsexmltag(Rn[0]).Format || "General"); + if (XLMLFormatMap[stag.nf]) + stag.nf = XLMLFormatMap[stag.nf]; + for (var ssfidx = 0; ssfidx != 0x188; ++ssfidx) + if (table_fmt[ssfidx] == stag.nf) + break; + if (ssfidx == 0x188) + for (ssfidx = 0x39; ssfidx != 0x188; ++ssfidx) + if (table_fmt[ssfidx] == null) { + SSF__load(stag.nf, ssfidx); + break; + } + break; + case 'column' /*case 'Column'*/: + if (state[state.length - 1][0] !== /*'Table'*/ 'table') + break; + if (Rn[1] === '/') + break; + csty = xlml_parsexmltag(Rn[0]); + if (csty.Hidden) { + csty.hidden = true; + delete csty.Hidden; + } + if (csty.Width) + csty.wpx = parseInt(csty.Width, 10); + if (!seencol && csty.wpx > 10) { + seencol = true; + MDW = DEF_MDW; //find_mdw_wpx(csty.wpx); + for (var _col = 0; _col < cstys.length; ++_col) + if (cstys[_col]) + process_col(cstys[_col]); + } + if (seencol) + process_col(csty); + cstys[(csty.Index - 1 || cstys.length)] = csty; + for (var i = 0; i < +csty.Span; ++i) + cstys[cstys.length] = dup(csty); + break; + case 'namedrange' /*case 'NamedRange'*/: + if (Rn[1] === '/') + break; + if (!Workbook.Names) + Workbook.Names = []; + var _NamedRange = parsexmltag(Rn[0]); + var _DefinedName /*:DefinedName*/ = ({ + Name: xlml_prefix_dname(_NamedRange.Name), + Ref: rc_to_a1(_NamedRange.RefersTo.slice(1), { r: 0, c: 0 }) + } /*:any*/); + if (Workbook.Sheets.length > 0) + _DefinedName.Sheet = Workbook.Sheets.length - 1; + /*:: if(Workbook.Names) */ Workbook.Names.push(_DefinedName); + break; + case 'namedcell' /*case 'NamedCell'*/: break; + case 'b' /*case 'B'*/: break; + case 'i' /*case 'I'*/: break; + case 'u' /*case 'U'*/: break; + case 's' /*case 'S'*/: break; + case 'em' /*case 'EM'*/: break; + case 'h2' /*case 'H2'*/: break; + case 'h3' /*case 'H3'*/: break; + case 'sub' /*case 'Sub'*/: break; + case 'sup' /*case 'Sup'*/: break; + case 'span' /*case 'Span'*/: break; + case 'alignment' /*case 'Alignment'*/: + break; + case 'borders' /*case 'Borders'*/: break; + case 'border' /*case 'Border'*/: break; + case 'font' /*case 'Font'*/: + if (Rn[0].slice(-2) === "/>") + break; + else if (Rn[1] === "/") + ss += str.slice(fidx, Rn.index); + else + fidx = Rn.index + Rn[0].length; + break; + case 'interior' /*case 'Interior'*/: + if (!opts.cellStyles) + break; + stag.Interior = xlml_parsexmltag(Rn[0]); + break; + case 'protection' /*case 'Protection'*/: break; + case 'author' /*case 'Author'*/: + case 'title' /*case 'Title'*/: + case 'description' /*case 'Description'*/: + case 'created' /*case 'Created'*/: + case 'keywords' /*case 'Keywords'*/: + case 'subject' /*case 'Subject'*/: + case 'category' /*case 'Category'*/: + case 'company' /*case 'Company'*/: + case 'lastauthor' /*case 'LastAuthor'*/: + case 'lastsaved' /*case 'LastSaved'*/: + case 'lastprinted' /*case 'LastPrinted'*/: + case 'version' /*case 'Version'*/: + case 'revision' /*case 'Revision'*/: + case 'totaltime' /*case 'TotalTime'*/: + case 'hyperlinkbase' /*case 'HyperlinkBase'*/: + case 'manager' /*case 'Manager'*/: + case 'contentstatus' /*case 'ContentStatus'*/: + case 'identifier' /*case 'Identifier'*/: + case 'language' /*case 'Language'*/: + case 'appname' /*case 'AppName'*/: + if (Rn[0].slice(-2) === "/>") + break; + else if (Rn[1] === "/") + xlml_set_prop(Props, raw_Rn3, str.slice(pidx, Rn.index)); + else + pidx = Rn.index + Rn[0].length; + break; + case 'paragraphs' /*case 'Paragraphs'*/: break; + case 'styles' /*case 'Styles'*/: + case 'workbook' /*case 'Workbook'*/: + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw new Error("Bad state: " + tmp.join("|")); + } + else + state.push([Rn[3], false]); + break; + case 'comment' /*case 'Comment'*/: + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw new Error("Bad state: " + tmp.join("|")); + xlml_clean_comment(comment); + comments.push(comment); + } + else { + state.push([Rn[3], false]); + tmp = xlml_parsexmltag(Rn[0]); + if (!parsexmlbool(tmp["ShowAlways"] || "0")) + comments.hidden = true; + comment = ({ a: tmp.Author } /*:any*/); + } + break; + case 'autofilter' /*case 'AutoFilter'*/: + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw new Error("Bad state: " + tmp.join("|")); + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + var AutoFilter = xlml_parsexmltag(Rn[0]); + cursheet['!autofilter'] = { ref: rc_to_a1(AutoFilter.Range).replace(/\$/g, "") }; + state.push([Rn[3], true]); + } + break; + case 'name' /*case 'Name'*/: break; + case 'datavalidation' /*case 'DataValidation'*/: + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw new Error("Bad state: " + tmp.join("|")); + } + else { + if (Rn[0].charAt(Rn[0].length - 2) !== '/') + state.push([Rn[3], true]); + } + break; + case 'pixelsperinch' /*case 'PixelsPerInch'*/: + break; + case 'componentoptions' /*case 'ComponentOptions'*/: + case 'documentproperties' /*case 'DocumentProperties'*/: + case 'customdocumentproperties' /*case 'CustomDocumentProperties'*/: + case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: + case 'pivottable' /*case 'PivotTable'*/: + case 'pivotcache' /*case 'PivotCache'*/: + case 'names' /*case 'Names'*/: + case 'mapinfo' /*case 'MapInfo'*/: + case 'pagebreaks' /*case 'PageBreaks'*/: + case 'querytable' /*case 'QueryTable'*/: + case 'sorting' /*case 'Sorting'*/: + case 'schema' /*case 'Schema'*/: //case 'data' /*case 'data'*/: + case 'conditionalformatting' /*case 'ConditionalFormatting'*/: + case 'smarttagtype' /*case 'SmartTagType'*/: + case 'smarttags' /*case 'SmartTags'*/: + case 'excelworkbook' /*case 'ExcelWorkbook'*/: + case 'workbookoptions' /*case 'WorkbookOptions'*/: + case 'worksheetoptions' /*case 'WorksheetOptions'*/: + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw new Error("Bad state: " + tmp.join("|")); + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') + state.push([Rn[3], true]); + break; + case 'null' /*case 'Null'*/: break; + default: + /* FODS file root is */ + if (state.length == 0 && Rn[3] == "document") + return parse_fods(str, opts); + /* UOS file root is */ + if (state.length == 0 && Rn[3] == "uof" /*"UOF"*/) + return parse_fods(str, opts); + var seen = true; + switch (state[state.length - 1][0]) { + /* OfficeDocumentSettings */ + case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: + switch (Rn[3]) { + case 'allowpng' /*case 'AllowPNG'*/: break; + case 'removepersonalinformation' /*case 'RemovePersonalInformation'*/: break; + case 'downloadcomponents' /*case 'DownloadComponents'*/: break; + case 'locationofcomponents' /*case 'LocationOfComponents'*/: break; + case 'colors' /*case 'Colors'*/: break; + case 'color' /*case 'Color'*/: break; + case 'index' /*case 'Index'*/: break; + case 'rgb' /*case 'RGB'*/: break; + case 'targetscreensize' /*case 'TargetScreenSize'*/: break; + case 'readonlyrecommended' /*case 'ReadOnlyRecommended'*/: break; + default: seen = false; + } + break; + /* ComponentOptions */ + case 'componentoptions' /*case 'ComponentOptions'*/: + switch (Rn[3]) { + case 'toolbar' /*case 'Toolbar'*/: break; + case 'hideofficelogo' /*case 'HideOfficeLogo'*/: break; + case 'spreadsheetautofit' /*case 'SpreadsheetAutoFit'*/: break; + case 'label' /*case 'Label'*/: break; + case 'caption' /*case 'Caption'*/: break; + case 'maxheight' /*case 'MaxHeight'*/: break; + case 'maxwidth' /*case 'MaxWidth'*/: break; + case 'nextsheetnumber' /*case 'NextSheetNumber'*/: break; + default: seen = false; + } + break; + /* ExcelWorkbook */ + case 'excelworkbook' /*case 'ExcelWorkbook'*/: + switch (Rn[3]) { + case 'date1904' /*case 'Date1904'*/: + /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ + Workbook.WBProps.date1904 = true; + break; + case 'hidehorizontalscrollbar' /*case 'HideHorizontalScrollBar'*/: break; + case 'hideverticalscrollbar' /*case 'HideVerticalScrollBar'*/: break; + case 'hideworkbooktabs' /*case 'HideWorkbookTabs'*/: break; + case 'windowheight' /*case 'WindowHeight'*/: break; + case 'windowwidth' /*case 'WindowWidth'*/: break; + case 'windowtopx' /*case 'WindowTopX'*/: break; + case 'windowtopy' /*case 'WindowTopY'*/: break; + case 'tabratio' /*case 'TabRatio'*/: break; + case 'protectstructure' /*case 'ProtectStructure'*/: break; + case 'protectwindow' /*case 'ProtectWindow'*/: break; + case 'protectwindows' /*case 'ProtectWindows'*/: break; + case 'activesheet' /*case 'ActiveSheet'*/: break; + case 'displayinknotes' /*case 'DisplayInkNotes'*/: break; + case 'firstvisiblesheet' /*case 'FirstVisibleSheet'*/: break; + case 'supbook' /*case 'SupBook'*/: break; + case 'sheetname' /*case 'SheetName'*/: break; + case 'sheetindex' /*case 'SheetIndex'*/: break; + case 'sheetindexfirst' /*case 'SheetIndexFirst'*/: break; + case 'sheetindexlast' /*case 'SheetIndexLast'*/: break; + case 'dll' /*case 'Dll'*/: break; + case 'acceptlabelsinformulas' /*case 'AcceptLabelsInFormulas'*/: break; + case 'donotsavelinkvalues' /*case 'DoNotSaveLinkValues'*/: break; + case 'iteration' /*case 'Iteration'*/: break; + case 'maxiterations' /*case 'MaxIterations'*/: break; + case 'maxchange' /*case 'MaxChange'*/: break; + case 'path' /*case 'Path'*/: break; + case 'xct' /*case 'Xct'*/: break; + case 'count' /*case 'Count'*/: break; + case 'selectedsheets' /*case 'SelectedSheets'*/: break; + case 'calculation' /*case 'Calculation'*/: break; + case 'uncalced' /*case 'Uncalced'*/: break; + case 'startupprompt' /*case 'StartupPrompt'*/: break; + case 'crn' /*case 'Crn'*/: break; + case 'externname' /*case 'ExternName'*/: break; + case 'formula' /*case 'Formula'*/: break; + case 'colfirst' /*case 'ColFirst'*/: break; + case 'collast' /*case 'ColLast'*/: break; + case 'wantadvise' /*case 'WantAdvise'*/: break; + case 'boolean' /*case 'Boolean'*/: break; + case 'error' /*case 'Error'*/: break; + case 'text' /*case 'Text'*/: break; + case 'ole' /*case 'OLE'*/: break; + case 'noautorecover' /*case 'NoAutoRecover'*/: break; + case 'publishobjects' /*case 'PublishObjects'*/: break; + case 'donotcalculatebeforesave' /*case 'DoNotCalculateBeforeSave'*/: break; + case 'number' /*case 'Number'*/: break; + case 'refmoder1c1' /*case 'RefModeR1C1'*/: break; + case 'embedsavesmarttags' /*case 'EmbedSaveSmartTags'*/: break; + default: seen = false; + } + break; + /* WorkbookOptions */ + case 'workbookoptions' /*case 'WorkbookOptions'*/: + switch (Rn[3]) { + case 'owcversion' /*case 'OWCVersion'*/: break; + case 'height' /*case 'Height'*/: break; + case 'width' /*case 'Width'*/: break; + default: seen = false; + } + break; + /* WorksheetOptions */ + case 'worksheetoptions' /*case 'WorksheetOptions'*/: + switch (Rn[3]) { + case 'visible' /*case 'Visible'*/: + if (Rn[0].slice(-2) === "/>") { /* empty */ } + else if (Rn[1] === "/") + switch (str.slice(pidx, Rn.index)) { + case "SheetHidden": + wsprops.Hidden = 1; + break; + case "SheetVeryHidden": + wsprops.Hidden = 2; + break; + } + else + pidx = Rn.index + Rn[0].length; + break; + case 'header' /*case 'Header'*/: + if (!cursheet['!margins']) + default_margins(cursheet['!margins'] = {}, 'xlml'); + if (!isNaN(+parsexmltag(Rn[0]).Margin)) + cursheet['!margins'].header = +parsexmltag(Rn[0]).Margin; + break; + case 'footer' /*case 'Footer'*/: + if (!cursheet['!margins']) + default_margins(cursheet['!margins'] = {}, 'xlml'); + if (!isNaN(+parsexmltag(Rn[0]).Margin)) + cursheet['!margins'].footer = +parsexmltag(Rn[0]).Margin; + break; + case 'pagemargins' /*case 'PageMargins'*/: + var pagemargins = parsexmltag(Rn[0]); + if (!cursheet['!margins']) + default_margins(cursheet['!margins'] = {}, 'xlml'); + if (!isNaN(+pagemargins.Top)) + cursheet['!margins'].top = +pagemargins.Top; + if (!isNaN(+pagemargins.Left)) + cursheet['!margins'].left = +pagemargins.Left; + if (!isNaN(+pagemargins.Right)) + cursheet['!margins'].right = +pagemargins.Right; + if (!isNaN(+pagemargins.Bottom)) + cursheet['!margins'].bottom = +pagemargins.Bottom; + break; + case 'displayrighttoleft' /*case 'DisplayRightToLeft'*/: + if (!Workbook.Views) + Workbook.Views = []; + if (!Workbook.Views[0]) + Workbook.Views[0] = {}; + Workbook.Views[0].RTL = true; + break; + case 'freezepanes' /*case 'FreezePanes'*/: break; + case 'frozennosplit' /*case 'FrozenNoSplit'*/: break; + case 'splithorizontal' /*case 'SplitHorizontal'*/: + case 'splitvertical' /*case 'SplitVertical'*/: + break; + case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/: + break; + case 'activerow' /*case 'ActiveRow'*/: break; + case 'activecol' /*case 'ActiveCol'*/: break; + case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break; + case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break; + case 'unsynced' /*case 'Unsynced'*/: break; + case 'print' /*case 'Print'*/: break; + case 'printerrors' /*case 'PrintErrors'*/: break; + case 'panes' /*case 'Panes'*/: break; + case 'scale' /*case 'Scale'*/: break; + case 'pane' /*case 'Pane'*/: break; + case 'number' /*case 'Number'*/: break; + case 'layout' /*case 'Layout'*/: break; + case 'pagesetup' /*case 'PageSetup'*/: break; + case 'selected' /*case 'Selected'*/: break; + case 'protectobjects' /*case 'ProtectObjects'*/: break; + case 'enableselection' /*case 'EnableSelection'*/: break; + case 'protectscenarios' /*case 'ProtectScenarios'*/: break; + case 'validprinterinfo' /*case 'ValidPrinterInfo'*/: break; + case 'horizontalresolution' /*case 'HorizontalResolution'*/: break; + case 'verticalresolution' /*case 'VerticalResolution'*/: break; + case 'numberofcopies' /*case 'NumberofCopies'*/: break; + case 'activepane' /*case 'ActivePane'*/: break; + case 'toprowvisible' /*case 'TopRowVisible'*/: break; + case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break; + case 'fittopage' /*case 'FitToPage'*/: break; + case 'rangeselection' /*case 'RangeSelection'*/: break; + case 'papersizeindex' /*case 'PaperSizeIndex'*/: break; + case 'pagelayoutzoom' /*case 'PageLayoutZoom'*/: break; + case 'pagebreakzoom' /*case 'PageBreakZoom'*/: break; + case 'filteron' /*case 'FilterOn'*/: break; + case 'fitwidth' /*case 'FitWidth'*/: break; + case 'fitheight' /*case 'FitHeight'*/: break; + case 'commentslayout' /*case 'CommentsLayout'*/: break; + case 'zoom' /*case 'Zoom'*/: break; + case 'lefttoright' /*case 'LeftToRight'*/: break; + case 'gridlines' /*case 'Gridlines'*/: break; + case 'allowsort' /*case 'AllowSort'*/: break; + case 'allowfilter' /*case 'AllowFilter'*/: break; + case 'allowinsertrows' /*case 'AllowInsertRows'*/: break; + case 'allowdeleterows' /*case 'AllowDeleteRows'*/: break; + case 'allowinsertcols' /*case 'AllowInsertCols'*/: break; + case 'allowdeletecols' /*case 'AllowDeleteCols'*/: break; + case 'allowinserthyperlinks' /*case 'AllowInsertHyperlinks'*/: break; + case 'allowformatcells' /*case 'AllowFormatCells'*/: break; + case 'allowsizecols' /*case 'AllowSizeCols'*/: break; + case 'allowsizerows' /*case 'AllowSizeRows'*/: break; + case 'nosummaryrowsbelowdetail' /*case 'NoSummaryRowsBelowDetail'*/: + if (!cursheet["!outline"]) + cursheet["!outline"] = {}; + cursheet["!outline"].above = true; + break; + case 'tabcolorindex' /*case 'TabColorIndex'*/: break; + case 'donotdisplayheadings' /*case 'DoNotDisplayHeadings'*/: break; + case 'showpagelayoutzoom' /*case 'ShowPageLayoutZoom'*/: break; + case 'nosummarycolumnsrightdetail' /*case 'NoSummaryColumnsRightDetail'*/: + if (!cursheet["!outline"]) + cursheet["!outline"] = {}; + cursheet["!outline"].left = true; + break; + case 'blackandwhite' /*case 'BlackAndWhite'*/: break; + case 'donotdisplayzeros' /*case 'DoNotDisplayZeros'*/: break; + case 'displaypagebreak' /*case 'DisplayPageBreak'*/: break; + case 'rowcolheadings' /*case 'RowColHeadings'*/: break; + case 'donotdisplayoutline' /*case 'DoNotDisplayOutline'*/: break; + case 'noorientation' /*case 'NoOrientation'*/: break; + case 'allowusepivottables' /*case 'AllowUsePivotTables'*/: break; + case 'zeroheight' /*case 'ZeroHeight'*/: break; + case 'viewablerange' /*case 'ViewableRange'*/: break; + case 'selection' /*case 'Selection'*/: break; + case 'protectcontents' /*case 'ProtectContents'*/: break; + default: seen = false; + } + break; + /* PivotTable */ + case 'pivottable' /*case 'PivotTable'*/: + case 'pivotcache' /*case 'PivotCache'*/: + switch (Rn[3]) { + case 'immediateitemsondrop' /*case 'ImmediateItemsOnDrop'*/: break; + case 'showpagemultipleitemlabel' /*case 'ShowPageMultipleItemLabel'*/: break; + case 'compactrowindent' /*case 'CompactRowIndent'*/: break; + case 'location' /*case 'Location'*/: break; + case 'pivotfield' /*case 'PivotField'*/: break; + case 'orientation' /*case 'Orientation'*/: break; + case 'layoutform' /*case 'LayoutForm'*/: break; + case 'layoutsubtotallocation' /*case 'LayoutSubtotalLocation'*/: break; + case 'layoutcompactrow' /*case 'LayoutCompactRow'*/: break; + case 'position' /*case 'Position'*/: break; + case 'pivotitem' /*case 'PivotItem'*/: break; + case 'datatype' /*case 'DataType'*/: break; + case 'datafield' /*case 'DataField'*/: break; + case 'sourcename' /*case 'SourceName'*/: break; + case 'parentfield' /*case 'ParentField'*/: break; + case 'ptlineitems' /*case 'PTLineItems'*/: break; + case 'ptlineitem' /*case 'PTLineItem'*/: break; + case 'countofsameitems' /*case 'CountOfSameItems'*/: break; + case 'item' /*case 'Item'*/: break; + case 'itemtype' /*case 'ItemType'*/: break; + case 'ptsource' /*case 'PTSource'*/: break; + case 'cacheindex' /*case 'CacheIndex'*/: break; + case 'consolidationreference' /*case 'ConsolidationReference'*/: break; + case 'filename' /*case 'FileName'*/: break; + case 'reference' /*case 'Reference'*/: break; + case 'nocolumngrand' /*case 'NoColumnGrand'*/: break; + case 'norowgrand' /*case 'NoRowGrand'*/: break; + case 'blanklineafteritems' /*case 'BlankLineAfterItems'*/: break; + case 'hidden' /*case 'Hidden'*/: break; + case 'subtotal' /*case 'Subtotal'*/: break; + case 'basefield' /*case 'BaseField'*/: break; + case 'mapchilditems' /*case 'MapChildItems'*/: break; + case 'function' /*case 'Function'*/: break; + case 'refreshonfileopen' /*case 'RefreshOnFileOpen'*/: break; + case 'printsettitles' /*case 'PrintSetTitles'*/: break; + case 'mergelabels' /*case 'MergeLabels'*/: break; + case 'defaultversion' /*case 'DefaultVersion'*/: break; + case 'refreshname' /*case 'RefreshName'*/: break; + case 'refreshdate' /*case 'RefreshDate'*/: break; + case 'refreshdatecopy' /*case 'RefreshDateCopy'*/: break; + case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break; + case 'versionlastupdate' /*case 'VersionLastUpdate'*/: break; + case 'versionupdateablemin' /*case 'VersionUpdateableMin'*/: break; + case 'versionrefreshablemin' /*case 'VersionRefreshableMin'*/: break; + case 'calculation' /*case 'Calculation'*/: break; + default: seen = false; + } + break; + /* PageBreaks */ + case 'pagebreaks' /*case 'PageBreaks'*/: + switch (Rn[3]) { + case 'colbreaks' /*case 'ColBreaks'*/: break; + case 'colbreak' /*case 'ColBreak'*/: break; + case 'rowbreaks' /*case 'RowBreaks'*/: break; + case 'rowbreak' /*case 'RowBreak'*/: break; + case 'colstart' /*case 'ColStart'*/: break; + case 'colend' /*case 'ColEnd'*/: break; + case 'rowend' /*case 'RowEnd'*/: break; + default: seen = false; + } + break; + /* AutoFilter */ + case 'autofilter' /*case 'AutoFilter'*/: + switch (Rn[3]) { + case 'autofiltercolumn' /*case 'AutoFilterColumn'*/: break; + case 'autofiltercondition' /*case 'AutoFilterCondition'*/: break; + case 'autofilterand' /*case 'AutoFilterAnd'*/: break; + case 'autofilteror' /*case 'AutoFilterOr'*/: break; + default: seen = false; + } + break; + /* QueryTable */ + case 'querytable' /*case 'QueryTable'*/: + switch (Rn[3]) { + case 'id' /*case 'Id'*/: break; + case 'autoformatfont' /*case 'AutoFormatFont'*/: break; + case 'autoformatpattern' /*case 'AutoFormatPattern'*/: break; + case 'querysource' /*case 'QuerySource'*/: break; + case 'querytype' /*case 'QueryType'*/: break; + case 'enableredirections' /*case 'EnableRedirections'*/: break; + case 'refreshedinxl9' /*case 'RefreshedInXl9'*/: break; + case 'urlstring' /*case 'URLString'*/: break; + case 'htmltables' /*case 'HTMLTables'*/: break; + case 'connection' /*case 'Connection'*/: break; + case 'commandtext' /*case 'CommandText'*/: break; + case 'refreshinfo' /*case 'RefreshInfo'*/: break; + case 'notitles' /*case 'NoTitles'*/: break; + case 'nextid' /*case 'NextId'*/: break; + case 'columninfo' /*case 'ColumnInfo'*/: break; + case 'overwritecells' /*case 'OverwriteCells'*/: break; + case 'donotpromptforfile' /*case 'DoNotPromptForFile'*/: break; + case 'textwizardsettings' /*case 'TextWizardSettings'*/: break; + case 'source' /*case 'Source'*/: break; + case 'number' /*case 'Number'*/: break; + case 'decimal' /*case 'Decimal'*/: break; + case 'thousandseparator' /*case 'ThousandSeparator'*/: break; + case 'trailingminusnumbers' /*case 'TrailingMinusNumbers'*/: break; + case 'formatsettings' /*case 'FormatSettings'*/: break; + case 'fieldtype' /*case 'FieldType'*/: break; + case 'delimiters' /*case 'Delimiters'*/: break; + case 'tab' /*case 'Tab'*/: break; + case 'comma' /*case 'Comma'*/: break; + case 'autoformatname' /*case 'AutoFormatName'*/: break; + case 'versionlastedit' /*case 'VersionLastEdit'*/: break; + case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break; + default: seen = false; + } + break; + case 'datavalidation' /*case 'DataValidation'*/: + switch (Rn[3]) { + case 'range' /*case 'Range'*/: break; + case 'type' /*case 'Type'*/: break; + case 'min' /*case 'Min'*/: break; + case 'max' /*case 'Max'*/: break; + case 'sort' /*case 'Sort'*/: break; + case 'descending' /*case 'Descending'*/: break; + case 'order' /*case 'Order'*/: break; + case 'casesensitive' /*case 'CaseSensitive'*/: break; + case 'value' /*case 'Value'*/: break; + case 'errorstyle' /*case 'ErrorStyle'*/: break; + case 'errormessage' /*case 'ErrorMessage'*/: break; + case 'errortitle' /*case 'ErrorTitle'*/: break; + case 'inputmessage' /*case 'InputMessage'*/: break; + case 'inputtitle' /*case 'InputTitle'*/: break; + case 'combohide' /*case 'ComboHide'*/: break; + case 'inputhide' /*case 'InputHide'*/: break; + case 'condition' /*case 'Condition'*/: break; + case 'qualifier' /*case 'Qualifier'*/: break; + case 'useblank' /*case 'UseBlank'*/: break; + case 'value1' /*case 'Value1'*/: break; + case 'value2' /*case 'Value2'*/: break; + case 'format' /*case 'Format'*/: break; + case 'cellrangelist' /*case 'CellRangeList'*/: break; + default: seen = false; + } + break; + case 'sorting' /*case 'Sorting'*/: + case 'conditionalformatting' /*case 'ConditionalFormatting'*/: + switch (Rn[3]) { + case 'range' /*case 'Range'*/: break; + case 'type' /*case 'Type'*/: break; + case 'min' /*case 'Min'*/: break; + case 'max' /*case 'Max'*/: break; + case 'sort' /*case 'Sort'*/: break; + case 'descending' /*case 'Descending'*/: break; + case 'order' /*case 'Order'*/: break; + case 'casesensitive' /*case 'CaseSensitive'*/: break; + case 'value' /*case 'Value'*/: break; + case 'errorstyle' /*case 'ErrorStyle'*/: break; + case 'errormessage' /*case 'ErrorMessage'*/: break; + case 'errortitle' /*case 'ErrorTitle'*/: break; + case 'cellrangelist' /*case 'CellRangeList'*/: break; + case 'inputmessage' /*case 'InputMessage'*/: break; + case 'inputtitle' /*case 'InputTitle'*/: break; + case 'combohide' /*case 'ComboHide'*/: break; + case 'inputhide' /*case 'InputHide'*/: break; + case 'condition' /*case 'Condition'*/: break; + case 'qualifier' /*case 'Qualifier'*/: break; + case 'useblank' /*case 'UseBlank'*/: break; + case 'value1' /*case 'Value1'*/: break; + case 'value2' /*case 'Value2'*/: break; + case 'format' /*case 'Format'*/: break; + default: seen = false; + } + break; + /* MapInfo (schema) */ + case 'mapinfo' /*case 'MapInfo'*/: + case 'schema' /*case 'Schema'*/: + case 'data' /*case 'data'*/: + switch (Rn[3]) { + case 'map' /*case 'Map'*/: break; + case 'entry' /*case 'Entry'*/: break; + case 'range' /*case 'Range'*/: break; + case 'xpath' /*case 'XPath'*/: break; + case 'field' /*case 'Field'*/: break; + case 'xsdtype' /*case 'XSDType'*/: break; + case 'filteron' /*case 'FilterOn'*/: break; + case 'aggregate' /*case 'Aggregate'*/: break; + case 'elementtype' /*case 'ElementType'*/: break; + case 'attributetype' /*case 'AttributeType'*/: break; + /* These are from xsd (XML Schema Definition) */ + case 'schema' /*case 'schema'*/: + case 'element' /*case 'element'*/: + case 'complextype' /*case 'complexType'*/: + case 'datatype' /*case 'datatype'*/: + case 'all' /*case 'all'*/: + case 'attribute' /*case 'attribute'*/: + case 'extends' /*case 'extends'*/: break; + case 'row' /*case 'row'*/: break; + default: seen = false; + } + break; + /* SmartTags (can be anything) */ + case 'smarttags' /*case 'SmartTags'*/: break; + default: + seen = false; + break; + } + if (seen) + break; + /* CustomDocumentProperties */ + if (Rn[3].match(/!\[CDATA/)) + break; + if (!state[state.length - 1][1]) + throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|"); + if (state[state.length - 1][0] === /*'CustomDocumentProperties'*/ 'customdocumentproperties') { + if (Rn[0].slice(-2) === "/>") + break; + else if (Rn[1] === "/") + xlml_set_custprop(Custprops, raw_Rn3, cp, str.slice(pidx, Rn.index)); + else { + cp = Rn; + pidx = Rn.index + Rn[0].length; + } + break; + } + if (opts.WTF) + throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|"); + } + var out = ({} /*:any*/); + if (!opts.bookSheets && !opts.bookProps) + out.Sheets = sheets; + out.SheetNames = sheetnames; + out.Workbook = Workbook; + out.SSF = dup(table_fmt); + out.Props = Props; + out.Custprops = Custprops; + out.bookType = "xlml"; + return out; +} +function parse_xlml(data /*:RawBytes|string*/, opts) { + fix_read_opts(opts = opts || {}); + switch (opts.type || "base64") { + case "base64": return parse_xlml_xml(Base64_decode(data), opts); + case "binary": + case "buffer": + case "file": return parse_xlml_xml(data, opts); + case "array": return parse_xlml_xml(a2s(data), opts); + } + /*:: throw new Error("unsupported type " + opts.type); */ +} +/* TODO */ +function write_props_xlml(wb /*:Workbook*/, opts) { + var o /*:Array*/ = []; + /* DocumentProperties */ + if (wb.Props) + o.push(xlml_write_docprops(wb.Props, opts)); + /* CustomDocumentProperties */ + if (wb.Custprops) + o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts)); + return o.join(""); +} +/* TODO */ +function write_wb_xlml(wb /*::, opts*/) { + /* OfficeDocumentSettings */ + /* ExcelWorkbook */ + if ((((wb || {}).Workbook || {}).WBProps || {}).date1904) + return ''; + return ""; +} +/* TODO */ +function write_sty_xlml(wb, opts) { + /* Styles */ + var styles /*:Array*/ = ['']; + opts.cellXfs.forEach(function (xf, id) { + var payload /*:Array*/ = []; + payload.push(writextag('NumberFormat', null, { "ss:Format": escapexml(table_fmt[xf.numFmtId]) })); + var o = /*::(*/ { "ss:ID": "s" + (21 + id) } /*:: :any)*/; + styles.push(writextag('Style', payload.join(""), o)); + }); + return writextag("Styles", styles.join("")); +} +function write_name_xlml(n) { return writextag("NamedRange", null, { "ss:Name": n.Name.slice(0, 6) == "_xlnm." ? n.Name.slice(6) : n.Name, "ss:RefersTo": "=" + a1_to_rc(n.Ref, { r: 0, c: 0 }) }); } +function write_names_xlml(wb /*::, opts*/) { + if (!((wb || {}).Workbook || {}).Names) + return ""; + /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */ + var names /*:Array*/ = wb.Workbook.Names; + var out /*:Array*/ = []; + for (var i = 0; i < names.length; ++i) { + var n = names[i]; + if (n.Sheet != null) + continue; + if (n.Name.match(/^_xlfn\./)) + continue; + out.push(write_name_xlml(n)); + } + return writextag("Names", out.join("")); +} +function write_ws_xlml_names(ws /*:Worksheet*/, opts, idx /*:number*/, wb /*:Workbook*/) { + if (!ws) + return ""; + if (!((wb || {}).Workbook || {}).Names) + return ""; + /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */ + var names /*:Array*/ = wb.Workbook.Names; + var out /*:Array*/ = []; + for (var i = 0; i < names.length; ++i) { + var n = names[i]; + if (n.Sheet != idx) + continue; + /*switch(n.Name) { + case "_": continue; + }*/ + if (n.Name.match(/^_xlfn\./)) + continue; + out.push(write_name_xlml(n)); + } + return out.join(""); +} +/* WorksheetOptions */ +function write_ws_xlml_wsopts(ws /*:Worksheet*/, opts, idx /*:number*/, wb /*:Workbook*/) { + if (!ws) + return ""; + var o /*:Array*/ = []; + /* NOTE: spec technically allows any order, but stick with implied order */ + /* FitToPage */ + /* DoNotDisplayColHeaders */ + /* DoNotDisplayRowHeaders */ + /* ViewableRange */ + /* Selection */ + /* GridlineColor */ + /* Name */ + /* ExcelWorksheetType */ + /* IntlMacro */ + /* Unsynced */ + /* Selected */ + /* CodeName */ + if (ws['!margins']) { + o.push(""); + if (ws['!margins'].header) + o.push(writextag("Header", null, { 'x:Margin': ws['!margins'].header })); + if (ws['!margins'].footer) + o.push(writextag("Footer", null, { 'x:Margin': ws['!margins'].footer })); + o.push(writextag("PageMargins", null, { + 'x:Bottom': ws['!margins'].bottom || "0.75", + 'x:Left': ws['!margins'].left || "0.7", + 'x:Right': ws['!margins'].right || "0.7", + 'x:Top': ws['!margins'].top || "0.75" + })); + o.push(""); + } + /* PageSetup */ + /* DisplayPageBreak */ + /* TransitionExpressionEvaluation */ + /* TransitionFormulaEntry */ + /* Print */ + /* Zoom */ + /* PageLayoutZoom */ + /* PageBreakZoom */ + /* ShowPageBreakZoom */ + /* DefaultRowHeight */ + /* DefaultColumnWidth */ + /* StandardWidth */ + if (wb && wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx]) { + /* Visible */ + if (wb.Workbook.Sheets[idx].Hidden) + o.push(writextag("Visible", (wb.Workbook.Sheets[idx].Hidden == 1 ? "SheetHidden" : "SheetVeryHidden"), {})); + else { + /* Selected */ + for (var i = 0; i < idx; ++i) + if (wb.Workbook.Sheets[i] && !wb.Workbook.Sheets[i].Hidden) + break; + if (i == idx) + o.push(""); + } + } + /* LeftColumnVisible */ + if (((((wb || {}).Workbook || {}).Views || [])[0] || {}).RTL) + o.push(""); + /* GridlineColorIndex */ + /* DisplayFormulas */ + /* DoNotDisplayGridlines */ + /* DoNotDisplayHeadings */ + /* DoNotDisplayOutline */ + /* ApplyAutomaticOutlineStyles */ + /* NoSummaryRowsBelowDetail */ + /* NoSummaryColumnsRightDetail */ + /* DoNotDisplayZeros */ + /* ActiveRow */ + /* ActiveColumn */ + /* FilterOn */ + /* RangeSelection */ + /* TopRowVisible */ + /* TopRowBottomPane */ + /* LeftColumnRightPane */ + /* ActivePane */ + /* SplitHorizontal */ + /* SplitVertical */ + /* FreezePanes */ + /* FrozenNoSplit */ + /* TabColorIndex */ + /* Panes */ + /* NOTE: Password not supported in XLML Format */ + if (ws['!protect']) { + o.push(writetag("ProtectContents", "True")); + if (ws['!protect'].objects) + o.push(writetag("ProtectObjects", "True")); + if (ws['!protect'].scenarios) + o.push(writetag("ProtectScenarios", "True")); + if (ws['!protect'].selectLockedCells != null && !ws['!protect'].selectLockedCells) + o.push(writetag("EnableSelection", "NoSelection")); + else if (ws['!protect'].selectUnlockedCells != null && !ws['!protect'].selectUnlockedCells) + o.push(writetag("EnableSelection", "UnlockedCells")); + [ + ["formatCells", "AllowFormatCells"], + ["formatColumns", "AllowSizeCols"], + ["formatRows", "AllowSizeRows"], + ["insertColumns", "AllowInsertCols"], + ["insertRows", "AllowInsertRows"], + ["insertHyperlinks", "AllowInsertHyperlinks"], + ["deleteColumns", "AllowDeleteCols"], + ["deleteRows", "AllowDeleteRows"], + ["sort", "AllowSort"], + ["autoFilter", "AllowFilter"], + ["pivotTables", "AllowUsePivotTables"] + ].forEach(function (x) { if (ws['!protect'][x[0]]) + o.push("<" + x[1] + "/>"); }); + } + if (o.length == 0) + return ""; + return writextag("WorksheetOptions", o.join(""), { xmlns: XLMLNS.x }); +} +function write_ws_xlml_comment(comments /*:Array*/) { + /* TODO: test multiple comments */ + return comments.map(function (c) { + // TODO: formatted text + var t = xlml_unfixstr(c.t || ""); + var d = writextag("ss:Data", t, { "xmlns": "http://www.w3.org/TR/REC-html40" }); + var p = {}; + if (c.a) + p["ss:Author"] = c.a; + if (!comments.hidden) + p["ss:ShowAlways"] = "1"; + return writextag("Comment", d, p); + }).join(""); +} +function write_ws_xlml_cell(cell, ref /*:string*/, ws, opts, idx /*:number*/, wb, addr) { + if (!cell || (cell.v == undefined && cell.f == undefined)) + return ""; + var attr = {}; + if (cell.f) + attr["ss:Formula"] = "=" + escapexml(a1_to_rc(cell.f, addr)); + if (cell.F && cell.F.slice(0, ref.length) == ref) { + var end = decode_cell(cell.F.slice(ref.length + 1)); + attr["ss:ArrayRange"] = "RC:R" + (end.r == addr.r ? "" : "[" + (end.r - addr.r) + "]") + "C" + (end.c == addr.c ? "" : "[" + (end.c - addr.c) + "]"); + } + if (cell.l && cell.l.Target) { + attr["ss:HRef"] = escapexml(cell.l.Target); + if (cell.l.Tooltip) + attr["x:HRefScreenTip"] = escapexml(cell.l.Tooltip); + } + if (ws['!merges']) { + var marr = ws['!merges']; + for (var mi = 0; mi != marr.length; ++mi) { + if (marr[mi].s.c != addr.c || marr[mi].s.r != addr.r) + continue; + if (marr[mi].e.c > marr[mi].s.c) + attr['ss:MergeAcross'] = marr[mi].e.c - marr[mi].s.c; + if (marr[mi].e.r > marr[mi].s.r) + attr['ss:MergeDown'] = marr[mi].e.r - marr[mi].s.r; + } + } + var t = "", p = ""; + switch (cell.t) { + case 'z': + if (!opts.sheetStubs) + return ""; + break; + case 'n': + t = 'Number'; + p = String(cell.v); + break; + case 'b': + t = 'Boolean'; + p = (cell.v ? "1" : "0"); + break; + case 'e': + t = 'Error'; + p = BErr[cell.v]; + break; + case 'd': + t = 'DateTime'; + p = new Date(cell.v).toISOString(); + if (cell.z == null) + cell.z = cell.z || table_fmt[14]; + break; + case 's': + t = 'String'; + p = escapexlml(cell.v || ""); + break; + } + /* TODO: cell style */ + var os = get_cell_style(opts.cellXfs, cell, opts); + attr["ss:StyleID"] = "s" + (21 + os); + attr["ss:Index"] = addr.c + 1; + var _v = (cell.v != null ? p : ""); + var m = cell.t == 'z' ? "" : ('' + _v + ''); + if ((cell.c || []).length > 0) + m += write_ws_xlml_comment(cell.c); + return writextag("Cell", m, attr); +} +function write_ws_xlml_row(R /*:number*/, row) { + var o = ''; +} +/* TODO */ +function write_ws_xlml_table(ws /*:Worksheet*/, opts, idx /*:number*/, wb /*:Workbook*/) { + if (!ws['!ref']) + return ""; + var range /*:Range*/ = safe_decode_range(ws['!ref']); + var marr /*:Array*/ = ws['!merges'] || [], mi = 0; + var o /*:Array*/ = []; + if (ws['!cols']) + ws['!cols'].forEach(function (n, i) { + process_col(n); + var w = !!n.width; + var p = col_obj_w(i, n); + var k /*:any*/ = { "ss:Index": i + 1 }; + if (w) + k['ss:Width'] = width2px(p.width); + if (n.hidden) + k['ss:Hidden'] = "1"; + o.push(writextag("Column", null, k)); + }); + var dense = ws["!data"] != null; + for (var R = range.s.r; R <= range.e.r; ++R) { + var row = [write_ws_xlml_row(R, (ws['!rows'] || [])[R])]; + for (var C = range.s.c; C <= range.e.c; ++C) { + var skip = false; + for (mi = 0; mi != marr.length; ++mi) { + if (marr[mi].s.c > C) + continue; + if (marr[mi].s.r > R) + continue; + if (marr[mi].e.c < C) + continue; + if (marr[mi].e.r < R) + continue; + if (marr[mi].s.c != C || marr[mi].s.r != R) + skip = true; + break; + } + if (skip) + continue; + var addr = { r: R, c: C }; + var ref = encode_col(C) + encode_row(R), cell = dense ? (ws["!data"][R] || [])[C] : ws[ref]; + row.push(write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr)); + } + row.push(""); + if (row.length > 2) + o.push(row.join("")); + } + return o.join(""); +} +function write_ws_xlml(idx /*:number*/, opts, wb /*:Workbook*/) { + var o /*:Array*/ = []; + var s = wb.SheetNames[idx]; + var ws = wb.Sheets[s]; + var t /*:string*/ = ws ? write_ws_xlml_names(ws, opts, idx, wb) : ""; + if (t.length > 0) + o.push("" + t + ""); + /* Table */ + t = ws ? write_ws_xlml_table(ws, opts, idx, wb) : ""; + if (t.length > 0) + o.push("
" + t + "
"); + /* WorksheetOptions */ + o.push(write_ws_xlml_wsopts(ws, opts, idx, wb)); + if (ws["!autofilter"]) + o.push(''); + return o.join(""); +} +function write_xlml(wb, opts) { + if (!opts) + opts = {}; + if (!wb.SSF) + wb.SSF = dup(table_fmt); + if (wb.SSF) { + make_ssf(); + SSF_load_table(wb.SSF); + // $FlowIgnore + opts.revssf = evert_num(wb.SSF); + opts.revssf[wb.SSF[65535]] = 0; + opts.ssf = wb.SSF; + opts.cellXfs = []; + get_cell_style(opts.cellXfs, {}, { revssf: { "General": 0 } }); + } + var d /*:Array*/ = []; + d.push(write_props_xlml(wb, opts)); + d.push(write_wb_xlml(wb, opts)); + d.push(""); + d.push(""); + for (var i = 0; i < wb.SheetNames.length; ++i) + d.push(writextag("Worksheet", write_ws_xlml(i, opts, wb), { "ss:Name": escapexml(wb.SheetNames[i]) })); + d[2] = write_sty_xlml(wb, opts); + d[3] = write_names_xlml(wb, opts); + return XML_HEADER + writextag("Workbook", d.join(""), { + 'xmlns': XLMLNS.ss, + 'xmlns:o': XLMLNS.o, + 'xmlns:x': XLMLNS.x, + 'xmlns:ss': XLMLNS.ss, + 'xmlns:dt': XLMLNS.dt, + 'xmlns:html': XLMLNS.html + }); +} +/* [MS-OLEDS] 2.3.8 CompObjStream */ +function parse_compobj(obj /*:CFBEntry*/) { + var v = {}; + var o = obj.content; + /*:: if(o == null) return; */ + /* [MS-OLEDS] 2.3.7 CompObjHeader -- All fields MUST be ignored */ + o.l = 28; + v.AnsiUserType = o.read_shift(0, "lpstr-ansi"); + v.AnsiClipboardFormat = parse_ClipboardFormatOrAnsiString(o); + if (o.length - o.l <= 4) + return v; + var m /*:number*/ = o.read_shift(4); + if (m == 0 || m > 40) + return v; + o.l -= 4; + v.Reserved1 = o.read_shift(0, "lpstr-ansi"); + if (o.length - o.l <= 4) + return v; + m = o.read_shift(4); + if (m !== 0x71b239f4) + return v; + v.UnicodeClipboardFormat = parse_ClipboardFormatOrUnicodeString(o); + m = o.read_shift(4); + if (m == 0 || m > 40) + return v; + o.l -= 4; + v.Reserved2 = o.read_shift(0, "lpwstr"); +} +/* + Continue logic for: + - 2.4.58 Continue 0x003c + - 2.4.59 ContinueBigName 0x043c + - 2.4.60 ContinueFrt 0x0812 + - 2.4.61 ContinueFrt11 0x0875 + - 2.4.62 ContinueFrt12 0x087f +*/ +var CONTINUE_RT = [0x003c, 0x043c, 0x0812, 0x0875, 0x087f]; +function slurp(RecordType, R, blob, length /*:number*/, opts) { + var l = length; + var bufs = []; + var d = blob.slice(blob.l, blob.l + l); + if (opts && opts.enc && opts.enc.insitu && d.length > 0) + switch (RecordType) { + case 0x0009: + case 0x0209: + case 0x0409: + case 0x0809 /* BOF */: + case 0x002F /* FilePass */: + case 0x0195 /* FileLock */: + case 0x00E1 /* InterfaceHdr */: + case 0x0196 /* RRDInfo */: + case 0x0138 /* RRDHead */: + case 0x0194 /* UsrExcl */: + case 0x000a /* EOF */: + break; + case 0x0085 /* BoundSheet8 */: + break; + default: + opts.enc.insitu(d); + } + bufs.push(d); + blob.l += l; + var nextrt = __readUInt16LE(blob, blob.l), next = XLSRecordEnum[nextrt]; + var start = 0; + while (next != null && CONTINUE_RT.indexOf(nextrt) > -1) { + l = __readUInt16LE(blob, blob.l + 2); + start = blob.l + 4; + if (nextrt == 0x0812 /* ContinueFrt */) + start += 4; + else if (nextrt == 0x0875 || nextrt == 0x087f) { + start += 12; + } + d = blob.slice(start, blob.l + 4 + l); + bufs.push(d); + blob.l += 4 + l; + next = (XLSRecordEnum[nextrt = __readUInt16LE(blob, blob.l)]); + } + var b = (bconcat(bufs) /*:any*/); + prep_blob(b, 0); + var ll = 0; + b.lens = []; + for (var j = 0; j < bufs.length; ++j) { + b.lens.push(ll); + ll += bufs[j].length; + } + if (b.length < length) + throw "XLS Record 0x" + RecordType.toString(16) + " Truncated: " + b.length + " < " + length; + return R.f(b, b.length, opts); +} +function safe_format_xf(p /*:any*/, opts /*:ParseOpts*/, date1904 /*:?boolean*/) { + if (p.t === 'z') + return; + if (!p.XF) + return; + var fmtid = 0; + try { + fmtid = p.z || p.XF.numFmtId || 0; + if (opts.cellNF && p.z == null) + p.z = table_fmt[fmtid]; + } + catch (e) { + if (opts.WTF) + throw e; + } + if (!opts || opts.cellText !== false) + try { + if (p.t === 'e') { + p.w = p.w || BErr[p.v]; + } + else if (fmtid === 0 || fmtid == "General") { + if (p.t === 'n') { + if ((p.v | 0) === p.v) + p.w = p.v.toString(10); + else + p.w = SSF_general_num(p.v); + } + else + p.w = SSF_general(p.v); + } + else + p.w = SSF_format(fmtid, p.v, { date1904: !!date1904, dateNF: opts && opts.dateNF }); + } + catch (e) { + if (opts.WTF) + throw e; + } + if (opts.cellDates && fmtid && p.t == 'n' && fmt_is_date(table_fmt[fmtid] || String(fmtid))) { + var _d = SSF_parse_date_code(p.v + (date1904 ? 1462 : 0)); + if (_d) { + p.t = 'd'; + p.v = new Date(Date.UTC(_d.y, _d.m - 1, _d.d, _d.H, _d.M, _d.S, _d.u)); + } + } +} +function make_cell(val, ixfe, t) { + return ({ v: val, ixfe: ixfe, t: t } /*:any*/); +} +// 2.3.2 +function parse_workbook(blob, options /*:ParseOpts*/) { + var wb = ({ opts: {} } /*:any*/); + var Sheets = {}; + if (DENSE != null && options.dense == null) + options.dense = DENSE; + var out /*:Worksheet*/ = ({} /*:any*/); + if (options.dense) + out["!data"] = []; + var Directory = {}; + var range /*:Range*/ = ({} /*:any*/); + var last_formula = null; + var sst /*:SST*/ = ([] /*:any*/); + var cur_sheet = ""; + var Preamble = {}; + var lastcell, last_cell = "", cc /*:Cell*/, cmnt, rngC, rngR; + var sharedf = {}; + var arrayf /*:Array<[Range, string]>*/ = []; + var temp_val /*:Cell*/; + var country; + var XFs = []; /* XF records */ + var palette /*:Array<[number, number, number]>*/ = []; + var Workbook /*:WBWBProps*/ = ({ Sheets: [], WBProps: { date1904: false }, Views: [{}] } /*:any*/), wsprops = {}; + var biff4w = false; + var get_rgb = function getrgb(icv /*:number*/) { + if (icv < 8) + return XLSIcv[icv]; + if (icv < 64) + return palette[icv - 8] || XLSIcv[icv]; + return XLSIcv[icv]; + }; + var process_cell_style = function pcs(cell, line /*:any*/, options) { + var xfd = line.XF.data; + if (!xfd || !xfd.patternType || !options || !options.cellStyles) + return; + line.s = ({} /*:any*/); + line.s.patternType = xfd.patternType; + var t; + if ((t = rgb2Hex(get_rgb(xfd.icvFore)))) { + line.s.fgColor = { rgb: t }; + } + if ((t = rgb2Hex(get_rgb(xfd.icvBack)))) { + line.s.bgColor = { rgb: t }; + } + }; + var addcell = function addcell(cell /*:any*/, line /*:any*/, options /*:any*/) { + if (!biff4w && file_depth > 1) + return; + if (options.sheetRows && cell.r >= options.sheetRows) + return; + if (options.cellStyles && line.XF && line.XF.data) + process_cell_style(cell, line, options); + delete line.ixfe; + delete line.XF; + lastcell = cell; + last_cell = encode_cell(cell); + if (!range || !range.s || !range.e) + range = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + if (cell.r < range.s.r) + range.s.r = cell.r; + if (cell.c < range.s.c) + range.s.c = cell.c; + if (cell.r + 1 > range.e.r) + range.e.r = cell.r + 1; + if (cell.c + 1 > range.e.c) + range.e.c = cell.c + 1; + if (options.cellFormula && line.f) { + for (var afi = 0; afi < arrayf.length; ++afi) { + if (arrayf[afi][0].s.c > cell.c || arrayf[afi][0].s.r > cell.r) + continue; + if (arrayf[afi][0].e.c < cell.c || arrayf[afi][0].e.r < cell.r) + continue; + line.F = encode_range(arrayf[afi][0]); + if (arrayf[afi][0].s.c != cell.c || arrayf[afi][0].s.r != cell.r) + delete line.f; + if (line.f) + line.f = "" + stringify_formula(arrayf[afi][1], range, cell, supbooks, opts); + break; + } + } + { + if (options.dense) { + if (!out["!data"][cell.r]) + out["!data"][cell.r] = []; + out["!data"][cell.r][cell.c] = line; + } + else + out[last_cell] = line; + } + }; + var opts = ({ + enc: false, + sbcch: 0, + snames: [], + sharedf: sharedf, + arrayf: arrayf, + rrtabid: [], + lastuser: "", + biff: 8, + codepage: 0, + winlocked: 0, + cellStyles: !!options && !!options.cellStyles, + WTF: !!options && !!options.wtf + } /*:any*/); + if (options.password) + opts.password = options.password; + var themes; + var merges /*:Array*/ = []; + var objects = []; + var colinfo /*:Array*/ = [], rowinfo /*:Array*/ = []; + var seencol = false; + var supbooks = ([] /*:any*/); // 1-indexed, will hold extern names + supbooks.SheetNames = opts.snames; + supbooks.sharedf = opts.sharedf; + supbooks.arrayf = opts.arrayf; + supbooks.names = []; + supbooks.XTI = []; + var last_RT = 0; + var file_depth = 0; /* TODO: make a real stack */ + var BIFF2Fmt = 0, BIFF2FmtTable /*:Array*/ = []; + var FilterDatabases = []; /* TODO: sort out supbooks and process elsewhere */ + var last_lbl /*:?DefinedName*/; + /* explicit override for some broken writers */ + opts.codepage = 1200; + set_cp(1200); + var seen_codepage = false; + while (blob.l < blob.length - 1) { + var s = blob.l; + var RecordType = blob.read_shift(2); + if (RecordType === 0 && last_RT === 0x000a /* EOF */) + break; + var length = (blob.l === blob.length ? 0 : blob.read_shift(2)); + var R = XLSRecordEnum[RecordType]; + if (file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(RecordType) == -1 /* BOF */) + break; + //console.log(RecordType.toString(16), RecordType, R, blob.l, length, blob.length); + //if(!R) console.log(blob.slice(blob.l, blob.l + length)); + if (R && R.f) { + if (options.bookSheets) { + if (last_RT === 0x0085 /* BoundSheet8 */ && RecordType !== 0x0085 /* R.n !== 'BoundSheet8' */) + break; + } + last_RT = RecordType; + if (R.r === 2 || R.r == 12) { + var rt = blob.read_shift(2); + length -= 2; + if (!opts.enc && rt !== RecordType && (((rt & 0xFF) << 8) | (rt >> 8)) !== RecordType) + throw new Error("rt mismatch: " + rt + "!=" + RecordType); + if (R.r == 12) { + blob.l += 10; + length -= 10; + } // skip FRT + } + //console.error(R,blob.l,length,blob.length); + var val /*:any*/ = ({} /*:any*/); + if (RecordType === 0x000a /* EOF */) + val = /*::(*/ R.f(blob, length, opts) /*:: :any)*/; + else + val = /*::(*/ slurp(RecordType, R, blob, length, opts) /*:: :any)*/; + /*:: val = (val:any); */ + if (file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) + continue; + switch (RecordType) { + case 0x0022 /* Date1904 */: + /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ + wb.opts.Date1904 = Workbook.WBProps.date1904 = val; + break; + case 0x0086 /* WriteProtect */: + wb.opts.WriteProtect = true; + break; + case 0x002f /* FilePass */: + if (!opts.enc) + blob.l = 0; + opts.enc = val; + if (!options.password) + throw new Error("File is password-protected"); + if (val.valid == null) + throw new Error("Encryption scheme unsupported"); + if (!val.valid) + throw new Error("Password is incorrect"); + break; + case 0x005c /* WriteAccess */: + opts.lastuser = val; + break; + case 0x0042 /* CodePage */: + var cpval = Number(val); + /* overrides based on test cases */ + switch (cpval) { + case 0x5212: + cpval = 1200; + break; + case 0x8000: + cpval = 10000; + break; + case 0x8001: + cpval = 1252; + break; + } + set_cp(opts.codepage = cpval); + seen_codepage = true; + break; + case 0x013d /* RRTabId */: + opts.rrtabid = val; + break; + case 0x0019 /* WinProtect */: + opts.winlocked = val; + break; + case 0x01b7 /* RefreshAll */: + wb.opts["RefreshAll"] = val; + break; + case 0x000c /* CalcCount */: + wb.opts["CalcCount"] = val; + break; + case 0x0010 /* CalcDelta */: + wb.opts["CalcDelta"] = val; + break; + case 0x0011 /* CalcIter */: + wb.opts["CalcIter"] = val; + break; + case 0x000d /* CalcMode */: + wb.opts["CalcMode"] = val; + break; + case 0x000e /* CalcPrecision */: + wb.opts["CalcPrecision"] = val; + break; + case 0x005f /* CalcSaveRecalc */: + wb.opts["CalcSaveRecalc"] = val; + break; + case 0x000f /* CalcRefMode */: + opts.CalcRefMode = val; + break; // TODO: implement R1C1 + case 0x08a3 /* ForceFullCalculation */: + wb.opts.FullCalc = val; + break; + case 0x0081 /* WsBool */: + if (val.fDialog) + out["!type"] = "dialog"; + if (!val.fBelow) + (out["!outline"] || (out["!outline"] = {})).above = true; + if (!val.fRight) + (out["!outline"] || (out["!outline"] = {})).left = true; + break; // TODO + case 0x0043: /* BIFF2XF */ + case 0x0243: /* BIFF3XF */ + case 0x0443: /* BIFF4XF */ + case 0x00e0 /* XF */: + XFs.push(val); + break; + case 0x01ae /* SupBook */: + supbooks.push([val]); + supbooks[supbooks.length - 1].XTI = []; + break; + case 0x0023: + case 0x0223 /* ExternName */: + supbooks[supbooks.length - 1].push(val); + break; + case 0x0018: + case 0x0218 /* Lbl */: + last_lbl = ({ + Name: val.Name, + Ref: stringify_formula(val.rgce, range, null, supbooks, opts) + } /*:DefinedName*/); + if (val.itab > 0) + last_lbl.Sheet = val.itab - 1; + supbooks.names.push(last_lbl); + if (!supbooks[0]) { + supbooks[0] = []; + supbooks[0].XTI = []; + } + supbooks[supbooks.length - 1].push(val); + if (val.Name == "_xlnm._FilterDatabase" && val.itab > 0) + if (val.rgce && val.rgce[0] && val.rgce[0][0] && val.rgce[0][0][0] == 'PtgArea3d') + FilterDatabases[val.itab - 1] = { ref: encode_range(val.rgce[0][0][1][2]) }; + break; + case 0x0016 /* ExternCount */: + opts.ExternCount = val; + break; + case 0x0017 /* ExternSheet */: + if (supbooks.length == 0) { + supbooks[0] = []; + supbooks[0].XTI = []; + } + supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); + supbooks.XTI = supbooks.XTI.concat(val); + break; + case 0x0894 /* NameCmt */: + /* TODO: search for correct name */ + if (opts.biff < 8) + break; + if (last_lbl != null) + last_lbl.Comment = val[1]; + break; + case 0x0012 /* Protect */: + out["!protect"] = val; + break; /* for sheet or book */ + case 0x0013 /* Password */: + if (val !== 0 && opts.WTF) + console.error("Password verifier: " + val); + break; + case 0x0085 /* BoundSheet8 */: + { + Directory[opts.biff == 4 ? opts.snames.length : val.pos] = val; + opts.snames.push(val.name); + } + break; + case 0x000a /* EOF */: + { + if (--file_depth ? !biff4w : biff4w) + break; + if (range.e) { + if (range.e.r > 0 && range.e.c > 0) { + range.e.r--; + range.e.c--; + out["!ref"] = encode_range(range); + if (options.sheetRows && options.sheetRows <= range.e.r) { + var tmpri = range.e.r; + range.e.r = options.sheetRows - 1; + out["!fullref"] = out["!ref"]; + out["!ref"] = encode_range(range); + range.e.r = tmpri; + } + range.e.r++; + range.e.c++; + } + if (merges.length > 0) + out["!merges"] = merges; + if (objects.length > 0) + out["!objects"] = objects; + if (colinfo.length > 0) + out["!cols"] = colinfo; + if (rowinfo.length > 0) + out["!rows"] = rowinfo; + Workbook.Sheets.push(wsprops); + } + if (cur_sheet === "") + Preamble = out; + else + Sheets[cur_sheet] = out; + out = ({} /*:any*/); + if (options.dense) + out["!data"] = []; + } + break; + case 0x0009: + case 0x0209: + case 0x0409: + case 0x0809 /* BOF */: + { + if (opts.biff === 8) + opts.biff = { + /*::[*/ 0x0009 /*::]*/: 2, + /*::[*/ 0x0209 /*::]*/: 3, + /*::[*/ 0x0409 /*::]*/: 4 + }[RecordType] || { + /*::[*/ 0x0200 /*::]*/: 2, + /*::[*/ 0x0300 /*::]*/: 3, + /*::[*/ 0x0400 /*::]*/: 4, + /*::[*/ 0x0500 /*::]*/: 5, + /*::[*/ 0x0600 /*::]*/: 8, + /*::[*/ 0x0002 /*::]*/: 2, + /*::[*/ 0x0007 /*::]*/: 2 + }[val.BIFFVer] || 8; + opts.biffguess = val.BIFFVer == 0; + if (val.BIFFVer == 0 && val.dt == 0x1000) { + opts.biff = 5; + seen_codepage = true; + set_cp(opts.codepage = 28591); + } + if (opts.biff == 4 && val.dt & 0x100) + biff4w = true; + if (opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) + opts.biff = 2; + if (file_depth++ && !biff4w) + break; + out = ({} /*:any*/); + if (options.dense) + out["!data"] = []; + if (opts.biff < 8 && !seen_codepage) { + seen_codepage = true; + set_cp(opts.codepage = options.codepage || 1252); + } + if (opts.biff == 4 && biff4w) { + cur_sheet = (Directory[opts.snames.indexOf(cur_sheet) + 1] || { name: "" }).name; + } + else if (opts.biff < 5 || val.BIFFVer == 0 && val.dt == 0x1000) { + if (cur_sheet === "") + cur_sheet = "Sheet1"; + range = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + /* fake BoundSheet8 */ + var fakebs8 = { pos: blob.l - length, name: cur_sheet }; + Directory[fakebs8.pos] = fakebs8; + opts.snames.push(cur_sheet); + } + else + cur_sheet = (Directory[s] || { name: "" }).name; + if (val.dt == 0x20) + out["!type"] = "chart"; + if (val.dt == 0x40) + out["!type"] = "macro"; + merges = []; + objects = []; + opts.arrayf = arrayf = []; + colinfo = []; + rowinfo = []; + seencol = false; + wsprops = { Hidden: (Directory[s] || { hs: 0 }).hs, name: cur_sheet }; + } + break; + case 0x0203 /* Number */: + case 0x0003 /* BIFF2NUM */: + case 0x0002 /* BIFF2INT */: + { + if (out["!type"] == "chart") + if (options.dense ? (out["!data"][val.r] || [])[val.c] : out[encode_col(val.c) + encode_row(val.r)]) + ++val.c; + temp_val = ({ ixfe: val.ixfe, XF: XFs[val.ixfe] || {}, v: val.val, t: 'n' } /*:any*/); + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({ c: val.c, r: val.r }, temp_val, options); + } + break; + case 0x0005: + case 0x0205 /* BoolErr */: + { + temp_val = ({ ixfe: val.ixfe, XF: XFs[val.ixfe], v: val.val, t: val.t } /*:any*/); + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({ c: val.c, r: val.r }, temp_val, options); + } + break; + case 0x027e /* RK */: + { + temp_val = ({ ixfe: val.ixfe, XF: XFs[val.ixfe], v: val.rknum, t: 'n' } /*:any*/); + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({ c: val.c, r: val.r }, temp_val, options); + } + break; + case 0x00bd /* MulRk */: + { + for (var j = val.c; j <= val.C; ++j) { + var ixfe = val.rkrec[j - val.c][0]; + temp_val = ({ ixfe: ixfe, XF: XFs[ixfe], v: val.rkrec[j - val.c][1], t: 'n' } /*:any*/); + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({ c: j, r: val.r }, temp_val, options); + } + } + break; + case 0x0006: + case 0x0206: + case 0x0406 /* Formula */: + { + if (val.val == 'String') { + last_formula = val; + break; + } + temp_val = make_cell(val.val, val.cell.ixfe, val.tt); + temp_val.XF = XFs[temp_val.ixfe]; + if (options.cellFormula) { + var _f = val.formula; + if (_f && _f[0] && _f[0][0] && _f[0][0][0] == 'PtgExp') { + var _fr = _f[0][0][1][0], _fc = _f[0][0][1][1]; + var _fe = encode_cell({ r: _fr, c: _fc }); + if (sharedf[_fe]) + temp_val.f = "" + stringify_formula(val.formula, range, val.cell, supbooks, opts); + else + temp_val.F = ((options.dense ? (out["!data"][_fr] || [])[_fc] : out[_fe]) || {}).F; + } + else + temp_val.f = "" + stringify_formula(val.formula, range, val.cell, supbooks, opts); + } + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell(val.cell, temp_val, options); + last_formula = val; + } + break; + case 0x0007: + case 0x0207 /* String */: + { + if (last_formula) { /* technically always true */ + last_formula.val = val; + temp_val = make_cell(val, last_formula.cell.ixfe, 's'); + temp_val.XF = XFs[temp_val.ixfe]; + if (options.cellFormula) { + temp_val.f = "" + stringify_formula(last_formula.formula, range, last_formula.cell, supbooks, opts); + } + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell(last_formula.cell, temp_val, options); + last_formula = null; + } + else + throw new Error("String record expects Formula"); + } + break; + case 0x0021: + case 0x0221 /* Array */: + { + arrayf.push(val); + var _arraystart = encode_cell(val[0].s); + cc = options.dense ? (out["!data"][val[0].s.r] || [])[val[0].s.c] : out[_arraystart]; + if (options.cellFormula && cc) { + if (!last_formula) + break; /* technically unreachable */ + if (!_arraystart || !cc) + break; + cc.f = "" + stringify_formula(val[1], range, val[0], supbooks, opts); + cc.F = encode_range(val[0]); + } + } + break; + case 0x04bc /* ShrFmla */: + { + if (!options.cellFormula) + break; + if (last_cell) { + /* TODO: capture range */ + if (!last_formula) + break; /* technically unreachable */ + sharedf[encode_cell(last_formula.cell)] = val[0]; + cc = options.dense ? (out["!data"][last_formula.cell.r] || [])[last_formula.cell.c] : out[encode_cell(last_formula.cell)]; + (cc || {}).f = "" + stringify_formula(val[0], range, lastcell, supbooks, opts); + } + } + break; + case 0x00fd /* LabelSst */: + temp_val = make_cell(sst[val.isst].t, val.ixfe, 's'); + if (sst[val.isst].h) + temp_val.h = sst[val.isst].h; + temp_val.XF = XFs[temp_val.ixfe]; + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({ c: val.c, r: val.r }, temp_val, options); + break; + case 0x0201 /* Blank */: + if (options.sheetStubs) { + temp_val = ({ ixfe: val.ixfe, XF: XFs[val.ixfe], t: 'z' } /*:any*/); + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({ c: val.c, r: val.r }, temp_val, options); + } + break; + case 0x00be /* MulBlank */: + if (options.sheetStubs) { + for (var _j = val.c; _j <= val.C; ++_j) { + var _ixfe = val.ixfe[_j - val.c]; + temp_val = ({ ixfe: _ixfe, XF: XFs[_ixfe], t: 'z' } /*:any*/); + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({ c: _j, r: val.r }, temp_val, options); + } + } + break; + case 0x00d6 /* RString */: + case 0x0204 /* Label */: + case 0x0004 /* BIFF2STR */: + temp_val = make_cell(val.val, val.ixfe, 's'); + temp_val.XF = XFs[temp_val.ixfe]; + if (BIFF2Fmt > 0) + temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe >> 8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({ c: val.c, r: val.r }, temp_val, options); + break; + case 0x0000: + case 0x0200 /* Dimensions */: + { + if (file_depth === 1) + range = val; /* TODO: stack */ + } + break; + case 0x00fc /* SST */: + { + sst = val; + } + break; + case 0x041e /* Format */: + { /* val = [id, fmt] */ + if (opts.biff >= 3 && opts.biff <= 4) { + BIFF2FmtTable[BIFF2Fmt++] = val[1]; + for (var b4idx = 0; b4idx < BIFF2Fmt + 163; ++b4idx) + if (table_fmt[b4idx] == val[1]) + break; + if (b4idx >= 163) + SSF__load(val[1], BIFF2Fmt + 163); + } + else + SSF__load(val[1], val[0]); + } + break; + case 0x001e /* BIFF2FORMAT */: + { + BIFF2FmtTable[BIFF2Fmt++] = val; + for (var b2idx = 0; b2idx < BIFF2Fmt + 163; ++b2idx) + if (table_fmt[b2idx] == val) + break; + if (b2idx >= 163) + SSF__load(val, BIFF2Fmt + 163); + } + break; + case 0x00e5 /* MergeCells */: + merges = merges.concat(val); + break; + case 0x005d /* Obj */: + objects[val.cmo[0]] = opts.lastobj = val; + break; + case 0x01b6 /* TxO */: + opts.lastobj.TxO = val; + break; + case 0x007f /* ImData */: + opts.lastobj.ImData = val; + break; + case 0x01b8 /* HLink */: + { + for (rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR) + for (rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) { + cc = options.dense ? (out["!data"][rngR] || [])[rngC] : out[encode_cell({ c: rngC, r: rngR })]; + if (cc) + cc.l = val[1]; + } + } + break; + case 0x0800 /* HLinkTooltip */: + { + for (rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR) + for (rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) { + cc = options.dense ? (out["!data"][rngR] || [])[rngC] : out[encode_cell({ c: rngC, r: rngR })]; + if (cc && cc.l) + cc.l.Tooltip = val[1]; + } + } + break; + case 0x001c /* Note */: + { + /* TODO: comment continuation (row == -1 / 0xFFFF) */ + cc = options.dense ? (out["!data"][val[0].r] || [])[val[0].c] : out[encode_cell(val[0])]; + if (!cc) { + if (options.dense) { + if (!out["!data"][val[0].r]) + out["!data"][val[0].r] = []; + cc = out["!data"][val[0].r][val[0].c] = ({ t: "z" } /*:any*/); + } + else { + cc = out[encode_cell(val[0])] = ({ t: "z" } /*:any*/); + } + range.e.r = Math.max(range.e.r, val[0].r); + range.s.r = Math.min(range.s.r, val[0].r); + range.e.c = Math.max(range.e.c, val[0].c); + range.s.c = Math.min(range.s.c, val[0].c); + } + if (!cc.c) + cc.c = []; + if (opts.biff <= 5 && opts.biff >= 2) + cmnt = { a: "SheetJ5", t: val[1] }; + else { + var noteobj = objects[val[2]]; + cmnt = { a: val[1], t: noteobj.TxO.t }; + if (val[3] != null && !(val[3] & 0x02)) + cc.c.hidden = true; + } + cc.c.push(cmnt); + } + break; + case 0x087d /* XFExt */: + update_xfext(XFs[val.ixfe], val.ext); + break; + case 0x007d /* ColInfo */: + { + if (!opts.cellStyles) + break; + while (val.e >= val.s) { + colinfo[val.e--] = { width: val.w / 256, level: (val.level || 0), hidden: !!(val.flags & 1) }; + if (!seencol) { + seencol = true; + find_mdw_colw(val.w / 256); + } + process_col(colinfo[val.e + 1]); + } + } + break; + case 0x0208 /* Row */: + { + var rowobj = {}; + if (val.level != null) { + rowinfo[val.r] = rowobj; + rowobj.level = val.level; + } + if (val.hidden) { + rowinfo[val.r] = rowobj; + rowobj.hidden = true; + } + if (val.hpt) { + rowinfo[val.r] = rowobj; + rowobj.hpt = val.hpt; + rowobj.hpx = pt2px(val.hpt); + } + } + break; + case 0x0026 /* LeftMargin */: + case 0x0027 /* RightMargin */: + case 0x0028 /* TopMargin */: + case 0x0029 /* BottomMargin */: + if (!out['!margins']) + default_margins(out['!margins'] = {}); + out['!margins'][({ 0x26: "left", 0x27: "right", 0x28: "top", 0x29: "bottom" })[RecordType]] = val; + break; + case 0x00a1 /* Setup */: // TODO + if (!out['!margins']) + default_margins(out['!margins'] = {}); + out['!margins'].header = val.header; + out['!margins'].footer = val.footer; + break; + case 0x023e /* Window2 */: // TODO + // $FlowIgnore + if (val.RTL) + Workbook.Views[0].RTL = true; + break; + case 0x0092 /* Palette */: + palette = val; + break; + case 0x0896 /* Theme */: + themes = val; + break; + case 0x008c /* Country */: + country = val; + break; + case 0x01ba /* CodeName */: + { + /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ + if (!cur_sheet) + Workbook.WBProps.CodeName = val || "ThisWorkbook"; + else + wsprops.CodeName = val || wsprops.name; + } + break; + } + } + else { + if (!R) + console.error("Missing Info for XLS Record 0x" + RecordType.toString(16)); + blob.l += length; + } + } + wb.SheetNames = keys(Directory).sort(function (a, b) { return Number(a) - Number(b); }).map(function (x) { return Directory[x].name; }); + if (!options.bookSheets) + wb.Sheets = Sheets; + if (!wb.SheetNames.length && Preamble["!ref"]) { + wb.SheetNames.push("Sheet1"); + /*jshint -W069 */ + if (wb.Sheets) + wb.Sheets["Sheet1"] = Preamble; + /*jshint +W069 */ + } + else + wb.Preamble = Preamble; + if (wb.Sheets) + FilterDatabases.forEach(function (r, i) { wb.Sheets[wb.SheetNames[i]]['!autofilter'] = r; }); + wb.Strings = sst; + wb.SSF = dup(table_fmt); + if (opts.enc) + wb.Encryption = opts.enc; + if (themes) + wb.Themes = themes; + wb.Metadata = {}; + if (country !== undefined) + wb.Metadata.Country = country; + if (supbooks.names.length > 0) + Workbook.Names = supbooks.names; + wb.Workbook = Workbook; + return wb; +} +/* TODO: split props*/ +var PSCLSID = { + SI: "e0859ff2f94f6810ab9108002b27b3d9", + DSI: "02d5cdd59c2e1b10939708002b2cf9ae", + UDI: "05d5cdd59c2e1b10939708002b2cf9ae" +}; +function parse_xls_props(cfb /*:CFBContainer*/, props, o) { + /* [MS-OSHARED] 2.3.3.2.2 Document Summary Information Property Set */ + var DSI = CFB.find(cfb, '/!DocumentSummaryInformation'); + if (DSI && DSI.size > 0) + try { + var DocSummary = parse_PropertySetStream(DSI, DocSummaryPIDDSI, PSCLSID.DSI); + for (var d in DocSummary) + props[d] = DocSummary[d]; + } + catch (e) { + if (o.WTF) + throw e; /* empty */ + } + /* [MS-OSHARED] 2.3.3.2.1 Summary Information Property Set*/ + var SI = CFB.find(cfb, '/!SummaryInformation'); + if (SI && SI.size > 0) + try { + var Summary = parse_PropertySetStream(SI, SummaryPIDSI, PSCLSID.SI); + for (var s in Summary) + if (props[s] == null) + props[s] = Summary[s]; + } + catch (e) { + if (o.WTF) + throw e; /* empty */ + } + if (props.HeadingPairs && props.TitlesOfParts) { + load_props_pairs(props.HeadingPairs, props.TitlesOfParts, props, o); + delete props.HeadingPairs; + delete props.TitlesOfParts; + } +} +function write_xls_props(wb /*:Workbook*/, cfb /*:CFBContainer*/) { + var DSEntries = [], SEntries = [], CEntries = []; + var i = 0, Keys; + var DocSummaryRE /*:{[key:string]:string}*/ = evert_key(DocSummaryPIDDSI, "n"); + var SummaryRE /*:{[key:string]:string}*/ = evert_key(SummaryPIDSI, "n"); + if (wb.Props) { + Keys = keys(wb.Props); + // $FlowIgnore + for (i = 0; i < Keys.length; ++i) + (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]); + } + if (wb.Custprops) { + Keys = keys(wb.Custprops); + // $FlowIgnore + for (i = 0; i < Keys.length; ++i) + if (!Object.prototype.hasOwnProperty.call((wb.Props || {}), Keys[i])) + (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]); + } + var CEntries2 = []; + for (i = 0; i < CEntries.length; ++i) { + if (XLSPSSkip.indexOf(CEntries[i][0]) > -1 || PseudoPropsPairs.indexOf(CEntries[i][0]) > -1) + continue; + if (CEntries[i][1] == null) + continue; + CEntries2.push(CEntries[i]); + } + if (SEntries.length) + CFB.utils.cfb_add(cfb, "/\u0005SummaryInformation", write_PropertySetStream(SEntries, PSCLSID.SI, SummaryRE, SummaryPIDSI)); + if (DSEntries.length || CEntries2.length) + CFB.utils.cfb_add(cfb, "/\u0005DocumentSummaryInformation", write_PropertySetStream(DSEntries, PSCLSID.DSI, DocSummaryRE, DocSummaryPIDDSI, CEntries2.length ? CEntries2 : null, PSCLSID.UDI)); +} +function parse_xlscfb(cfb /*:any*/, options /*:?ParseOpts*/) { + if (!options) + options = {}; + fix_read_opts(options); + reset_cp(); + if (options.codepage) + set_ansi(options.codepage); + var CompObj /*:?CFBEntry*/, WB /*:?any*/; + if (cfb.FullPaths) { + if (CFB.find(cfb, '/encryption')) + throw new Error("File is password-protected"); + CompObj = CFB.find(cfb, '!CompObj'); + WB = CFB.find(cfb, '/Workbook') || CFB.find(cfb, '/Book'); + } + else { + switch (options.type) { + case 'base64': + cfb = s2a(Base64_decode(cfb)); + break; + case 'binary': + cfb = s2a(cfb); + break; + case 'buffer': break; + case 'array': + if (!Array.isArray(cfb)) + cfb = Array.prototype.slice.call(cfb); + break; + } + prep_blob(cfb, 0); + WB = ({ content: cfb } /*:any*/); + } + var /*::CompObjP, */ WorkbookP /*:: :Workbook = XLSX.utils.book_new(); */; + var _data /*:?any*/; + if (CompObj) /*::CompObjP = */ + parse_compobj(CompObj); + if (options.bookProps && !options.bookSheets) + WorkbookP = ({} /*:any*/); + else /*:: if(cfb instanceof CFBContainer) */ { + var T = has_buf ? 'buffer' : 'array'; + if (WB && WB.content) + WorkbookP = parse_workbook(WB.content, options); + /* Quattro Pro 7-8 */ + else if ((_data = CFB.find(cfb, 'PerfectOffice_MAIN')) && _data.content) + WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options)); + /* Quattro Pro 9 */ + else if ((_data = CFB.find(cfb, 'NativeContent_MAIN')) && _data.content) + WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options)); + /* Works 4 for Mac */ + else if ((_data = CFB.find(cfb, 'MN0')) && _data.content) + throw new Error("Unsupported Works 4 for Mac file"); + else + throw new Error("Cannot find Workbook stream"); + if (options.bookVBA && cfb.FullPaths && CFB.find(cfb, '/_VBA_PROJECT_CUR/VBA/dir')) + WorkbookP.vbaraw = make_vba_xls(cfb); + } + var props = {}; + if (cfb.FullPaths) + parse_xls_props(/*::((*/ cfb /*:: :any):CFBContainer)*/, props, options); + WorkbookP.Props = WorkbookP.Custprops = props; /* TODO: split up properties */ + if (options.bookFiles) + WorkbookP.cfb = cfb; + /*WorkbookP.CompObjP = CompObjP; // TODO: storage? */ + return WorkbookP; +} +function write_xlscfb(wb /*:Workbook*/, opts /*:WriteOpts*/) { + var o = opts || {}; + var cfb = CFB.utils.cfb_new({ root: "R" }); + var wbpath = "/Workbook"; + switch (o.bookType || "xls") { + case "xls": o.bookType = "biff8"; + /* falls through */ + case "xla": if (!o.bookType) + o.bookType = "xla"; + /* falls through */ + case "biff8": + wbpath = "/Workbook"; + o.biff = 8; + break; + case "biff5": + wbpath = "/Book"; + o.biff = 5; + break; + default: throw new Error("invalid type " + o.bookType + " for XLS CFB"); + } + CFB.utils.cfb_add(cfb, wbpath, write_biff_buf(wb, o)); + if (o.biff == 8 && (wb.Props || wb.Custprops)) + write_xls_props(wb, cfb); + // TODO: SI, DSI, CO + if (o.biff == 8 && wb.vbaraw) + fill_vba_xls(cfb, CFB.read(wb.vbaraw, { type: typeof wb.vbaraw == "string" ? "binary" : "buffer" })); + return cfb; +} +/* [MS-XLSB] 2.3 Record Enumeration */ +var XLSBRecordEnum = { + /*::[*/ 0x0000 /*::]*/: { /* n:"BrtRowHdr", */ f: parse_BrtRowHdr }, + /*::[*/ 0x0001 /*::]*/: { /* n:"BrtCellBlank", */ f: parse_BrtCellBlank }, + /*::[*/ 0x0002 /*::]*/: { /* n:"BrtCellRk", */ f: parse_BrtCellRk }, + /*::[*/ 0x0003 /*::]*/: { /* n:"BrtCellError", */ f: parse_BrtCellError }, + /*::[*/ 0x0004 /*::]*/: { /* n:"BrtCellBool", */ f: parse_BrtCellBool }, + /*::[*/ 0x0005 /*::]*/: { /* n:"BrtCellReal", */ f: parse_BrtCellReal }, + /*::[*/ 0x0006 /*::]*/: { /* n:"BrtCellSt", */ f: parse_BrtCellSt }, + /*::[*/ 0x0007 /*::]*/: { /* n:"BrtCellIsst", */ f: parse_BrtCellIsst }, + /*::[*/ 0x0008 /*::]*/: { /* n:"BrtFmlaString", */ f: parse_BrtFmlaString }, + /*::[*/ 0x0009 /*::]*/: { /* n:"BrtFmlaNum", */ f: parse_BrtFmlaNum }, + /*::[*/ 0x000A /*::]*/: { /* n:"BrtFmlaBool", */ f: parse_BrtFmlaBool }, + /*::[*/ 0x000B /*::]*/: { /* n:"BrtFmlaError", */ f: parse_BrtFmlaError }, + /*::[*/ 0x000C /*::]*/: { /* n:"BrtShortBlank", */ f: parse_BrtShortBlank }, + /*::[*/ 0x000D /*::]*/: { /* n:"BrtShortRk", */ f: parse_BrtShortRk }, + /*::[*/ 0x000E /*::]*/: { /* n:"BrtShortError", */ f: parse_BrtShortError }, + /*::[*/ 0x000F /*::]*/: { /* n:"BrtShortBool", */ f: parse_BrtShortBool }, + /*::[*/ 0x0010 /*::]*/: { /* n:"BrtShortReal", */ f: parse_BrtShortReal }, + /*::[*/ 0x0011 /*::]*/: { /* n:"BrtShortSt", */ f: parse_BrtShortSt }, + /*::[*/ 0x0012 /*::]*/: { /* n:"BrtShortIsst", */ f: parse_BrtShortIsst }, + /*::[*/ 0x0013 /*::]*/: { /* n:"BrtSSTItem", */ f: parse_RichStr }, + /*::[*/ 0x0014 /*::]*/: { /* n:"BrtPCDIMissing" */}, + /*::[*/ 0x0015 /*::]*/: { /* n:"BrtPCDINumber" */}, + /*::[*/ 0x0016 /*::]*/: { /* n:"BrtPCDIBoolean" */}, + /*::[*/ 0x0017 /*::]*/: { /* n:"BrtPCDIError" */}, + /*::[*/ 0x0018 /*::]*/: { /* n:"BrtPCDIString" */}, + /*::[*/ 0x0019 /*::]*/: { /* n:"BrtPCDIDatetime" */}, + /*::[*/ 0x001A /*::]*/: { /* n:"BrtPCDIIndex" */}, + /*::[*/ 0x001B /*::]*/: { /* n:"BrtPCDIAMissing" */}, + /*::[*/ 0x001C /*::]*/: { /* n:"BrtPCDIANumber" */}, + /*::[*/ 0x001D /*::]*/: { /* n:"BrtPCDIABoolean" */}, + /*::[*/ 0x001E /*::]*/: { /* n:"BrtPCDIAError" */}, + /*::[*/ 0x001F /*::]*/: { /* n:"BrtPCDIAString" */}, + /*::[*/ 0x0020 /*::]*/: { /* n:"BrtPCDIADatetime" */}, + /*::[*/ 0x0021 /*::]*/: { /* n:"BrtPCRRecord" */}, + /*::[*/ 0x0022 /*::]*/: { /* n:"BrtPCRRecordDt" */}, + /*::[*/ 0x0023 /*::]*/: { /* n:"BrtFRTBegin", */ T: 1 }, + /*::[*/ 0x0024 /*::]*/: { /* n:"BrtFRTEnd", */ T: -1 }, + /*::[*/ 0x0025 /*::]*/: { /* n:"BrtACBegin", */ T: 1 }, + /*::[*/ 0x0026 /*::]*/: { /* n:"BrtACEnd", */ T: -1 }, + /*::[*/ 0x0027 /*::]*/: { /* n:"BrtName", */ f: parse_BrtName }, + /*::[*/ 0x0028 /*::]*/: { /* n:"BrtIndexRowBlock" */}, + /*::[*/ 0x002A /*::]*/: { /* n:"BrtIndexBlock" */}, + /*::[*/ 0x002B /*::]*/: { /* n:"BrtFont", */ f: parse_BrtFont }, + /*::[*/ 0x002C /*::]*/: { /* n:"BrtFmt", */ f: parse_BrtFmt }, + /*::[*/ 0x002D /*::]*/: { /* n:"BrtFill", */ f: parse_BrtFill }, + /*::[*/ 0x002E /*::]*/: { /* n:"BrtBorder", */ f: parse_BrtBorder }, + /*::[*/ 0x002F /*::]*/: { /* n:"BrtXF", */ f: parse_BrtXF }, + /*::[*/ 0x0030 /*::]*/: { /* n:"BrtStyle" */}, + /*::[*/ 0x0031 /*::]*/: { /* n:"BrtCellMeta", */ f: parse_Int32LE }, + /*::[*/ 0x0032 /*::]*/: { /* n:"BrtValueMeta" */}, + /*::[*/ 0x0033 /*::]*/: { /* n:"BrtMdb" */ f: parse_BrtMdb }, + /*::[*/ 0x0034 /*::]*/: { /* n:"BrtBeginFmd", */ T: 1 }, + /*::[*/ 0x0035 /*::]*/: { /* n:"BrtEndFmd", */ T: -1 }, + /*::[*/ 0x0036 /*::]*/: { /* n:"BrtBeginMdx", */ T: 1 }, + /*::[*/ 0x0037 /*::]*/: { /* n:"BrtEndMdx", */ T: -1 }, + /*::[*/ 0x0038 /*::]*/: { /* n:"BrtBeginMdxTuple", */ T: 1 }, + /*::[*/ 0x0039 /*::]*/: { /* n:"BrtEndMdxTuple", */ T: -1 }, + /*::[*/ 0x003A /*::]*/: { /* n:"BrtMdxMbrIstr" */}, + /*::[*/ 0x003B /*::]*/: { /* n:"BrtStr" */}, + /*::[*/ 0x003C /*::]*/: { /* n:"BrtColInfo", */ f: parse_ColInfo }, + /*::[*/ 0x003E /*::]*/: { /* n:"BrtCellRString", */ f: parse_BrtCellRString }, + /*::[*/ 0x003F /*::]*/: { /* n:"BrtCalcChainItem$", */ f: parse_BrtCalcChainItem$ }, + /*::[*/ 0x0040 /*::]*/: { /* n:"BrtDVal", */ f: parse_BrtDVal }, + /*::[*/ 0x0041 /*::]*/: { /* n:"BrtSxvcellNum" */}, + /*::[*/ 0x0042 /*::]*/: { /* n:"BrtSxvcellStr" */}, + /*::[*/ 0x0043 /*::]*/: { /* n:"BrtSxvcellBool" */}, + /*::[*/ 0x0044 /*::]*/: { /* n:"BrtSxvcellErr" */}, + /*::[*/ 0x0045 /*::]*/: { /* n:"BrtSxvcellDate" */}, + /*::[*/ 0x0046 /*::]*/: { /* n:"BrtSxvcellNil" */}, + /*::[*/ 0x0080 /*::]*/: { /* n:"BrtFileVersion" */}, + /*::[*/ 0x0081 /*::]*/: { /* n:"BrtBeginSheet", */ T: 1 }, + /*::[*/ 0x0082 /*::]*/: { /* n:"BrtEndSheet", */ T: -1 }, + /*::[*/ 0x0083 /*::]*/: { /* n:"BrtBeginBook", */ T: 1, f: parsenoop, p: 0 }, + /*::[*/ 0x0084 /*::]*/: { /* n:"BrtEndBook", */ T: -1 }, + /*::[*/ 0x0085 /*::]*/: { /* n:"BrtBeginWsViews", */ T: 1 }, + /*::[*/ 0x0086 /*::]*/: { /* n:"BrtEndWsViews", */ T: -1 }, + /*::[*/ 0x0087 /*::]*/: { /* n:"BrtBeginBookViews", */ T: 1 }, + /*::[*/ 0x0088 /*::]*/: { /* n:"BrtEndBookViews", */ T: -1 }, + /*::[*/ 0x0089 /*::]*/: { /* n:"BrtBeginWsView", */ T: 1, f: parse_BrtBeginWsView }, + /*::[*/ 0x008A /*::]*/: { /* n:"BrtEndWsView", */ T: -1 }, + /*::[*/ 0x008B /*::]*/: { /* n:"BrtBeginCsViews", */ T: 1 }, + /*::[*/ 0x008C /*::]*/: { /* n:"BrtEndCsViews", */ T: -1 }, + /*::[*/ 0x008D /*::]*/: { /* n:"BrtBeginCsView", */ T: 1 }, + /*::[*/ 0x008E /*::]*/: { /* n:"BrtEndCsView", */ T: -1 }, + /*::[*/ 0x008F /*::]*/: { /* n:"BrtBeginBundleShs", */ T: 1 }, + /*::[*/ 0x0090 /*::]*/: { /* n:"BrtEndBundleShs", */ T: -1 }, + /*::[*/ 0x0091 /*::]*/: { /* n:"BrtBeginSheetData", */ T: 1 }, + /*::[*/ 0x0092 /*::]*/: { /* n:"BrtEndSheetData", */ T: -1 }, + /*::[*/ 0x0093 /*::]*/: { /* n:"BrtWsProp", */ f: parse_BrtWsProp }, + /*::[*/ 0x0094 /*::]*/: { /* n:"BrtWsDim", */ f: parse_BrtWsDim, p: 16 }, + /*::[*/ 0x0097 /*::]*/: { /* n:"BrtPane", */ f: parse_BrtPane }, + /*::[*/ 0x0098 /*::]*/: { /* n:"BrtSel" */}, + /*::[*/ 0x0099 /*::]*/: { /* n:"BrtWbProp", */ f: parse_BrtWbProp }, + /*::[*/ 0x009A /*::]*/: { /* n:"BrtWbFactoid" */}, + /*::[*/ 0x009B /*::]*/: { /* n:"BrtFileRecover" */}, + /*::[*/ 0x009C /*::]*/: { /* n:"BrtBundleSh", */ f: parse_BrtBundleSh }, + /*::[*/ 0x009D /*::]*/: { /* n:"BrtCalcProp" */}, + /*::[*/ 0x009E /*::]*/: { /* n:"BrtBookView" */}, + /*::[*/ 0x009F /*::]*/: { /* n:"BrtBeginSst", */ T: 1, f: parse_BrtBeginSst }, + /*::[*/ 0x00A0 /*::]*/: { /* n:"BrtEndSst", */ T: -1 }, + /*::[*/ 0x00A1 /*::]*/: { /* n:"BrtBeginAFilter", */ T: 1, f: parse_UncheckedRfX }, + /*::[*/ 0x00A2 /*::]*/: { /* n:"BrtEndAFilter", */ T: -1 }, + /*::[*/ 0x00A3 /*::]*/: { /* n:"BrtBeginFilterColumn", */ T: 1 }, + /*::[*/ 0x00A4 /*::]*/: { /* n:"BrtEndFilterColumn", */ T: -1 }, + /*::[*/ 0x00A5 /*::]*/: { /* n:"BrtBeginFilters", */ T: 1 }, + /*::[*/ 0x00A6 /*::]*/: { /* n:"BrtEndFilters", */ T: -1 }, + /*::[*/ 0x00A7 /*::]*/: { /* n:"BrtFilter" */}, + /*::[*/ 0x00A8 /*::]*/: { /* n:"BrtColorFilter" */}, + /*::[*/ 0x00A9 /*::]*/: { /* n:"BrtIconFilter" */}, + /*::[*/ 0x00AA /*::]*/: { /* n:"BrtTop10Filter" */}, + /*::[*/ 0x00AB /*::]*/: { /* n:"BrtDynamicFilter" */}, + /*::[*/ 0x00AC /*::]*/: { /* n:"BrtBeginCustomFilters", */ T: 1 }, + /*::[*/ 0x00AD /*::]*/: { /* n:"BrtEndCustomFilters", */ T: -1 }, + /*::[*/ 0x00AE /*::]*/: { /* n:"BrtCustomFilter" */}, + /*::[*/ 0x00AF /*::]*/: { /* n:"BrtAFilterDateGroupItem" */}, + /*::[*/ 0x00B0 /*::]*/: { /* n:"BrtMergeCell", */ f: parse_BrtMergeCell }, + /*::[*/ 0x00B1 /*::]*/: { /* n:"BrtBeginMergeCells", */ T: 1 }, + /*::[*/ 0x00B2 /*::]*/: { /* n:"BrtEndMergeCells", */ T: -1 }, + /*::[*/ 0x00B3 /*::]*/: { /* n:"BrtBeginPivotCacheDef", */ T: 1 }, + /*::[*/ 0x00B4 /*::]*/: { /* n:"BrtEndPivotCacheDef", */ T: -1 }, + /*::[*/ 0x00B5 /*::]*/: { /* n:"BrtBeginPCDFields", */ T: 1 }, + /*::[*/ 0x00B6 /*::]*/: { /* n:"BrtEndPCDFields", */ T: -1 }, + /*::[*/ 0x00B7 /*::]*/: { /* n:"BrtBeginPCDField", */ T: 1 }, + /*::[*/ 0x00B8 /*::]*/: { /* n:"BrtEndPCDField", */ T: -1 }, + /*::[*/ 0x00B9 /*::]*/: { /* n:"BrtBeginPCDSource", */ T: 1 }, + /*::[*/ 0x00BA /*::]*/: { /* n:"BrtEndPCDSource", */ T: -1 }, + /*::[*/ 0x00BB /*::]*/: { /* n:"BrtBeginPCDSRange", */ T: 1 }, + /*::[*/ 0x00BC /*::]*/: { /* n:"BrtEndPCDSRange", */ T: -1 }, + /*::[*/ 0x00BD /*::]*/: { /* n:"BrtBeginPCDFAtbl", */ T: 1 }, + /*::[*/ 0x00BE /*::]*/: { /* n:"BrtEndPCDFAtbl", */ T: -1 }, + /*::[*/ 0x00BF /*::]*/: { /* n:"BrtBeginPCDIRun", */ T: 1 }, + /*::[*/ 0x00C0 /*::]*/: { /* n:"BrtEndPCDIRun", */ T: -1 }, + /*::[*/ 0x00C1 /*::]*/: { /* n:"BrtBeginPivotCacheRecords", */ T: 1 }, + /*::[*/ 0x00C2 /*::]*/: { /* n:"BrtEndPivotCacheRecords", */ T: -1 }, + /*::[*/ 0x00C3 /*::]*/: { /* n:"BrtBeginPCDHierarchies", */ T: 1 }, + /*::[*/ 0x00C4 /*::]*/: { /* n:"BrtEndPCDHierarchies", */ T: -1 }, + /*::[*/ 0x00C5 /*::]*/: { /* n:"BrtBeginPCDHierarchy", */ T: 1 }, + /*::[*/ 0x00C6 /*::]*/: { /* n:"BrtEndPCDHierarchy", */ T: -1 }, + /*::[*/ 0x00C7 /*::]*/: { /* n:"BrtBeginPCDHFieldsUsage", */ T: 1 }, + /*::[*/ 0x00C8 /*::]*/: { /* n:"BrtEndPCDHFieldsUsage", */ T: -1 }, + /*::[*/ 0x00C9 /*::]*/: { /* n:"BrtBeginExtConnection", */ T: 1 }, + /*::[*/ 0x00CA /*::]*/: { /* n:"BrtEndExtConnection", */ T: -1 }, + /*::[*/ 0x00CB /*::]*/: { /* n:"BrtBeginECDbProps", */ T: 1 }, + /*::[*/ 0x00CC /*::]*/: { /* n:"BrtEndECDbProps", */ T: -1 }, + /*::[*/ 0x00CD /*::]*/: { /* n:"BrtBeginECOlapProps", */ T: 1 }, + /*::[*/ 0x00CE /*::]*/: { /* n:"BrtEndECOlapProps", */ T: -1 }, + /*::[*/ 0x00CF /*::]*/: { /* n:"BrtBeginPCDSConsol", */ T: 1 }, + /*::[*/ 0x00D0 /*::]*/: { /* n:"BrtEndPCDSConsol", */ T: -1 }, + /*::[*/ 0x00D1 /*::]*/: { /* n:"BrtBeginPCDSCPages", */ T: 1 }, + /*::[*/ 0x00D2 /*::]*/: { /* n:"BrtEndPCDSCPages", */ T: -1 }, + /*::[*/ 0x00D3 /*::]*/: { /* n:"BrtBeginPCDSCPage", */ T: 1 }, + /*::[*/ 0x00D4 /*::]*/: { /* n:"BrtEndPCDSCPage", */ T: -1 }, + /*::[*/ 0x00D5 /*::]*/: { /* n:"BrtBeginPCDSCPItem", */ T: 1 }, + /*::[*/ 0x00D6 /*::]*/: { /* n:"BrtEndPCDSCPItem", */ T: -1 }, + /*::[*/ 0x00D7 /*::]*/: { /* n:"BrtBeginPCDSCSets", */ T: 1 }, + /*::[*/ 0x00D8 /*::]*/: { /* n:"BrtEndPCDSCSets", */ T: -1 }, + /*::[*/ 0x00D9 /*::]*/: { /* n:"BrtBeginPCDSCSet", */ T: 1 }, + /*::[*/ 0x00DA /*::]*/: { /* n:"BrtEndPCDSCSet", */ T: -1 }, + /*::[*/ 0x00DB /*::]*/: { /* n:"BrtBeginPCDFGroup", */ T: 1 }, + /*::[*/ 0x00DC /*::]*/: { /* n:"BrtEndPCDFGroup", */ T: -1 }, + /*::[*/ 0x00DD /*::]*/: { /* n:"BrtBeginPCDFGItems", */ T: 1 }, + /*::[*/ 0x00DE /*::]*/: { /* n:"BrtEndPCDFGItems", */ T: -1 }, + /*::[*/ 0x00DF /*::]*/: { /* n:"BrtBeginPCDFGRange", */ T: 1 }, + /*::[*/ 0x00E0 /*::]*/: { /* n:"BrtEndPCDFGRange", */ T: -1 }, + /*::[*/ 0x00E1 /*::]*/: { /* n:"BrtBeginPCDFGDiscrete", */ T: 1 }, + /*::[*/ 0x00E2 /*::]*/: { /* n:"BrtEndPCDFGDiscrete", */ T: -1 }, + /*::[*/ 0x00E3 /*::]*/: { /* n:"BrtBeginPCDSDTupleCache", */ T: 1 }, + /*::[*/ 0x00E4 /*::]*/: { /* n:"BrtEndPCDSDTupleCache", */ T: -1 }, + /*::[*/ 0x00E5 /*::]*/: { /* n:"BrtBeginPCDSDTCEntries", */ T: 1 }, + /*::[*/ 0x00E6 /*::]*/: { /* n:"BrtEndPCDSDTCEntries", */ T: -1 }, + /*::[*/ 0x00E7 /*::]*/: { /* n:"BrtBeginPCDSDTCEMembers", */ T: 1 }, + /*::[*/ 0x00E8 /*::]*/: { /* n:"BrtEndPCDSDTCEMembers", */ T: -1 }, + /*::[*/ 0x00E9 /*::]*/: { /* n:"BrtBeginPCDSDTCEMember", */ T: 1 }, + /*::[*/ 0x00EA /*::]*/: { /* n:"BrtEndPCDSDTCEMember", */ T: -1 }, + /*::[*/ 0x00EB /*::]*/: { /* n:"BrtBeginPCDSDTCQueries", */ T: 1 }, + /*::[*/ 0x00EC /*::]*/: { /* n:"BrtEndPCDSDTCQueries", */ T: -1 }, + /*::[*/ 0x00ED /*::]*/: { /* n:"BrtBeginPCDSDTCQuery", */ T: 1 }, + /*::[*/ 0x00EE /*::]*/: { /* n:"BrtEndPCDSDTCQuery", */ T: -1 }, + /*::[*/ 0x00EF /*::]*/: { /* n:"BrtBeginPCDSDTCSets", */ T: 1 }, + /*::[*/ 0x00F0 /*::]*/: { /* n:"BrtEndPCDSDTCSets", */ T: -1 }, + /*::[*/ 0x00F1 /*::]*/: { /* n:"BrtBeginPCDSDTCSet", */ T: 1 }, + /*::[*/ 0x00F2 /*::]*/: { /* n:"BrtEndPCDSDTCSet", */ T: -1 }, + /*::[*/ 0x00F3 /*::]*/: { /* n:"BrtBeginPCDCalcItems", */ T: 1 }, + /*::[*/ 0x00F4 /*::]*/: { /* n:"BrtEndPCDCalcItems", */ T: -1 }, + /*::[*/ 0x00F5 /*::]*/: { /* n:"BrtBeginPCDCalcItem", */ T: 1 }, + /*::[*/ 0x00F6 /*::]*/: { /* n:"BrtEndPCDCalcItem", */ T: -1 }, + /*::[*/ 0x00F7 /*::]*/: { /* n:"BrtBeginPRule", */ T: 1 }, + /*::[*/ 0x00F8 /*::]*/: { /* n:"BrtEndPRule", */ T: -1 }, + /*::[*/ 0x00F9 /*::]*/: { /* n:"BrtBeginPRFilters", */ T: 1 }, + /*::[*/ 0x00FA /*::]*/: { /* n:"BrtEndPRFilters", */ T: -1 }, + /*::[*/ 0x00FB /*::]*/: { /* n:"BrtBeginPRFilter", */ T: 1 }, + /*::[*/ 0x00FC /*::]*/: { /* n:"BrtEndPRFilter", */ T: -1 }, + /*::[*/ 0x00FD /*::]*/: { /* n:"BrtBeginPNames", */ T: 1 }, + /*::[*/ 0x00FE /*::]*/: { /* n:"BrtEndPNames", */ T: -1 }, + /*::[*/ 0x00FF /*::]*/: { /* n:"BrtBeginPName", */ T: 1 }, + /*::[*/ 0x0100 /*::]*/: { /* n:"BrtEndPName", */ T: -1 }, + /*::[*/ 0x0101 /*::]*/: { /* n:"BrtBeginPNPairs", */ T: 1 }, + /*::[*/ 0x0102 /*::]*/: { /* n:"BrtEndPNPairs", */ T: -1 }, + /*::[*/ 0x0103 /*::]*/: { /* n:"BrtBeginPNPair", */ T: 1 }, + /*::[*/ 0x0104 /*::]*/: { /* n:"BrtEndPNPair", */ T: -1 }, + /*::[*/ 0x0105 /*::]*/: { /* n:"BrtBeginECWebProps", */ T: 1 }, + /*::[*/ 0x0106 /*::]*/: { /* n:"BrtEndECWebProps", */ T: -1 }, + /*::[*/ 0x0107 /*::]*/: { /* n:"BrtBeginEcWpTables", */ T: 1 }, + /*::[*/ 0x0108 /*::]*/: { /* n:"BrtEndECWPTables", */ T: -1 }, + /*::[*/ 0x0109 /*::]*/: { /* n:"BrtBeginECParams", */ T: 1 }, + /*::[*/ 0x010A /*::]*/: { /* n:"BrtEndECParams", */ T: -1 }, + /*::[*/ 0x010B /*::]*/: { /* n:"BrtBeginECParam", */ T: 1 }, + /*::[*/ 0x010C /*::]*/: { /* n:"BrtEndECParam", */ T: -1 }, + /*::[*/ 0x010D /*::]*/: { /* n:"BrtBeginPCDKPIs", */ T: 1 }, + /*::[*/ 0x010E /*::]*/: { /* n:"BrtEndPCDKPIs", */ T: -1 }, + /*::[*/ 0x010F /*::]*/: { /* n:"BrtBeginPCDKPI", */ T: 1 }, + /*::[*/ 0x0110 /*::]*/: { /* n:"BrtEndPCDKPI", */ T: -1 }, + /*::[*/ 0x0111 /*::]*/: { /* n:"BrtBeginDims", */ T: 1 }, + /*::[*/ 0x0112 /*::]*/: { /* n:"BrtEndDims", */ T: -1 }, + /*::[*/ 0x0113 /*::]*/: { /* n:"BrtBeginDim", */ T: 1 }, + /*::[*/ 0x0114 /*::]*/: { /* n:"BrtEndDim", */ T: -1 }, + /*::[*/ 0x0115 /*::]*/: { /* n:"BrtIndexPartEnd" */}, + /*::[*/ 0x0116 /*::]*/: { /* n:"BrtBeginStyleSheet", */ T: 1 }, + /*::[*/ 0x0117 /*::]*/: { /* n:"BrtEndStyleSheet", */ T: -1 }, + /*::[*/ 0x0118 /*::]*/: { /* n:"BrtBeginSXView", */ T: 1 }, + /*::[*/ 0x0119 /*::]*/: { /* n:"BrtEndSXVI", */ T: -1 }, + /*::[*/ 0x011A /*::]*/: { /* n:"BrtBeginSXVI", */ T: 1 }, + /*::[*/ 0x011B /*::]*/: { /* n:"BrtBeginSXVIs", */ T: 1 }, + /*::[*/ 0x011C /*::]*/: { /* n:"BrtEndSXVIs", */ T: -1 }, + /*::[*/ 0x011D /*::]*/: { /* n:"BrtBeginSXVD", */ T: 1 }, + /*::[*/ 0x011E /*::]*/: { /* n:"BrtEndSXVD", */ T: -1 }, + /*::[*/ 0x011F /*::]*/: { /* n:"BrtBeginSXVDs", */ T: 1 }, + /*::[*/ 0x0120 /*::]*/: { /* n:"BrtEndSXVDs", */ T: -1 }, + /*::[*/ 0x0121 /*::]*/: { /* n:"BrtBeginSXPI", */ T: 1 }, + /*::[*/ 0x0122 /*::]*/: { /* n:"BrtEndSXPI", */ T: -1 }, + /*::[*/ 0x0123 /*::]*/: { /* n:"BrtBeginSXPIs", */ T: 1 }, + /*::[*/ 0x0124 /*::]*/: { /* n:"BrtEndSXPIs", */ T: -1 }, + /*::[*/ 0x0125 /*::]*/: { /* n:"BrtBeginSXDI", */ T: 1 }, + /*::[*/ 0x0126 /*::]*/: { /* n:"BrtEndSXDI", */ T: -1 }, + /*::[*/ 0x0127 /*::]*/: { /* n:"BrtBeginSXDIs", */ T: 1 }, + /*::[*/ 0x0128 /*::]*/: { /* n:"BrtEndSXDIs", */ T: -1 }, + /*::[*/ 0x0129 /*::]*/: { /* n:"BrtBeginSXLI", */ T: 1 }, + /*::[*/ 0x012A /*::]*/: { /* n:"BrtEndSXLI", */ T: -1 }, + /*::[*/ 0x012B /*::]*/: { /* n:"BrtBeginSXLIRws", */ T: 1 }, + /*::[*/ 0x012C /*::]*/: { /* n:"BrtEndSXLIRws", */ T: -1 }, + /*::[*/ 0x012D /*::]*/: { /* n:"BrtBeginSXLICols", */ T: 1 }, + /*::[*/ 0x012E /*::]*/: { /* n:"BrtEndSXLICols", */ T: -1 }, + /*::[*/ 0x012F /*::]*/: { /* n:"BrtBeginSXFormat", */ T: 1 }, + /*::[*/ 0x0130 /*::]*/: { /* n:"BrtEndSXFormat", */ T: -1 }, + /*::[*/ 0x0131 /*::]*/: { /* n:"BrtBeginSXFormats", */ T: 1 }, + /*::[*/ 0x0132 /*::]*/: { /* n:"BrtEndSxFormats", */ T: -1 }, + /*::[*/ 0x0133 /*::]*/: { /* n:"BrtBeginSxSelect", */ T: 1 }, + /*::[*/ 0x0134 /*::]*/: { /* n:"BrtEndSxSelect", */ T: -1 }, + /*::[*/ 0x0135 /*::]*/: { /* n:"BrtBeginISXVDRws", */ T: 1 }, + /*::[*/ 0x0136 /*::]*/: { /* n:"BrtEndISXVDRws", */ T: -1 }, + /*::[*/ 0x0137 /*::]*/: { /* n:"BrtBeginISXVDCols", */ T: 1 }, + /*::[*/ 0x0138 /*::]*/: { /* n:"BrtEndISXVDCols", */ T: -1 }, + /*::[*/ 0x0139 /*::]*/: { /* n:"BrtEndSXLocation", */ T: -1 }, + /*::[*/ 0x013A /*::]*/: { /* n:"BrtBeginSXLocation", */ T: 1 }, + /*::[*/ 0x013B /*::]*/: { /* n:"BrtEndSXView", */ T: -1 }, + /*::[*/ 0x013C /*::]*/: { /* n:"BrtBeginSXTHs", */ T: 1 }, + /*::[*/ 0x013D /*::]*/: { /* n:"BrtEndSXTHs", */ T: -1 }, + /*::[*/ 0x013E /*::]*/: { /* n:"BrtBeginSXTH", */ T: 1 }, + /*::[*/ 0x013F /*::]*/: { /* n:"BrtEndSXTH", */ T: -1 }, + /*::[*/ 0x0140 /*::]*/: { /* n:"BrtBeginISXTHRws", */ T: 1 }, + /*::[*/ 0x0141 /*::]*/: { /* n:"BrtEndISXTHRws", */ T: -1 }, + /*::[*/ 0x0142 /*::]*/: { /* n:"BrtBeginISXTHCols", */ T: 1 }, + /*::[*/ 0x0143 /*::]*/: { /* n:"BrtEndISXTHCols", */ T: -1 }, + /*::[*/ 0x0144 /*::]*/: { /* n:"BrtBeginSXTDMPS", */ T: 1 }, + /*::[*/ 0x0145 /*::]*/: { /* n:"BrtEndSXTDMPs", */ T: -1 }, + /*::[*/ 0x0146 /*::]*/: { /* n:"BrtBeginSXTDMP", */ T: 1 }, + /*::[*/ 0x0147 /*::]*/: { /* n:"BrtEndSXTDMP", */ T: -1 }, + /*::[*/ 0x0148 /*::]*/: { /* n:"BrtBeginSXTHItems", */ T: 1 }, + /*::[*/ 0x0149 /*::]*/: { /* n:"BrtEndSXTHItems", */ T: -1 }, + /*::[*/ 0x014A /*::]*/: { /* n:"BrtBeginSXTHItem", */ T: 1 }, + /*::[*/ 0x014B /*::]*/: { /* n:"BrtEndSXTHItem", */ T: -1 }, + /*::[*/ 0x014C /*::]*/: { /* n:"BrtBeginMetadata", */ T: 1 }, + /*::[*/ 0x014D /*::]*/: { /* n:"BrtEndMetadata", */ T: -1 }, + /*::[*/ 0x014E /*::]*/: { /* n:"BrtBeginEsmdtinfo", */ T: 1 }, + /*::[*/ 0x014F /*::]*/: { /* n:"BrtMdtinfo", */ f: parse_BrtMdtinfo }, + /*::[*/ 0x0150 /*::]*/: { /* n:"BrtEndEsmdtinfo", */ T: -1 }, + /*::[*/ 0x0151 /*::]*/: { /* n:"BrtBeginEsmdb", */ f: parse_BrtBeginEsmdb, T: 1 }, + /*::[*/ 0x0152 /*::]*/: { /* n:"BrtEndEsmdb", */ T: -1 }, + /*::[*/ 0x0153 /*::]*/: { /* n:"BrtBeginEsfmd", */ T: 1 }, + /*::[*/ 0x0154 /*::]*/: { /* n:"BrtEndEsfmd", */ T: -1 }, + /*::[*/ 0x0155 /*::]*/: { /* n:"BrtBeginSingleCells", */ T: 1 }, + /*::[*/ 0x0156 /*::]*/: { /* n:"BrtEndSingleCells", */ T: -1 }, + /*::[*/ 0x0157 /*::]*/: { /* n:"BrtBeginList", */ T: 1 }, + /*::[*/ 0x0158 /*::]*/: { /* n:"BrtEndList", */ T: -1 }, + /*::[*/ 0x0159 /*::]*/: { /* n:"BrtBeginListCols", */ T: 1 }, + /*::[*/ 0x015A /*::]*/: { /* n:"BrtEndListCols", */ T: -1 }, + /*::[*/ 0x015B /*::]*/: { /* n:"BrtBeginListCol", */ T: 1 }, + /*::[*/ 0x015C /*::]*/: { /* n:"BrtEndListCol", */ T: -1 }, + /*::[*/ 0x015D /*::]*/: { /* n:"BrtBeginListXmlCPr", */ T: 1 }, + /*::[*/ 0x015E /*::]*/: { /* n:"BrtEndListXmlCPr", */ T: -1 }, + /*::[*/ 0x015F /*::]*/: { /* n:"BrtListCCFmla" */}, + /*::[*/ 0x0160 /*::]*/: { /* n:"BrtListTrFmla" */}, + /*::[*/ 0x0161 /*::]*/: { /* n:"BrtBeginExternals", */ T: 1 }, + /*::[*/ 0x0162 /*::]*/: { /* n:"BrtEndExternals", */ T: -1 }, + /*::[*/ 0x0163 /*::]*/: { /* n:"BrtSupBookSrc", */ f: parse_RelID }, + /*::[*/ 0x0165 /*::]*/: { /* n:"BrtSupSelf" */}, + /*::[*/ 0x0166 /*::]*/: { /* n:"BrtSupSame" */}, + /*::[*/ 0x0167 /*::]*/: { /* n:"BrtSupTabs" */}, + /*::[*/ 0x0168 /*::]*/: { /* n:"BrtBeginSupBook", */ T: 1 }, + /*::[*/ 0x0169 /*::]*/: { /* n:"BrtPlaceholderName" */}, + /*::[*/ 0x016A /*::]*/: { /* n:"BrtExternSheet", */ f: parse_ExternSheet }, + /*::[*/ 0x016B /*::]*/: { /* n:"BrtExternTableStart" */}, + /*::[*/ 0x016C /*::]*/: { /* n:"BrtExternTableEnd" */}, + /*::[*/ 0x016E /*::]*/: { /* n:"BrtExternRowHdr" */}, + /*::[*/ 0x016F /*::]*/: { /* n:"BrtExternCellBlank" */}, + /*::[*/ 0x0170 /*::]*/: { /* n:"BrtExternCellReal" */}, + /*::[*/ 0x0171 /*::]*/: { /* n:"BrtExternCellBool" */}, + /*::[*/ 0x0172 /*::]*/: { /* n:"BrtExternCellError" */}, + /*::[*/ 0x0173 /*::]*/: { /* n:"BrtExternCellString" */}, + /*::[*/ 0x0174 /*::]*/: { /* n:"BrtBeginEsmdx", */ T: 1 }, + /*::[*/ 0x0175 /*::]*/: { /* n:"BrtEndEsmdx", */ T: -1 }, + /*::[*/ 0x0176 /*::]*/: { /* n:"BrtBeginMdxSet", */ T: 1 }, + /*::[*/ 0x0177 /*::]*/: { /* n:"BrtEndMdxSet", */ T: -1 }, + /*::[*/ 0x0178 /*::]*/: { /* n:"BrtBeginMdxMbrProp", */ T: 1 }, + /*::[*/ 0x0179 /*::]*/: { /* n:"BrtEndMdxMbrProp", */ T: -1 }, + /*::[*/ 0x017A /*::]*/: { /* n:"BrtBeginMdxKPI", */ T: 1 }, + /*::[*/ 0x017B /*::]*/: { /* n:"BrtEndMdxKPI", */ T: -1 }, + /*::[*/ 0x017C /*::]*/: { /* n:"BrtBeginEsstr", */ T: 1 }, + /*::[*/ 0x017D /*::]*/: { /* n:"BrtEndEsstr", */ T: -1 }, + /*::[*/ 0x017E /*::]*/: { /* n:"BrtBeginPRFItem", */ T: 1 }, + /*::[*/ 0x017F /*::]*/: { /* n:"BrtEndPRFItem", */ T: -1 }, + /*::[*/ 0x0180 /*::]*/: { /* n:"BrtBeginPivotCacheIDs", */ T: 1 }, + /*::[*/ 0x0181 /*::]*/: { /* n:"BrtEndPivotCacheIDs", */ T: -1 }, + /*::[*/ 0x0182 /*::]*/: { /* n:"BrtBeginPivotCacheID", */ T: 1 }, + /*::[*/ 0x0183 /*::]*/: { /* n:"BrtEndPivotCacheID", */ T: -1 }, + /*::[*/ 0x0184 /*::]*/: { /* n:"BrtBeginISXVIs", */ T: 1 }, + /*::[*/ 0x0185 /*::]*/: { /* n:"BrtEndISXVIs", */ T: -1 }, + /*::[*/ 0x0186 /*::]*/: { /* n:"BrtBeginColInfos", */ T: 1 }, + /*::[*/ 0x0187 /*::]*/: { /* n:"BrtEndColInfos", */ T: -1 }, + /*::[*/ 0x0188 /*::]*/: { /* n:"BrtBeginRwBrk", */ T: 1 }, + /*::[*/ 0x0189 /*::]*/: { /* n:"BrtEndRwBrk", */ T: -1 }, + /*::[*/ 0x018A /*::]*/: { /* n:"BrtBeginColBrk", */ T: 1 }, + /*::[*/ 0x018B /*::]*/: { /* n:"BrtEndColBrk", */ T: -1 }, + /*::[*/ 0x018C /*::]*/: { /* n:"BrtBrk" */}, + /*::[*/ 0x018D /*::]*/: { /* n:"BrtUserBookView" */}, + /*::[*/ 0x018E /*::]*/: { /* n:"BrtInfo" */}, + /*::[*/ 0x018F /*::]*/: { /* n:"BrtCUsr" */}, + /*::[*/ 0x0190 /*::]*/: { /* n:"BrtUsr" */}, + /*::[*/ 0x0191 /*::]*/: { /* n:"BrtBeginUsers", */ T: 1 }, + /*::[*/ 0x0193 /*::]*/: { /* n:"BrtEOF" */}, + /*::[*/ 0x0194 /*::]*/: { /* n:"BrtUCR" */}, + /*::[*/ 0x0195 /*::]*/: { /* n:"BrtRRInsDel" */}, + /*::[*/ 0x0196 /*::]*/: { /* n:"BrtRREndInsDel" */}, + /*::[*/ 0x0197 /*::]*/: { /* n:"BrtRRMove" */}, + /*::[*/ 0x0198 /*::]*/: { /* n:"BrtRREndMove" */}, + /*::[*/ 0x0199 /*::]*/: { /* n:"BrtRRChgCell" */}, + /*::[*/ 0x019A /*::]*/: { /* n:"BrtRREndChgCell" */}, + /*::[*/ 0x019B /*::]*/: { /* n:"BrtRRHeader" */}, + /*::[*/ 0x019C /*::]*/: { /* n:"BrtRRUserView" */}, + /*::[*/ 0x019D /*::]*/: { /* n:"BrtRRRenSheet" */}, + /*::[*/ 0x019E /*::]*/: { /* n:"BrtRRInsertSh" */}, + /*::[*/ 0x019F /*::]*/: { /* n:"BrtRRDefName" */}, + /*::[*/ 0x01A0 /*::]*/: { /* n:"BrtRRNote" */}, + /*::[*/ 0x01A1 /*::]*/: { /* n:"BrtRRConflict" */}, + /*::[*/ 0x01A2 /*::]*/: { /* n:"BrtRRTQSIF" */}, + /*::[*/ 0x01A3 /*::]*/: { /* n:"BrtRRFormat" */}, + /*::[*/ 0x01A4 /*::]*/: { /* n:"BrtRREndFormat" */}, + /*::[*/ 0x01A5 /*::]*/: { /* n:"BrtRRAutoFmt" */}, + /*::[*/ 0x01A6 /*::]*/: { /* n:"BrtBeginUserShViews", */ T: 1 }, + /*::[*/ 0x01A7 /*::]*/: { /* n:"BrtBeginUserShView", */ T: 1 }, + /*::[*/ 0x01A8 /*::]*/: { /* n:"BrtEndUserShView", */ T: -1 }, + /*::[*/ 0x01A9 /*::]*/: { /* n:"BrtEndUserShViews", */ T: -1 }, + /*::[*/ 0x01AA /*::]*/: { /* n:"BrtArrFmla", */ f: parse_BrtArrFmla }, + /*::[*/ 0x01AB /*::]*/: { /* n:"BrtShrFmla", */ f: parse_BrtShrFmla }, + /*::[*/ 0x01AC /*::]*/: { /* n:"BrtTable" */}, + /*::[*/ 0x01AD /*::]*/: { /* n:"BrtBeginExtConnections", */ T: 1 }, + /*::[*/ 0x01AE /*::]*/: { /* n:"BrtEndExtConnections", */ T: -1 }, + /*::[*/ 0x01AF /*::]*/: { /* n:"BrtBeginPCDCalcMems", */ T: 1 }, + /*::[*/ 0x01B0 /*::]*/: { /* n:"BrtEndPCDCalcMems", */ T: -1 }, + /*::[*/ 0x01B1 /*::]*/: { /* n:"BrtBeginPCDCalcMem", */ T: 1 }, + /*::[*/ 0x01B2 /*::]*/: { /* n:"BrtEndPCDCalcMem", */ T: -1 }, + /*::[*/ 0x01B3 /*::]*/: { /* n:"BrtBeginPCDHGLevels", */ T: 1 }, + /*::[*/ 0x01B4 /*::]*/: { /* n:"BrtEndPCDHGLevels", */ T: -1 }, + /*::[*/ 0x01B5 /*::]*/: { /* n:"BrtBeginPCDHGLevel", */ T: 1 }, + /*::[*/ 0x01B6 /*::]*/: { /* n:"BrtEndPCDHGLevel", */ T: -1 }, + /*::[*/ 0x01B7 /*::]*/: { /* n:"BrtBeginPCDHGLGroups", */ T: 1 }, + /*::[*/ 0x01B8 /*::]*/: { /* n:"BrtEndPCDHGLGroups", */ T: -1 }, + /*::[*/ 0x01B9 /*::]*/: { /* n:"BrtBeginPCDHGLGroup", */ T: 1 }, + /*::[*/ 0x01BA /*::]*/: { /* n:"BrtEndPCDHGLGroup", */ T: -1 }, + /*::[*/ 0x01BB /*::]*/: { /* n:"BrtBeginPCDHGLGMembers", */ T: 1 }, + /*::[*/ 0x01BC /*::]*/: { /* n:"BrtEndPCDHGLGMembers", */ T: -1 }, + /*::[*/ 0x01BD /*::]*/: { /* n:"BrtBeginPCDHGLGMember", */ T: 1 }, + /*::[*/ 0x01BE /*::]*/: { /* n:"BrtEndPCDHGLGMember", */ T: -1 }, + /*::[*/ 0x01BF /*::]*/: { /* n:"BrtBeginQSI", */ T: 1 }, + /*::[*/ 0x01C0 /*::]*/: { /* n:"BrtEndQSI", */ T: -1 }, + /*::[*/ 0x01C1 /*::]*/: { /* n:"BrtBeginQSIR", */ T: 1 }, + /*::[*/ 0x01C2 /*::]*/: { /* n:"BrtEndQSIR", */ T: -1 }, + /*::[*/ 0x01C3 /*::]*/: { /* n:"BrtBeginDeletedNames", */ T: 1 }, + /*::[*/ 0x01C4 /*::]*/: { /* n:"BrtEndDeletedNames", */ T: -1 }, + /*::[*/ 0x01C5 /*::]*/: { /* n:"BrtBeginDeletedName", */ T: 1 }, + /*::[*/ 0x01C6 /*::]*/: { /* n:"BrtEndDeletedName", */ T: -1 }, + /*::[*/ 0x01C7 /*::]*/: { /* n:"BrtBeginQSIFs", */ T: 1 }, + /*::[*/ 0x01C8 /*::]*/: { /* n:"BrtEndQSIFs", */ T: -1 }, + /*::[*/ 0x01C9 /*::]*/: { /* n:"BrtBeginQSIF", */ T: 1 }, + /*::[*/ 0x01CA /*::]*/: { /* n:"BrtEndQSIF", */ T: -1 }, + /*::[*/ 0x01CB /*::]*/: { /* n:"BrtBeginAutoSortScope", */ T: 1 }, + /*::[*/ 0x01CC /*::]*/: { /* n:"BrtEndAutoSortScope", */ T: -1 }, + /*::[*/ 0x01CD /*::]*/: { /* n:"BrtBeginConditionalFormatting", */ T: 1 }, + /*::[*/ 0x01CE /*::]*/: { /* n:"BrtEndConditionalFormatting", */ T: -1 }, + /*::[*/ 0x01CF /*::]*/: { /* n:"BrtBeginCFRule", */ T: 1 }, + /*::[*/ 0x01D0 /*::]*/: { /* n:"BrtEndCFRule", */ T: -1 }, + /*::[*/ 0x01D1 /*::]*/: { /* n:"BrtBeginIconSet", */ T: 1 }, + /*::[*/ 0x01D2 /*::]*/: { /* n:"BrtEndIconSet", */ T: -1 }, + /*::[*/ 0x01D3 /*::]*/: { /* n:"BrtBeginDatabar", */ T: 1 }, + /*::[*/ 0x01D4 /*::]*/: { /* n:"BrtEndDatabar", */ T: -1 }, + /*::[*/ 0x01D5 /*::]*/: { /* n:"BrtBeginColorScale", */ T: 1 }, + /*::[*/ 0x01D6 /*::]*/: { /* n:"BrtEndColorScale", */ T: -1 }, + /*::[*/ 0x01D7 /*::]*/: { /* n:"BrtCFVO" */}, + /*::[*/ 0x01D8 /*::]*/: { /* n:"BrtExternValueMeta" */}, + /*::[*/ 0x01D9 /*::]*/: { /* n:"BrtBeginColorPalette", */ T: 1 }, + /*::[*/ 0x01DA /*::]*/: { /* n:"BrtEndColorPalette", */ T: -1 }, + /*::[*/ 0x01DB /*::]*/: { /* n:"BrtIndexedColor" */}, + /*::[*/ 0x01DC /*::]*/: { /* n:"BrtMargins", */ f: parse_BrtMargins }, + /*::[*/ 0x01DD /*::]*/: { /* n:"BrtPrintOptions" */}, + /*::[*/ 0x01DE /*::]*/: { /* n:"BrtPageSetup" */}, + /*::[*/ 0x01DF /*::]*/: { /* n:"BrtBeginHeaderFooter", */ T: 1 }, + /*::[*/ 0x01E0 /*::]*/: { /* n:"BrtEndHeaderFooter", */ T: -1 }, + /*::[*/ 0x01E1 /*::]*/: { /* n:"BrtBeginSXCrtFormat", */ T: 1 }, + /*::[*/ 0x01E2 /*::]*/: { /* n:"BrtEndSXCrtFormat", */ T: -1 }, + /*::[*/ 0x01E3 /*::]*/: { /* n:"BrtBeginSXCrtFormats", */ T: 1 }, + /*::[*/ 0x01E4 /*::]*/: { /* n:"BrtEndSXCrtFormats", */ T: -1 }, + /*::[*/ 0x01E5 /*::]*/: { /* n:"BrtWsFmtInfo", */ f: parse_BrtWsFmtInfo }, + /*::[*/ 0x01E6 /*::]*/: { /* n:"BrtBeginMgs", */ T: 1 }, + /*::[*/ 0x01E7 /*::]*/: { /* n:"BrtEndMGs", */ T: -1 }, + /*::[*/ 0x01E8 /*::]*/: { /* n:"BrtBeginMGMaps", */ T: 1 }, + /*::[*/ 0x01E9 /*::]*/: { /* n:"BrtEndMGMaps", */ T: -1 }, + /*::[*/ 0x01EA /*::]*/: { /* n:"BrtBeginMG", */ T: 1 }, + /*::[*/ 0x01EB /*::]*/: { /* n:"BrtEndMG", */ T: -1 }, + /*::[*/ 0x01EC /*::]*/: { /* n:"BrtBeginMap", */ T: 1 }, + /*::[*/ 0x01ED /*::]*/: { /* n:"BrtEndMap", */ T: -1 }, + /*::[*/ 0x01EE /*::]*/: { /* n:"BrtHLink", */ f: parse_BrtHLink }, + /*::[*/ 0x01EF /*::]*/: { /* n:"BrtBeginDCon", */ T: 1 }, + /*::[*/ 0x01F0 /*::]*/: { /* n:"BrtEndDCon", */ T: -1 }, + /*::[*/ 0x01F1 /*::]*/: { /* n:"BrtBeginDRefs", */ T: 1 }, + /*::[*/ 0x01F2 /*::]*/: { /* n:"BrtEndDRefs", */ T: -1 }, + /*::[*/ 0x01F3 /*::]*/: { /* n:"BrtDRef" */}, + /*::[*/ 0x01F4 /*::]*/: { /* n:"BrtBeginScenMan", */ T: 1 }, + /*::[*/ 0x01F5 /*::]*/: { /* n:"BrtEndScenMan", */ T: -1 }, + /*::[*/ 0x01F6 /*::]*/: { /* n:"BrtBeginSct", */ T: 1 }, + /*::[*/ 0x01F7 /*::]*/: { /* n:"BrtEndSct", */ T: -1 }, + /*::[*/ 0x01F8 /*::]*/: { /* n:"BrtSlc" */}, + /*::[*/ 0x01F9 /*::]*/: { /* n:"BrtBeginDXFs", */ T: 1 }, + /*::[*/ 0x01FA /*::]*/: { /* n:"BrtEndDXFs", */ T: -1 }, + /*::[*/ 0x01FB /*::]*/: { /* n:"BrtDXF" */}, + /*::[*/ 0x01FC /*::]*/: { /* n:"BrtBeginTableStyles", */ T: 1 }, + /*::[*/ 0x01FD /*::]*/: { /* n:"BrtEndTableStyles", */ T: -1 }, + /*::[*/ 0x01FE /*::]*/: { /* n:"BrtBeginTableStyle", */ T: 1 }, + /*::[*/ 0x01FF /*::]*/: { /* n:"BrtEndTableStyle", */ T: -1 }, + /*::[*/ 0x0200 /*::]*/: { /* n:"BrtTableStyleElement" */}, + /*::[*/ 0x0201 /*::]*/: { /* n:"BrtTableStyleClient" */}, + /*::[*/ 0x0202 /*::]*/: { /* n:"BrtBeginVolDeps", */ T: 1 }, + /*::[*/ 0x0203 /*::]*/: { /* n:"BrtEndVolDeps", */ T: -1 }, + /*::[*/ 0x0204 /*::]*/: { /* n:"BrtBeginVolType", */ T: 1 }, + /*::[*/ 0x0205 /*::]*/: { /* n:"BrtEndVolType", */ T: -1 }, + /*::[*/ 0x0206 /*::]*/: { /* n:"BrtBeginVolMain", */ T: 1 }, + /*::[*/ 0x0207 /*::]*/: { /* n:"BrtEndVolMain", */ T: -1 }, + /*::[*/ 0x0208 /*::]*/: { /* n:"BrtBeginVolTopic", */ T: 1 }, + /*::[*/ 0x0209 /*::]*/: { /* n:"BrtEndVolTopic", */ T: -1 }, + /*::[*/ 0x020A /*::]*/: { /* n:"BrtVolSubtopic" */}, + /*::[*/ 0x020B /*::]*/: { /* n:"BrtVolRef" */}, + /*::[*/ 0x020C /*::]*/: { /* n:"BrtVolNum" */}, + /*::[*/ 0x020D /*::]*/: { /* n:"BrtVolErr" */}, + /*::[*/ 0x020E /*::]*/: { /* n:"BrtVolStr" */}, + /*::[*/ 0x020F /*::]*/: { /* n:"BrtVolBool" */}, + /*::[*/ 0x0210 /*::]*/: { /* n:"BrtBeginCalcChain$", */ T: 1 }, + /*::[*/ 0x0211 /*::]*/: { /* n:"BrtEndCalcChain$", */ T: -1 }, + /*::[*/ 0x0212 /*::]*/: { /* n:"BrtBeginSortState", */ T: 1 }, + /*::[*/ 0x0213 /*::]*/: { /* n:"BrtEndSortState", */ T: -1 }, + /*::[*/ 0x0214 /*::]*/: { /* n:"BrtBeginSortCond", */ T: 1 }, + /*::[*/ 0x0215 /*::]*/: { /* n:"BrtEndSortCond", */ T: -1 }, + /*::[*/ 0x0216 /*::]*/: { /* n:"BrtBookProtection" */}, + /*::[*/ 0x0217 /*::]*/: { /* n:"BrtSheetProtection" */}, + /*::[*/ 0x0218 /*::]*/: { /* n:"BrtRangeProtection" */}, + /*::[*/ 0x0219 /*::]*/: { /* n:"BrtPhoneticInfo" */}, + /*::[*/ 0x021A /*::]*/: { /* n:"BrtBeginECTxtWiz", */ T: 1 }, + /*::[*/ 0x021B /*::]*/: { /* n:"BrtEndECTxtWiz", */ T: -1 }, + /*::[*/ 0x021C /*::]*/: { /* n:"BrtBeginECTWFldInfoLst", */ T: 1 }, + /*::[*/ 0x021D /*::]*/: { /* n:"BrtEndECTWFldInfoLst", */ T: -1 }, + /*::[*/ 0x021E /*::]*/: { /* n:"BrtBeginECTwFldInfo", */ T: 1 }, + /*::[*/ 0x0224 /*::]*/: { /* n:"BrtFileSharing" */}, + /*::[*/ 0x0225 /*::]*/: { /* n:"BrtOleSize" */}, + /*::[*/ 0x0226 /*::]*/: { /* n:"BrtDrawing", */ f: parse_RelID }, + /*::[*/ 0x0227 /*::]*/: { /* n:"BrtLegacyDrawing", */ f: parse_XLNullableWideString }, + /*::[*/ 0x0228 /*::]*/: { /* n:"BrtLegacyDrawingHF" */}, + /*::[*/ 0x0229 /*::]*/: { /* n:"BrtWebOpt" */}, + /*::[*/ 0x022A /*::]*/: { /* n:"BrtBeginWebPubItems", */ T: 1 }, + /*::[*/ 0x022B /*::]*/: { /* n:"BrtEndWebPubItems", */ T: -1 }, + /*::[*/ 0x022C /*::]*/: { /* n:"BrtBeginWebPubItem", */ T: 1 }, + /*::[*/ 0x022D /*::]*/: { /* n:"BrtEndWebPubItem", */ T: -1 }, + /*::[*/ 0x022E /*::]*/: { /* n:"BrtBeginSXCondFmt", */ T: 1 }, + /*::[*/ 0x022F /*::]*/: { /* n:"BrtEndSXCondFmt", */ T: -1 }, + /*::[*/ 0x0230 /*::]*/: { /* n:"BrtBeginSXCondFmts", */ T: 1 }, + /*::[*/ 0x0231 /*::]*/: { /* n:"BrtEndSXCondFmts", */ T: -1 }, + /*::[*/ 0x0232 /*::]*/: { /* n:"BrtBkHim" */}, + /*::[*/ 0x0234 /*::]*/: { /* n:"BrtColor" */}, + /*::[*/ 0x0235 /*::]*/: { /* n:"BrtBeginIndexedColors", */ T: 1 }, + /*::[*/ 0x0236 /*::]*/: { /* n:"BrtEndIndexedColors", */ T: -1 }, + /*::[*/ 0x0239 /*::]*/: { /* n:"BrtBeginMRUColors", */ T: 1 }, + /*::[*/ 0x023A /*::]*/: { /* n:"BrtEndMRUColors", */ T: -1 }, + /*::[*/ 0x023C /*::]*/: { /* n:"BrtMRUColor" */}, + /*::[*/ 0x023D /*::]*/: { /* n:"BrtBeginDVals", */ T: 1 }, + /*::[*/ 0x023E /*::]*/: { /* n:"BrtEndDVals", */ T: -1 }, + /*::[*/ 0x0241 /*::]*/: { /* n:"BrtSupNameStart" */}, + /*::[*/ 0x0242 /*::]*/: { /* n:"BrtSupNameValueStart" */}, + /*::[*/ 0x0243 /*::]*/: { /* n:"BrtSupNameValueEnd" */}, + /*::[*/ 0x0244 /*::]*/: { /* n:"BrtSupNameNum" */}, + /*::[*/ 0x0245 /*::]*/: { /* n:"BrtSupNameErr" */}, + /*::[*/ 0x0246 /*::]*/: { /* n:"BrtSupNameSt" */}, + /*::[*/ 0x0247 /*::]*/: { /* n:"BrtSupNameNil" */}, + /*::[*/ 0x0248 /*::]*/: { /* n:"BrtSupNameBool" */}, + /*::[*/ 0x0249 /*::]*/: { /* n:"BrtSupNameFmla" */}, + /*::[*/ 0x024A /*::]*/: { /* n:"BrtSupNameBits" */}, + /*::[*/ 0x024B /*::]*/: { /* n:"BrtSupNameEnd" */}, + /*::[*/ 0x024C /*::]*/: { /* n:"BrtEndSupBook", */ T: -1 }, + /*::[*/ 0x024D /*::]*/: { /* n:"BrtCellSmartTagProperty" */}, + /*::[*/ 0x024E /*::]*/: { /* n:"BrtBeginCellSmartTag", */ T: 1 }, + /*::[*/ 0x024F /*::]*/: { /* n:"BrtEndCellSmartTag", */ T: -1 }, + /*::[*/ 0x0250 /*::]*/: { /* n:"BrtBeginCellSmartTags", */ T: 1 }, + /*::[*/ 0x0251 /*::]*/: { /* n:"BrtEndCellSmartTags", */ T: -1 }, + /*::[*/ 0x0252 /*::]*/: { /* n:"BrtBeginSmartTags", */ T: 1 }, + /*::[*/ 0x0253 /*::]*/: { /* n:"BrtEndSmartTags", */ T: -1 }, + /*::[*/ 0x0254 /*::]*/: { /* n:"BrtSmartTagType" */}, + /*::[*/ 0x0255 /*::]*/: { /* n:"BrtBeginSmartTagTypes", */ T: 1 }, + /*::[*/ 0x0256 /*::]*/: { /* n:"BrtEndSmartTagTypes", */ T: -1 }, + /*::[*/ 0x0257 /*::]*/: { /* n:"BrtBeginSXFilters", */ T: 1 }, + /*::[*/ 0x0258 /*::]*/: { /* n:"BrtEndSXFilters", */ T: -1 }, + /*::[*/ 0x0259 /*::]*/: { /* n:"BrtBeginSXFILTER", */ T: 1 }, + /*::[*/ 0x025A /*::]*/: { /* n:"BrtEndSXFilter", */ T: -1 }, + /*::[*/ 0x025B /*::]*/: { /* n:"BrtBeginFills", */ T: 1 }, + /*::[*/ 0x025C /*::]*/: { /* n:"BrtEndFills", */ T: -1 }, + /*::[*/ 0x025D /*::]*/: { /* n:"BrtBeginCellWatches", */ T: 1 }, + /*::[*/ 0x025E /*::]*/: { /* n:"BrtEndCellWatches", */ T: -1 }, + /*::[*/ 0x025F /*::]*/: { /* n:"BrtCellWatch" */}, + /*::[*/ 0x0260 /*::]*/: { /* n:"BrtBeginCRErrs", */ T: 1 }, + /*::[*/ 0x0261 /*::]*/: { /* n:"BrtEndCRErrs", */ T: -1 }, + /*::[*/ 0x0262 /*::]*/: { /* n:"BrtCrashRecErr" */}, + /*::[*/ 0x0263 /*::]*/: { /* n:"BrtBeginFonts", */ T: 1 }, + /*::[*/ 0x0264 /*::]*/: { /* n:"BrtEndFonts", */ T: -1 }, + /*::[*/ 0x0265 /*::]*/: { /* n:"BrtBeginBorders", */ T: 1 }, + /*::[*/ 0x0266 /*::]*/: { /* n:"BrtEndBorders", */ T: -1 }, + /*::[*/ 0x0267 /*::]*/: { /* n:"BrtBeginFmts", */ T: 1 }, + /*::[*/ 0x0268 /*::]*/: { /* n:"BrtEndFmts", */ T: -1 }, + /*::[*/ 0x0269 /*::]*/: { /* n:"BrtBeginCellXFs", */ T: 1 }, + /*::[*/ 0x026A /*::]*/: { /* n:"BrtEndCellXFs", */ T: -1 }, + /*::[*/ 0x026B /*::]*/: { /* n:"BrtBeginStyles", */ T: 1 }, + /*::[*/ 0x026C /*::]*/: { /* n:"BrtEndStyles", */ T: -1 }, + /*::[*/ 0x0271 /*::]*/: { /* n:"BrtBigName" */}, + /*::[*/ 0x0272 /*::]*/: { /* n:"BrtBeginCellStyleXFs", */ T: 1 }, + /*::[*/ 0x0273 /*::]*/: { /* n:"BrtEndCellStyleXFs", */ T: -1 }, + /*::[*/ 0x0274 /*::]*/: { /* n:"BrtBeginComments", */ T: 1 }, + /*::[*/ 0x0275 /*::]*/: { /* n:"BrtEndComments", */ T: -1 }, + /*::[*/ 0x0276 /*::]*/: { /* n:"BrtBeginCommentAuthors", */ T: 1 }, + /*::[*/ 0x0277 /*::]*/: { /* n:"BrtEndCommentAuthors", */ T: -1 }, + /*::[*/ 0x0278 /*::]*/: { /* n:"BrtCommentAuthor", */ f: parse_BrtCommentAuthor }, + /*::[*/ 0x0279 /*::]*/: { /* n:"BrtBeginCommentList", */ T: 1 }, + /*::[*/ 0x027A /*::]*/: { /* n:"BrtEndCommentList", */ T: -1 }, + /*::[*/ 0x027B /*::]*/: { /* n:"BrtBeginComment", */ T: 1, f: parse_BrtBeginComment }, + /*::[*/ 0x027C /*::]*/: { /* n:"BrtEndComment", */ T: -1 }, + /*::[*/ 0x027D /*::]*/: { /* n:"BrtCommentText", */ f: parse_BrtCommentText }, + /*::[*/ 0x027E /*::]*/: { /* n:"BrtBeginOleObjects", */ T: 1 }, + /*::[*/ 0x027F /*::]*/: { /* n:"BrtOleObject" */}, + /*::[*/ 0x0280 /*::]*/: { /* n:"BrtEndOleObjects", */ T: -1 }, + /*::[*/ 0x0281 /*::]*/: { /* n:"BrtBeginSxrules", */ T: 1 }, + /*::[*/ 0x0282 /*::]*/: { /* n:"BrtEndSxRules", */ T: -1 }, + /*::[*/ 0x0283 /*::]*/: { /* n:"BrtBeginActiveXControls", */ T: 1 }, + /*::[*/ 0x0284 /*::]*/: { /* n:"BrtActiveX" */}, + /*::[*/ 0x0285 /*::]*/: { /* n:"BrtEndActiveXControls", */ T: -1 }, + /*::[*/ 0x0286 /*::]*/: { /* n:"BrtBeginPCDSDTCEMembersSortBy", */ T: 1 }, + /*::[*/ 0x0288 /*::]*/: { /* n:"BrtBeginCellIgnoreECs", */ T: 1 }, + /*::[*/ 0x0289 /*::]*/: { /* n:"BrtCellIgnoreEC" */}, + /*::[*/ 0x028A /*::]*/: { /* n:"BrtEndCellIgnoreECs", */ T: -1 }, + /*::[*/ 0x028B /*::]*/: { /* n:"BrtCsProp", */ f: parse_BrtCsProp }, + /*::[*/ 0x028C /*::]*/: { /* n:"BrtCsPageSetup" */}, + /*::[*/ 0x028D /*::]*/: { /* n:"BrtBeginUserCsViews", */ T: 1 }, + /*::[*/ 0x028E /*::]*/: { /* n:"BrtEndUserCsViews", */ T: -1 }, + /*::[*/ 0x028F /*::]*/: { /* n:"BrtBeginUserCsView", */ T: 1 }, + /*::[*/ 0x0290 /*::]*/: { /* n:"BrtEndUserCsView", */ T: -1 }, + /*::[*/ 0x0291 /*::]*/: { /* n:"BrtBeginPcdSFCIEntries", */ T: 1 }, + /*::[*/ 0x0292 /*::]*/: { /* n:"BrtEndPCDSFCIEntries", */ T: -1 }, + /*::[*/ 0x0293 /*::]*/: { /* n:"BrtPCDSFCIEntry" */}, + /*::[*/ 0x0294 /*::]*/: { /* n:"BrtBeginListParts", */ T: 1 }, + /*::[*/ 0x0295 /*::]*/: { /* n:"BrtListPart" */}, + /*::[*/ 0x0296 /*::]*/: { /* n:"BrtEndListParts", */ T: -1 }, + /*::[*/ 0x0297 /*::]*/: { /* n:"BrtSheetCalcProp" */}, + /*::[*/ 0x0298 /*::]*/: { /* n:"BrtBeginFnGroup", */ T: 1 }, + /*::[*/ 0x0299 /*::]*/: { /* n:"BrtFnGroup" */}, + /*::[*/ 0x029A /*::]*/: { /* n:"BrtEndFnGroup", */ T: -1 }, + /*::[*/ 0x029B /*::]*/: { /* n:"BrtSupAddin" */}, + /*::[*/ 0x029C /*::]*/: { /* n:"BrtSXTDMPOrder" */}, + /*::[*/ 0x029D /*::]*/: { /* n:"BrtCsProtection" */}, + /*::[*/ 0x029F /*::]*/: { /* n:"BrtBeginWsSortMap", */ T: 1 }, + /*::[*/ 0x02A0 /*::]*/: { /* n:"BrtEndWsSortMap", */ T: -1 }, + /*::[*/ 0x02A1 /*::]*/: { /* n:"BrtBeginRRSort", */ T: 1 }, + /*::[*/ 0x02A2 /*::]*/: { /* n:"BrtEndRRSort", */ T: -1 }, + /*::[*/ 0x02A3 /*::]*/: { /* n:"BrtRRSortItem" */}, + /*::[*/ 0x02A4 /*::]*/: { /* n:"BrtFileSharingIso" */}, + /*::[*/ 0x02A5 /*::]*/: { /* n:"BrtBookProtectionIso" */}, + /*::[*/ 0x02A6 /*::]*/: { /* n:"BrtSheetProtectionIso" */}, + /*::[*/ 0x02A7 /*::]*/: { /* n:"BrtCsProtectionIso" */}, + /*::[*/ 0x02A8 /*::]*/: { /* n:"BrtRangeProtectionIso" */}, + /*::[*/ 0x02A9 /*::]*/: { /* n:"BrtDValList" */}, + /*::[*/ 0x0400 /*::]*/: { /* n:"BrtRwDescent" */}, + /*::[*/ 0x0401 /*::]*/: { /* n:"BrtKnownFonts" */}, + /*::[*/ 0x0402 /*::]*/: { /* n:"BrtBeginSXTupleSet", */ T: 1 }, + /*::[*/ 0x0403 /*::]*/: { /* n:"BrtEndSXTupleSet", */ T: -1 }, + /*::[*/ 0x0404 /*::]*/: { /* n:"BrtBeginSXTupleSetHeader", */ T: 1 }, + /*::[*/ 0x0405 /*::]*/: { /* n:"BrtEndSXTupleSetHeader", */ T: -1 }, + /*::[*/ 0x0406 /*::]*/: { /* n:"BrtSXTupleSetHeaderItem" */}, + /*::[*/ 0x0407 /*::]*/: { /* n:"BrtBeginSXTupleSetData", */ T: 1 }, + /*::[*/ 0x0408 /*::]*/: { /* n:"BrtEndSXTupleSetData", */ T: -1 }, + /*::[*/ 0x0409 /*::]*/: { /* n:"BrtBeginSXTupleSetRow", */ T: 1 }, + /*::[*/ 0x040A /*::]*/: { /* n:"BrtEndSXTupleSetRow", */ T: -1 }, + /*::[*/ 0x040B /*::]*/: { /* n:"BrtSXTupleSetRowItem" */}, + /*::[*/ 0x040C /*::]*/: { /* n:"BrtNameExt" */}, + /*::[*/ 0x040D /*::]*/: { /* n:"BrtPCDH14" */}, + /*::[*/ 0x040E /*::]*/: { /* n:"BrtBeginPCDCalcMem14", */ T: 1 }, + /*::[*/ 0x040F /*::]*/: { /* n:"BrtEndPCDCalcMem14", */ T: -1 }, + /*::[*/ 0x0410 /*::]*/: { /* n:"BrtSXTH14" */}, + /*::[*/ 0x0411 /*::]*/: { /* n:"BrtBeginSparklineGroup", */ T: 1 }, + /*::[*/ 0x0412 /*::]*/: { /* n:"BrtEndSparklineGroup", */ T: -1 }, + /*::[*/ 0x0413 /*::]*/: { /* n:"BrtSparkline" */}, + /*::[*/ 0x0414 /*::]*/: { /* n:"BrtSXDI14" */}, + /*::[*/ 0x0415 /*::]*/: { /* n:"BrtWsFmtInfoEx14" */}, + /*::[*/ 0x0416 /*::]*/: { /* n:"BrtBeginConditionalFormatting14", */ T: 1 }, + /*::[*/ 0x0417 /*::]*/: { /* n:"BrtEndConditionalFormatting14", */ T: -1 }, + /*::[*/ 0x0418 /*::]*/: { /* n:"BrtBeginCFRule14", */ T: 1 }, + /*::[*/ 0x0419 /*::]*/: { /* n:"BrtEndCFRule14", */ T: -1 }, + /*::[*/ 0x041A /*::]*/: { /* n:"BrtCFVO14" */}, + /*::[*/ 0x041B /*::]*/: { /* n:"BrtBeginDatabar14", */ T: 1 }, + /*::[*/ 0x041C /*::]*/: { /* n:"BrtBeginIconSet14", */ T: 1 }, + /*::[*/ 0x041D /*::]*/: { /* n:"BrtDVal14", */ f: parse_BrtDVal14 }, + /*::[*/ 0x041E /*::]*/: { /* n:"BrtBeginDVals14", */ T: 1 }, + /*::[*/ 0x041F /*::]*/: { /* n:"BrtColor14" */}, + /*::[*/ 0x0420 /*::]*/: { /* n:"BrtBeginSparklines", */ T: 1 }, + /*::[*/ 0x0421 /*::]*/: { /* n:"BrtEndSparklines", */ T: -1 }, + /*::[*/ 0x0422 /*::]*/: { /* n:"BrtBeginSparklineGroups", */ T: 1 }, + /*::[*/ 0x0423 /*::]*/: { /* n:"BrtEndSparklineGroups", */ T: -1 }, + /*::[*/ 0x0425 /*::]*/: { /* n:"BrtSXVD14" */}, + /*::[*/ 0x0426 /*::]*/: { /* n:"BrtBeginSXView14", */ T: 1 }, + /*::[*/ 0x0427 /*::]*/: { /* n:"BrtEndSXView14", */ T: -1 }, + /*::[*/ 0x0428 /*::]*/: { /* n:"BrtBeginSXView16", */ T: 1 }, + /*::[*/ 0x0429 /*::]*/: { /* n:"BrtEndSXView16", */ T: -1 }, + /*::[*/ 0x042A /*::]*/: { /* n:"BrtBeginPCD14", */ T: 1 }, + /*::[*/ 0x042B /*::]*/: { /* n:"BrtEndPCD14", */ T: -1 }, + /*::[*/ 0x042C /*::]*/: { /* n:"BrtBeginExtConn14", */ T: 1 }, + /*::[*/ 0x042D /*::]*/: { /* n:"BrtEndExtConn14", */ T: -1 }, + /*::[*/ 0x042E /*::]*/: { /* n:"BrtBeginSlicerCacheIDs", */ T: 1 }, + /*::[*/ 0x042F /*::]*/: { /* n:"BrtEndSlicerCacheIDs", */ T: -1 }, + /*::[*/ 0x0430 /*::]*/: { /* n:"BrtBeginSlicerCacheID", */ T: 1 }, + /*::[*/ 0x0431 /*::]*/: { /* n:"BrtEndSlicerCacheID", */ T: -1 }, + /*::[*/ 0x0433 /*::]*/: { /* n:"BrtBeginSlicerCache", */ T: 1 }, + /*::[*/ 0x0434 /*::]*/: { /* n:"BrtEndSlicerCache", */ T: -1 }, + /*::[*/ 0x0435 /*::]*/: { /* n:"BrtBeginSlicerCacheDef", */ T: 1 }, + /*::[*/ 0x0436 /*::]*/: { /* n:"BrtEndSlicerCacheDef", */ T: -1 }, + /*::[*/ 0x0437 /*::]*/: { /* n:"BrtBeginSlicersEx", */ T: 1 }, + /*::[*/ 0x0438 /*::]*/: { /* n:"BrtEndSlicersEx", */ T: -1 }, + /*::[*/ 0x0439 /*::]*/: { /* n:"BrtBeginSlicerEx", */ T: 1 }, + /*::[*/ 0x043A /*::]*/: { /* n:"BrtEndSlicerEx", */ T: -1 }, + /*::[*/ 0x043B /*::]*/: { /* n:"BrtBeginSlicer", */ T: 1 }, + /*::[*/ 0x043C /*::]*/: { /* n:"BrtEndSlicer", */ T: -1 }, + /*::[*/ 0x043D /*::]*/: { /* n:"BrtSlicerCachePivotTables" */}, + /*::[*/ 0x043E /*::]*/: { /* n:"BrtBeginSlicerCacheOlapImpl", */ T: 1 }, + /*::[*/ 0x043F /*::]*/: { /* n:"BrtEndSlicerCacheOlapImpl", */ T: -1 }, + /*::[*/ 0x0440 /*::]*/: { /* n:"BrtBeginSlicerCacheLevelsData", */ T: 1 }, + /*::[*/ 0x0441 /*::]*/: { /* n:"BrtEndSlicerCacheLevelsData", */ T: -1 }, + /*::[*/ 0x0442 /*::]*/: { /* n:"BrtBeginSlicerCacheLevelData", */ T: 1 }, + /*::[*/ 0x0443 /*::]*/: { /* n:"BrtEndSlicerCacheLevelData", */ T: -1 }, + /*::[*/ 0x0444 /*::]*/: { /* n:"BrtBeginSlicerCacheSiRanges", */ T: 1 }, + /*::[*/ 0x0445 /*::]*/: { /* n:"BrtEndSlicerCacheSiRanges", */ T: -1 }, + /*::[*/ 0x0446 /*::]*/: { /* n:"BrtBeginSlicerCacheSiRange", */ T: 1 }, + /*::[*/ 0x0447 /*::]*/: { /* n:"BrtEndSlicerCacheSiRange", */ T: -1 }, + /*::[*/ 0x0448 /*::]*/: { /* n:"BrtSlicerCacheOlapItem" */}, + /*::[*/ 0x0449 /*::]*/: { /* n:"BrtBeginSlicerCacheSelections", */ T: 1 }, + /*::[*/ 0x044A /*::]*/: { /* n:"BrtSlicerCacheSelection" */}, + /*::[*/ 0x044B /*::]*/: { /* n:"BrtEndSlicerCacheSelections", */ T: -1 }, + /*::[*/ 0x044C /*::]*/: { /* n:"BrtBeginSlicerCacheNative", */ T: 1 }, + /*::[*/ 0x044D /*::]*/: { /* n:"BrtEndSlicerCacheNative", */ T: -1 }, + /*::[*/ 0x044E /*::]*/: { /* n:"BrtSlicerCacheNativeItem" */}, + /*::[*/ 0x044F /*::]*/: { /* n:"BrtRangeProtection14" */}, + /*::[*/ 0x0450 /*::]*/: { /* n:"BrtRangeProtectionIso14" */}, + /*::[*/ 0x0451 /*::]*/: { /* n:"BrtCellIgnoreEC14" */}, + /*::[*/ 0x0457 /*::]*/: { /* n:"BrtList14" */}, + /*::[*/ 0x0458 /*::]*/: { /* n:"BrtCFIcon" */}, + /*::[*/ 0x0459 /*::]*/: { /* n:"BrtBeginSlicerCachesPivotCacheIDs", */ T: 1 }, + /*::[*/ 0x045A /*::]*/: { /* n:"BrtEndSlicerCachesPivotCacheIDs", */ T: -1 }, + /*::[*/ 0x045B /*::]*/: { /* n:"BrtBeginSlicers", */ T: 1 }, + /*::[*/ 0x045C /*::]*/: { /* n:"BrtEndSlicers", */ T: -1 }, + /*::[*/ 0x045D /*::]*/: { /* n:"BrtWbProp14" */}, + /*::[*/ 0x045E /*::]*/: { /* n:"BrtBeginSXEdit", */ T: 1 }, + /*::[*/ 0x045F /*::]*/: { /* n:"BrtEndSXEdit", */ T: -1 }, + /*::[*/ 0x0460 /*::]*/: { /* n:"BrtBeginSXEdits", */ T: 1 }, + /*::[*/ 0x0461 /*::]*/: { /* n:"BrtEndSXEdits", */ T: -1 }, + /*::[*/ 0x0462 /*::]*/: { /* n:"BrtBeginSXChange", */ T: 1 }, + /*::[*/ 0x0463 /*::]*/: { /* n:"BrtEndSXChange", */ T: -1 }, + /*::[*/ 0x0464 /*::]*/: { /* n:"BrtBeginSXChanges", */ T: 1 }, + /*::[*/ 0x0465 /*::]*/: { /* n:"BrtEndSXChanges", */ T: -1 }, + /*::[*/ 0x0466 /*::]*/: { /* n:"BrtSXTupleItems" */}, + /*::[*/ 0x0468 /*::]*/: { /* n:"BrtBeginSlicerStyle", */ T: 1 }, + /*::[*/ 0x0469 /*::]*/: { /* n:"BrtEndSlicerStyle", */ T: -1 }, + /*::[*/ 0x046A /*::]*/: { /* n:"BrtSlicerStyleElement" */}, + /*::[*/ 0x046B /*::]*/: { /* n:"BrtBeginStyleSheetExt14", */ T: 1 }, + /*::[*/ 0x046C /*::]*/: { /* n:"BrtEndStyleSheetExt14", */ T: -1 }, + /*::[*/ 0x046D /*::]*/: { /* n:"BrtBeginSlicerCachesPivotCacheID", */ T: 1 }, + /*::[*/ 0x046E /*::]*/: { /* n:"BrtEndSlicerCachesPivotCacheID", */ T: -1 }, + /*::[*/ 0x046F /*::]*/: { /* n:"BrtBeginConditionalFormattings", */ T: 1 }, + /*::[*/ 0x0470 /*::]*/: { /* n:"BrtEndConditionalFormattings", */ T: -1 }, + /*::[*/ 0x0471 /*::]*/: { /* n:"BrtBeginPCDCalcMemExt", */ T: 1 }, + /*::[*/ 0x0472 /*::]*/: { /* n:"BrtEndPCDCalcMemExt", */ T: -1 }, + /*::[*/ 0x0473 /*::]*/: { /* n:"BrtBeginPCDCalcMemsExt", */ T: 1 }, + /*::[*/ 0x0474 /*::]*/: { /* n:"BrtEndPCDCalcMemsExt", */ T: -1 }, + /*::[*/ 0x0475 /*::]*/: { /* n:"BrtPCDField14" */}, + /*::[*/ 0x0476 /*::]*/: { /* n:"BrtBeginSlicerStyles", */ T: 1 }, + /*::[*/ 0x0477 /*::]*/: { /* n:"BrtEndSlicerStyles", */ T: -1 }, + /*::[*/ 0x0478 /*::]*/: { /* n:"BrtBeginSlicerStyleElements", */ T: 1 }, + /*::[*/ 0x0479 /*::]*/: { /* n:"BrtEndSlicerStyleElements", */ T: -1 }, + /*::[*/ 0x047A /*::]*/: { /* n:"BrtCFRuleExt" */}, + /*::[*/ 0x047B /*::]*/: { /* n:"BrtBeginSXCondFmt14", */ T: 1 }, + /*::[*/ 0x047C /*::]*/: { /* n:"BrtEndSXCondFmt14", */ T: -1 }, + /*::[*/ 0x047D /*::]*/: { /* n:"BrtBeginSXCondFmts14", */ T: 1 }, + /*::[*/ 0x047E /*::]*/: { /* n:"BrtEndSXCondFmts14", */ T: -1 }, + /*::[*/ 0x0480 /*::]*/: { /* n:"BrtBeginSortCond14", */ T: 1 }, + /*::[*/ 0x0481 /*::]*/: { /* n:"BrtEndSortCond14", */ T: -1 }, + /*::[*/ 0x0482 /*::]*/: { /* n:"BrtEndDVals14", */ T: -1 }, + /*::[*/ 0x0483 /*::]*/: { /* n:"BrtEndIconSet14", */ T: -1 }, + /*::[*/ 0x0484 /*::]*/: { /* n:"BrtEndDatabar14", */ T: -1 }, + /*::[*/ 0x0485 /*::]*/: { /* n:"BrtBeginColorScale14", */ T: 1 }, + /*::[*/ 0x0486 /*::]*/: { /* n:"BrtEndColorScale14", */ T: -1 }, + /*::[*/ 0x0487 /*::]*/: { /* n:"BrtBeginSxrules14", */ T: 1 }, + /*::[*/ 0x0488 /*::]*/: { /* n:"BrtEndSxrules14", */ T: -1 }, + /*::[*/ 0x0489 /*::]*/: { /* n:"BrtBeginPRule14", */ T: 1 }, + /*::[*/ 0x048A /*::]*/: { /* n:"BrtEndPRule14", */ T: -1 }, + /*::[*/ 0x048B /*::]*/: { /* n:"BrtBeginPRFilters14", */ T: 1 }, + /*::[*/ 0x048C /*::]*/: { /* n:"BrtEndPRFilters14", */ T: -1 }, + /*::[*/ 0x048D /*::]*/: { /* n:"BrtBeginPRFilter14", */ T: 1 }, + /*::[*/ 0x048E /*::]*/: { /* n:"BrtEndPRFilter14", */ T: -1 }, + /*::[*/ 0x048F /*::]*/: { /* n:"BrtBeginPRFItem14", */ T: 1 }, + /*::[*/ 0x0490 /*::]*/: { /* n:"BrtEndPRFItem14", */ T: -1 }, + /*::[*/ 0x0491 /*::]*/: { /* n:"BrtBeginCellIgnoreECs14", */ T: 1 }, + /*::[*/ 0x0492 /*::]*/: { /* n:"BrtEndCellIgnoreECs14", */ T: -1 }, + /*::[*/ 0x0493 /*::]*/: { /* n:"BrtDxf14" */}, + /*::[*/ 0x0494 /*::]*/: { /* n:"BrtBeginDxF14s", */ T: 1 }, + /*::[*/ 0x0495 /*::]*/: { /* n:"BrtEndDxf14s", */ T: -1 }, + /*::[*/ 0x0499 /*::]*/: { /* n:"BrtFilter14" */}, + /*::[*/ 0x049A /*::]*/: { /* n:"BrtBeginCustomFilters14", */ T: 1 }, + /*::[*/ 0x049C /*::]*/: { /* n:"BrtCustomFilter14" */}, + /*::[*/ 0x049D /*::]*/: { /* n:"BrtIconFilter14" */}, + /*::[*/ 0x049E /*::]*/: { /* n:"BrtPivotCacheConnectionName" */}, + /*::[*/ 0x0800 /*::]*/: { /* n:"BrtBeginDecoupledPivotCacheIDs", */ T: 1 }, + /*::[*/ 0x0801 /*::]*/: { /* n:"BrtEndDecoupledPivotCacheIDs", */ T: -1 }, + /*::[*/ 0x0802 /*::]*/: { /* n:"BrtDecoupledPivotCacheID" */}, + /*::[*/ 0x0803 /*::]*/: { /* n:"BrtBeginPivotTableRefs", */ T: 1 }, + /*::[*/ 0x0804 /*::]*/: { /* n:"BrtEndPivotTableRefs", */ T: -1 }, + /*::[*/ 0x0805 /*::]*/: { /* n:"BrtPivotTableRef" */}, + /*::[*/ 0x0806 /*::]*/: { /* n:"BrtSlicerCacheBookPivotTables" */}, + /*::[*/ 0x0807 /*::]*/: { /* n:"BrtBeginSxvcells", */ T: 1 }, + /*::[*/ 0x0808 /*::]*/: { /* n:"BrtEndSxvcells", */ T: -1 }, + /*::[*/ 0x0809 /*::]*/: { /* n:"BrtBeginSxRow", */ T: 1 }, + /*::[*/ 0x080A /*::]*/: { /* n:"BrtEndSxRow", */ T: -1 }, + /*::[*/ 0x080C /*::]*/: { /* n:"BrtPcdCalcMem15" */}, + /*::[*/ 0x0813 /*::]*/: { /* n:"BrtQsi15" */}, + /*::[*/ 0x0814 /*::]*/: { /* n:"BrtBeginWebExtensions", */ T: 1 }, + /*::[*/ 0x0815 /*::]*/: { /* n:"BrtEndWebExtensions", */ T: -1 }, + /*::[*/ 0x0816 /*::]*/: { /* n:"BrtWebExtension" */}, + /*::[*/ 0x0817 /*::]*/: { /* n:"BrtAbsPath15" */}, + /*::[*/ 0x0818 /*::]*/: { /* n:"BrtBeginPivotTableUISettings", */ T: 1 }, + /*::[*/ 0x0819 /*::]*/: { /* n:"BrtEndPivotTableUISettings", */ T: -1 }, + /*::[*/ 0x081B /*::]*/: { /* n:"BrtTableSlicerCacheIDs" */}, + /*::[*/ 0x081C /*::]*/: { /* n:"BrtTableSlicerCacheID" */}, + /*::[*/ 0x081D /*::]*/: { /* n:"BrtBeginTableSlicerCache", */ T: 1 }, + /*::[*/ 0x081E /*::]*/: { /* n:"BrtEndTableSlicerCache", */ T: -1 }, + /*::[*/ 0x081F /*::]*/: { /* n:"BrtSxFilter15" */}, + /*::[*/ 0x0820 /*::]*/: { /* n:"BrtBeginTimelineCachePivotCacheIDs", */ T: 1 }, + /*::[*/ 0x0821 /*::]*/: { /* n:"BrtEndTimelineCachePivotCacheIDs", */ T: -1 }, + /*::[*/ 0x0822 /*::]*/: { /* n:"BrtTimelineCachePivotCacheID" */}, + /*::[*/ 0x0823 /*::]*/: { /* n:"BrtBeginTimelineCacheIDs", */ T: 1 }, + /*::[*/ 0x0824 /*::]*/: { /* n:"BrtEndTimelineCacheIDs", */ T: -1 }, + /*::[*/ 0x0825 /*::]*/: { /* n:"BrtBeginTimelineCacheID", */ T: 1 }, + /*::[*/ 0x0826 /*::]*/: { /* n:"BrtEndTimelineCacheID", */ T: -1 }, + /*::[*/ 0x0827 /*::]*/: { /* n:"BrtBeginTimelinesEx", */ T: 1 }, + /*::[*/ 0x0828 /*::]*/: { /* n:"BrtEndTimelinesEx", */ T: -1 }, + /*::[*/ 0x0829 /*::]*/: { /* n:"BrtBeginTimelineEx", */ T: 1 }, + /*::[*/ 0x082A /*::]*/: { /* n:"BrtEndTimelineEx", */ T: -1 }, + /*::[*/ 0x082B /*::]*/: { /* n:"BrtWorkBookPr15" */}, + /*::[*/ 0x082C /*::]*/: { /* n:"BrtPCDH15" */}, + /*::[*/ 0x082D /*::]*/: { /* n:"BrtBeginTimelineStyle", */ T: 1 }, + /*::[*/ 0x082E /*::]*/: { /* n:"BrtEndTimelineStyle", */ T: -1 }, + /*::[*/ 0x082F /*::]*/: { /* n:"BrtTimelineStyleElement" */}, + /*::[*/ 0x0830 /*::]*/: { /* n:"BrtBeginTimelineStylesheetExt15", */ T: 1 }, + /*::[*/ 0x0831 /*::]*/: { /* n:"BrtEndTimelineStylesheetExt15", */ T: -1 }, + /*::[*/ 0x0832 /*::]*/: { /* n:"BrtBeginTimelineStyles", */ T: 1 }, + /*::[*/ 0x0833 /*::]*/: { /* n:"BrtEndTimelineStyles", */ T: -1 }, + /*::[*/ 0x0834 /*::]*/: { /* n:"BrtBeginTimelineStyleElements", */ T: 1 }, + /*::[*/ 0x0835 /*::]*/: { /* n:"BrtEndTimelineStyleElements", */ T: -1 }, + /*::[*/ 0x0836 /*::]*/: { /* n:"BrtDxf15" */}, + /*::[*/ 0x0837 /*::]*/: { /* n:"BrtBeginDxfs15", */ T: 1 }, + /*::[*/ 0x0838 /*::]*/: { /* n:"BrtEndDxfs15", */ T: -1 }, + /*::[*/ 0x0839 /*::]*/: { /* n:"BrtSlicerCacheHideItemsWithNoData" */}, + /*::[*/ 0x083A /*::]*/: { /* n:"BrtBeginItemUniqueNames", */ T: 1 }, + /*::[*/ 0x083B /*::]*/: { /* n:"BrtEndItemUniqueNames", */ T: -1 }, + /*::[*/ 0x083C /*::]*/: { /* n:"BrtItemUniqueName" */}, + /*::[*/ 0x083D /*::]*/: { /* n:"BrtBeginExtConn15", */ T: 1 }, + /*::[*/ 0x083E /*::]*/: { /* n:"BrtEndExtConn15", */ T: -1 }, + /*::[*/ 0x083F /*::]*/: { /* n:"BrtBeginOledbPr15", */ T: 1 }, + /*::[*/ 0x0840 /*::]*/: { /* n:"BrtEndOledbPr15", */ T: -1 }, + /*::[*/ 0x0841 /*::]*/: { /* n:"BrtBeginDataFeedPr15", */ T: 1 }, + /*::[*/ 0x0842 /*::]*/: { /* n:"BrtEndDataFeedPr15", */ T: -1 }, + /*::[*/ 0x0843 /*::]*/: { /* n:"BrtTextPr15" */}, + /*::[*/ 0x0844 /*::]*/: { /* n:"BrtRangePr15" */}, + /*::[*/ 0x0845 /*::]*/: { /* n:"BrtDbCommand15" */}, + /*::[*/ 0x0846 /*::]*/: { /* n:"BrtBeginDbTables15", */ T: 1 }, + /*::[*/ 0x0847 /*::]*/: { /* n:"BrtEndDbTables15", */ T: -1 }, + /*::[*/ 0x0848 /*::]*/: { /* n:"BrtDbTable15" */}, + /*::[*/ 0x0849 /*::]*/: { /* n:"BrtBeginDataModel", */ T: 1 }, + /*::[*/ 0x084A /*::]*/: { /* n:"BrtEndDataModel", */ T: -1 }, + /*::[*/ 0x084B /*::]*/: { /* n:"BrtBeginModelTables", */ T: 1 }, + /*::[*/ 0x084C /*::]*/: { /* n:"BrtEndModelTables", */ T: -1 }, + /*::[*/ 0x084D /*::]*/: { /* n:"BrtModelTable" */}, + /*::[*/ 0x084E /*::]*/: { /* n:"BrtBeginModelRelationships", */ T: 1 }, + /*::[*/ 0x084F /*::]*/: { /* n:"BrtEndModelRelationships", */ T: -1 }, + /*::[*/ 0x0850 /*::]*/: { /* n:"BrtModelRelationship" */}, + /*::[*/ 0x0851 /*::]*/: { /* n:"BrtBeginECTxtWiz15", */ T: 1 }, + /*::[*/ 0x0852 /*::]*/: { /* n:"BrtEndECTxtWiz15", */ T: -1 }, + /*::[*/ 0x0853 /*::]*/: { /* n:"BrtBeginECTWFldInfoLst15", */ T: 1 }, + /*::[*/ 0x0854 /*::]*/: { /* n:"BrtEndECTWFldInfoLst15", */ T: -1 }, + /*::[*/ 0x0855 /*::]*/: { /* n:"BrtBeginECTWFldInfo15", */ T: 1 }, + /*::[*/ 0x0856 /*::]*/: { /* n:"BrtFieldListActiveItem" */}, + /*::[*/ 0x0857 /*::]*/: { /* n:"BrtPivotCacheIdVersion" */}, + /*::[*/ 0x0858 /*::]*/: { /* n:"BrtSXDI15" */}, + /*::[*/ 0x0859 /*::]*/: { /* n:"BrtBeginModelTimeGroupings", */ T: 1 }, + /*::[*/ 0x085A /*::]*/: { /* n:"BrtEndModelTimeGroupings", */ T: -1 }, + /*::[*/ 0x085B /*::]*/: { /* n:"BrtBeginModelTimeGrouping", */ T: 1 }, + /*::[*/ 0x085C /*::]*/: { /* n:"BrtEndModelTimeGrouping", */ T: -1 }, + /*::[*/ 0x085D /*::]*/: { /* n:"BrtModelTimeGroupingCalcCol" */}, + /*::[*/ 0x0C00 /*::]*/: { /* n:"BrtUid" */}, + /*::[*/ 0x0C01 /*::]*/: { /* n:"BrtRevisionPtr" */}, + /*::[*/ 0x1000 /*::]*/: { /* n:"BrtBeginDynamicArrayPr", */ T: 1 }, + /*::[*/ 0x1001 /*::]*/: { /* n:"BrtEndDynamicArrayPr", */ T: -1 }, + /*::[*/ 0x138A /*::]*/: { /* n:"BrtBeginRichValueBlock", */ T: 1 }, + /*::[*/ 0x138B /*::]*/: { /* n:"BrtEndRichValueBlock", */ T: -1 }, + /*::[*/ 0x13D9 /*::]*/: { /* n:"BrtBeginRichFilters", */ T: 1 }, + /*::[*/ 0x13DA /*::]*/: { /* n:"BrtEndRichFilters", */ T: -1 }, + /*::[*/ 0x13DB /*::]*/: { /* n:"BrtRichFilter" */}, + /*::[*/ 0x13DC /*::]*/: { /* n:"BrtBeginRichFilterColumn", */ T: 1 }, + /*::[*/ 0x13DD /*::]*/: { /* n:"BrtEndRichFilterColumn", */ T: -1 }, + /*::[*/ 0x13DE /*::]*/: { /* n:"BrtBeginCustomRichFilters", */ T: 1 }, + /*::[*/ 0x13DF /*::]*/: { /* n:"BrtEndCustomRichFilters", */ T: -1 }, + /*::[*/ 0x13E0 /*::]*/: { /* n:"BrtCustomRichFilter" */}, + /*::[*/ 0x13E1 /*::]*/: { /* n:"BrtTop10RichFilter" */}, + /*::[*/ 0x13E2 /*::]*/: { /* n:"BrtDynamicRichFilter" */}, + /*::[*/ 0x13E4 /*::]*/: { /* n:"BrtBeginRichSortCondition", */ T: 1 }, + /*::[*/ 0x13E5 /*::]*/: { /* n:"BrtEndRichSortCondition", */ T: -1 }, + /*::[*/ 0x13E6 /*::]*/: { /* n:"BrtRichFilterDateGroupItem" */}, + /*::[*/ 0x13E7 /*::]*/: { /* n:"BrtBeginCalcFeatures", */ T: 1 }, + /*::[*/ 0x13E8 /*::]*/: { /* n:"BrtEndCalcFeatures", */ T: -1 }, + /*::[*/ 0x13E9 /*::]*/: { /* n:"BrtCalcFeature" */}, + /*::[*/ 0x13EB /*::]*/: { /* n:"BrtExternalLinksPr" */}, + /*::[*/ 0xFFFF /*::]*/: { n: "" } +}; +/* [MS-XLS] 2.3 Record Enumeration (and other sources) */ +var XLSRecordEnum = { + /* [MS-XLS] 2.3 Record Enumeration 2021-08-17 */ + /*::[*/ 0x0006 /*::]*/: { /* n:"Formula", */ f: parse_Formula }, + /*::[*/ 0x000a /*::]*/: { /* n:"EOF", */ f: parsenoop2 }, + /*::[*/ 0x000c /*::]*/: { /* n:"CalcCount", */ f: parseuint16 }, + /*::[*/ 0x000d /*::]*/: { /* n:"CalcMode", */ f: parseuint16 }, + /*::[*/ 0x000e /*::]*/: { /* n:"CalcPrecision", */ f: parsebool }, + /*::[*/ 0x000f /*::]*/: { /* n:"CalcRefMode", */ f: parsebool }, + /*::[*/ 0x0010 /*::]*/: { /* n:"CalcDelta", */ f: parse_Xnum }, + /*::[*/ 0x0011 /*::]*/: { /* n:"CalcIter", */ f: parsebool }, + /*::[*/ 0x0012 /*::]*/: { /* n:"Protect", */ f: parsebool }, + /*::[*/ 0x0013 /*::]*/: { /* n:"Password", */ f: parseuint16 }, + /*::[*/ 0x0014 /*::]*/: { /* n:"Header", */ f: parse_XLHeaderFooter }, + /*::[*/ 0x0015 /*::]*/: { /* n:"Footer", */ f: parse_XLHeaderFooter }, + /*::[*/ 0x0017 /*::]*/: { /* n:"ExternSheet", */ f: parse_ExternSheet }, + /*::[*/ 0x0018 /*::]*/: { /* n:"Lbl", */ f: parse_Lbl }, + /*::[*/ 0x0019 /*::]*/: { /* n:"WinProtect", */ f: parsebool }, + /*::[*/ 0x001a /*::]*/: { /* n:"VerticalPageBreaks", */}, + /*::[*/ 0x001b /*::]*/: { /* n:"HorizontalPageBreaks", */}, + /*::[*/ 0x001c /*::]*/: { /* n:"Note", */ f: parse_Note }, + /*::[*/ 0x001d /*::]*/: { /* n:"Selection", */}, + /*::[*/ 0x0022 /*::]*/: { /* n:"Date1904", */ f: parsebool }, + /*::[*/ 0x0023 /*::]*/: { /* n:"ExternName", */ f: parse_ExternName }, + /*::[*/ 0x0026 /*::]*/: { /* n:"LeftMargin", */ f: parse_Xnum }, + /*::[*/ 0x0027 /*::]*/: { /* n:"RightMargin", */ f: parse_Xnum }, + /*::[*/ 0x0028 /*::]*/: { /* n:"TopMargin", */ f: parse_Xnum }, + /*::[*/ 0x0029 /*::]*/: { /* n:"BottomMargin", */ f: parse_Xnum }, + /*::[*/ 0x002a /*::]*/: { /* n:"PrintRowCol", */ f: parsebool }, + /*::[*/ 0x002b /*::]*/: { /* n:"PrintGrid", */ f: parsebool }, + /*::[*/ 0x002f /*::]*/: { /* n:"FilePass", */ f: parse_FilePass }, + /*::[*/ 0x0031 /*::]*/: { /* n:"Font", */ f: parse_Font }, + /*::[*/ 0x0033 /*::]*/: { /* n:"PrintSize", */ f: parseuint16 }, + /*::[*/ 0x003c /*::]*/: { /* n:"Continue", */}, + /*::[*/ 0x003d /*::]*/: { /* n:"Window1", */ f: parse_Window1 }, + /*::[*/ 0x0040 /*::]*/: { /* n:"Backup", */ f: parsebool }, + /*::[*/ 0x0041 /*::]*/: { /* n:"Pane", */ f: parse_Pane }, + /*::[*/ 0x0042 /*::]*/: { /* n:"CodePage", */ f: parseuint16 }, + /*::[*/ 0x004d /*::]*/: { /* n:"Pls", */}, + /*::[*/ 0x0050 /*::]*/: { /* n:"DCon", */}, + /*::[*/ 0x0051 /*::]*/: { /* n:"DConRef", */}, + /*::[*/ 0x0052 /*::]*/: { /* n:"DConName", */}, + /*::[*/ 0x0055 /*::]*/: { /* n:"DefColWidth", */ f: parseuint16 }, + /*::[*/ 0x0059 /*::]*/: { /* n:"XCT", */}, + /*::[*/ 0x005a /*::]*/: { /* n:"CRN", */}, + /*::[*/ 0x005b /*::]*/: { /* n:"FileSharing", */}, + /*::[*/ 0x005c /*::]*/: { /* n:"WriteAccess", */ f: parse_WriteAccess }, + /*::[*/ 0x005d /*::]*/: { /* n:"Obj", */ f: parse_Obj }, + /*::[*/ 0x005e /*::]*/: { /* n:"Uncalced", */}, + /*::[*/ 0x005f /*::]*/: { /* n:"CalcSaveRecalc", */ f: parsebool }, + /*::[*/ 0x0060 /*::]*/: { /* n:"Template", */}, + /*::[*/ 0x0061 /*::]*/: { /* n:"Intl", */}, + /*::[*/ 0x0063 /*::]*/: { /* n:"ObjProtect", */ f: parsebool }, + /*::[*/ 0x007d /*::]*/: { /* n:"ColInfo", */ f: parse_ColInfo }, + /*::[*/ 0x0080 /*::]*/: { /* n:"Guts", */ f: parse_Guts }, + /*::[*/ 0x0081 /*::]*/: { /* n:"WsBool", */ f: parse_WsBool }, + /*::[*/ 0x0082 /*::]*/: { /* n:"GridSet", */ f: parseuint16 }, + /*::[*/ 0x0083 /*::]*/: { /* n:"HCenter", */ f: parsebool }, + /*::[*/ 0x0084 /*::]*/: { /* n:"VCenter", */ f: parsebool }, + /*::[*/ 0x0085 /*::]*/: { /* n:"BoundSheet8", */ f: parse_BoundSheet8 }, + /*::[*/ 0x0086 /*::]*/: { /* n:"WriteProtect", */}, + /*::[*/ 0x008c /*::]*/: { /* n:"Country", */ f: parse_Country }, + /*::[*/ 0x008d /*::]*/: { /* n:"HideObj", */ f: parseuint16 }, + /*::[*/ 0x0090 /*::]*/: { /* n:"Sort", */}, + /*::[*/ 0x0092 /*::]*/: { /* n:"Palette", */ f: parse_Palette }, + /*::[*/ 0x0097 /*::]*/: { /* n:"Sync", */}, + /*::[*/ 0x0098 /*::]*/: { /* n:"LPr", */}, + /*::[*/ 0x0099 /*::]*/: { /* n:"DxGCol", */}, + /*::[*/ 0x009a /*::]*/: { /* n:"FnGroupName", */}, + /*::[*/ 0x009b /*::]*/: { /* n:"FilterMode", */}, + /*::[*/ 0x009c /*::]*/: { /* n:"BuiltInFnGroupCount", */ f: parseuint16 }, + /*::[*/ 0x009d /*::]*/: { /* n:"AutoFilterInfo", */}, + /*::[*/ 0x009e /*::]*/: { /* n:"AutoFilter", */}, + /*::[*/ 0x00a0 /*::]*/: { /* n:"Scl", */ f: parse_Scl }, + /*::[*/ 0x00a1 /*::]*/: { /* n:"Setup", */ f: parse_Setup }, + /*::[*/ 0x00ae /*::]*/: { /* n:"ScenMan", */}, + /*::[*/ 0x00af /*::]*/: { /* n:"SCENARIO", */}, + /*::[*/ 0x00b0 /*::]*/: { /* n:"SxView", */}, + /*::[*/ 0x00b1 /*::]*/: { /* n:"Sxvd", */}, + /*::[*/ 0x00b2 /*::]*/: { /* n:"SXVI", */}, + /*::[*/ 0x00b4 /*::]*/: { /* n:"SxIvd", */}, + /*::[*/ 0x00b5 /*::]*/: { /* n:"SXLI", */}, + /*::[*/ 0x00b6 /*::]*/: { /* n:"SXPI", */}, + /*::[*/ 0x00b8 /*::]*/: { /* n:"DocRoute", */}, + /*::[*/ 0x00b9 /*::]*/: { /* n:"RecipName", */}, + /*::[*/ 0x00bd /*::]*/: { /* n:"MulRk", */ f: parse_MulRk }, + /*::[*/ 0x00be /*::]*/: { /* n:"MulBlank", */ f: parse_MulBlank }, + /*::[*/ 0x00c1 /*::]*/: { /* n:"Mms", */ f: parsenoop2 }, + /*::[*/ 0x00c5 /*::]*/: { /* n:"SXDI", */}, + /*::[*/ 0x00c6 /*::]*/: { /* n:"SXDB", */}, + /*::[*/ 0x00c7 /*::]*/: { /* n:"SXFDB", */}, + /*::[*/ 0x00c8 /*::]*/: { /* n:"SXDBB", */}, + /*::[*/ 0x00c9 /*::]*/: { /* n:"SXNum", */}, + /*::[*/ 0x00ca /*::]*/: { /* n:"SxBool", */ f: parsebool }, + /*::[*/ 0x00cb /*::]*/: { /* n:"SxErr", */}, + /*::[*/ 0x00cc /*::]*/: { /* n:"SXInt", */}, + /*::[*/ 0x00cd /*::]*/: { /* n:"SXString", */}, + /*::[*/ 0x00ce /*::]*/: { /* n:"SXDtr", */}, + /*::[*/ 0x00cf /*::]*/: { /* n:"SxNil", */}, + /*::[*/ 0x00d0 /*::]*/: { /* n:"SXTbl", */}, + /*::[*/ 0x00d1 /*::]*/: { /* n:"SXTBRGIITM", */}, + /*::[*/ 0x00d2 /*::]*/: { /* n:"SxTbpg", */}, + /*::[*/ 0x00d3 /*::]*/: { /* n:"ObProj", */}, + /*::[*/ 0x00d5 /*::]*/: { /* n:"SXStreamID", */}, + /*::[*/ 0x00d7 /*::]*/: { /* n:"DBCell", */}, + /*::[*/ 0x00d8 /*::]*/: { /* n:"SXRng", */}, + /*::[*/ 0x00d9 /*::]*/: { /* n:"SxIsxoper", */}, + /*::[*/ 0x00da /*::]*/: { /* n:"BookBool", */ f: parseuint16 }, + /*::[*/ 0x00dc /*::]*/: { /* n:"DbOrParamQry", */}, + /*::[*/ 0x00dd /*::]*/: { /* n:"ScenarioProtect", */ f: parsebool }, + /*::[*/ 0x00de /*::]*/: { /* n:"OleObjectSize", */}, + /*::[*/ 0x00e0 /*::]*/: { /* n:"XF", */ f: parse_XF }, + /*::[*/ 0x00e1 /*::]*/: { /* n:"InterfaceHdr", */ f: parse_InterfaceHdr }, + /*::[*/ 0x00e2 /*::]*/: { /* n:"InterfaceEnd", */ f: parsenoop2 }, + /*::[*/ 0x00e3 /*::]*/: { /* n:"SXVS", */}, + /*::[*/ 0x00e5 /*::]*/: { /* n:"MergeCells", */ f: parse_MergeCells }, + /*::[*/ 0x00e9 /*::]*/: { /* n:"BkHim", */}, + /*::[*/ 0x00eb /*::]*/: { /* n:"MsoDrawingGroup", */}, + /*::[*/ 0x00ec /*::]*/: { /* n:"MsoDrawing", */}, + /*::[*/ 0x00ed /*::]*/: { /* n:"MsoDrawingSelection", */}, + /*::[*/ 0x00ef /*::]*/: { /* n:"PhoneticInfo", */}, + /*::[*/ 0x00f0 /*::]*/: { /* n:"SxRule", */}, + /*::[*/ 0x00f1 /*::]*/: { /* n:"SXEx", */}, + /*::[*/ 0x00f2 /*::]*/: { /* n:"SxFilt", */}, + /*::[*/ 0x00f4 /*::]*/: { /* n:"SxDXF", */}, + /*::[*/ 0x00f5 /*::]*/: { /* n:"SxItm", */}, + /*::[*/ 0x00f6 /*::]*/: { /* n:"SxName", */}, + /*::[*/ 0x00f7 /*::]*/: { /* n:"SxSelect", */}, + /*::[*/ 0x00f8 /*::]*/: { /* n:"SXPair", */}, + /*::[*/ 0x00f9 /*::]*/: { /* n:"SxFmla", */}, + /*::[*/ 0x00fb /*::]*/: { /* n:"SxFormat", */}, + /*::[*/ 0x00fc /*::]*/: { /* n:"SST", */ f: parse_SST }, + /*::[*/ 0x00fd /*::]*/: { /* n:"LabelSst", */ f: parse_LabelSst }, + /*::[*/ 0x00ff /*::]*/: { /* n:"ExtSST", */ f: parse_ExtSST }, + /*::[*/ 0x0100 /*::]*/: { /* n:"SXVDEx", */}, + /*::[*/ 0x0103 /*::]*/: { /* n:"SXFormula", */}, + /*::[*/ 0x0122 /*::]*/: { /* n:"SXDBEx", */}, + /*::[*/ 0x0137 /*::]*/: { /* n:"RRDInsDel", */}, + /*::[*/ 0x0138 /*::]*/: { /* n:"RRDHead", */}, + /*::[*/ 0x013b /*::]*/: { /* n:"RRDChgCell", */}, + /*::[*/ 0x013d /*::]*/: { /* n:"RRTabId", */ f: parseuint16a }, + /*::[*/ 0x013e /*::]*/: { /* n:"RRDRenSheet", */}, + /*::[*/ 0x013f /*::]*/: { /* n:"RRSort", */}, + /*::[*/ 0x0140 /*::]*/: { /* n:"RRDMove", */}, + /*::[*/ 0x014a /*::]*/: { /* n:"RRFormat", */}, + /*::[*/ 0x014b /*::]*/: { /* n:"RRAutoFmt", */}, + /*::[*/ 0x014d /*::]*/: { /* n:"RRInsertSh", */}, + /*::[*/ 0x014e /*::]*/: { /* n:"RRDMoveBegin", */}, + /*::[*/ 0x014f /*::]*/: { /* n:"RRDMoveEnd", */}, + /*::[*/ 0x0150 /*::]*/: { /* n:"RRDInsDelBegin", */}, + /*::[*/ 0x0151 /*::]*/: { /* n:"RRDInsDelEnd", */}, + /*::[*/ 0x0152 /*::]*/: { /* n:"RRDConflict", */}, + /*::[*/ 0x0153 /*::]*/: { /* n:"RRDDefName", */}, + /*::[*/ 0x0154 /*::]*/: { /* n:"RRDRstEtxp", */}, + /*::[*/ 0x015f /*::]*/: { /* n:"LRng", */}, + /*::[*/ 0x0160 /*::]*/: { /* n:"UsesELFs", */ f: parsebool }, + /*::[*/ 0x0161 /*::]*/: { /* n:"DSF", */ f: parsenoop2 }, + /*::[*/ 0x0191 /*::]*/: { /* n:"CUsr", */}, + /*::[*/ 0x0192 /*::]*/: { /* n:"CbUsr", */}, + /*::[*/ 0x0193 /*::]*/: { /* n:"UsrInfo", */}, + /*::[*/ 0x0194 /*::]*/: { /* n:"UsrExcl", */}, + /*::[*/ 0x0195 /*::]*/: { /* n:"FileLock", */}, + /*::[*/ 0x0196 /*::]*/: { /* n:"RRDInfo", */}, + /*::[*/ 0x0197 /*::]*/: { /* n:"BCUsrs", */}, + /*::[*/ 0x0198 /*::]*/: { /* n:"UsrChk", */}, + /*::[*/ 0x01a9 /*::]*/: { /* n:"UserBView", */}, + /*::[*/ 0x01aa /*::]*/: { /* n:"UserSViewBegin", */}, + /*::[*/ 0x01ab /*::]*/: { /* n:"UserSViewEnd", */}, + /*::[*/ 0x01ac /*::]*/: { /* n:"RRDUserView", */}, + /*::[*/ 0x01ad /*::]*/: { /* n:"Qsi", */}, + /*::[*/ 0x01ae /*::]*/: { /* n:"SupBook", */ f: parse_SupBook }, + /*::[*/ 0x01af /*::]*/: { /* n:"Prot4Rev", */ f: parsebool }, + /*::[*/ 0x01b0 /*::]*/: { /* n:"CondFmt", */}, + /*::[*/ 0x01b1 /*::]*/: { /* n:"CF", */}, + /*::[*/ 0x01b2 /*::]*/: { /* n:"DVal", */}, + /*::[*/ 0x01b5 /*::]*/: { /* n:"DConBin", */}, + /*::[*/ 0x01b6 /*::]*/: { /* n:"TxO", */ f: parse_TxO }, + /*::[*/ 0x01b7 /*::]*/: { /* n:"RefreshAll", */ f: parsebool }, + /*::[*/ 0x01b8 /*::]*/: { /* n:"HLink", */ f: parse_HLink }, + /*::[*/ 0x01b9 /*::]*/: { /* n:"Lel", */}, + /*::[*/ 0x01ba /*::]*/: { /* n:"CodeName", */ f: parse_XLUnicodeString }, + /*::[*/ 0x01bb /*::]*/: { /* n:"SXFDBType", */}, + /*::[*/ 0x01bc /*::]*/: { /* n:"Prot4RevPass", */ f: parseuint16 }, + /*::[*/ 0x01bd /*::]*/: { /* n:"ObNoMacros", */}, + /*::[*/ 0x01be /*::]*/: { /* n:"Dv", */}, + /*::[*/ 0x01c0 /*::]*/: { /* n:"Excel9File", */ f: parsenoop2 }, + /*::[*/ 0x01c1 /*::]*/: { /* n:"RecalcId", */ f: parse_RecalcId, r: 2 }, + /*::[*/ 0x01c2 /*::]*/: { /* n:"EntExU2", */ f: parsenoop2 }, + /*::[*/ 0x0200 /*::]*/: { /* n:"Dimensions", */ f: parse_Dimensions }, + /*::[*/ 0x0201 /*::]*/: { /* n:"Blank", */ f: parse_Blank }, + /*::[*/ 0x0203 /*::]*/: { /* n:"Number", */ f: parse_Number }, + /*::[*/ 0x0204 /*::]*/: { /* n:"Label", */ f: parse_Label }, + /*::[*/ 0x0205 /*::]*/: { /* n:"BoolErr", */ f: parse_BoolErr }, + /*::[*/ 0x0207 /*::]*/: { /* n:"String", */ f: parse_String }, + /*::[*/ 0x0208 /*::]*/: { /* n:"Row", */ f: parse_Row }, + /*::[*/ 0x020b /*::]*/: { /* n:"Index", */}, + /*::[*/ 0x0221 /*::]*/: { /* n:"Array", */ f: parse_Array }, + /*::[*/ 0x0225 /*::]*/: { /* n:"DefaultRowHeight", */ f: parse_DefaultRowHeight }, + /*::[*/ 0x0236 /*::]*/: { /* n:"Table", */}, + /*::[*/ 0x023e /*::]*/: { /* n:"Window2", */ f: parse_Window2 }, + /*::[*/ 0x027e /*::]*/: { /* n:"RK", */ f: parse_RK }, + /*::[*/ 0x0293 /*::]*/: { /* n:"Style", */}, + /*::[*/ 0x0418 /*::]*/: { /* n:"BigName", */}, + /*::[*/ 0x041e /*::]*/: { /* n:"Format", */ f: parse_Format }, + /*::[*/ 0x043c /*::]*/: { /* n:"ContinueBigName", */}, + /*::[*/ 0x04bc /*::]*/: { /* n:"ShrFmla", */ f: parse_ShrFmla }, + /*::[*/ 0x0800 /*::]*/: { /* n:"HLinkTooltip", */ f: parse_HLinkTooltip }, + /*::[*/ 0x0801 /*::]*/: { /* n:"WebPub", */}, + /*::[*/ 0x0802 /*::]*/: { /* n:"QsiSXTag", */}, + /*::[*/ 0x0803 /*::]*/: { /* n:"DBQueryExt", */}, + /*::[*/ 0x0804 /*::]*/: { /* n:"ExtString", */}, + /*::[*/ 0x0805 /*::]*/: { /* n:"TxtQry", */}, + /*::[*/ 0x0806 /*::]*/: { /* n:"Qsir", */}, + /*::[*/ 0x0807 /*::]*/: { /* n:"Qsif", */}, + /*::[*/ 0x0808 /*::]*/: { /* n:"RRDTQSIF", */}, + /*::[*/ 0x0809 /*::]*/: { /* n:"BOF", */ f: parse_BOF }, + /*::[*/ 0x080a /*::]*/: { /* n:"OleDbConn", */}, + /*::[*/ 0x080b /*::]*/: { /* n:"WOpt", */}, + /*::[*/ 0x080c /*::]*/: { /* n:"SXViewEx", */}, + /*::[*/ 0x080d /*::]*/: { /* n:"SXTH", */}, + /*::[*/ 0x080e /*::]*/: { /* n:"SXPIEx", */}, + /*::[*/ 0x080f /*::]*/: { /* n:"SXVDTEx", */}, + /*::[*/ 0x0810 /*::]*/: { /* n:"SXViewEx9", */}, + /*::[*/ 0x0812 /*::]*/: { /* n:"ContinueFrt", */}, + /*::[*/ 0x0813 /*::]*/: { /* n:"RealTimeData", */}, + /*::[*/ 0x0850 /*::]*/: { /* n:"ChartFrtInfo", */}, + /*::[*/ 0x0851 /*::]*/: { /* n:"FrtWrapper", */}, + /*::[*/ 0x0852 /*::]*/: { /* n:"StartBlock", */}, + /*::[*/ 0x0853 /*::]*/: { /* n:"EndBlock", */}, + /*::[*/ 0x0854 /*::]*/: { /* n:"StartObject", */}, + /*::[*/ 0x0855 /*::]*/: { /* n:"EndObject", */}, + /*::[*/ 0x0856 /*::]*/: { /* n:"CatLab", */}, + /*::[*/ 0x0857 /*::]*/: { /* n:"YMult", */}, + /*::[*/ 0x0858 /*::]*/: { /* n:"SXViewLink", */}, + /*::[*/ 0x0859 /*::]*/: { /* n:"PivotChartBits", */}, + /*::[*/ 0x085a /*::]*/: { /* n:"FrtFontList", */}, + /*::[*/ 0x0862 /*::]*/: { /* n:"SheetExt", */}, + /*::[*/ 0x0863 /*::]*/: { /* n:"BookExt", */ r: 12 }, + /*::[*/ 0x0864 /*::]*/: { /* n:"SXAddl", */}, + /*::[*/ 0x0865 /*::]*/: { /* n:"CrErr", */}, + /*::[*/ 0x0866 /*::]*/: { /* n:"HFPicture", */}, + /*::[*/ 0x0867 /*::]*/: { /* n:"FeatHdr", */ f: parsenoop2 }, + /*::[*/ 0x0868 /*::]*/: { /* n:"Feat", */}, + /*::[*/ 0x086a /*::]*/: { /* n:"DataLabExt", */}, + /*::[*/ 0x086b /*::]*/: { /* n:"DataLabExtContents", */}, + /*::[*/ 0x086c /*::]*/: { /* n:"CellWatch", */}, + /*::[*/ 0x0871 /*::]*/: { /* n:"FeatHdr11", */}, + /*::[*/ 0x0872 /*::]*/: { /* n:"Feature11", */}, + /*::[*/ 0x0874 /*::]*/: { /* n:"DropDownObjIds", */}, + /*::[*/ 0x0875 /*::]*/: { /* n:"ContinueFrt11", */}, + /*::[*/ 0x0876 /*::]*/: { /* n:"DConn", */}, + /*::[*/ 0x0877 /*::]*/: { /* n:"List12", */}, + /*::[*/ 0x0878 /*::]*/: { /* n:"Feature12", */}, + /*::[*/ 0x0879 /*::]*/: { /* n:"CondFmt12", */}, + /*::[*/ 0x087a /*::]*/: { /* n:"CF12", */}, + /*::[*/ 0x087b /*::]*/: { /* n:"CFEx", */}, + /*::[*/ 0x087c /*::]*/: { /* n:"XFCRC", */ f: parse_XFCRC, r: 12 }, + /*::[*/ 0x087d /*::]*/: { /* n:"XFExt", */ f: parse_XFExt, r: 12 }, + /*::[*/ 0x087e /*::]*/: { /* n:"AutoFilter12", */}, + /*::[*/ 0x087f /*::]*/: { /* n:"ContinueFrt12", */}, + /*::[*/ 0x0884 /*::]*/: { /* n:"MDTInfo", */}, + /*::[*/ 0x0885 /*::]*/: { /* n:"MDXStr", */}, + /*::[*/ 0x0886 /*::]*/: { /* n:"MDXTuple", */}, + /*::[*/ 0x0887 /*::]*/: { /* n:"MDXSet", */}, + /*::[*/ 0x0888 /*::]*/: { /* n:"MDXProp", */}, + /*::[*/ 0x0889 /*::]*/: { /* n:"MDXKPI", */}, + /*::[*/ 0x088a /*::]*/: { /* n:"MDB", */}, + /*::[*/ 0x088b /*::]*/: { /* n:"PLV", */}, + /*::[*/ 0x088c /*::]*/: { /* n:"Compat12", */ f: parsebool, r: 12 }, + /*::[*/ 0x088d /*::]*/: { /* n:"DXF", */}, + /*::[*/ 0x088e /*::]*/: { /* n:"TableStyles", */ r: 12 }, + /*::[*/ 0x088f /*::]*/: { /* n:"TableStyle", */}, + /*::[*/ 0x0890 /*::]*/: { /* n:"TableStyleElement", */}, + /*::[*/ 0x0892 /*::]*/: { /* n:"StyleExt", */}, + /*::[*/ 0x0893 /*::]*/: { /* n:"NamePublish", */}, + /*::[*/ 0x0894 /*::]*/: { /* n:"NameCmt", */ f: parse_NameCmt, r: 12 }, + /*::[*/ 0x0895 /*::]*/: { /* n:"SortData", */}, + /*::[*/ 0x0896 /*::]*/: { /* n:"Theme", */ f: parse_Theme, r: 12 }, + /*::[*/ 0x0897 /*::]*/: { /* n:"GUIDTypeLib", */}, + /*::[*/ 0x0898 /*::]*/: { /* n:"FnGrp12", */}, + /*::[*/ 0x0899 /*::]*/: { /* n:"NameFnGrp12", */}, + /*::[*/ 0x089a /*::]*/: { /* n:"MTRSettings", */ f: parse_MTRSettings, r: 12 }, + /*::[*/ 0x089b /*::]*/: { /* n:"CompressPictures", */ f: parsenoop2 }, + /*::[*/ 0x089c /*::]*/: { /* n:"HeaderFooter", */}, + /*::[*/ 0x089d /*::]*/: { /* n:"CrtLayout12", */}, + /*::[*/ 0x089e /*::]*/: { /* n:"CrtMlFrt", */}, + /*::[*/ 0x089f /*::]*/: { /* n:"CrtMlFrtContinue", */}, + /*::[*/ 0x08a3 /*::]*/: { /* n:"ForceFullCalculation", */ f: parse_ForceFullCalculation }, + /*::[*/ 0x08a4 /*::]*/: { /* n:"ShapePropsStream", */}, + /*::[*/ 0x08a5 /*::]*/: { /* n:"TextPropsStream", */}, + /*::[*/ 0x08a6 /*::]*/: { /* n:"RichTextStream", */}, + /*::[*/ 0x08a7 /*::]*/: { /* n:"CrtLayout12A", */}, + /*::[*/ 0x1001 /*::]*/: { /* n:"Units", */}, + /*::[*/ 0x1002 /*::]*/: { /* n:"Chart", */}, + /*::[*/ 0x1003 /*::]*/: { /* n:"Series", */}, + /*::[*/ 0x1006 /*::]*/: { /* n:"DataFormat", */}, + /*::[*/ 0x1007 /*::]*/: { /* n:"LineFormat", */}, + /*::[*/ 0x1009 /*::]*/: { /* n:"MarkerFormat", */}, + /*::[*/ 0x100a /*::]*/: { /* n:"AreaFormat", */}, + /*::[*/ 0x100b /*::]*/: { /* n:"PieFormat", */}, + /*::[*/ 0x100c /*::]*/: { /* n:"AttachedLabel", */}, + /*::[*/ 0x100d /*::]*/: { /* n:"SeriesText", */}, + /*::[*/ 0x1014 /*::]*/: { /* n:"ChartFormat", */}, + /*::[*/ 0x1015 /*::]*/: { /* n:"Legend", */}, + /*::[*/ 0x1016 /*::]*/: { /* n:"SeriesList", */}, + /*::[*/ 0x1017 /*::]*/: { /* n:"Bar", */}, + /*::[*/ 0x1018 /*::]*/: { /* n:"Line", */}, + /*::[*/ 0x1019 /*::]*/: { /* n:"Pie", */}, + /*::[*/ 0x101a /*::]*/: { /* n:"Area", */}, + /*::[*/ 0x101b /*::]*/: { /* n:"Scatter", */}, + /*::[*/ 0x101c /*::]*/: { /* n:"CrtLine", */}, + /*::[*/ 0x101d /*::]*/: { /* n:"Axis", */}, + /*::[*/ 0x101e /*::]*/: { /* n:"Tick", */}, + /*::[*/ 0x101f /*::]*/: { /* n:"ValueRange", */}, + /*::[*/ 0x1020 /*::]*/: { /* n:"CatSerRange", */}, + /*::[*/ 0x1021 /*::]*/: { /* n:"AxisLine", */}, + /*::[*/ 0x1022 /*::]*/: { /* n:"CrtLink", */}, + /*::[*/ 0x1024 /*::]*/: { /* n:"DefaultText", */}, + /*::[*/ 0x1025 /*::]*/: { /* n:"Text", */}, + /*::[*/ 0x1026 /*::]*/: { /* n:"FontX", */ f: parseuint16 }, + /*::[*/ 0x1027 /*::]*/: { /* n:"ObjectLink", */}, + /*::[*/ 0x1032 /*::]*/: { /* n:"Frame", */}, + /*::[*/ 0x1033 /*::]*/: { /* n:"Begin", */}, + /*::[*/ 0x1034 /*::]*/: { /* n:"End", */}, + /*::[*/ 0x1035 /*::]*/: { /* n:"PlotArea", */}, + /*::[*/ 0x103a /*::]*/: { /* n:"Chart3d", */}, + /*::[*/ 0x103c /*::]*/: { /* n:"PicF", */}, + /*::[*/ 0x103d /*::]*/: { /* n:"DropBar", */}, + /*::[*/ 0x103e /*::]*/: { /* n:"Radar", */}, + /*::[*/ 0x103f /*::]*/: { /* n:"Surf", */}, + /*::[*/ 0x1040 /*::]*/: { /* n:"RadarArea", */}, + /*::[*/ 0x1041 /*::]*/: { /* n:"AxisParent", */}, + /*::[*/ 0x1043 /*::]*/: { /* n:"LegendException", */}, + /*::[*/ 0x1044 /*::]*/: { /* n:"ShtProps", */ f: parse_ShtProps }, + /*::[*/ 0x1045 /*::]*/: { /* n:"SerToCrt", */}, + /*::[*/ 0x1046 /*::]*/: { /* n:"AxesUsed", */}, + /*::[*/ 0x1048 /*::]*/: { /* n:"SBaseRef", */}, + /*::[*/ 0x104a /*::]*/: { /* n:"SerParent", */}, + /*::[*/ 0x104b /*::]*/: { /* n:"SerAuxTrend", */}, + /*::[*/ 0x104e /*::]*/: { /* n:"IFmtRecord", */}, + /*::[*/ 0x104f /*::]*/: { /* n:"Pos", */}, + /*::[*/ 0x1050 /*::]*/: { /* n:"AlRuns", */}, + /*::[*/ 0x1051 /*::]*/: { /* n:"BRAI", */}, + /*::[*/ 0x105b /*::]*/: { /* n:"SerAuxErrBar", */}, + /*::[*/ 0x105c /*::]*/: { /* n:"ClrtClient", */ f: parse_ClrtClient }, + /*::[*/ 0x105d /*::]*/: { /* n:"SerFmt", */}, + /*::[*/ 0x105f /*::]*/: { /* n:"Chart3DBarShape", */}, + /*::[*/ 0x1060 /*::]*/: { /* n:"Fbi", */}, + /*::[*/ 0x1061 /*::]*/: { /* n:"BopPop", */}, + /*::[*/ 0x1062 /*::]*/: { /* n:"AxcExt", */}, + /*::[*/ 0x1063 /*::]*/: { /* n:"Dat", */}, + /*::[*/ 0x1064 /*::]*/: { /* n:"PlotGrowth", */}, + /*::[*/ 0x1065 /*::]*/: { /* n:"SIIndex", */}, + /*::[*/ 0x1066 /*::]*/: { /* n:"GelFrame", */}, + /*::[*/ 0x1067 /*::]*/: { /* n:"BopPopCustom", */}, + /*::[*/ 0x1068 /*::]*/: { /* n:"Fbi2", */}, + /*::[*/ 0x0000 /*::]*/: { /* n:"Dimensions", */ f: parse_Dimensions }, + /*::[*/ 0x0001 /*::]*/: { /* n:"BIFF2BLANK", */}, + /*::[*/ 0x0002 /*::]*/: { /* n:"BIFF2INT", */ f: parse_BIFF2INT }, + /*::[*/ 0x0003 /*::]*/: { /* n:"BIFF2NUM", */ f: parse_BIFF2NUM }, + /*::[*/ 0x0004 /*::]*/: { /* n:"BIFF2STR", */ f: parse_BIFF2STR }, + /*::[*/ 0x0005 /*::]*/: { /* n:"BIFF2BOOLERR", */ f: parse_BIFF2BOOLERR }, + /*::[*/ 0x0007 /*::]*/: { /* n:"String", */ f: parse_BIFF2STRING }, + /*::[*/ 0x0008 /*::]*/: { /* n:"BIFF2ROW", */}, + /*::[*/ 0x0009 /*::]*/: { /* n:"BOF", */ f: parse_BOF }, + /*::[*/ 0x000b /*::]*/: { /* n:"Index", */}, + /*::[*/ 0x0016 /*::]*/: { /* n:"ExternCount", */ f: parseuint16 }, + /*::[*/ 0x001e /*::]*/: { /* n:"BIFF2FORMAT", */ f: parse_BIFF2Format }, + /*::[*/ 0x001f /*::]*/: { /* n:"BIFF2FMTCNT", */}, + /*::[*/ 0x0020 /*::]*/: { /* n:"BIFF2COLINFO", */}, + /*::[*/ 0x0021 /*::]*/: { /* n:"Array", */ f: parse_Array }, + /*::[*/ 0x0024 /*::]*/: { /* n:"COLWIDTH", */}, + /*::[*/ 0x0025 /*::]*/: { /* n:"DefaultRowHeight", */ f: parse_DefaultRowHeight }, + // 0x002c ?? + // 0x002d ?? + // 0x002e ?? + // 0x0030 FONTCOUNT: number of fonts + /*::[*/ 0x0032 /*::]*/: { /* n:"BIFF2FONTXTRA", */ f: parse_BIFF2FONTXTRA }, + // 0x0035: INFOOPTS + // 0x0036: TABLE (BIFF2 only) + // 0x0037: TABLE2 (BIFF2 only) + // 0x0038: WNDESK + // 0x0039 ?? + // 0x003a: BEGINPREF + // 0x003b: ENDPREF + /*::[*/ 0x003e /*::]*/: { /* n:"BIFF2WINDOW2", */}, + // 0x003f ?? + // 0x0046: SHOWSCROLL + // 0x0047: SHOWFORMULA + // 0x0048: STATUSBAR + // 0x0049: SHORTMENUS + // 0x004A: + // 0x004B: + // 0x004C: + // 0x004E: + // 0x004F: + // 0x0058: TOOLBAR (BIFF3) + /* - - - */ + /*::[*/ 0x0034 /*::]*/: { /* n:"DDEObjName", */}, + /*::[*/ 0x0043 /*::]*/: { /* n:"BIFF2XF", */ f: parse_BIFF2XF }, + /*::[*/ 0x0044 /*::]*/: { /* n:"BIFF2XFINDEX", */ f: parseuint16 }, + /*::[*/ 0x0045 /*::]*/: { /* n:"BIFF2FONTCLR", */}, + /*::[*/ 0x0056 /*::]*/: { /* n:"BIFF4FMTCNT", */}, + /*::[*/ 0x007e /*::]*/: { /* n:"RK", */}, + /*::[*/ 0x007f /*::]*/: { /* n:"ImData", */ f: parse_ImData }, + /*::[*/ 0x0087 /*::]*/: { /* n:"Addin", */}, + /*::[*/ 0x0088 /*::]*/: { /* n:"Edg", */}, + /*::[*/ 0x0089 /*::]*/: { /* n:"Pub", */}, + // 0x8A + // 0x8B LH: alternate menu key flag (BIFF3/4) + // 0x8E + /*::[*/ 0x008F /*::]*/: { /* n:"BIFF4SheetInfo", */ f: parse_BIFF4SheetInfo }, + /*::[*/ 0x0091 /*::]*/: { /* n:"Sub", */}, + // 0x93 STYLE + /*::[*/ 0x0094 /*::]*/: { /* n:"LHRecord", */}, + /*::[*/ 0x0095 /*::]*/: { /* n:"LHNGraph", */}, + /*::[*/ 0x0096 /*::]*/: { /* n:"Sound", */}, + // 0xA2 FNPROTO: function prototypes (BIFF4) + // 0xA3 + // 0xA8 + /*::[*/ 0x00a9 /*::]*/: { /* n:"CoordList", */}, + /*::[*/ 0x00ab /*::]*/: { /* n:"GCW", */}, + /*::[*/ 0x00bc /*::]*/: { /* n:"ShrFmla", */}, + /*::[*/ 0x00bf /*::]*/: { /* n:"ToolbarHdr", */}, + /*::[*/ 0x00c0 /*::]*/: { /* n:"ToolbarEnd", */}, + /*::[*/ 0x00c2 /*::]*/: { /* n:"AddMenu", */}, + /*::[*/ 0x00c3 /*::]*/: { /* n:"DelMenu", */}, + /*::[*/ 0x00d6 /*::]*/: { /* n:"RString", */ f: parse_RString }, + /*::[*/ 0x00df /*::]*/: { /* n:"UDDesc", */}, + /*::[*/ 0x00ea /*::]*/: { /* n:"TabIdConf", */}, + /*::[*/ 0x0162 /*::]*/: { /* n:"XL5Modify", */}, + /*::[*/ 0x01a5 /*::]*/: { /* n:"FileSharing2", */}, + /*::[*/ 0x0206 /*::]*/: { /* n:"Formula", */ f: parse_Formula }, + /*::[*/ 0x0209 /*::]*/: { /* n:"BOF", */ f: parse_BOF }, + /*::[*/ 0x0218 /*::]*/: { /* n:"Lbl", */ f: parse_Lbl }, + /*::[*/ 0x0223 /*::]*/: { /* n:"ExternName", */ f: parse_ExternName }, + /*::[*/ 0x0231 /*::]*/: { /* n:"Font", */}, + /*::[*/ 0x0243 /*::]*/: { /* n:"BIFF3XF", */ f: parse_BIFF3XF }, + /*::[*/ 0x0406 /*::]*/: { /* n:"Formula", */ f: parse_Formula }, + /*::[*/ 0x0409 /*::]*/: { /* n:"BOF", */ f: parse_BOF }, + /*::[*/ 0x0443 /*::]*/: { /* n:"BIFF4XF", */ f: parse_BIFF4XF }, + /*::[*/ 0x086d /*::]*/: { /* n:"FeatInfo", */}, + /*::[*/ 0x0873 /*::]*/: { /* n:"FeatInfo11", */}, + /*::[*/ 0x0881 /*::]*/: { /* n:"SXAddl12", */}, + /*::[*/ 0x08c0 /*::]*/: { /* n:"AutoWebPub", */}, + /*::[*/ 0x08c1 /*::]*/: { /* n:"ListObj", */}, + /*::[*/ 0x08c2 /*::]*/: { /* n:"ListField", */}, + /*::[*/ 0x08c3 /*::]*/: { /* n:"ListDV", */}, + /*::[*/ 0x08c4 /*::]*/: { /* n:"ListCondFmt", */}, + /*::[*/ 0x08c5 /*::]*/: { /* n:"ListCF", */}, + /*::[*/ 0x08c6 /*::]*/: { /* n:"FMQry", */}, + /*::[*/ 0x08c7 /*::]*/: { /* n:"FMSQry", */}, + /*::[*/ 0x08c8 /*::]*/: { /* n:"PLV", */}, + /*::[*/ 0x08c9 /*::]*/: { /* n:"LnExt", */}, + /*::[*/ 0x08ca /*::]*/: { /* n:"MkrExt", */}, + /*::[*/ 0x08cb /*::]*/: { /* n:"CrtCoopt", */}, + /*::[*/ 0x08d6 /*::]*/: { /* n:"FRTArchId$", */ r: 12 }, + /* --- multiplan 4 records --- */ + /*::[*/ 0x0065 /*::]*/: { /* n:"", */}, + /*::[*/ 0x0066 /*::]*/: { /* n:"", */}, + /*::[*/ 0x0069 /*::]*/: { /* n:"", */}, + /*::[*/ 0x006a /*::]*/: { /* n:"", */}, + /*::[*/ 0x006b /*::]*/: { /* n:"", */}, + /*::[*/ 0x006d /*::]*/: { /* n:"", */}, + /*::[*/ 0x0070 /*::]*/: { /* n:"", */}, + /*::[*/ 0x0072 /*::]*/: { /* n:"", */}, + /*::[*/ 0x7262 /*::]*/: {} +}; +function write_biff_rec(ba /*:BufArray*/, type /*:number*/, payload, length /*:?number*/) { + var t /*:number*/ = type; + if (isNaN(t)) + return; + var len = length || (payload || []).length || 0; + var o = ba.next(4); + o.write_shift(2, t); + o.write_shift(2, len); + if ( /*:: len != null &&*/len > 0 && is_buf(payload)) + ba.push(payload); +} +function write_biff_continue(ba /*:BufArray*/, type /*:number*/, payload, length /*:?number*/) { + var len = length || (payload || []).length || 0; + if (len <= 8224) + return write_biff_rec(ba, type, payload, len); + var t = type; + if (isNaN(t)) + return; + var parts = payload.parts || [], sidx = 0; + var i = 0, w = 0; + while (w + (parts[sidx] || 8224) <= 8224) { + w += (parts[sidx] || 8224); + sidx++; + } + var o = ba.next(4); + o.write_shift(2, t); + o.write_shift(2, w); + ba.push(payload.slice(i, i + w)); + i += w; + while (i < len) { + o = ba.next(4); + o.write_shift(2, 0x3c); // TODO: figure out correct continue type + w = 0; + while (w + (parts[sidx] || 8224) <= 8224) { + w += (parts[sidx] || 8224); + sidx++; + } + o.write_shift(2, w); + ba.push(payload.slice(i, i + w)); + i += w; + } +} +function write_BIFF2BERR(r /*:number*/, c /*:number*/, val, t /*:string*/) { + var out = new_buf(9); + write_BIFF2Cell(out, r, c); + write_Bes(val, t || 'b', out); + return out; +} +/* TODO: codepage, large strings */ +function write_BIFF2LABEL(r /*:number*/, c /*:number*/, val) { + var out = new_buf(8 + 2 * val.length); + write_BIFF2Cell(out, r, c); + out.write_shift(1, val.length); + out.write_shift(val.length, val, 'sbcs'); + return out.l < out.length ? out.slice(0, out.l) : out; +} +function write_comments_biff2(ba /*:BufArray*/, comments /*:Array<[Comment[], number, number]>*/) { + comments.forEach(function (data) { + var text = data[0].map(function (cc) { return cc.t; }).join(""); + // TODO: should '\n' be translated to '\r' to correct for Excel 5.0 bug when exporting to BIFF2/3 ? + if (text.length <= 2048) + return write_biff_rec(ba, 0x001C, write_NOTE_BIFF2(text, data[1], data[2])); + write_biff_rec(ba, 0x001C, write_NOTE_BIFF2(text.slice(0, 2048), data[1], data[2], text.length)); + for (var i = 2048; i < text.length; i += 2048) + write_biff_rec(ba, 0x001C, write_NOTE_BIFF2(text.slice(i, Math.min(i + 2048, text.length)), -1, -1, Math.min(2048, text.length - i))); + }); +} +/* TODO: BIFF3/4 use different records -- see comments*/ +function write_ws_biff2_cell(ba /*:BufArray*/, cell /*:Cell*/, R /*:number*/, C /*:number*/, opts, date1904 /*:boolean*/) { + var ifmt = 0; + if (cell.z != null) { + ifmt = opts._BIFF2FmtTable.indexOf(cell.z); + if (ifmt == -1) { + opts._BIFF2FmtTable.push(cell.z); + ifmt = opts._BIFF2FmtTable.length - 1; + } + } + var ixfe = 0; + if (cell.z != null) { + for (; ixfe < opts.cellXfs.length; ++ixfe) + if (opts.cellXfs[ixfe].numFmtId == ifmt) + break; + if (ixfe == opts.cellXfs.length) + opts.cellXfs.push({ numFmtId: ifmt }); + } + if (cell.v != null) + switch (cell.t) { + case 'd': + case 'n': + var v = cell.t == 'd' ? datenum(parseDate(cell.v, date1904), date1904) : cell.v; + if (opts.biff == 2 && (v == (v | 0)) && (v >= 0) && (v < 65536)) + // 0x027E (RK) in BIFF3/4 + write_biff_rec(ba, 0x0002, write_BIFF2INT(R, C, v, ixfe, ifmt)); + else if (isNaN(v)) + // 0x0205 in BIFF3/4 + write_biff_rec(ba, 0x0005, write_BIFF2BERR(R, C, 0x24, "e")); // #NUM! + else if (!isFinite(v)) + // 0x0205 in BIFF3/4 + write_biff_rec(ba, 0x0005, write_BIFF2BERR(R, C, 0x07, "e")); // #DIV/0! + else + // 0x0203 in BIFF3/4 + write_biff_rec(ba, 0x0003, write_BIFF2NUM(R, C, v, ixfe, ifmt)); + return; + case 'b': + case 'e': + // 0x0205 in BIFF3/4 + write_biff_rec(ba, 0x0005, write_BIFF2BERR(R, C, cell.v, cell.t)); + return; + /* TODO: codepage, sst */ + case 's': + case 'str': + // 0x0204 in BIFF3/4 + write_biff_rec(ba, 0x0004, write_BIFF2LABEL(R, C, cell.v == null ? "" : String(cell.v).slice(0, 255))); + return; + } + // 0x0201 in BIFF3/4 + write_biff_rec(ba, 0x0001, write_BIFF2Cell(null, R, C)); +} +function write_ws_biff2(ba /*:BufArray*/, ws /*:Worksheet*/, idx /*:number*/, opts, wb /*:Workbook*/) { + var dense = ws["!data"] != null; + var range = safe_decode_range(ws['!ref'] || "A1"), ref /*:string*/, rr = "", cols /*:Array*/ = []; + if (range.e.c > 0xFF || range.e.r > 0x3FFF) { + if (opts.WTF) + throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384"); + range.e.c = Math.min(range.e.c, 0xFF); + range.e.r = Math.min(range.e.c, 0x3FFF); + } + var date1904 = (((wb || {}).Workbook || {}).WBProps || {}).date1904; + var row = [], comments = []; + /* TODO: 0x0000 / 0x0200 dimensions? */ + for (var C = range.s.c; C <= range.e.c; ++C) + cols[C] = encode_col(C); + for (var R = range.s.r; R <= range.e.r; ++R) { + if (dense) + row = ws["!data"][R] || []; + rr = encode_row(R); + for (C = range.s.c; C <= range.e.c; ++C) { + var cell = dense ? row[C] : ws[cols[C] + rr]; + if (!cell) + continue; + /* write cell */ + write_ws_biff2_cell(ba, cell, R, C, opts, date1904); + if (cell.c) + comments.push([cell.c, R, C]); + } + } + /* ... 0x12 0x19 0x13 (Password) */ + write_comments_biff2(ba, comments); + /* 0x3d (Window1) ... */ +} +/* Based on test files */ +function write_biff2_buf(wb /*:Workbook*/, opts /*:WriteOpts*/) { + var o = opts || {}; + var ba = buf_array(); + var idx = 0; + for (var i = 0; i < wb.SheetNames.length; ++i) + if (wb.SheetNames[i] == o.sheet) + idx = i; + if (idx == 0 && !!o.sheet && wb.SheetNames[0] != o.sheet) + throw new Error("Sheet not found: " + o.sheet); + write_biff_rec(ba, (o.biff == 4 ? 0x0409 : (o.biff == 3 ? 0x0209 : 0x0009)), write_BOF(wb, 0x10, o)); + if (((wb.Workbook || {}).WBProps || {}).date1904) + write_biff_rec(ba, 0x0022, writebool(true)); + o.cellXfs = [{ numFmtId: 0 }]; + o._BIFF2FmtTable /*:Array*/ = ["General"]; + o._Fonts = []; + var body = buf_array(); + write_ws_biff2(body, wb.Sheets[wb.SheetNames[idx]], idx, o, wb); + o._BIFF2FmtTable.forEach(function (f) { + if (o.biff <= 3) + write_biff_rec(ba, 0x001E, write_BIFF2Format(f)); + else + write_biff_rec(ba, 0x041E, write_BIFF4Format(f)); + }); + o.cellXfs.forEach(function (xf) { + switch (o.biff) { + case 2: + write_biff_rec(ba, 0x0043, write_BIFF2XF(xf)); + break; + case 3: + write_biff_rec(ba, 0x0243, write_BIFF3XF(xf)); + break; + case 4: + write_biff_rec(ba, 0x0443, write_BIFF4XF(xf)); + break; + } + }); + delete o._BIFF2FmtTable; + delete o.cellXfs; + delete o._Fonts; + ba.push(body.end()); + write_biff_rec(ba, 0x000A); + return ba.end(); +} +var b8oid = 1, b8ocnts /*:Array<[number, number, number]>*/ = []; +function write_MsoDrawingGroup() { + var buf = new_buf(82 + 8 * b8ocnts.length); + /* [MS-ODRAW] 2.2.12 OfficeArtDggContainer */ + buf.write_shift(2, 0x0F); + buf.write_shift(2, 0xF000); + buf.write_shift(4, 74 + 8 * b8ocnts.length); + /* 2.2.48 OfficeArtFDGGBlock */ + { + buf.write_shift(2, 0); + buf.write_shift(2, 0xF006); + buf.write_shift(4, 16 + 8 * b8ocnts.length); + /* 2.2.47 OfficeArtFDGG */ + { + buf.write_shift(4, b8oid); + buf.write_shift(4, b8ocnts.length + 1); + var acc = 0; + for (var i = 0; i < b8ocnts.length; ++i) + acc += (b8ocnts[i] && b8ocnts[i][1] || 0); + buf.write_shift(4, acc); + buf.write_shift(4, b8ocnts.length); + } + /* 2.2.46 OfficeArtIDCL + */ + b8ocnts.forEach(function (b8) { + buf.write_shift(4, b8[0]); + buf.write_shift(4, b8[2]); + }); + } + /* 2.2.9 OfficeArtFOPT */ + { + buf.write_shift(2, 0x33); // 0x03 | (3 << 4) + buf.write_shift(2, 0xF00B); + buf.write_shift(4, 0x12); // 3 * 6 + /* 2.3.21.15 Text Boolean Properties */ + buf.write_shift(2, 0xBF); + buf.write_shift(4, 0x00080008); + /* 2.3.7.2 fillColor */ + buf.write_shift(2, 0x0181); + buf.write_shift(4, 0x08000041); + /* 2.3.8.1 lineColor */ + buf.write_shift(2, 0x01C0); + buf.write_shift(4, 0x08000040); + } + /* 2.2.45 OfficeArtSplitMenuColorContainer */ + { + buf.write_shift(2, 0x40); + buf.write_shift(2, 0xF11E); + buf.write_shift(4, 16); + buf.write_shift(4, 0x0800000D); + buf.write_shift(4, 0x0800000C); + buf.write_shift(4, 0x08000017); + buf.write_shift(4, 0x100000F7); + } + return buf; +} +function write_comments_biff8(ba /*:BufArray*/, comments /*:Array<[Comment[], number, number]>*/) { + var notes /*:Array*/ = [], sz = 0, pl = buf_array(), baseid = b8oid; + var _oasc; + comments.forEach(function (c, ci) { + var author = ""; + var text = c[0].map(function (t) { if (t.a && !author) + author = t.a; return t.t; }).join(""); + ++b8oid; + /* 2.2.14 OfficeArtSpContainer */ + { + var oasc = new_buf(0x96); + oasc.write_shift(2, 0x0F); + oasc.write_shift(2, 0xF004); + oasc.write_shift(4, 0x96); + /* 2.2.40 OfficeArtFSP */ + { + oasc.write_shift(2, 0xca2); // 0x02 | (0xca << 4) + oasc.write_shift(2, 0xF00A); + oasc.write_shift(4, 8); + oasc.write_shift(4, b8oid); + oasc.write_shift(4, 0xA00); + } + /* 2.2.9 OfficeArtFOPT */ + { + oasc.write_shift(2, 0xE3); // 0x03 | (14 << 4) + oasc.write_shift(2, 0xF00B); + oasc.write_shift(4, 0x54); // 14 * 6 + /* 2.3.21.1 ITxid */ + oasc.write_shift(2, 0x80); + oasc.write_shift(4, 0); + /* 2.3.21.12 txdir */ + oasc.write_shift(2, 0x8B); + oasc.write_shift(4, 0x02); + /* 2.3.21.15 Text Boolean Properties */ + oasc.write_shift(2, 0xBF); + oasc.write_shift(4, 0x00080008); + /* 2.3.6.30 cxk */ + oasc.write_shift(2, 0x0158); + oasc.l += 4; + /* 2.3.7.2 fillColor */ + oasc.write_shift(2, 0x0181); + oasc.write_shift(4, 0x08000050); + /* 2.3.7.4 fillBackColor */ + oasc.write_shift(2, 0x0183); + oasc.write_shift(4, 0x08000050); + /* 2.3.7.6 fillCrMod */ + oasc.write_shift(2, 0x0185); + oasc.write_shift(4, 0x100000F4); + /* 2.3.7.43 Fill Style Boolean Properties */ + oasc.write_shift(2, 0x01BF); + oasc.write_shift(4, 0x00100010); + /* 2.3.8.1 lineColor */ + oasc.write_shift(2, 0x01C0); + oasc.write_shift(4, 0x08000051); + /* 2.3.8.4 lineCrMod */ + oasc.write_shift(2, 0x01C3); + oasc.write_shift(4, 0x100000F4); + /* 2.3.13.2 shadowColor */ + oasc.write_shift(2, 0x0201); + oasc.write_shift(4, 0x08000051); + /* 2.3.13.4 shadowCrMod */ + oasc.write_shift(2, 0x0203); + oasc.write_shift(4, 0x100000F4); + /* 2.3.13.23 Shadow Style Boolean Properties */ + oasc.write_shift(2, 0x023F); + oasc.write_shift(4, 0x00030001); + /* 2.3.4.44 Group Shape Boolean Properties */ + oasc.write_shift(2, 0x03BF); + oasc.write_shift(4, 0x00020000 | (c[0].hidden ? 2 : 0)); + } + /* [MS-XLS] 2.5.193 OfficeArtClientAnchorSheet */ + { + oasc.l += 2; + oasc.write_shift(2, 0xF010); + oasc.write_shift(4, 0x12); + oasc.write_shift(2, 0x3); // do not move or size with cells + oasc.write_shift(2, c[2] + 2); + oasc.l += 2; + oasc.write_shift(2, c[1] + 1); + oasc.l += 2; + oasc.write_shift(2, c[2] + 4); + oasc.l += 2; + oasc.write_shift(2, c[1] + 5); + oasc.l += 2; + } + /* [MS-XLS] 2.5.194 OfficeArtClientData */ + { + oasc.l += 2; + oasc.write_shift(2, 0xF011); + oasc.l += 4; + } + oasc.l = 0x96; + if (ci == 0) /* write_biff_rec(pl, 0x003C, oasc); */ + _oasc = oasc; + else + write_biff_rec(pl, 0x00EC, oasc); + } + sz += 0x96; + /* [MS-XLS] 2.4.181 Obj */ + { + var obj = new_buf(52); // 22 + 26 + 4 + /* [MS-XLS] 2.5.143 FtCmo */ + obj.write_shift(2, 0x15); + obj.write_shift(2, 0x12); + obj.write_shift(2, 0x19); + obj.write_shift(2, b8oid); + obj.write_shift(2, 0); + obj.l = 22; + /* [MS-XLS] 2.5.149 FtNts */ + obj.write_shift(2, 0x0D); + obj.write_shift(2, 0x16); + obj.write_shift(4, 0x62726272); + obj.write_shift(4, 0x95374305); + obj.write_shift(4, 0x80301328); + obj.write_shift(4, 0x69696904 + b8oid * 256); + obj.write_shift(2, 0); + obj.write_shift(4, 0); + // reserved + obj.l += 4; + write_biff_rec(pl, 0x005D, obj); + } + /* [MS-XLS] 2.5.195 OfficeArtClientTextbox */ + { + var oact = new_buf(8); + oact.l += 2; + oact.write_shift(2, 0xF00D); + oact.l += 4; + write_biff_rec(pl, 0x00EC, oact); + } + sz += 8; + /* [MS-XLS] 2.4.329 TxO */ + { + var txo = new_buf(18); + txo.write_shift(2, 0x12); + txo.l += 8; + txo.write_shift(2, text.length); + txo.write_shift(2, 0x10); + txo.l += 4; + write_biff_rec(pl, 0x01b6, txo); + /* text continue record TODO: switch to wide strings */ + { + var cont = new_buf(1 + text.length); + cont.write_shift(1, 0); + cont.write_shift(text.length, text, "sbcs"); + write_biff_rec(pl, 0x003C, cont); + } + /* formatting continue records */ + { + var conf = new_buf(0x10); + conf.l += 8; + conf.write_shift(2, text.length); + conf.l += 6; + write_biff_rec(pl, 0x003C, conf); + } + } + /* 2.4.179 Note */ + { + var notesh = new_buf(12 + author.length); + notesh.write_shift(2, c[1]); + notesh.write_shift(2, c[2]); + notesh.write_shift(2, 0 | (c[0].hidden ? 0 : 2)); + notesh.write_shift(2, b8oid); + notesh.write_shift(2, author.length); + notesh.write_shift(1, 0); + notesh.write_shift(author.length, author, "sbcs"); + notesh.l++; + notes.push(notesh); + } + }); + /* [MS-ODRAW] 2.2.13 OfficeArtDgContainer */ + { + var hdr = new_buf(80); + hdr.write_shift(2, 0x0F); + hdr.write_shift(2, 0xF002); + hdr.write_shift(4, sz + hdr.length - 8); + /* [MS-ODRAW] 2.2.49 OfficeArtFDG */ + { + hdr.write_shift(2, 0x10); + hdr.write_shift(2, 0xF008); + hdr.write_shift(4, 0x08); + hdr.write_shift(4, comments.length + 1); + hdr.write_shift(4, b8oid); + } + /* [MS-ODRAW] 2.2.16 OfficeArtSpgrContainer */ + { + hdr.write_shift(2, 0x0f); + hdr.write_shift(2, 0xF003); + hdr.write_shift(4, sz + 0x30); + /* [MS-ODRAW] 2.2.14 OfficeArtSpContainer */ + { + hdr.write_shift(2, 0x0f); + hdr.write_shift(2, 0xF004); + hdr.write_shift(4, 0x28); + /* [MS-ODRAW] 2.2.38 OfficeArtFSPGR */ + { + hdr.write_shift(2, 0x01); + hdr.write_shift(2, 0xF009); + hdr.write_shift(4, 0x10); + hdr.l += 16; + } + /* [MS-ODRAW] 2.2.40 OfficeArtFSP */ + { + hdr.write_shift(2, 0x02); + hdr.write_shift(2, 0xF00A); + hdr.write_shift(4, 0x08); + hdr.write_shift(4, baseid); + hdr.write_shift(4, 0x05); + } + } + } + write_biff_rec(ba, 0x00EC, /* hdr */ _oasc ? bconcat([hdr, _oasc]) : hdr); + } + ba.push(pl.end()); + notes.forEach(function (n) { write_biff_rec(ba, 0x001C, n); }); + b8ocnts.push([baseid, comments.length + 1, b8oid]); + ++b8oid; +} +function write_FONTS_biff8(ba, data, opts) { + write_biff_rec(ba, 0x0031 /* Font */, write_Font({ + sz: 12, + color: { theme: 1 }, + name: "Arial", + family: 2, + scheme: "minor" + }, opts)); +} +function write_FMTS_biff8(ba, NF /*:?SSFTable*/, opts) { + if (!NF) + return; + [[5, 8], [23, 26], [41, 44], [/*63*/ 50, /*66],[164,*/ 392]].forEach(function (r) { + /*:: if(!NF) return; */ + for (var i = r[0]; i <= r[1]; ++i) + if (NF[i] != null) + write_biff_rec(ba, 0x041E /* Format */, write_Format(i, NF[i], opts)); + }); +} +function write_FEAT(ba, ws) { + /* [MS-XLS] 2.4.112 */ + var o = new_buf(19); + o.write_shift(4, 0x867); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(2, 3); + o.write_shift(1, 1); + o.write_shift(4, 0); + write_biff_rec(ba, 0x0867 /* FeatHdr */, o); + /* [MS-XLS] 2.4.111 */ + o = new_buf(39); + o.write_shift(4, 0x868); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(2, 3); + o.write_shift(1, 0); + o.write_shift(4, 0); + o.write_shift(2, 1); + o.write_shift(4, 4); + o.write_shift(2, 0); + write_Ref8U(safe_decode_range(ws['!ref'] || "A1"), o); + o.write_shift(4, 4); + write_biff_rec(ba, 0x0868 /* Feat */, o); +} +function write_CELLXFS_biff8(ba, opts) { + for (var i = 0; i < 16; ++i) + write_biff_rec(ba, 0x00e0 /* XF */, write_XF({ numFmtId: 0, style: true }, 0, opts)); + opts.cellXfs.forEach(function (c) { + write_biff_rec(ba, 0x00e0 /* XF */, write_XF(c, 0, opts)); + }); +} +function write_ws_biff8_hlinks(ba /*:BufArray*/, ws) { + for (var R = 0; R < ws['!links'].length; ++R) { + var HL = ws['!links'][R]; + write_biff_rec(ba, 0x01b8 /* HLink */, write_HLink(HL)); + if (HL[1].Tooltip) + write_biff_rec(ba, 0x0800 /* HLinkTooltip */, write_HLinkTooltip(HL)); + } + delete ws['!links']; +} +function write_ws_cols_biff8(ba, cols) { + if (!cols) + return; + var cnt = 0; + cols.forEach(function (col, idx) { + if (++cnt <= 256 && col) { + write_biff_rec(ba, 0x007d /* ColInfo */, write_ColInfo(col_obj_w(idx, col), idx)); + } + }); +} +function write_ws_biff8_cell(ba /*:BufArray*/, cell /*:Cell*/, R /*:number*/, C /*:number*/, opts, date1904 /*:boolean*/) { + var os = 16 + get_cell_style(opts.cellXfs, cell, opts); + if (cell.v == null && !cell.bf) { + write_biff_rec(ba, 0x0201 /* Blank */, write_XLSCell(R, C, os)); + return; + } + if (cell.bf) + write_biff_rec(ba, 0x0006 /* Formula */, write_Formula(cell, R, C, opts, os)); + else + switch (cell.t) { + case 'd': + case 'n': + var v = cell.t == 'd' ? datenum(parseDate(cell.v, date1904), date1904) : cell.v; + if (isNaN(v)) + write_biff_rec(ba, 0x0205 /* BoolErr */, write_BoolErr(R, C, 0x24, os, opts, "e")); // #NUM! + else if (!isFinite(v)) + write_biff_rec(ba, 0x0205 /* BoolErr */, write_BoolErr(R, C, 0x07, os, opts, "e")); // #DIV/0! + /* TODO: emit RK as appropriate */ + else + write_biff_rec(ba, 0x0203 /* Number */, write_Number(R, C, v, os, opts)); + break; + case 'b': + case 'e': + write_biff_rec(ba, 0x0205 /* BoolErr */, write_BoolErr(R, C, cell.v, os, opts, cell.t)); + break; + /* TODO: codepage, sst */ + case 's': + case 'str': + if (opts.bookSST) { + var isst = get_sst_id(opts.Strings, cell.v == null ? "" : String(cell.v), opts.revStrings); + write_biff_rec(ba, 0x00fd /* LabelSst */, write_LabelSst(R, C, isst, os, opts)); + } + else + write_biff_rec(ba, 0x0204 /* Label */, write_Label(R, C, (cell.v == null ? "" : String(cell.v)).slice(0, 255), os, opts)); + break; + default: + write_biff_rec(ba, 0x0201 /* Blank */, write_XLSCell(R, C, os)); + } +} +/* [MS-XLS] 2.1.7.20.5 */ +function write_ws_biff8(idx /*:number*/, opts, wb /*:Workbook*/) { + var ba = buf_array(); + var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {}; + var _WB /*:WBWBProps*/ = ((wb || {}).Workbook || {} /*:any*/); + var _sheet /*:WBWSProp*/ = ((_WB.Sheets || [])[idx] || {} /*:any*/); + var dense = ws["!data"] != null; + var b8 = opts.biff == 8; + var ref /*:string*/, rr = "", cols /*:Array*/ = []; + var range = safe_decode_range(ws['!ref'] || "A1"); + var MAX_ROWS = b8 ? 65536 : 16384; + if (range.e.c > 0xFF || range.e.r >= MAX_ROWS) { + if (opts.WTF) + throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384"); + range.e.c = Math.min(range.e.c, 0xFF); + range.e.r = Math.min(range.e.c, MAX_ROWS - 1); + } + write_biff_rec(ba, 0x0809, write_BOF(wb, 0x10, opts)); + /* [Uncalced] Index */ + write_biff_rec(ba, 0x000d /* CalcMode */, writeuint16(1)); + write_biff_rec(ba, 0x000c /* CalcCount */, writeuint16(100)); + write_biff_rec(ba, 0x000f /* CalcRefMode */, writebool(true)); + write_biff_rec(ba, 0x0011 /* CalcIter */, writebool(false)); + write_biff_rec(ba, 0x0010 /* CalcDelta */, write_Xnum(0.001)); + write_biff_rec(ba, 0x005f /* CalcSaveRecalc */, writebool(true)); + write_biff_rec(ba, 0x002a /* PrintRowCol */, writebool(false)); + write_biff_rec(ba, 0x002b /* PrintGrid */, writebool(false)); + write_biff_rec(ba, 0x0082 /* GridSet */, writeuint16(1)); + write_biff_rec(ba, 0x0080 /* Guts */, write_Guts([0, 0])); + /* DefaultRowHeight WsBool [Sync] [LPr] [HorizontalPageBreaks] [VerticalPageBreaks] */ + /* Header (string) */ + /* Footer (string) */ + write_biff_rec(ba, 0x0083 /* HCenter */, writebool(false)); + write_biff_rec(ba, 0x0084 /* VCenter */, writebool(false)); + /* ... */ + if (b8) + write_ws_cols_biff8(ba, ws["!cols"]); + /* ... */ + write_biff_rec(ba, 0x0200 /* Dimensions */, write_Dimensions(range, opts)); + /* ... */ + var date1904 = (((wb || {}).Workbook || {}).WBProps || {}).date1904; + if (b8) + ws['!links'] = []; + var comments = []; + var row = []; + for (var C = range.s.c; C <= range.e.c; ++C) + cols[C] = encode_col(C); + for (var R = range.s.r; R <= range.e.r; ++R) { + if (dense) + row = ws["!data"][R] || []; + rr = encode_row(R); + for (C = range.s.c; C <= range.e.c; ++C) { + ref = cols[C] + rr; + var cell = dense ? row[C] : ws[ref]; + if (!cell) + continue; + /* write cell */ + write_ws_biff8_cell(ba, cell, R, C, opts, date1904); + if (b8 && cell.l) + ws['!links'].push([ref, cell.l]); + if (cell.c) + comments.push([cell.c, R, C]); + } + } + var cname /*:string*/ = _sheet.CodeName || _sheet.name || s; + /* ... */ + if (b8) + write_comments_biff8(ba, comments); + else + write_comments_biff2(ba, comments); + /* ... */ + if (b8) + write_biff_rec(ba, 0x023e /* Window2 */, write_Window2((_WB.Views || [])[0])); + /* ... */ + if (b8 && (ws['!merges'] || []).length) + write_biff_rec(ba, 0x00e5 /* MergeCells */, write_MergeCells(ws['!merges'])); + /* [LRng] *QUERYTABLE [PHONETICINFO] CONDFMTS */ + if (b8) + write_ws_biff8_hlinks(ba, ws); + /* [DVAL] */ + write_biff_rec(ba, 0x01ba /* CodeName */, write_XLUnicodeString(cname, opts)); + /* *WebPub *CellWatch [SheetExt] */ + if (b8) + write_FEAT(ba, ws); + /* *FEAT11 *RECORD12 */ + write_biff_rec(ba, 0x000a /* EOF */); + return ba.end(); +} +/* [MS-XLS] 2.1.7.20.3 */ +function write_biff8_global(wb /*:Workbook*/, bufs, opts /*:WriteOpts*/) { + var A = buf_array(); + var _WB /*:WBWBProps*/ = ((wb || {}).Workbook || {} /*:any*/); + var _sheets /*:Array*/ = (_WB.Sheets || []); + var _wb /*:WBProps*/ = /*::((*/ _WB.WBProps || { /*::CodeName:"ThisWorkbook"*/} /*:: ):any)*/; + var b8 = opts.biff == 8, b5 = opts.biff == 5; + write_biff_rec(A, 0x0809, write_BOF(wb, 0x05, opts)); + if (opts.bookType == "xla") + write_biff_rec(A, 0x0087 /* Addin */); + write_biff_rec(A, 0x00e1 /* InterfaceHdr */, b8 ? writeuint16(0x04b0) : null); + write_biff_rec(A, 0x00c1 /* Mms */, writezeroes(2)); + if (b5) + write_biff_rec(A, 0x00bf /* ToolbarHdr */); + if (b5) + write_biff_rec(A, 0x00c0 /* ToolbarEnd */); + write_biff_rec(A, 0x00e2 /* InterfaceEnd */); + write_biff_rec(A, 0x005c /* WriteAccess */, write_WriteAccess("SheetJS", opts)); + /* [FileSharing] */ + write_biff_rec(A, 0x0042 /* CodePage */, writeuint16(b8 ? 0x04b0 : 0x04E4)); + /* *2047 Lel */ + if (b8) + write_biff_rec(A, 0x0161 /* DSF */, writeuint16(0)); + if (b8) + write_biff_rec(A, 0x01c0 /* Excel9File */); + write_biff_rec(A, 0x013d /* RRTabId */, write_RRTabId(wb.SheetNames.length)); + if (b8 && wb.vbaraw) + write_biff_rec(A, 0x00d3 /* ObProj */); + /* [ObNoMacros] */ + if (b8 && wb.vbaraw) { + var cname /*:string*/ = _wb.CodeName || "ThisWorkbook"; + write_biff_rec(A, 0x01ba /* CodeName */, write_XLUnicodeString(cname, opts)); + } + write_biff_rec(A, 0x009c /* BuiltInFnGroupCount */, writeuint16(0x11)); + /* *FnGroupName *FnGrp12 */ + /* *Lbl */ + /* [OleObjectSize] */ + write_biff_rec(A, 0x0019 /* WinProtect */, writebool(false)); + write_biff_rec(A, 0x0012 /* Protect */, writebool(false)); + write_biff_rec(A, 0x0013 /* Password */, writeuint16(0)); + if (b8) + write_biff_rec(A, 0x01af /* Prot4Rev */, writebool(false)); + if (b8) + write_biff_rec(A, 0x01bc /* Prot4RevPass */, writeuint16(0)); + write_biff_rec(A, 0x003d /* Window1 */, write_Window1(opts)); + write_biff_rec(A, 0x0040 /* Backup */, writebool(false)); + write_biff_rec(A, 0x008d /* HideObj */, writeuint16(0)); + write_biff_rec(A, 0x0022 /* Date1904 */, writebool(safe1904(wb) == "true")); + write_biff_rec(A, 0x000e /* CalcPrecision */, writebool(true)); + if (b8) + write_biff_rec(A, 0x01b7 /* RefreshAll */, writebool(false)); + write_biff_rec(A, 0x00DA /* BookBool */, writeuint16(0)); + /* ... */ + write_FONTS_biff8(A, wb, opts); + write_FMTS_biff8(A, wb.SSF, opts); + write_CELLXFS_biff8(A, opts); + /* ... */ + if (b8) + write_biff_rec(A, 0x0160 /* UsesELFs */, writebool(false)); + var a = A.end(); + var C = buf_array(); + /* METADATA [MTRSettings] [ForceFullCalculation] */ + if (b8) + write_biff_rec(C, 0x008C /* Country */, write_Country()); + /* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture */ + /* BIFF8: MsoDrawingGroup [*Continue] */ + if (b8 && b8ocnts.length) + write_biff_rec(C, 0x00EB /* MsoDrawingGroup */, write_MsoDrawingGroup()); + /* BIFF8: [SST *Continue] ExtSST */ + if (b8 && opts.Strings) + write_biff_continue(C, 0x00FC /* SST */, write_SST(opts.Strings, opts)); + /* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */ + write_biff_rec(C, 0x000A /* EOF */); + var c = C.end(); + var B = buf_array(); + var blen = 0, j = 0; + for (j = 0; j < wb.SheetNames.length; ++j) + blen += (b8 ? 12 : 11) + (b8 ? 2 : 1) * wb.SheetNames[j].length; + var start = a.length + blen + c.length; + for (j = 0; j < wb.SheetNames.length; ++j) { + var _sheet /*:WBWSProp*/ = _sheets[j] || ({} /*:any*/); + write_biff_rec(B, 0x0085 /* BoundSheet8 */, write_BoundSheet8({ pos: start, hs: _sheet.Hidden || 0, dt: 0, name: wb.SheetNames[j] }, opts)); + start += bufs[j].length; + } + /* 1*BoundSheet8 */ + var b = B.end(); + if (blen != b.length) + throw new Error("BS8 " + blen + " != " + b.length); + var out = []; + if (a.length) + out.push(a); + if (b.length) + out.push(b); + if (c.length) + out.push(c); + return bconcat(out); +} +/* [MS-XLS] 2.1.7.20 Workbook Stream */ +function write_biff8_buf(wb /*:Workbook*/, opts /*:WriteOpts*/) { + var o = opts || {}; + var bufs = []; + if (wb && !wb.SSF) { + wb.SSF = dup(table_fmt); + } + if (wb && wb.SSF) { + make_ssf(); + SSF_load_table(wb.SSF); + // $FlowIgnore + o.revssf = evert_num(wb.SSF); + o.revssf[wb.SSF[65535]] = 0; + o.ssf = wb.SSF; + } + b8oid = 1; + b8ocnts = []; + o.Strings = /*::((*/ [] /*:: :any):SST)*/; + o.Strings.Count = 0; + o.Strings.Unique = 0; + fix_write_opts(o); + o.cellXfs = []; + get_cell_style(o.cellXfs, {}, { revssf: { "General": 0 } }); + if (!wb.Props) + wb.Props = {}; + for (var i = 0; i < wb.SheetNames.length; ++i) + bufs[bufs.length] = write_ws_biff8(i, o, wb); + bufs.unshift(write_biff8_global(wb, bufs, o)); + return bconcat(bufs); +} +function write_biff_buf(wb /*:Workbook*/, opts /*:WriteOpts*/) { + for (var i = 0; i <= wb.SheetNames.length; ++i) { + var ws = wb.Sheets[wb.SheetNames[i]]; + if (!ws || !ws["!ref"]) + continue; + var range = decode_range(ws["!ref"]); + if (range.e.c > 255) { // note: 255 is IV + if (typeof console != "undefined" && console.error) + console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost."); + } + } + var o = opts || {}; + switch (o.biff || 2) { + case 8: + case 5: return write_biff8_buf(wb, opts); + case 4: + case 3: + case 2: return write_biff2_buf(wb, opts); + } + throw new Error("invalid type " + o.bookType + " for BIFF"); +} +/* note: browser DOM element cannot see mso- style attrs, must parse */ +function html_to_sheet(str /*:string*/, _opts) { + var opts = _opts || {}; + var dense = (opts.dense != null) ? opts.dense : DENSE; + var ws /*:Worksheet*/ = ({} /*:any*/); + if (dense) + ws["!data"] = []; + str = str.replace(//g, ""); + var mtch /*:any*/ = str.match(/"); + var mtch2 /*:any*/ = str.match(/<\/table/i); + var i /*:number*/ = mtch.index, j /*:number*/ = mtch2 && mtch2.index || str.length; + var rows = split_regex(str.slice(i, j), /(:?]*>)/i, ""); + var R = -1, C = 0, RS = 0, CS = 0; + var range /*:Range*/ = { s: { r: 10000000, c: 10000000 }, e: { r: 0, c: 0 } }; + var merges /*:Array*/ = []; + for (i = 0; i < rows.length; ++i) { + var row = rows[i].trim(); + var hd = row.slice(0, 3).toLowerCase(); + if (hd == "/i); + for (j = 0; j < cells.length; ++j) { + var cell = cells[j].trim(); + if (!cell.match(/")) > -1) + m = m.slice(cc + 1); + for (var midx = 0; midx < merges.length; ++midx) { + var _merge /*:Range*/ = merges[midx]; + if (_merge.s.c == C && _merge.s.r < R && R <= _merge.e.r) { + C = _merge.e.c + 1; + midx = -1; + } + } + var tag = parsexmltag(cell.slice(0, cell.indexOf(">"))); + CS = tag.colspan ? +tag.colspan : 1; + if ((RS = +tag.rowspan) > 1 || CS > 1) + merges.push({ s: { r: R, c: C }, e: { r: R + (RS || 1) - 1, c: C + CS - 1 } }); + var _t /*:string*/ = tag.t || tag["data-t"] || ""; + /* TODO: generate stub cells */ + if (!m.length) { + C += CS; + continue; + } + m = htmldecode(m); + if (range.s.r > R) + range.s.r = R; + if (range.e.r < R) + range.e.r = R; + if (range.s.c > C) + range.s.c = C; + if (range.e.c < C) + range.e.c = C; + if (!m.length) { + C += CS; + continue; + } + var o /*:Cell*/ = { t: 's', v: m }; + if (opts.raw || !m.trim().length || _t == 's') { } + else if (m === 'TRUE') + o = { t: 'b', v: true }; + else if (m === 'FALSE') + o = { t: 'b', v: false }; + else if (!isNaN(fuzzynum(m))) + o = { t: 'n', v: fuzzynum(m) }; + else if (!isNaN(fuzzydate(m).getDate())) { + o = ({ t: 'd', v: parseDate(m) } /*:any*/); + if (opts.UTC === false) + o.v = utc_to_local(o.v); + if (!opts.cellDates) + o = ({ t: 'n', v: datenum(o.v) } /*:any*/); + o.z = opts.dateNF || table_fmt[14]; + } + if (o.cellText !== false) + o.w = m; + if (dense) { + if (!ws["!data"][R]) + ws["!data"][R] = []; + ws["!data"][R][C] = o; + } + else + ws[encode_cell({ r: R, c: C })] = o; + C += CS; + } + } + ws['!ref'] = encode_range(range); + if (merges.length) + ws["!merges"] = merges; + return ws; +} +function make_html_row(ws /*:Worksheet*/, r /*:Range*/, R /*:number*/, o /*:Sheet2HTMLOpts*/) { + var M /*:Array*/ = (ws['!merges'] || []); + var oo /*:Array*/ = []; + var sp = ({} /*:any*/); + var dense = ws["!data"] != null; + for (var C = r.s.c; C <= r.e.c; ++C) { + var RS = 0, CS = 0; + for (var j = 0; j < M.length; ++j) { + if (M[j].s.r > R || M[j].s.c > C) + continue; + if (M[j].e.r < R || M[j].e.c < C) + continue; + if (M[j].s.r < R || M[j].s.c < C) { + RS = -1; + break; + } + RS = M[j].e.r - M[j].s.r + 1; + CS = M[j].e.c - M[j].s.c + 1; + break; + } + if (RS < 0) + continue; + var coord = encode_col(C) + encode_row(R); + var cell = dense ? (ws["!data"][R] || [])[C] : ws[coord]; + /* TODO: html entities */ + var w = (cell && cell.v != null) && (cell.h || escapehtml(cell.w || (format_cell(cell), cell.w) || "")) || ""; + sp = ({} /*:any*/); + if (RS > 1) + sp.rowspan = RS; + if (CS > 1) + sp.colspan = CS; + if (o.editable) + w = '' + w + ''; + else if (cell) { + sp["data-t"] = cell && cell.t || 'z'; + // note: data-v is unaffected by the timezone interpretation + if (cell.v != null) + sp["data-v"] = cell.v instanceof Date ? cell.v.toISOString() : cell.v; + if (cell.z != null) + sp["data-z"] = cell.z; + if (cell.l && (cell.l.Target || "#").charAt(0) != "#") + w = '' + w + ''; + } + sp.id = (o.id || "sjs") + "-" + coord; + oo.push(writextag('td', w, sp)); + } + var preamble = ""; + return preamble + oo.join("") + ""; +} +var HTML_BEGIN = 'SheetJS Table Export'; +var HTML_END = ''; +function html_to_workbook(str /*:string*/, opts) { + var mtch = str.match(/[\s\S]*?<\/table>/gi); + if (!mtch || mtch.length == 0) + throw new Error("Invalid HTML: could not find
"); + if (mtch.length == 1) { + var w = sheet_to_workbook(html_to_sheet(mtch[0], opts), opts); + w.bookType = "html"; + return w; + } + var wb = book_new(); + mtch.forEach(function (s, idx) { book_append_sheet(wb, html_to_sheet(s, opts), "Sheet" + (idx + 1)); }); + wb.bookType = "html"; + return wb; +} +function make_html_preamble(ws /*:Worksheet*/, R /*:Range*/, o /*:Sheet2HTMLOpts*/) { + var out /*:Array*/ = []; + return out.join("") + ''; +} +function sheet_to_html(ws /*:Worksheet*/, opts /*:?Sheet2HTMLOpts*/ /*, wb:?Workbook*/) { + var o = opts || {}; + var header = o.header != null ? o.header : HTML_BEGIN; + var footer = o.footer != null ? o.footer : HTML_END; + var out /*:Array*/ = [header]; + var r = decode_range(ws['!ref']); + out.push(make_html_preamble(ws, r, o)); + for (var R = r.s.r; R <= r.e.r; ++R) + out.push(make_html_row(ws, r, R, o)); + out.push("
" + footer); + return out.join(""); +} +function sheet_add_dom(ws /*:Worksheet*/, table /*:HTMLElement*/, _opts /*:?any*/) { + var rows /*:HTMLCollection*/ = table.rows; + if (!rows) { + /* not an HTML TABLE */ + throw "Unsupported origin when " + table.tagName + " is not a TABLE"; + } + var opts = _opts || {}; + var dense = ws["!data"] != null; + var or_R = 0, or_C = 0; + if (opts.origin != null) { + if (typeof opts.origin == 'number') + or_R = opts.origin; + else { + var _origin /*:CellAddress*/ = typeof opts.origin == "string" ? decode_cell(opts.origin) : opts.origin; + or_R = _origin.r; + or_C = _origin.c; + } + } + var sheetRows = Math.min(opts.sheetRows || 10000000, rows.length); + var range /*:Range*/ = { s: { r: 0, c: 0 }, e: { r: or_R, c: or_C } }; + if (ws["!ref"]) { + var _range /*:Range*/ = decode_range(ws["!ref"]); + range.s.r = Math.min(range.s.r, _range.s.r); + range.s.c = Math.min(range.s.c, _range.s.c); + range.e.r = Math.max(range.e.r, _range.e.r); + range.e.c = Math.max(range.e.c, _range.e.c); + if (or_R == -1) + range.e.r = or_R = _range.e.r + 1; + } + var merges /*:Array*/ = [], midx = 0; + var rowinfo /*:Array*/ = ws["!rows"] || (ws["!rows"] = []); + var _R = 0, R = 0, _C = 0, C = 0, RS = 0, CS = 0; + if (!ws["!cols"]) + ws['!cols'] = []; + for (; _R < rows.length && R < sheetRows; ++_R) { + var row /*:HTMLTableRowElement*/ = rows[_R]; + if (is_dom_element_hidden(row)) { + if (opts.display) + continue; + rowinfo[R] = { hidden: true }; + } + var elts /*:HTMLCollection*/ = (row.cells); + for (_C = C = 0; _C < elts.length; ++_C) { + var elt /*:HTMLTableCellElement*/ = elts[_C]; + if (opts.display && is_dom_element_hidden(elt)) + continue; + var v /*:?string*/ = elt.hasAttribute('data-v') ? elt.getAttribute('data-v') : elt.hasAttribute('v') ? elt.getAttribute('v') : htmldecode(elt.innerHTML); + var z /*:?string*/ = elt.getAttribute('data-z') || elt.getAttribute('z'); + for (midx = 0; midx < merges.length; ++midx) { + var m /*:Range*/ = merges[midx]; + if (m.s.c == C + or_C && m.s.r < R + or_R && R + or_R <= m.e.r) { + C = m.e.c + 1 - or_C; + midx = -1; + } + } + /* TODO: figure out how to extract nonstandard mso- style */ + CS = +elt.getAttribute("colspan") || 1; + if (((RS = (+elt.getAttribute("rowspan") || 1))) > 1 || CS > 1) + merges.push({ s: { r: R + or_R, c: C + or_C }, e: { r: R + or_R + (RS || 1) - 1, c: C + or_C + (CS || 1) - 1 } }); + var o /*:Cell*/ = { t: 's', v: v }; + var _t /*:string*/ = elt.getAttribute("data-t") || elt.getAttribute("t") || ""; + if (v != null) { + if (v.length == 0) + o.t = _t || 'z'; + else if (opts.raw || v.trim().length == 0 || _t == "s") { } + else if (v === 'TRUE') + o = { t: 'b', v: true }; + else if (v === 'FALSE') + o = { t: 'b', v: false }; + else if (!isNaN(fuzzynum(v))) + o = { t: 'n', v: fuzzynum(v) }; + else if (!isNaN(fuzzydate(v).getDate())) { + o = ({ t: 'd', v: parseDate(v) } /*:any*/); + if (opts.UTC) + o.v = local_to_utc(o.v); + if (!opts.cellDates) + o = ({ t: 'n', v: datenum(o.v) } /*:any*/); + o.z = opts.dateNF || table_fmt[14]; + } + } + if (o.z === undefined && z != null) + o.z = z; + /* The first link is used. Links are assumed to be fully specified. + * TODO: The right way to process relative links is to make a new */ + var l = "", Aelts = elt.getElementsByTagName("A"); + if (Aelts && Aelts.length) + for (var Aelti = 0; Aelti < Aelts.length; ++Aelti) + if (Aelts[Aelti].hasAttribute("href")) { + l = Aelts[Aelti].getAttribute("href"); + if (l.charAt(0) != "#") + break; + } + if (l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') + o.l = ({ Target: l }); + if (dense) { + if (!ws["!data"][R + or_R]) + ws["!data"][R + or_R] = []; + ws["!data"][R + or_R][C + or_C] = o; + } + else + ws[encode_cell({ c: C + or_C, r: R + or_R })] = o; + if (range.e.c < C + or_C) + range.e.c = C + or_C; + C += CS; + } + ++R; + } + if (merges.length) + ws['!merges'] = (ws["!merges"] || []).concat(merges); + range.e.r = Math.max(range.e.r, R - 1 + or_R); + ws['!ref'] = encode_range(range); + if (R >= sheetRows) + ws['!fullref'] = encode_range((range.e.r = rows.length - _R + R - 1 + or_R, range)); // We can count the real number of rows to parse but we don't to improve the performance + return ws; +} +function parse_dom_table(table /*:HTMLElement*/, _opts /*:?any*/) { + var opts = _opts || {}; + var ws /*:Worksheet*/ = ({} /*:any*/); + if (opts.dense) + ws["!data"] = []; + return sheet_add_dom(ws, table, _opts); +} +function table_to_book(table /*:HTMLElement*/, opts /*:?any*/) { + var o = sheet_to_workbook(parse_dom_table(table, opts), opts); + //o.bookType = "dom"; // TODO: define a type for this + return o; +} +function is_dom_element_hidden(element /*:HTMLElement*/) { + var display /*:string*/ = ''; + var get_computed_style /*:?function*/ = get_get_computed_style_function(element); + if (get_computed_style) + display = get_computed_style(element).getPropertyValue('display'); + if (!display) + display = element.style && element.style.display; + return display === 'none'; +} +/* global getComputedStyle */ +function get_get_computed_style_function(element /*:HTMLElement*/) { + // The proper getComputedStyle implementation is the one defined in the element window + if (element.ownerDocument.defaultView && typeof element.ownerDocument.defaultView.getComputedStyle === 'function') + return element.ownerDocument.defaultView.getComputedStyle; + // If it is not available, try to get one from the global namespace + if (typeof getComputedStyle === 'function') + return getComputedStyle; + return null; +} +/* OpenDocument */ +function parse_text_p(text /*:string*/ /*::, tag*/) { + /* 6.1.2 White Space Characters */ + var fixed = text + .replace(/[\t\r\n]/g, " ").trim().replace(/ +/g, " ") + .replace(//g, " ") + .replace(//g, function ($$, $1) { return Array(parseInt($1, 10) + 1).join(" "); }) + .replace(/]*\/>/g, "\t") + .replace(//g, "\n"); + var v = unescapexml(fixed.replace(/<[^>]*>/g, "")); + return [v]; +} +/* Note: ODS can stick styles in content.xml or styles.xml, FODS blurs lines */ +function parse_ods_styles(d /*:string*/, _opts, _nfm) { + var number_format_map = _nfm || {}; + var str = xlml_normalize(d); + xlmlregex.lastIndex = 0; + str = str.replace(//mg, "").replace(//gm, ""); + var Rn, NFtag, NF = "", tNF = "", y, etpos = 0, tidx = -1, infmt = false, payload = ""; + while ((Rn = xlmlregex.exec(str))) { + switch ((Rn[3] = Rn[3].replace(/_.*$/, ""))) { + /* Number Format Definitions */ + case 'number-style': // 16.29.2 + case 'currency-style': // 16.29.8 + case 'percentage-style': // 16.29.10 + case 'date-style': // 16.29.11 + case 'time-style': // 16.29.19 + case 'text-style': // 16.29.26 + if (Rn[1] === '/') { + infmt = false; + if (NFtag['truncate-on-overflow'] == "false") { + if (NF.match(/h/)) + NF = NF.replace(/h+/, "[$&]"); + else if (NF.match(/m/)) + NF = NF.replace(/m+/, "[$&]"); + else if (NF.match(/s/)) + NF = NF.replace(/s+/, "[$&]"); + } + number_format_map[NFtag.name] = NF; + NF = ""; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + infmt = true; + NF = ""; + NFtag = parsexmltag(Rn[0], false); + } + break; + // LibreOffice bug https://bugs.documentfoundation.org/show_bug.cgi?id=149484 + case 'boolean-style': // 16.29.24 + if (Rn[1] === '/') { + infmt = false; + number_format_map[NFtag.name] = "General"; + NF = ""; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + infmt = true; + NF = ""; + NFtag = parsexmltag(Rn[0], false); + } + break; + /* Number Format Elements */ + case 'boolean': // 16.29.25 + NF += "General"; // ODF spec is unfortunately underspecified here + break; + case 'text': // 16.29.27 + if (Rn[1] === '/') { + payload = str.slice(tidx, xlmlregex.lastIndex - Rn[0].length); + // NOTE: Excel has a different interpretation of "%%" and friends + if (payload == "%" && NFtag[0] == ' 16.29.12 + y = parsexmltag(Rn[0], false); + switch (y["style"]) { + case "short": + NF += "d"; + break; + case "long": + NF += "dd"; + break; + default: + NF += "dd"; + break; // TODO: error condition + } + } + break; + case 'day-of-week': + { // 16.29.16 + y = parsexmltag(Rn[0], false); + switch (y["style"]) { + case "short": + NF += "ddd"; + break; + case "long": + NF += "dddd"; + break; + default: + NF += "ddd"; + break; + } + } + break; + case 'era': + { // 16.29.15 TODO: proper mapping + y = parsexmltag(Rn[0], false); + switch (y["style"]) { + case "short": + NF += "ee"; + break; + case "long": + NF += "eeee"; + break; + default: + NF += "eeee"; + break; // TODO: error condition + } + } + break; + case 'hours': + { // 16.29.20 + y = parsexmltag(Rn[0], false); + switch (y["style"]) { + case "short": + NF += "h"; + break; + case "long": + NF += "hh"; + break; + default: + NF += "hh"; + break; // TODO: error condition + } + } + break; + case 'minutes': + { // 16.29.21 + y = parsexmltag(Rn[0], false); + switch (y["style"]) { + case "short": + NF += "m"; + break; + case "long": + NF += "mm"; + break; + default: + NF += "mm"; + break; // TODO: error condition + } + } + break; + case 'month': + { // 16.29.13 + y = parsexmltag(Rn[0], false); + if (y["textual"]) + NF += "mm"; + switch (y["style"]) { + case "short": + NF += "m"; + break; + case "long": + NF += "mm"; + break; + default: + NF += "m"; + break; + } + } + break; + case 'seconds': + { // 16.29.22 + y = parsexmltag(Rn[0], false); + switch (y["style"]) { + case "short": + NF += "s"; + break; + case "long": + NF += "ss"; + break; + default: + NF += "ss"; + break; // TODO: error condition + } + if (y["decimal-places"]) + NF += "." + fill("0", +y["decimal-places"]); + } + break; + case 'year': + { // 16.29.14 + y = parsexmltag(Rn[0], false); + switch (y["style"]) { + case "short": + NF += "yy"; + break; + case "long": + NF += "yyyy"; + break; + default: + NF += "yy"; + break; // TODO: error condition + } + } + break; + case 'am-pm': // 16.29.23 + NF += "AM/PM"; // LO autocorrects A/P -> AM/PM + break; + case 'week-of-year': // 16.29.17 + case 'quarter': // 16.29.18 + console.error("Excel does not support ODS format token " + Rn[3]); + break; + case 'fill-character': // 16.29.5 + if (Rn[1] === '/') { + payload = str.slice(tidx, xlmlregex.lastIndex - Rn[0].length); + // NOTE: Excel has a different interpretation of "%%" and friends + NF += '"' + payload.replace(/"/g, '""') + '"*'; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + tidx = xlmlregex.lastIndex; + } + break; + case 'scientific-number': // 16.29.6 + // TODO: find a mapping for all parameters + y = parsexmltag(Rn[0], false); + NF += "0." + fill("0", +y["min-decimal-places"] || +y["decimal-places"] || 2) + fill("?", +y["decimal-places"] - +y["min-decimal-places"] || 0) + "E" + (parsexmlbool(y["forced-exponent-sign"]) ? "+" : "") + fill("0", +y["min-exponent-digits"] || 2); + break; + case 'fraction': // 16.29.7 + // TODO: find a mapping for all parameters + y = parsexmltag(Rn[0], false); + if (!+y["min-integer-digits"]) + NF += "#"; + else + NF += fill("0", +y["min-integer-digits"]); + NF += " "; + NF += fill("?", +y["min-numerator-digits"] || 1); + NF += "/"; + if (+y["denominator-value"]) + NF += y["denominator-value"]; + else + NF += fill("?", +y["min-denominator-digits"] || 1); + break; + case 'currency-symbol': // 16.29.9 + // TODO: localization with [$-...] + if (Rn[1] === '/') { + NF += '"' + str.slice(tidx, xlmlregex.lastIndex - Rn[0].length).replace(/"/g, '""') + '"'; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + tidx = xlmlregex.lastIndex; + } + else + NF += "$"; + break; + case 'text-properties': // 16.29.29 + y = parsexmltag(Rn[0], false); + switch ((y["color"] || "").toLowerCase().replace("#", "")) { + case "ff0000": + case "red": + NF = "[Red]" + NF; + break; + } + break; + case 'text-content': // 16.29.28 + NF += "@"; + break; + case 'map': // 16.3 + // TODO: handle more complex maps + y = parsexmltag(Rn[0], false); + if (unescapexml(y["condition"]) == "value()>=0") + NF = number_format_map[y["apply-style-name"]] + ";" + NF; + else + console.error("ODS number format may be incorrect: " + y["condition"]); + break; + case 'number': // 16.29.3 + // TODO: handle all the attributes + if (Rn[1] === '/') + break; + y = parsexmltag(Rn[0], false); + tNF = ""; + tNF += fill("0", +y["min-integer-digits"] || 1); + if (parsexmlbool(y["grouping"])) + tNF = commaify(fill("#", Math.max(0, 4 - tNF.length)) + tNF); + if (+y["min-decimal-places"] || +y["decimal-places"]) + tNF += "."; + if (+y["min-decimal-places"]) + tNF += fill("0", +y["min-decimal-places"] || 1); + if (+y["decimal-places"] - (+y["min-decimal-places"] || 0)) + tNF += fill("0", +y["decimal-places"] - (+y["min-decimal-places"] || 0)); // TODO: should this be "#" ? + NF += tNF; + break; + case 'embedded-text': // 16.29.4 + // TODO: verify interplay with grouping et al + if (Rn[1] === '/') { + if (etpos == 0) + NF += '"' + str.slice(tidx, xlmlregex.lastIndex - Rn[0].length).replace(/"/g, '""') + '"'; + else + NF = NF.slice(0, etpos) + '"' + str.slice(tidx, xlmlregex.lastIndex - Rn[0].length).replace(/"/g, '""') + '"' + NF.slice(etpos); + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + tidx = xlmlregex.lastIndex; + etpos = -+parsexmltag(Rn[0], false)["position"] || 0; + } + break; + } + } + return number_format_map; +} +function parse_content_xml(d /*:string*/, _opts, _nfm) { + var opts = _opts || {}; + if (DENSE != null && opts.dense == null) + opts.dense = DENSE; + var str = xlml_normalize(d); + var state /*:Array*/ = [], tmp; + var tag /*:: = {}*/; + var nfidx, NF = "", pidx = 0; + var sheetag /*:: = {name:"", '名称':""}*/; + var rowtag /*:: = {'行号':""}*/; + var Sheets = {}, SheetNames /*:Array*/ = []; + var ws = ({} /*:any*/); + if (opts.dense) + ws["!data"] = []; + var Rn, q /*:: :any = ({t:"", v:null, z:null, w:"",c:[],}:any)*/; + var ctag = ({ value: "" } /*:any*/); + var textp = "", textpidx = 0, textptag /*:: = {}*/, oldtextp = "", oldtextpidx = 0; + var textR = [], oldtextR = []; + var R = -1, C = -1, range = { s: { r: 1000000, c: 10000000 }, e: { r: 0, c: 0 } }; + var row_ol = 0; + var number_format_map = _nfm || {}, styles = {}; + var merges /*:Array*/ = [], mrange = {}, mR = 0, mC = 0; + var rowinfo /*:Array*/ = [], rowpeat = 1, colpeat = 1; + var arrayf /*:Array<[Range, string]>*/ = []; + var WB = { Names: [], WBProps: {} }; + var atag = ({} /*:any*/); + var _Ref /*:[string, string]*/ = ["", ""]; + var comments /*:Array*/ = [], comment /*:Comment*/ = ({} /*:any*/); + var creator = "", creatoridx = 0; + var isstub = false, intable = false; + var i = 0; + xlmlregex.lastIndex = 0; + str = str.replace(//mg, "").replace(//gm, ""); + while ((Rn = xlmlregex.exec(str))) + switch ((Rn[3] = Rn[3].replace(/_.*$/, ""))) { + case 'table': + case '工作表': // 9.1.2 + if (Rn[1] === '/') { + if (range.e.c >= range.s.c && range.e.r >= range.s.r) + ws['!ref'] = encode_range(range); + else + ws['!ref'] = "A1:A1"; + if (opts.sheetRows > 0 && opts.sheetRows <= range.e.r) { + ws['!fullref'] = ws['!ref']; + range.e.r = opts.sheetRows - 1; + ws['!ref'] = encode_range(range); + } + if (merges.length) + ws['!merges'] = merges; + if (rowinfo.length) + ws["!rows"] = rowinfo; + sheetag.name = sheetag['名称'] || sheetag.name; + if (typeof JSON !== 'undefined') + JSON.stringify(sheetag); + SheetNames.push(sheetag.name); + Sheets[sheetag.name] = ws; + intable = false; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + sheetag = parsexmltag(Rn[0], false); + R = C = -1; + range.s.r = range.s.c = 10000000; + range.e.r = range.e.c = 0; + ws = ({} /*:any*/); + if (opts.dense) + ws["!data"] = []; + merges = []; + rowinfo = []; + intable = true; + } + break; + case 'table-row-group': // 9.1.9 + if (Rn[1] === "/") + --row_ol; + else + ++row_ol; + break; + case 'table-row': + case 'è¡Œ': // 9.1.3 + if (Rn[1] === '/') { + R += rowpeat; + rowpeat = 1; + break; + } + rowtag = parsexmltag(Rn[0], false); + if (rowtag['行号']) + R = rowtag['行号'] - 1; + else if (R == -1) + R = 0; + rowpeat = +rowtag['number-rows-repeated'] || 1; + /* TODO: remove magic */ + if (rowpeat < 10) + for (i = 0; i < rowpeat; ++i) + if (row_ol > 0) + rowinfo[R + i] = { level: row_ol }; + C = -1; + break; + case 'covered-table-cell': // 9.1.5 + if (Rn[1] !== '/') + ++C; + if (opts.sheetStubs) { + if (opts.dense) { + if (!ws["!data"][R]) + ws["!data"][R] = []; + ws["!data"][R][C] = { t: 'z' }; + } + else + ws[encode_cell({ r: R, c: C })] = { t: 'z' }; + } + textp = ""; + textR = []; + break; /* stub */ + case 'table-cell': + case '数据': + if (Rn[0].charAt(Rn[0].length - 2) === '/') { + ++C; + ctag = parsexmltag(Rn[0], false); + colpeat = parseInt(ctag['number-columns-repeated'] || "1", 10); + q = ({ t: 'z', v: null /*:: , z:null, w:"",c:[]*/ } /*:any*/); + if (ctag.formula && opts.cellFormula != false) + q.f = ods_to_csf_formula(unescapexml(ctag.formula)); + if (ctag["style-name"] && styles[ctag["style-name"]]) + q.z = styles[ctag["style-name"]]; + if ((ctag['数据类型'] || ctag['value-type']) == "string") { + q.t = "s"; + q.v = unescapexml(ctag['string-value'] || ""); + if (opts.dense) { + if (!ws["!data"][R]) + ws["!data"][R] = []; + ws["!data"][R][C] = q; + } + else { + ws[encode_col(C) + encode_row(R)] = q; + } + } + C += colpeat - 1; + } + else if (Rn[1] !== '/') { + ++C; + textp = oldtextp = ""; + textpidx = oldtextpidx = 0; + textR = []; + oldtextR = []; + colpeat = 1; + var rptR = rowpeat ? R + rowpeat - 1 : R; + if (C > range.e.c) + range.e.c = C; + if (C < range.s.c) + range.s.c = C; + if (R < range.s.r) + range.s.r = R; + if (rptR > range.e.r) + range.e.r = rptR; + ctag = parsexmltag(Rn[0], false); + comments = []; + comment = ({} /*:any*/); + q = ({ t: ctag['数据类型'] || ctag['value-type'], v: null /*:: , z:null, w:"",c:[]*/ } /*:any*/); + if (ctag["style-name"] && styles[ctag["style-name"]]) + q.z = styles[ctag["style-name"]]; + if (opts.cellFormula) { + if (ctag.formula) + ctag.formula = unescapexml(ctag.formula); + if (ctag['number-matrix-columns-spanned'] && ctag['number-matrix-rows-spanned']) { + mR = parseInt(ctag['number-matrix-rows-spanned'], 10) || 0; + mC = parseInt(ctag['number-matrix-columns-spanned'], 10) || 0; + mrange = { s: { r: R, c: C }, e: { r: R + mR - 1, c: C + mC - 1 } }; + q.F = encode_range(mrange); + arrayf.push([mrange, q.F]); + } + if (ctag.formula) + q.f = ods_to_csf_formula(ctag.formula); + else + for (i = 0; i < arrayf.length; ++i) + if (R >= arrayf[i][0].s.r && R <= arrayf[i][0].e.r) + if (C >= arrayf[i][0].s.c && C <= arrayf[i][0].e.c) + q.F = arrayf[i][1]; + } + if (ctag['number-columns-spanned'] || ctag['number-rows-spanned']) { + mR = parseInt(ctag['number-rows-spanned'], 10) || 0; + mC = parseInt(ctag['number-columns-spanned'], 10) || 0; + mrange = { s: { r: R, c: C }, e: { r: R + mR - 1, c: C + mC - 1 } }; + merges.push(mrange); + } + /* 19.675.2 table:number-columns-repeated */ + if (ctag['number-columns-repeated']) + colpeat = parseInt(ctag['number-columns-repeated'], 10); + /* 19.385 office:value-type TODO: verify ODS and UOS */ + switch (q.t) { + case 'boolean': + q.t = 'b'; + q.v = parsexmlbool(ctag['boolean-value']) || (+ctag['boolean-value'] >= 1); + break; + case 'float': + q.t = 'n'; + q.v = parseFloat(ctag.value); + if (opts.cellDates && q.z && fmt_is_date(q.z)) { + q.v = numdate(q.v + (WB.WBProps.date1904 ? 1462 : 0)); + q.t = typeof q.v == "number" ? 'n' : 'd'; + } + break; + case 'percentage': + q.t = 'n'; + q.v = parseFloat(ctag.value); + break; + case 'currency': + q.t = 'n'; + q.v = parseFloat(ctag.value); + break; + case 'date': + q.t = 'd'; + q.v = parseDate(ctag['date-value'], WB.WBProps.date1904); + if (!opts.cellDates) { + q.t = 'n'; + q.v = datenum(q.v, WB.WBProps.date1904); + } + if (!q.z) + q.z = 'm/d/yy'; + break; + /* NOTE: for `time`, Excel ODS export incorrectly uses durations relative to 1900 epoch even if 1904 is specified */ + case 'time': + q.t = 'n'; + q.v = parse_isodur(ctag['time-value']) / 86400; + if (opts.cellDates) { + q.v = numdate(q.v); + q.t = typeof q.v == "number" ? 'n' : 'd'; + } + if (!q.z) + q.z = 'HH:MM:SS'; + break; + case 'number': + q.t = 'n'; + q.v = parseFloat(ctag['数据数值']); + break; + default: + if (q.t === 'string' || q.t === 'text' || !q.t) { + q.t = 's'; + if (ctag['string-value'] != null) { + textp = unescapexml(ctag['string-value']); + textR = []; + } + } + else + throw new Error('Unsupported value type ' + q.t); + } + } + else { + isstub = false; + if (q.t === 's') { + q.v = textp || ''; + if (textR.length) + q.R = textR; + isstub = textpidx == 0; + } + if (atag.Target) + q.l = atag; + if (comments.length > 0) { + q.c = comments; + comments = []; + } + if (textp && opts.cellText !== false) + q.w = textp; + if (isstub) { + q.t = "z"; + delete q.v; + } + if (!isstub || opts.sheetStubs) { + if (!(opts.sheetRows && opts.sheetRows <= R)) { + for (var rpt = 0; rpt < rowpeat; ++rpt) { + colpeat = parseInt(ctag['number-columns-repeated'] || "1", 10); + if (opts.dense) { + if (!ws["!data"][R + rpt]) + ws["!data"][R + rpt] = []; + ws["!data"][R + rpt][C] = rpt == 0 ? q : dup(q); + while (--colpeat > 0) + ws["!data"][R + rpt][C + colpeat] = dup(q); + } + else { + ws[encode_cell({ r: R + rpt, c: C })] = q; + while (--colpeat > 0) + ws[encode_cell({ r: R + rpt, c: C + colpeat })] = dup(q); + } + if (range.e.c <= C) + range.e.c = C; + } + } + } + colpeat = parseInt(ctag['number-columns-repeated'] || "1", 10); + C += colpeat - 1; + colpeat = 0; + q = { /*:: t:"", v:null, z:null, w:"",c:[]*/}; + textp = ""; + textR = []; + } + atag = ({} /*:any*/); + break; // 9.1.4 + /* pure state */ + case 'document': // TODO: is the root for FODS + case 'document-content': + case 'ç”µå­è¡¨æ ¼æ–‡æ¡£': // 3.1.3.2 + case 'spreadsheet': + case '主体': // 3.7 + case 'scripts': // 3.12 + case 'styles': // TODO + case 'font-face-decls': // 3.14 + case 'master-styles': // 3.15.4 -- relevant for FODS + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw "Bad state: " + tmp; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') + state.push([Rn[3], true]); + break; + case 'annotation': // 14.1 + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw "Bad state: " + tmp; + comment.t = textp; + if (textR.length) /*::(*/ + comment /*:: :any)*/.R = textR; + comment.a = creator; + comments.push(comment); + textp = oldtextp; + textpidx = oldtextpidx; + textR = oldtextR; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + state.push([Rn[3], false]); + var annotag = parsexmltag(Rn[0], true); + /* office:display TODO: check if there is a global override */ + if (!(annotag["display"] && parsexmlbool(annotag["display"]))) + comments.hidden = true; + oldtextp = textp; + oldtextpidx = textpidx; + oldtextR = textR; + textp = ""; + textpidx = 0; + textR = []; + } + creator = ""; + creatoridx = 0; + break; + case 'creator': // 4.3.2.7 + if (Rn[1] === '/') { + creator = str.slice(creatoridx, Rn.index); + } + else + creatoridx = Rn.index + Rn[0].length; + break; + /* ignore state */ + case 'meta': + case '元数据': // TODO: FODS/UOF + case 'settings': // TODO: + case 'config-item-set': // TODO: + case 'config-item-map-indexed': // TODO: + case 'config-item-map-entry': // TODO: + case 'config-item-map-named': // TODO: + case 'shapes': // 9.2.8 + case 'frame': // 10.4.2 + case 'text-box': // 10.4.3 + case 'image': // 10.4.4 + case 'data-pilot-tables': // 9.6.2 + case 'list-style': // 16.30 + case 'form': // 13.13 + case 'dde-links': // 9.8 + case 'event-listeners': // TODO + case 'chart': // TODO + if (Rn[1] === '/') { + if ((tmp = state.pop())[0] !== Rn[3]) + throw "Bad state: " + tmp; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') + state.push([Rn[3], false]); + textp = ""; + textpidx = 0; + textR = []; + break; + case 'scientific-number': // + case 'currency-symbol': // + case 'fill-character': // 16.29.5 + break; + case 'text-style': // 16.27.25 + case 'boolean-style': // 16.27.23 + case 'number-style': // 16.27.2 + case 'currency-style': // 16.29.8 + case 'percentage-style': // 16.27.9 + case 'date-style': // 16.27.10 + case 'time-style': // 16.27.18 + if (Rn[1] === '/') { + var xlmlidx = xlmlregex.lastIndex; + parse_ods_styles(str.slice(nfidx, xlmlregex.lastIndex), _opts, number_format_map); + xlmlregex.lastIndex = xlmlidx; + } + else if (Rn[0].charAt(Rn[0].length - 2) !== '/') { + nfidx = xlmlregex.lastIndex - Rn[0].length; + } + break; + case 'script': break; // 3.13 + case 'libraries': break; // TODO: + case 'automatic-styles': break; // 3.15.3 + case 'default-style': // TODO: + case 'page-layout': break; // TODO: + case 'style': + { // 16.2 + var styletag = parsexmltag(Rn[0], false); + if (styletag["family"] == "table-cell" && number_format_map[styletag["data-style-name"]]) + styles[styletag["name"]] = number_format_map[styletag["data-style-name"]]; + } + break; + case 'map': break; // 16.3 + case 'font-face': break; // 16.21 + case 'paragraph-properties': break; // 17.6 + case 'table-properties': break; // 17.15 + case 'table-column-properties': break; // 17.16 + case 'table-row-properties': break; // 17.17 + case 'table-cell-properties': break; // 17.18 + case 'number': // 16.27.3 + break; + case 'fraction': break; // TODO 16.27.6 + case 'day': // 16.27.11 + case 'month': // 16.27.12 + case 'year': // 16.27.13 + case 'era': // 16.27.14 + case 'day-of-week': // 16.27.15 + case 'week-of-year': // 16.27.16 + case 'quarter': // 16.27.17 + case 'hours': // 16.27.19 + case 'minutes': // 16.27.20 + case 'seconds': // 16.27.21 + case 'am-pm': // 16.27.22 + break; + case 'boolean': break; // 16.27.24 + case 'text': // 16.27.26 + if (Rn[0].slice(-2) === "/>") + break; + else if (Rn[1] === "/") + switch (state[state.length - 1][0]) { + case 'number-style': + case 'date-style': + case 'time-style': + NF += str.slice(pidx, Rn.index); + break; + } + else + pidx = Rn.index + Rn[0].length; + break; + case 'named-range': // 9.4.12 + tag = parsexmltag(Rn[0], false); + _Ref = ods_to_csf_3D(tag['cell-range-address']); + var nrange = ({ Name: tag.name, Ref: _Ref[0] + '!' + _Ref[1] } /*:any*/); + if (intable) + nrange.Sheet = SheetNames.length; + WB.Names.push(nrange); + break; + case 'text-content': break; // 16.27.27 + case 'text-properties': break; // 16.27.27 + case 'embedded-text': break; // 16.27.4 + case 'body': + case 'ç”µå­è¡¨æ ¼': break; // 3.3 16.9.6 19.726.3 + case 'forms': break; // 12.25.2 13.2 + case 'table-column': break; // 9.1.6 + case 'table-header-rows': break; // 9.1.7 + case 'table-rows': break; // 9.1.12 + /* TODO: outline levels */ + case 'table-column-group': break; // 9.1.10 + case 'table-header-columns': break; // 9.1.11 + case 'table-columns': break; // 9.1.12 + case 'null-date': // 9.4.2 + tag = parsexmltag(Rn[0], false); + switch (tag["date-value"]) { + case "1904-01-01": + WB.WBProps.date1904 = true; + break; + } + break; + case 'graphic-properties': break; // 17.21 + case 'calculation-settings': break; // 9.4.1 + case 'named-expressions': break; // 9.4.11 + case 'label-range': break; // 9.4.9 + case 'label-ranges': break; // 9.4.10 + case 'named-expression': break; // 9.4.13 + case 'sort': break; // 9.4.19 + case 'sort-by': break; // 9.4.20 + case 'sort-groups': break; // 9.4.22 + case 'tab': break; // 6.1.4 + case 'line-break': break; // 6.1.5 + case 'span': break; // 6.1.7 + case 'p': + case '文本串': // 5.1.3 + if (['master-styles'].indexOf(state[state.length - 1][0]) > -1) + break; + if (Rn[1] === '/' && (!ctag || !ctag['string-value'])) { + var ptp = parse_text_p(str.slice(textpidx, Rn.index), textptag); + textp = (textp.length > 0 ? textp + "\n" : "") + ptp[0]; + } + else if (Rn[0].slice(-2) == "/>") { + /* TODO: is self-closing 文本串 valid? */ + textp += "\n"; + } + else { + textptag = parsexmltag(Rn[0], false); + textpidx = Rn.index + Rn[0].length; + } + break; // + case 's': break; // + case 'database-range': // 9.4.15 + if (Rn[1] === '/') + break; + try { + _Ref = ods_to_csf_3D(parsexmltag(Rn[0])['target-range-address']); + Sheets[_Ref[0]]['!autofilter'] = { ref: _Ref[1] }; + } + catch (e) { /* empty */ } + break; + case 'date': break; // <*:date> + case 'object': break; // 10.4.6.2 + case 'title': + case 'æ ‡é¢˜': break; // <*:title> OR + case 'desc': break; // <*:desc> + case 'binary-data': break; // 10.4.5 TODO: b64 blob + /* 9.2 Advanced Tables */ + case 'table-source': break; // 9.2.6 + case 'scenario': break; // 9.2.6 + case 'iteration': break; // 9.4.3 + case 'content-validations': break; // 9.4.4 + case 'filter': break; // 9.5.2 + case 'filter-and': break; // 9.5.3 + case 'filter-or': break; // 9.5.4 + case 'filter-condition': break; // 9.5.5 + case 'list-level-style-bullet': break; // 16.31 + case 'page-count': break; // TODO + case 'time': break; // TODO + /* 9.3 Advanced Table Cells */ + case 'cell-range-source': break; // 9.3.1 + case 'property': break; // 13.8 + case 'a': // 6.1.8 hyperlink + if (Rn[1] !== '/') { + atag = parsexmltag(Rn[0], false); + if (!atag.href) + break; + atag.Target = unescapexml(atag.href); + delete atag.href; + if (atag.Target.charAt(0) == "#" && atag.Target.indexOf(".") > -1) { + _Ref = ods_to_csf_3D(atag.Target.slice(1)); + atag.Target = "#" + _Ref[0] + "!" + _Ref[1]; + } + else if (atag.Target.match(/^\.\.[\\\/]/)) + atag.Target = atag.Target.slice(3); + } + break; + /* non-standard */ + case 'table-protection': break; + case 'data-pilot-grand-total': break; // ', + '', + '', + '', + '', + '', + '', + '' + ].join(""); + var payload = '' + master_styles + ''; + return function wso( /*::wb, opts*/) { + return XML_HEADER + payload; + }; +})(); +// TODO: find out if anyone actually read the spec. LO has some wild errors +function write_number_format_ods(nf /*:string*/, nfidx /*:string*/) { + var type = "number", payload = "", nopts = { "style:name": nfidx }, c = "", i = 0; + nf = nf.replace(/"[$]"/g, "$"); + /* TODO: replace with an actual parser based on a real grammar */ + j: { + // TODO: support style maps + if (nf.indexOf(";") > -1) { + console.error("Unsupported ODS Style Map exported. Using first branch of " + nf); + nf = nf.slice(0, nf.indexOf(";")); + } + if (nf == "@") { + type = "text"; + payload = ""; + break j; + } + /* currency flag */ + if (nf.indexOf(/\$/) > -1) { + type = "currency"; + } + /* opening string literal */ + if (nf[i] == '"') { + c = ""; + while (nf[++i] != '"' || nf[++i] == '"') + c += nf[i]; + --i; + if (nf[i + 1] == "*") { + i++; + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } + else { + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } + nf = nf.slice(i + 1); + i = 0; + } + /* fractions */ + var t = nf.match(/# (\?+)\/(\?+)/); + if (t) { + payload += writextag("number:fraction", null, { "number:min-integer-digits": 0, "number:min-numerator-digits": t[1].length, "number:max-denominator-value": Math.max(+(t[1].replace(/./g, "9")), +(t[2].replace(/./g, "9"))) }); + break j; + } + if ((t = nf.match(/# (\?+)\/(\d+)/))) { + payload += writextag("number:fraction", null, { "number:min-integer-digits": 0, "number:min-numerator-digits": t[1].length, "number:denominator-value": +t[2] }); + break j; + } + /* percentages */ + if ((t = nf.match(/(\d+)(|\.\d+)%/))) { + type = "percentage"; + payload += writextag("number:number", null, { "number:decimal-places": t[2] && t.length - 1 || 0, "number:min-decimal-places": t[2] && t.length - 1 || 0, "number:min-integer-digits": t[1].length }) + "%"; + break j; + } + /* datetime */ + var has_time = false; + if (["y", "m", "d"].indexOf(nf[0]) > -1) { + type = "date"; + k: for (; i < nf.length; ++i) + switch ((c = nf[i].toLowerCase())) { + case "h": + case "s": + has_time = true; + --i; + break k; + case "m": + l: for (var h = i + 1; h < nf.length; ++h) + switch (nf[h]) { + case "y": + case "d": break l; + case "h": + case "s": + has_time = true; + --i; + break k; + } + /* falls through */ + case "y": + case "d": + while ((nf[++i] || "").toLowerCase() == c[0]) + c += c[0]; + --i; + switch (c) { + case "y": + case "yy": + payload += ""; + break; + case "yyy": + case "yyyy": + payload += ''; + break; + case "mmmmm": console.error("ODS has no equivalent of format |mmmmm|"); + /* falls through */ + case "m": + case "mm": + case "mmm": + case "mmmm": + payload += ''; + break; + case "d": + case "dd": + payload += ''; + break; + case "ddd": + case "dddd": + payload += ''; + break; + } + break; + case '"': + while (nf[++i] != '"' || nf[++i] == '"') + c += nf[i]; + --i; + payload += '' + escapexml(c.slice(1).replace(/""/g, '"')) + ''; + break; + case '\\': + c = nf[++i]; + payload += '' + escapexml(c) + ''; + break; + case '/': + case ':': + payload += '' + escapexml(c) + ''; + break; + default: console.error("unrecognized character " + c + " in ODF format " + nf); + } + if (!has_time) + break j; + nf = nf.slice(i + 1); + i = 0; + } + if (nf.match(/^\[?[hms]/)) { + if (type == "number") + type = "time"; + if (nf.match(/\[/)) { + nf = nf.replace(/[\[\]]/g, ""); + nopts['number:truncate-on-overflow'] = "false"; + } + for (; i < nf.length; ++i) + switch ((c = nf[i].toLowerCase())) { + case "h": + case "m": + case "s": + while ((nf[++i] || "").toLowerCase() == c[0]) + c += c[0]; + --i; + switch (c) { + case "h": + case "hh": + payload += ''; + break; + case "m": + case "mm": + payload += ''; + break; + case "s": + case "ss": + if (nf[i + 1] == ".") + do { + c += nf[i + 1]; + ++i; + } while (nf[i + 1] == "0"); + payload += ''; + break; + } + break; + case '"': + while (nf[++i] != '"' || nf[++i] == '"') + c += nf[i]; + --i; + payload += '' + escapexml(c.slice(1).replace(/""/g, '"')) + ''; + break; + case '/': + case ':': + payload += '' + escapexml(c) + ''; + break; + case "a": + if (nf.slice(i, i + 3).toLowerCase() == "a/p") { + payload += ''; + i += 2; + break; + } // Note: ODF does not support A/P + if (nf.slice(i, i + 5).toLowerCase() == "am/pm") { + payload += ''; + i += 4; + break; + } + /* falls through */ + default: console.error("unrecognized character " + c + " in ODF format " + nf); + } + break j; + } + /* currency flag */ + if (nf.indexOf(/\$/) > -1) { + type = "currency"; + } + /* should be in a char loop */ + if (nf[0] == "$") { + payload += '$'; + nf = nf.slice(1); + i = 0; + } + i = 0; + if (nf[i] == '"') { + while (nf[++i] != '"' || nf[++i] == '"') + c += nf[i]; + --i; + if (nf[i + 1] == "*") { + i++; + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } + else { + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } + nf = nf.slice(i + 1); + i = 0; + } + /* number TODO: interstitial text e.g. 000)000-0000 */ + var np = nf.match(/([#0][0#,]*)(\.[0#]*|)(E[+]?0*|)/i); + if (!np || !np[0]) + console.error("Could not find numeric part of " + nf); + else { + var base = np[1].replace(/,/g, ""); + payload += ' -1 ? ' number:grouping="true"' : "") + + (np[2] && ' number:decimal-places="' + (np[2].length - 1) + '"' || ' number:decimal-places="0"') + + (np[3] && np[3].indexOf("+") > -1 ? ' number:forced-exponent-sign="true"' : "") + + (np[3] ? ' number:min-exponent-digits="' + np[3].match(/0+/)[0].length + '"' : "") + + '>' + + /* TODO: interstitial text placeholders */ + ''; + i = np.index + np[0].length; + } + /* residual text */ + if (nf[i] == '"') { + c = ""; + while (nf[++i] != '"' || nf[++i] == '"') + c += nf[i]; + --i; + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } + } + if (!payload) { + console.error("Could not generate ODS number format for |" + nf + "|"); + return ""; + } + return writextag("number:" + type + "-style", payload, nopts); +} +function write_names_ods(Names, SheetNames, idx) { + //var scoped = Names.filter(function(name) { return name.Sheet == (idx == -1 ? null : idx); }); + var scoped = []; + for (var namei = 0; namei < Names.length; ++namei) { + var name = Names[namei]; + if (!name) + continue; + if (name.Sheet == (idx == -1 ? null : idx)) + scoped.push(name); + } + if (!scoped.length) + return ""; + return " \n" + scoped.map(function (name) { + var odsref = (idx == -1 ? "$" : "") + csf_to_ods_3D(name.Ref); + return " " + writextag("table:named-range", null, { + "table:name": name.Name, + "table:cell-range-address": odsref, + "table:base-cell-address": odsref.replace(/[\.]?[^\.]*$/, ".$A$1") + }); + }).join("\n") + "\n \n"; +} +var write_content_ods /*:{(wb:any, opts:any):string}*/ = /* @__PURE__ */ (function () { + /* 6.1.2 White Space Characters */ + var write_text_p = function (text /*:string*/) { + return escapexml(text) + .replace(/ +/g, function ($$) { return ''; }) + .replace(/\t/g, "") + .replace(/\n/g, "") + .replace(/^ /, "").replace(/ $/, ""); + }; + var null_cell_xml = ' \n'; + var write_ws = function (ws, wb /*:Workbook*/, i /*:number*/, opts, nfs, date1904) { + /* Section 9 Tables */ + var o /*:Array*/ = []; + o.push(' \n'); + var R = 0, C = 0, range = decode_range(ws['!ref'] || "A1"); + var marr /*:Array*/ = ws['!merges'] || [], mi = 0; + var dense = ws["!data"] != null; + if (ws["!cols"]) { + for (C = 0; C <= range.e.c; ++C) + o.push(' \n'); + } + var H = "", ROWS = ws["!rows"] || []; + for (R = 0; R < range.s.r; ++R) { + H = ROWS[R] ? ' table:style-name="ro' + ROWS[R].ods + '"' : ""; + o.push(' \n'); + } + for (; R <= range.e.r; ++R) { + H = ROWS[R] ? ' table:style-name="ro' + ROWS[R].ods + '"' : ""; + o.push(' \n'); + for (C = 0; C < range.s.c; ++C) + o.push(null_cell_xml); + for (; C <= range.e.c; ++C) { + var skip = false, ct = {}, textp = ""; + for (mi = 0; mi != marr.length; ++mi) { + if (marr[mi].s.c > C) + continue; + if (marr[mi].s.r > R) + continue; + if (marr[mi].e.c < C) + continue; + if (marr[mi].e.r < R) + continue; + if (marr[mi].s.c != C || marr[mi].s.r != R) + skip = true; + ct['table:number-columns-spanned'] = (marr[mi].e.c - marr[mi].s.c + 1); + ct['table:number-rows-spanned'] = (marr[mi].e.r - marr[mi].s.r + 1); + break; + } + if (skip) { + o.push(' \n'); + continue; + } + var ref = encode_cell({ r: R, c: C }), cell = dense ? (ws["!data"][R] || [])[C] : ws[ref]; + if (cell && cell.f) { + ct['table:formula'] = escapexml(csf_to_ods_formula(cell.f)); + if (cell.F) { + if (cell.F.slice(0, ref.length) == ref) { + var _Fref = decode_range(cell.F); + ct['table:number-matrix-columns-spanned'] = (_Fref.e.c - _Fref.s.c + 1); + ct['table:number-matrix-rows-spanned'] = (_Fref.e.r - _Fref.s.r + 1); + } + } + } + if (!cell) { + o.push(null_cell_xml); + continue; + } + switch (cell.t) { + case 'b': + textp = (cell.v ? 'TRUE' : 'FALSE'); + ct['office:value-type'] = "boolean"; + ct['office:boolean-value'] = (cell.v ? 'true' : 'false'); + break; + case 'n': + textp = (cell.w || String(cell.v || 0)); + ct['office:value-type'] = "float"; + ct['office:value'] = (cell.v || 0); + break; + case 's': + case 'str': + textp = cell.v == null ? "" : cell.v; + ct['office:value-type'] = "string"; + break; + case 'd': + textp = (cell.w || (parseDate(cell.v, date1904).toISOString())); + ct['office:value-type'] = "date"; + ct['office:date-value'] = (parseDate(cell.v, date1904).toISOString()); + ct['table:style-name'] = "ce1"; + break; + //case 'e': // TODO: translate to ODS errors + default: + o.push(null_cell_xml); + continue; // TODO: empty cell with comments + } + var text_p = write_text_p(textp); + if (cell.l && cell.l.Target) { + var _tgt = cell.l.Target; + _tgt = _tgt.charAt(0) == "#" ? "#" + csf_to_ods_3D(_tgt.slice(1)) : _tgt; + // TODO: choose correct parent path format based on link delimiters + if (_tgt.charAt(0) != "#" && !_tgt.match(/^\w+:/)) + _tgt = '../' + _tgt; + text_p = writextag('text:a', text_p, { 'xlink:href': _tgt.replace(/&/g, "&") }); + } + if (nfs[cell.z]) + ct["table:style-name"] = "ce" + nfs[cell.z].slice(1); + var payload = writextag('text:p', text_p, {}); + if (cell.c) { + var acreator = "", apayload = "", aprops = {}; + for (var ci = 0; ci < cell.c.length; ++ci) { + if (!acreator && cell.c[ci].a) + acreator = cell.c[ci].a; + apayload += "" + write_text_p(cell.c[ci].t) + ""; + } + if (!cell.c.hidden) + aprops["office:display"] = true; + payload = writextag('office:annotation', apayload, aprops) + payload; + } + o.push(' ' + writextag('table:table-cell', payload, ct) + '\n'); + } + o.push(' \n'); + } + if ((wb.Workbook || {}).Names) + o.push(write_names_ods(wb.Workbook.Names, wb.SheetNames, i)); + o.push(' \n'); + return o.join(""); + }; + var write_automatic_styles_ods = function (o /*:Array*/, wb) { + o.push(' \n'); + /* column styles */ + var cidx = 0; + wb.SheetNames.map(function (n) { return wb.Sheets[n]; }).forEach(function (ws) { + if (!ws) + return; + if (ws["!cols"]) { + for (var C = 0; C < ws["!cols"].length; ++C) + if (ws["!cols"][C]) { + var colobj = ws["!cols"][C]; + if (colobj.width == null && colobj.wpx == null && colobj.wch == null) + continue; + process_col(colobj); + colobj.ods = cidx; + var w = ws["!cols"][C].wpx + "px"; + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + ++cidx; + } + } + }); + /* row styles */ + var ridx = 0; + wb.SheetNames.map(function (n) { return wb.Sheets[n]; }).forEach(function (ws) { + if (!ws) + return; + if (ws["!rows"]) { + for (var R = 0; R < ws["!rows"].length; ++R) + if (ws["!rows"][R]) { + ws["!rows"][R].ods = ridx; + var h = ws["!rows"][R].hpx + "px"; + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + ++ridx; + } + } + }); + /* table */ + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + o.push(' /\n'); + o.push(' \n'); + o.push(' /\n'); + o.push(' \n'); + o.push(' \n'); + /* number formats, table cells, text */ + var nfs = {}; + var nfi = 69; + wb.SheetNames.map(function (n) { return wb.Sheets[n]; }).forEach(function (ws) { + if (!ws) + return; + var dense = (ws["!data"] != null); + var range = decode_range(ws["!ref"]); + for (var R = 0; R <= range.e.r; ++R) + for (var C = 0; C <= range.e.c; ++C) { + var c = dense ? (ws["!data"][R] || [])[C] : ws[encode_cell({ r: R, c: C })]; + if (!c || !c.z || c.z.toLowerCase() == "general") + continue; + if (!nfs[c.z]) { + var out = write_number_format_ods(c.z, "N" + nfi); + if (out) { + nfs[c.z] = "N" + nfi; + ++nfi; + o.push(out + "\n"); + } + } + } + }); + o.push(' \n'); + keys(nfs).forEach(function (nf) { + o.push('\n'); + }); + /* page-layout */ + o.push(' \n'); + return nfs; + }; + return function wcx(wb, opts) { + var o = [XML_HEADER]; + /* 3.1.3.2 */ + var attr = wxt_helper({ + 'xmlns:office': "urn:oasis:names:tc:opendocument:xmlns:office:1.0", + 'xmlns:table': "urn:oasis:names:tc:opendocument:xmlns:table:1.0", + 'xmlns:style': "urn:oasis:names:tc:opendocument:xmlns:style:1.0", + 'xmlns:text': "urn:oasis:names:tc:opendocument:xmlns:text:1.0", + 'xmlns:draw': "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", + 'xmlns:fo': "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", + 'xmlns:xlink': "http://www.w3.org/1999/xlink", + 'xmlns:dc': "http://purl.org/dc/elements/1.1/", + 'xmlns:meta': "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", + 'xmlns:number': "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", + 'xmlns:presentation': "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", + 'xmlns:svg': "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", + 'xmlns:chart': "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", + 'xmlns:dr3d': "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", + 'xmlns:math': "http://www.w3.org/1998/Math/MathML", + 'xmlns:form': "urn:oasis:names:tc:opendocument:xmlns:form:1.0", + 'xmlns:script': "urn:oasis:names:tc:opendocument:xmlns:script:1.0", + 'xmlns:ooo': "http://openoffice.org/2004/office", + 'xmlns:ooow': "http://openoffice.org/2004/writer", + 'xmlns:oooc': "http://openoffice.org/2004/calc", + 'xmlns:dom': "http://www.w3.org/2001/xml-events", + 'xmlns:xforms': "http://www.w3.org/2002/xforms", + 'xmlns:xsd': "http://www.w3.org/2001/XMLSchema", + 'xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance", + 'xmlns:sheet': "urn:oasis:names:tc:opendocument:sh33tjs:1.0", + 'xmlns:rpt': "http://openoffice.org/2005/report", + 'xmlns:of': "urn:oasis:names:tc:opendocument:xmlns:of:1.2", + 'xmlns:xhtml': "http://www.w3.org/1999/xhtml", + 'xmlns:grddl': "http://www.w3.org/2003/g/data-view#", + 'xmlns:tableooo': "http://openoffice.org/2009/table", + 'xmlns:drawooo': "http://openoffice.org/2010/draw", + 'xmlns:calcext': "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0", + 'xmlns:loext': "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", + 'xmlns:field': "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", + 'xmlns:formx': "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0", + 'xmlns:css3t': "http://www.w3.org/TR/css3-text/", + 'office:version': "1.2" + }); + var fods = wxt_helper({ + 'xmlns:config': "urn:oasis:names:tc:opendocument:xmlns:config:1.0", + 'office:mimetype': "application/vnd.oasis.opendocument.spreadsheet" + }); + if (opts.bookType == "fods") { + o.push('\n'); + o.push(write_meta_ods().replace(//, "").replace(/<\/office:document-meta>/, "") + "\n"); + // TODO: settings (equiv of settings.xml for ODS) + } + else + o.push('\n'); + // o.push(' \n'); + var nfs = write_automatic_styles_ods(o, wb); + o.push(' \n'); + o.push(' \n'); + if (((wb.Workbook || {}).WBProps || {}).date1904) + o.push(' \n \n \n'); + for (var i = 0; i != wb.SheetNames.length; ++i) + o.push(write_ws(wb.Sheets[wb.SheetNames[i]], wb, i, opts, nfs, ((wb.Workbook || {}).WBProps || {}).date1904)); + if ((wb.Workbook || {}).Names) + o.push(write_names_ods(wb.Workbook.Names, wb.SheetNames, -1)); + o.push(' \n'); + o.push(' \n'); + if (opts.bookType == "fods") + o.push(''); + else + o.push(''); + return o.join(""); + }; +})(); +function write_ods(wb /*:any*/, opts /*:any*/) { + if (opts.bookType == "fods") + return write_content_ods(wb, opts); + var zip = zip_new(); + var f = ""; + var manifest /*:Array >*/ = []; + var rdf /*:Array<[string, string]>*/ = []; + /* Part 3 Section 3.3 MIME Media Type */ + f = "mimetype"; + zip_add_file(zip, f, "application/vnd.oasis.opendocument.spreadsheet"); + /* Part 1 Section 2.2 Documents */ + f = "content.xml"; + zip_add_file(zip, f, write_content_ods(wb, opts)); + manifest.push([f, "text/xml"]); + rdf.push([f, "ContentFile"]); + /* TODO: these are hard-coded styles to satiate excel */ + f = "styles.xml"; + zip_add_file(zip, f, write_styles_ods(wb, opts)); + manifest.push([f, "text/xml"]); + rdf.push([f, "StylesFile"]); + /* TODO: this is hard-coded to satiate excel */ + f = "meta.xml"; + zip_add_file(zip, f, XML_HEADER + write_meta_ods( /*::wb, opts*/)); + manifest.push([f, "text/xml"]); + rdf.push([f, "MetadataFile"]); + /* Part 3 Section 6 Metadata Manifest File */ + f = "manifest.rdf"; + zip_add_file(zip, f, write_rdf(rdf /*, opts*/)); + manifest.push([f, "application/rdf+xml"]); + /* Part 3 Section 4 Manifest File */ + f = "META-INF/manifest.xml"; + zip_add_file(zip, f, write_manifest(manifest /*, opts*/)); + return zip; +} +/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */ +var subarray = function () { + try { + if (typeof Uint8Array == "undefined") + return "slice"; + if (typeof Uint8Array.prototype.subarray == "undefined") + return "slice"; + if (typeof Buffer !== "undefined") { + if (typeof Buffer.prototype.subarray == "undefined") + return "slice"; + if ((typeof Buffer.from == "function" ? Buffer.from([72, 62]) : new Buffer([72, 62])) instanceof Uint8Array) + return "subarray"; + return "slice"; + } + return "subarray"; + } + catch (e) { + return "slice"; + } +}(); +function u8_to_dataview(array) { + return new DataView(array.buffer, array.byteOffset, array.byteLength); +} +function u8str(u8) { + return typeof TextDecoder != "undefined" ? new TextDecoder().decode(u8) : utf8read(a2s(u8)); +} +function stru8(str) { + return typeof TextEncoder != "undefined" ? new TextEncoder().encode(str) : s2a(utf8write(str)); +} +function u8concat(u8a) { + var len = 0; + for (var i = 0; i < u8a.length; ++i) + len += u8a[i].length; + var out = new Uint8Array(len); + var off = 0; + for (i = 0; i < u8a.length; ++i) { + var u8 = u8a[i], L = u8.length; + if (L < 250) { + for (var j = 0; j < L; ++j) + out[off++] = u8[j]; + } + else { + out.set(u8, off); + off += L; + } + } + return out; +} +function popcnt(x) { + x -= x >> 1 & 1431655765; + x = (x & 858993459) + (x >> 2 & 858993459); + return (x + (x >> 4) & 252645135) * 16843009 >>> 24; +} +function readDecimal128LE(buf, offset) { + var exp = (buf[offset + 15] & 127) << 7 | buf[offset + 14] >> 1; + var mantissa = buf[offset + 14] & 1; + for (var j = offset + 13; j >= offset; --j) + mantissa = mantissa * 256 + buf[j]; + return (buf[offset + 15] & 128 ? -mantissa : mantissa) * Math.pow(10, exp - 6176); +} +function writeDecimal128LE(buf, offset, value) { + var exp = Math.floor(value == 0 ? 0 : Math.LOG10E * Math.log(Math.abs(value))) + 6176 - 16; + var mantissa = value / Math.pow(10, exp - 6176); + buf[offset + 15] |= exp >> 7; + buf[offset + 14] |= (exp & 127) << 1; + for (var i = 0; mantissa >= 1; ++i, mantissa /= 256) + buf[offset + i] = mantissa & 255; + buf[offset + 15] |= value >= 0 ? 0 : 128; +} +function parse_varint49(buf, ptr) { + var l = ptr.l; + var usz = buf[l] & 127; + varint: if (buf[l++] >= 128) { + usz |= (buf[l] & 127) << 7; + if (buf[l++] < 128) + break varint; + usz |= (buf[l] & 127) << 14; + if (buf[l++] < 128) + break varint; + usz |= (buf[l] & 127) << 21; + if (buf[l++] < 128) + break varint; + usz += (buf[l] & 127) * Math.pow(2, 28); + ++l; + if (buf[l++] < 128) + break varint; + usz += (buf[l] & 127) * Math.pow(2, 35); + ++l; + if (buf[l++] < 128) + break varint; + usz += (buf[l] & 127) * Math.pow(2, 42); + ++l; + if (buf[l++] < 128) + break varint; + } + ptr.l = l; + return usz; +} +function write_varint49(v) { + var usz = new Uint8Array(7); + usz[0] = v & 127; + var L = 1; + sz: if (v > 127) { + usz[L - 1] |= 128; + usz[L] = v >> 7 & 127; + ++L; + if (v <= 16383) + break sz; + usz[L - 1] |= 128; + usz[L] = v >> 14 & 127; + ++L; + if (v <= 2097151) + break sz; + usz[L - 1] |= 128; + usz[L] = v >> 21 & 127; + ++L; + if (v <= 268435455) + break sz; + usz[L - 1] |= 128; + usz[L] = v / 256 >>> 21 & 127; + ++L; + if (v <= 34359738367) + break sz; + usz[L - 1] |= 128; + usz[L] = v / 65536 >>> 21 & 127; + ++L; + if (v <= 4398046511103) + break sz; + usz[L - 1] |= 128; + usz[L] = v / 16777216 >>> 21 & 127; + ++L; + } + return usz[subarray](0, L); +} +function parse_packed_varints(buf) { + var ptr = { l: 0 }; + var out = []; + while (ptr.l < buf.length) + out.push(parse_varint49(buf, ptr)); + return out; +} +function write_packed_varints(nums) { + return u8concat(nums.map(function (x) { + return write_varint49(x); + })); +} +function varint_to_i32(buf) { + var l = 0, i32 = buf[l] & 127; + if (buf[l++] < 128) + return i32; + i32 |= (buf[l] & 127) << 7; + if (buf[l++] < 128) + return i32; + i32 |= (buf[l] & 127) << 14; + if (buf[l++] < 128) + return i32; + i32 |= (buf[l] & 127) << 21; + if (buf[l++] < 128) + return i32; + i32 |= (buf[l] & 15) << 28; + return i32; +} +function varint_to_u64(buf) { + var l = 0, lo = buf[l] & 127, hi = 0; + varint: if (buf[l++] >= 128) { + lo |= (buf[l] & 127) << 7; + if (buf[l++] < 128) + break varint; + lo |= (buf[l] & 127) << 14; + if (buf[l++] < 128) + break varint; + lo |= (buf[l] & 127) << 21; + if (buf[l++] < 128) + break varint; + lo |= (buf[l] & 127) << 28; + hi = buf[l] >> 4 & 7; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 3; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 10; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 17; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 24; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 31; + } + return [lo >>> 0, hi >>> 0]; +} +function parse_shallow(buf) { + var out = [], ptr = { l: 0 }; + while (ptr.l < buf.length) { + var off = ptr.l; + var num = parse_varint49(buf, ptr); + var type = num & 7; + num = num / 8 | 0; + var data; + var l = ptr.l; + switch (type) { + case 0: + { + while (buf[l++] >= 128) + ; + data = buf[subarray](ptr.l, l); + ptr.l = l; + } + break; + case 1: + { + data = buf[subarray](l, l + 8); + ptr.l = l + 8; + } + break; + case 2: + { + var len = parse_varint49(buf, ptr); + data = buf[subarray](ptr.l, ptr.l + len); + ptr.l += len; + } + break; + case 5: + { + data = buf[subarray](l, l + 4); + ptr.l = l + 4; + } + break; + default: + throw new Error("PB Type ".concat(type, " for Field ").concat(num, " at offset ").concat(off)); + } + var v = { data: data, type: type }; + if (out[num] == null) + out[num] = []; + out[num].push(v); + } + return out; +} +function write_shallow(proto) { + var out = []; + proto.forEach(function (field, idx) { + if (idx == 0) + return; + field.forEach(function (item) { + if (!item.data) + return; + out.push(write_varint49(idx * 8 + item.type)); + if (item.type == 2) + out.push(write_varint49(item.data.length)); + out.push(item.data); + }); + }); + return u8concat(out); +} +function mappa(data, cb) { + return (data == null ? void 0 : data.map(function (d) { + return cb(d.data); + })) || []; +} +function parse_iwa_file(buf) { + var _a; + var out = [], ptr = { l: 0 }; + while (ptr.l < buf.length) { + var len = parse_varint49(buf, ptr); + var ai = parse_shallow(buf[subarray](ptr.l, ptr.l + len)); + ptr.l += len; + var res = { + id: varint_to_i32(ai[1][0].data), + messages: [] + }; + ai[2].forEach(function (b) { + var mi = parse_shallow(b.data); + var fl = varint_to_i32(mi[3][0].data); + res.messages.push({ + meta: mi, + data: buf[subarray](ptr.l, ptr.l + fl) + }); + ptr.l += fl; + }); + if ((_a = ai[3]) == null ? void 0 : _a[0]) + res.merge = varint_to_i32(ai[3][0].data) >>> 0 > 0; + out.push(res); + } + return out; +} +function write_iwa_file(ias) { + var bufs = []; + ias.forEach(function (ia) { + var ai = [ + [], + [{ data: write_varint49(ia.id), type: 0 }], + [] + ]; + if (ia.merge != null) + ai[3] = [{ data: write_varint49(+!!ia.merge), type: 0 }]; + var midata = []; + ia.messages.forEach(function (mi) { + midata.push(mi.data); + mi.meta[3] = [{ type: 0, data: write_varint49(mi.data.length) }]; + ai[2].push({ data: write_shallow(mi.meta), type: 2 }); + }); + var aipayload = write_shallow(ai); + bufs.push(write_varint49(aipayload.length)); + bufs.push(aipayload); + midata.forEach(function (mid) { + return bufs.push(mid); + }); + }); + return u8concat(bufs); +} +function parse_snappy_chunk(type, buf) { + if (type != 0) + throw new Error("Unexpected Snappy chunk type ".concat(type)); + var ptr = { l: 0 }; + var usz = parse_varint49(buf, ptr); + var chunks = []; + var l = ptr.l; + while (l < buf.length) { + var tag = buf[l] & 3; + if (tag == 0) { + var len = buf[l++] >> 2; + if (len < 60) + ++len; + else { + var c = len - 59; + len = buf[l]; + if (c > 1) + len |= buf[l + 1] << 8; + if (c > 2) + len |= buf[l + 2] << 16; + if (c > 3) + len |= buf[l + 3] << 24; + len >>>= 0; + len++; + l += c; + } + chunks.push(buf[subarray](l, l + len)); + l += len; + continue; + } + else { + var offset = 0, length = 0; + if (tag == 1) { + length = (buf[l] >> 2 & 7) + 4; + offset = (buf[l++] & 224) << 3; + offset |= buf[l++]; + } + else { + length = (buf[l++] >> 2) + 1; + if (tag == 2) { + offset = buf[l] | buf[l + 1] << 8; + l += 2; + } + else { + offset = (buf[l] | buf[l + 1] << 8 | buf[l + 2] << 16 | buf[l + 3] << 24) >>> 0; + l += 4; + } + } + if (offset == 0) + throw new Error("Invalid offset 0"); + var j = chunks.length - 1, off = offset; + while (j >= 0 && off >= chunks[j].length) { + off -= chunks[j].length; + --j; + } + if (j < 0) { + if (off == 0) + off = chunks[j = 0].length; + else + throw new Error("Invalid offset beyond length"); + } + if (length < off) + chunks.push(chunks[j][subarray](chunks[j].length - off, chunks[j].length - off + length)); + else { + if (off > 0) { + chunks.push(chunks[j][subarray](chunks[j].length - off)); + length -= off; + } + ++j; + while (length >= chunks[j].length) { + chunks.push(chunks[j]); + length -= chunks[j].length; + ++j; + } + if (length) + chunks.push(chunks[j][subarray](0, length)); + } + if (chunks.length > 25) + chunks = [u8concat(chunks)]; + } + } + var clen = 0; + for (var u8i = 0; u8i < chunks.length; ++u8i) + clen += chunks[u8i].length; + if (clen != usz) + throw new Error("Unexpected length: ".concat(clen, " != ").concat(usz)); + return chunks; +} +function decompress_iwa_file(buf) { + if (Array.isArray(buf)) + buf = new Uint8Array(buf); + var out = []; + var l = 0; + while (l < buf.length) { + var t = buf[l++]; + var len = buf[l] | buf[l + 1] << 8 | buf[l + 2] << 16; + l += 3; + out.push.apply(out, parse_snappy_chunk(t, buf[subarray](l, l + len))); + l += len; + } + if (l !== buf.length) + throw new Error("data is not a valid framed stream!"); + return out.length == 1 ? out[0] : u8concat(out); +} +function compress_iwa_file(buf) { + var out = []; + var l = 0; + while (l < buf.length) { + var c = Math.min(buf.length - l, 268435455); + var frame = new Uint8Array(4); + out.push(frame); + var usz = write_varint49(c); + var L = usz.length; + out.push(usz); + if (c <= 60) { + L++; + out.push(new Uint8Array([c - 1 << 2])); + } + else if (c <= 256) { + L += 2; + out.push(new Uint8Array([240, c - 1 & 255])); + } + else if (c <= 65536) { + L += 3; + out.push(new Uint8Array([244, c - 1 & 255, c - 1 >> 8 & 255])); + } + else if (c <= 16777216) { + L += 4; + out.push(new Uint8Array([248, c - 1 & 255, c - 1 >> 8 & 255, c - 1 >> 16 & 255])); + } + else if (c <= 4294967296) { + L += 5; + out.push(new Uint8Array([252, c - 1 & 255, c - 1 >> 8 & 255, c - 1 >> 16 & 255, c - 1 >>> 24 & 255])); + } + out.push(buf[subarray](l, l + c)); + L += c; + frame[0] = 0; + frame[1] = L & 255; + frame[2] = L >> 8 & 255; + frame[3] = L >> 16 & 255; + l += c; + } + return u8concat(out); +} +var numbers_lut_new = function () { + return { sst: [], rsst: [], ofmt: [], nfmt: [], fmla: [], ferr: [], cmnt: [] }; +}; +function numbers_format_cell(cell, t, flags, ofmt, nfmt) { + var _a, _b, _c, _d; + var ctype = t & 255, ver = t >> 8; + var fmt = ver >= 5 ? nfmt : ofmt; + dur: if (flags & (ver > 4 ? 8 : 4) && cell.t == "n" && ctype == 7) { + var dstyle = ((_a = fmt[7]) == null ? void 0 : _a[0]) ? varint_to_i32(fmt[7][0].data) : -1; + if (dstyle == -1) + break dur; + var dmin = ((_b = fmt[15]) == null ? void 0 : _b[0]) ? varint_to_i32(fmt[15][0].data) : -1; + var dmax = ((_c = fmt[16]) == null ? void 0 : _c[0]) ? varint_to_i32(fmt[16][0].data) : -1; + var auto = ((_d = fmt[40]) == null ? void 0 : _d[0]) ? varint_to_i32(fmt[40][0].data) : -1; + var d = cell.v, dd = d; + autodur: if (auto) { + if (d == 0) { + dmin = dmax = 2; + break autodur; + } + if (d >= 604800) + dmin = 1; + else if (d >= 86400) + dmin = 2; + else if (d >= 3600) + dmin = 4; + else if (d >= 60) + dmin = 8; + else if (d >= 1) + dmin = 16; + else + dmin = 32; + if (Math.floor(d) != d) + dmax = 32; + else if (d % 60) + dmax = 16; + else if (d % 3600) + dmax = 8; + else if (d % 86400) + dmax = 4; + else if (d % 604800) + dmax = 2; + if (dmax < dmin) + dmax = dmin; + } + if (dmin == -1 || dmax == -1) + break dur; + var dstr = [], zstr = []; + if (dmin == 1) { + dd = d / 604800; + if (dmax == 1) { + zstr.push('d"d"'); + } + else { + dd |= 0; + d -= 604800 * dd; + } + dstr.push(dd + (dstyle == 2 ? " week" + (dd == 1 ? "" : "s") : dstyle == 1 ? "w" : "")); + } + if (dmin <= 2 && dmax >= 2) { + dd = d / 86400; + if (dmax > 2) { + dd |= 0; + d -= 86400 * dd; + } + zstr.push('d"d"'); + dstr.push(dd + (dstyle == 2 ? " day" + (dd == 1 ? "" : "s") : dstyle == 1 ? "d" : "")); + } + if (dmin <= 4 && dmax >= 4) { + dd = d / 3600; + if (dmax > 4) { + dd |= 0; + d -= 3600 * dd; + } + zstr.push((dmin >= 4 ? "[h]" : "h") + '"h"'); + dstr.push(dd + (dstyle == 2 ? " hour" + (dd == 1 ? "" : "s") : dstyle == 1 ? "h" : "")); + } + if (dmin <= 8 && dmax >= 8) { + dd = d / 60; + if (dmax > 8) { + dd |= 0; + d -= 60 * dd; + } + zstr.push((dmin >= 8 ? "[m]" : "m") + '"m"'); + if (dstyle == 0) + dstr.push((dmin == 8 && dmax == 8 || dd >= 10 ? "" : "0") + dd); + else + dstr.push(dd + (dstyle == 2 ? " minute" + (dd == 1 ? "" : "s") : dstyle == 1 ? "m" : "")); + } + if (dmin <= 16 && dmax >= 16) { + dd = d; + if (dmax > 16) { + dd |= 0; + d -= dd; + } + zstr.push((dmin >= 16 ? "[s]" : "s") + '"s"'); + if (dstyle == 0) + dstr.push((dmax == 16 && dmin == 16 || dd >= 10 ? "" : "0") + dd); + else + dstr.push(dd + (dstyle == 2 ? " second" + (dd == 1 ? "" : "s") : dstyle == 1 ? "s" : "")); + } + if (dmax >= 32) { + dd = Math.round(1e3 * d); + if (dmin < 32) + zstr.push('.000"ms"'); + if (dstyle == 0) + dstr.push((dd >= 100 ? "" : dd >= 10 ? "0" : "00") + dd); + else + dstr.push(dd + (dstyle == 2 ? " millisecond" + (dd == 1 ? "" : "s") : dstyle == 1 ? "ms" : "")); + } + cell.w = dstr.join(dstyle == 0 ? ":" : " "); + cell.z = zstr.join(dstyle == 0 ? '":"' : " "); + if (dstyle == 0) + cell.w = cell.w.replace(/:(\d\d\d)$/, ".$1"); + } +} +function parse_old_storage(buf, lut, v, opts) { + var dv = u8_to_dataview(buf); + var flags = dv.getUint32(4, true); + var ridx = -1, sidx = -1, zidx = -1, ieee = NaN, dc = 0, dt = new Date(Date.UTC(2001, 0, 1)); + var doff = v > 1 ? 12 : 8; + if (flags & 2) { + zidx = dv.getUint32(doff, true); + doff += 4; + } + doff += popcnt(flags & (v > 1 ? 3468 : 396)) * 4; + if (flags & 512) { + ridx = dv.getUint32(doff, true); + doff += 4; + } + doff += popcnt(flags & (v > 1 ? 12288 : 4096)) * 4; + if (flags & 16) { + sidx = dv.getUint32(doff, true); + doff += 4; + } + if (flags & 32) { + ieee = dv.getFloat64(doff, true); + doff += 8; + } + if (flags & 64) { + dt.setTime(dt.getTime() + (dc = dv.getFloat64(doff, true)) * 1e3); + doff += 8; + } + if (v > 1) { + flags = dv.getUint32(8, true) >>> 16; + if (flags & 255) { + if (zidx == -1) + zidx = dv.getUint32(doff, true); + doff += 4; + } + } + var ret; + var t = buf[v >= 4 ? 1 : 2]; + switch (t) { + case 0: + return void 0; + case 2: + ret = { t: "n", v: ieee }; + break; + case 3: + ret = { t: "s", v: lut.sst[sidx] }; + break; + case 5: + { + if (opts == null ? void 0 : opts.cellDates) + ret = { t: "d", v: dt }; + else + ret = { t: "n", v: dc / 86400 + 35430, z: table_fmt[14] }; + } + break; + case 6: + ret = { t: "b", v: ieee > 0 }; + break; + case 7: + ret = { t: "n", v: ieee }; + break; + case 8: + ret = { t: "e", v: 0 }; + break; + case 9: + { + if (ridx > -1) { + var rts = lut.rsst[ridx]; + ret = { t: "s", v: rts.v }; + if (rts.l) + ret.l = { Target: rts.l }; + } + else + throw new Error("Unsupported cell type ".concat(buf[subarray](0, 4))); + } + break; + default: + throw new Error("Unsupported cell type ".concat(buf[subarray](0, 4))); + } + if (zidx > -1) + numbers_format_cell(ret, t | v << 8, flags, lut.ofmt[zidx], lut.nfmt[zidx]); + if (t == 7) + ret.v /= 86400; + return ret; +} +function parse_new_storage(buf, lut, opts) { + var dv = u8_to_dataview(buf); + var flags = dv.getUint32(4, true); + var fields = dv.getUint32(8, true); + var doff = 12; + var ridx = -1, sidx = -1, zidx = -1, d128 = NaN, ieee = NaN, dc = 0, dt = new Date(Date.UTC(2001, 0, 1)), eidx = -1, fidx = -1; + if (fields & 1) { + d128 = readDecimal128LE(buf, doff); + doff += 16; + } + if (fields & 2) { + ieee = dv.getFloat64(doff, true); + doff += 8; + } + if (fields & 4) { + dt.setTime(dt.getTime() + (dc = dv.getFloat64(doff, true)) * 1e3); + doff += 8; + } + if (fields & 8) { + sidx = dv.getUint32(doff, true); + doff += 4; + } + if (fields & 16) { + ridx = dv.getUint32(doff, true); + doff += 4; + } + doff += popcnt(fields & 480) * 4; + if (fields & 512) { + fidx = dv.getUint32(doff, true); + doff += 4; + } + doff += popcnt(fields & 1024) * 4; + if (fields & 2048) { + eidx = dv.getUint32(doff, true); + doff += 4; + } + var ret; + var t = buf[1]; + switch (t) { + case 0: + ret = { t: "z" }; + break; + case 2: + ret = { t: "n", v: d128 }; + break; + case 3: + ret = { t: "s", v: lut.sst[sidx] }; + break; + case 5: + { + if (opts == null ? void 0 : opts.cellDates) + ret = { t: "d", v: dt }; + else + ret = { t: "n", v: dc / 86400 + 35430, z: table_fmt[14] }; + } + break; + case 6: + ret = { t: "b", v: ieee > 0 }; + break; + case 7: + ret = { t: "n", v: ieee }; + break; + case 8: + ret = { t: "e", v: 0 }; + break; + case 9: + { + if (ridx > -1) { + var rts = lut.rsst[ridx]; + ret = { t: "s", v: rts.v }; + if (rts.l) + ret.l = { Target: rts.l }; + } + else + throw new Error("Unsupported cell type ".concat(buf[1], " : ").concat(fields & 31, " : ").concat(buf[subarray](0, 4))); + } + break; + case 10: + ret = { t: "n", v: d128 }; + break; + default: + throw new Error("Unsupported cell type ".concat(buf[1], " : ").concat(fields & 31, " : ").concat(buf[subarray](0, 4))); + } + doff += popcnt(fields & 4096) * 4; + if (fields & 516096) { + if (zidx == -1) + zidx = dv.getUint32(doff, true); + doff += 4; + } + if (fields & 524288) { + var cmntidx = dv.getUint32(doff, true); + doff += 4; + if (lut.cmnt[cmntidx]) + ret.c = iwa_to_s5s_comment(lut.cmnt[cmntidx]); + } + if (zidx > -1) + numbers_format_cell(ret, t | 5 << 8, fields >> 13, lut.ofmt[zidx], lut.nfmt[zidx]); + if (t == 7) + ret.v /= 86400; + return ret; +} +function write_new_storage(cell, lut) { + var out = new Uint8Array(32), dv = u8_to_dataview(out), l = 12, fields = 0; + out[0] = 5; + switch (cell.t) { + case "n": + if (cell.z && fmt_is_date(cell.z)) { + out[1] = 5; + dv.setFloat64(l, (numdate(cell.v + 1462).getTime() - Date.UTC(2001, 0, 1)) / 1e3, true); + fields |= 4; + l += 8; + break; + } + else { + out[1] = 2; + writeDecimal128LE(out, l, cell.v); + fields |= 1; + l += 16; + } + break; + case "b": + out[1] = 6; + dv.setFloat64(l, cell.v ? 1 : 0, true); + fields |= 2; + l += 8; + break; + case "s": + { + var s = cell.v == null ? "" : String(cell.v); + if (cell.l) { + var irsst = lut.rsst.findIndex(function (v) { + var _a; + return v.v == s && v.l == ((_a = cell.l) == null ? void 0 : _a.Target); + }); + if (irsst == -1) + lut.rsst[irsst = lut.rsst.length] = { v: s, l: cell.l.Target }; + out[1] = 9; + dv.setUint32(l, irsst, true); + fields |= 16; + l += 4; + } + else { + var isst = lut.sst.indexOf(s); + if (isst == -1) + lut.sst[isst = lut.sst.length] = s; + out[1] = 3; + dv.setUint32(l, isst, true); + fields |= 8; + l += 4; + } + } + break; + case "d": + out[1] = 5; + dv.setFloat64(l, (cell.v.getTime() - Date.UTC(2001, 0, 1)) / 1e3, true); + fields |= 4; + l += 8; + break; + case "z": + out[1] = 0; + break; + default: + throw "unsupported cell type " + cell.t; + } + if (cell.c) { + lut.cmnt.push(s5s_to_iwa_comment(cell.c)); + dv.setUint32(l, lut.cmnt.length - 1, true); + fields |= 524288; + l += 4; + } + dv.setUint32(8, fields, true); + return out[subarray](0, l); +} +function write_old_storage(cell, lut) { + var out = new Uint8Array(32), dv = u8_to_dataview(out), l = 12, fields = 0, s = ""; + out[0] = 4; + switch (cell.t) { + case "n": + break; + case "b": + break; + case "s": + { + s = cell.v == null ? "" : String(cell.v); + if (cell.l) { + var irsst = lut.rsst.findIndex(function (v) { + var _a; + return v.v == s && v.l == ((_a = cell.l) == null ? void 0 : _a.Target); + }); + if (irsst == -1) + lut.rsst[irsst = lut.rsst.length] = { v: s, l: cell.l.Target }; + out[1] = 9; + dv.setUint32(l, irsst, true); + fields |= 512; + l += 4; + } + else { + } + } + break; + case "d": + break; + case "e": + break; + case "z": + break; + default: + throw "unsupported cell type " + cell.t; + } + if (cell.c) { + dv.setUint32(l, lut.cmnt.length - 1, true); + fields |= 4096; + l += 4; + } + switch (cell.t) { + case "n": + out[1] = 2; + dv.setFloat64(l, cell.v, true); + fields |= 32; + l += 8; + break; + case "b": + out[1] = 6; + dv.setFloat64(l, cell.v ? 1 : 0, true); + fields |= 32; + l += 8; + break; + case "s": + { + s = cell.v == null ? "" : String(cell.v); + if (cell.l) { + } + else { + var isst = lut.sst.indexOf(s); + if (isst == -1) + lut.sst[isst = lut.sst.length] = s; + out[1] = 3; + dv.setUint32(l, isst, true); + fields |= 16; + l += 4; + } + } + break; + case "d": + out[1] = 5; + dv.setFloat64(l, (cell.v.getTime() - Date.UTC(2001, 0, 1)) / 1e3, true); + fields |= 64; + l += 8; + break; + case "z": + out[1] = 0; + break; + default: + throw "unsupported cell type " + cell.t; + } + dv.setUint32(8, fields, true); + return out[subarray](0, l); +} +function parse_cell_storage(buf, lut, opts) { + switch (buf[0]) { + case 0: + case 1: + case 2: + case 3: + case 4: + return parse_old_storage(buf, lut, buf[0], opts); + case 5: + return parse_new_storage(buf, lut, opts); + default: + throw new Error("Unsupported payload version ".concat(buf[0])); + } +} +function parse_TSP_Reference(buf) { + var pb = parse_shallow(buf); + return varint_to_i32(pb[1][0].data); +} +function write_TSP_Reference(idx) { + return write_shallow([ + [], + [{ type: 0, data: write_varint49(idx) }] + ]); +} +function numbers_add_oref(iwa, ref) { + var _a; + var orefs = ((_a = iwa.messages[0].meta[5]) == null ? void 0 : _a[0]) ? parse_packed_varints(iwa.messages[0].meta[5][0].data) : []; + var orefidx = orefs.indexOf(ref); + if (orefidx == -1) { + orefs.push(ref); + iwa.messages[0].meta[5] = [{ type: 2, data: write_packed_varints(orefs) }]; + } +} +function numbers_del_oref(iwa, ref) { + var _a; + var orefs = ((_a = iwa.messages[0].meta[5]) == null ? void 0 : _a[0]) ? parse_packed_varints(iwa.messages[0].meta[5][0].data) : []; + iwa.messages[0].meta[5] = [{ type: 2, data: write_packed_varints(orefs.filter(function (r) { + return r != ref; + })) }]; +} +function parse_TST_TableDataList(M, root) { + var pb = parse_shallow(root.data); + var type = varint_to_i32(pb[1][0].data); + var entries = pb[3]; + var data = []; + (entries || []).forEach(function (entry) { + var _a, _b; + var le = parse_shallow(entry.data); + if (!le[1]) + return; + var key = varint_to_i32(le[1][0].data) >>> 0; + switch (type) { + case 1: + data[key] = u8str(le[3][0].data); + break; + case 8: + { + var rt = M[parse_TSP_Reference(le[9][0].data)][0]; + var rtp = parse_shallow(rt.data); + var rtpref = M[parse_TSP_Reference(rtp[1][0].data)][0]; + var mtype = varint_to_i32(rtpref.meta[1][0].data); + if (mtype != 2001) + throw new Error("2000 unexpected reference to ".concat(mtype)); + var tswpsa = parse_shallow(rtpref.data); + var richtext = { v: tswpsa[3].map(function (x) { + return u8str(x.data); + }).join("") }; + data[key] = richtext; + sfields: if ((_a = tswpsa == null ? void 0 : tswpsa[11]) == null ? void 0 : _a[0]) { + var smartfields = (_b = parse_shallow(tswpsa[11][0].data)) == null ? void 0 : _b[1]; + if (!smartfields) + break sfields; + smartfields.forEach(function (sf) { + var _a2, _b2, _c; + var attr = parse_shallow(sf.data); + if ((_a2 = attr[2]) == null ? void 0 : _a2[0]) { + var obj = M[parse_TSP_Reference((_b2 = attr[2]) == null ? void 0 : _b2[0].data)][0]; + var objtype = varint_to_i32(obj.meta[1][0].data); + switch (objtype) { + case 2032: + var hlink = parse_shallow(obj.data); + if (((_c = hlink == null ? void 0 : hlink[2]) == null ? void 0 : _c[0]) && !richtext.l) + richtext.l = u8str(hlink[2][0].data); + break; + case 2039: + break; + default: + console.log("unrecognized ObjectAttribute type ".concat(objtype)); + } + } + }); + } + } + break; + case 2: + data[key] = parse_shallow(le[6][0].data); + break; + case 3: + data[key] = parse_shallow(le[5][0].data); + break; + case 10: + { + var cs = M[parse_TSP_Reference(le[10][0].data)][0]; + data[key] = parse_TSD_CommentStorageArchive(M, cs.data); + } + break; + default: + throw type; + } + }); + return data; +} +function parse_TST_TileRowInfo(u8, type) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n; + var pb = parse_shallow(u8); + var R = varint_to_i32(pb[1][0].data) >>> 0; + var cnt = varint_to_i32(pb[2][0].data) >>> 0; + var wide_offsets = ((_b = (_a = pb[8]) == null ? void 0 : _a[0]) == null ? void 0 : _b.data) && varint_to_i32(pb[8][0].data) > 0 || false; + var used_storage_u8, used_storage; + if (((_d = (_c = pb[7]) == null ? void 0 : _c[0]) == null ? void 0 : _d.data) && type != 0) { + used_storage_u8 = (_f = (_e = pb[7]) == null ? void 0 : _e[0]) == null ? void 0 : _f.data; + used_storage = (_h = (_g = pb[6]) == null ? void 0 : _g[0]) == null ? void 0 : _h.data; + } + else if (((_j = (_i = pb[4]) == null ? void 0 : _i[0]) == null ? void 0 : _j.data) && type != 1) { + used_storage_u8 = (_l = (_k = pb[4]) == null ? void 0 : _k[0]) == null ? void 0 : _l.data; + used_storage = (_n = (_m = pb[3]) == null ? void 0 : _m[0]) == null ? void 0 : _n.data; + } + else + throw "NUMBERS Tile missing ".concat(type, " cell storage"); + var width = wide_offsets ? 4 : 1; + var used_storage_offsets = u8_to_dataview(used_storage_u8); + var offsets = []; + for (var C = 0; C < used_storage_u8.length / 2; ++C) { + var off = used_storage_offsets.getUint16(C * 2, true); + if (off < 65535) + offsets.push([C, off]); + } + if (offsets.length != cnt) + throw "Expected ".concat(cnt, " cells, found ").concat(offsets.length); + var cells = []; + for (C = 0; C < offsets.length - 1; ++C) + cells[offsets[C][0]] = used_storage[subarray](offsets[C][1] * width, offsets[C + 1][1] * width); + if (offsets.length >= 1) + cells[offsets[offsets.length - 1][0]] = used_storage[subarray](offsets[offsets.length - 1][1] * width); + return { R: R, cells: cells }; +} +function parse_TST_Tile(M, root) { + var _a; + var pb = parse_shallow(root.data); + var storage = -1; + if ((_a = pb == null ? void 0 : pb[7]) == null ? void 0 : _a[0]) { + if (varint_to_i32(pb[7][0].data) >>> 0) + storage = 1; + else + storage = 0; + } + var ri = mappa(pb[5], function (u8) { + return parse_TST_TileRowInfo(u8, storage); + }); + return { + nrows: varint_to_i32(pb[4][0].data) >>> 0, + data: ri.reduce(function (acc, x) { + if (!acc[x.R]) + acc[x.R] = []; + x.cells.forEach(function (cell, C) { + if (acc[x.R][C]) + throw new Error("Duplicate cell r=".concat(x.R, " c=").concat(C)); + acc[x.R][C] = cell; + }); + return acc; + }, []) + }; +} +function parse_TSD_CommentStorageArchive(M, data) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; + var out = { t: "", a: "" }; + var csp = parse_shallow(data); + if ((_b = (_a = csp == null ? void 0 : csp[1]) == null ? void 0 : _a[0]) == null ? void 0 : _b.data) + out.t = u8str((_d = (_c = csp == null ? void 0 : csp[1]) == null ? void 0 : _c[0]) == null ? void 0 : _d.data) || ""; + if ((_f = (_e = csp == null ? void 0 : csp[3]) == null ? void 0 : _e[0]) == null ? void 0 : _f.data) { + var as = M[parse_TSP_Reference((_h = (_g = csp == null ? void 0 : csp[3]) == null ? void 0 : _g[0]) == null ? void 0 : _h.data)][0]; + var asp = parse_shallow(as.data); + if ((_j = (_i = asp[1]) == null ? void 0 : _i[0]) == null ? void 0 : _j.data) + out.a = u8str(asp[1][0].data); + } + if (csp == null ? void 0 : csp[4]) { + out.replies = []; + csp[4].forEach(function (pi) { + var cs = M[parse_TSP_Reference(pi.data)][0]; + out.replies.push(parse_TSD_CommentStorageArchive(M, cs.data)); + }); + } + return out; +} +function iwa_to_s5s_comment(iwa) { + var out = []; + out.push({ t: iwa.t || "", a: iwa.a, T: iwa.replies && iwa.replies.length > 0 }); + if (iwa.replies) + iwa.replies.forEach(function (reply) { + out.push({ t: reply.t || "", a: reply.a, T: true }); + }); + return out; +} +function s5s_to_iwa_comment(s5s) { + var out = { a: "", t: "", replies: [] }; + for (var i = 0; i < s5s.length; ++i) { + if (i == 0) { + out.a = s5s[i].a; + out.t = s5s[i].t; + } + else { + out.replies.push({ a: s5s[i].a, t: s5s[i].t }); + } + } + return out; +} +function parse_TST_TableModelArchive(M, root, ws, opts) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i; + var pb = parse_shallow(root.data); + var range = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + range.e.r = (varint_to_i32(pb[6][0].data) >>> 0) - 1; + if (range.e.r < 0) + throw new Error("Invalid row varint ".concat(pb[6][0].data)); + range.e.c = (varint_to_i32(pb[7][0].data) >>> 0) - 1; + if (range.e.c < 0) + throw new Error("Invalid col varint ".concat(pb[7][0].data)); + ws["!ref"] = encode_range(range); + var dense = ws["!data"] != null, dws = ws; + var store = parse_shallow(pb[4][0].data); + var lut = numbers_lut_new(); + if ((_a = store[4]) == null ? void 0 : _a[0]) + lut.sst = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[4][0].data)][0]); + if ((_b = store[6]) == null ? void 0 : _b[0]) + lut.fmla = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[6][0].data)][0]); + if ((_c = store[11]) == null ? void 0 : _c[0]) + lut.ofmt = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[11][0].data)][0]); + if ((_d = store[12]) == null ? void 0 : _d[0]) + lut.ferr = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[12][0].data)][0]); + if ((_e = store[17]) == null ? void 0 : _e[0]) + lut.rsst = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[17][0].data)][0]); + if ((_f = store[19]) == null ? void 0 : _f[0]) + lut.cmnt = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[19][0].data)][0]); + if ((_g = store[22]) == null ? void 0 : _g[0]) + lut.nfmt = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[22][0].data)][0]); + var tile = parse_shallow(store[3][0].data); + var _R = 0; + tile[1].forEach(function (t) { + var tl = parse_shallow(t.data); + var ref2 = M[parse_TSP_Reference(tl[2][0].data)][0]; + var mtype2 = varint_to_i32(ref2.meta[1][0].data); + if (mtype2 != 6002) + throw new Error("6001 unexpected reference to ".concat(mtype2)); + var _tile = parse_TST_Tile(M, ref2); + _tile.data.forEach(function (row, R) { + row.forEach(function (buf, C) { + var res = parse_cell_storage(buf, lut, opts); + if (res) { + if (dense) { + if (!dws["!data"][_R + R]) + dws["!data"][_R + R] = []; + dws["!data"][_R + R][C] = res; + } + else { + ws[encode_col(C) + encode_row(_R + R)] = res; + } + } + }); + }); + _R += _tile.nrows; + }); + if ((_h = store[13]) == null ? void 0 : _h[0]) { + var ref = M[parse_TSP_Reference(store[13][0].data)][0]; + var mtype = varint_to_i32(ref.meta[1][0].data); + if (mtype != 6144) + throw new Error("Expected merge type 6144, found ".concat(mtype)); + ws["!merges"] = (_i = parse_shallow(ref.data)) == null ? void 0 : _i[1].map(function (pi) { + var merge = parse_shallow(pi.data); + var origin = u8_to_dataview(parse_shallow(merge[1][0].data)[1][0].data), size = u8_to_dataview(parse_shallow(merge[2][0].data)[1][0].data); + return { + s: { r: origin.getUint16(0, true), c: origin.getUint16(2, true) }, + e: { + r: origin.getUint16(0, true) + size.getUint16(0, true) - 1, + c: origin.getUint16(2, true) + size.getUint16(2, true) - 1 + } + }; + }); + } +} +function parse_TST_TableInfoArchive(M, root, opts) { + var pb = parse_shallow(root.data); + var out = { "!ref": "A1" }; + if (opts == null ? void 0 : opts.dense) + out["!data"] = []; + var tableref = M[parse_TSP_Reference(pb[2][0].data)]; + var mtype = varint_to_i32(tableref[0].meta[1][0].data); + if (mtype != 6001) + throw new Error("6000 unexpected reference to ".concat(mtype)); + parse_TST_TableModelArchive(M, tableref[0], out, opts); + return out; +} +function parse_TN_SheetArchive(M, root, opts) { + var _a; + var pb = parse_shallow(root.data); + var out = { + name: ((_a = pb[1]) == null ? void 0 : _a[0]) ? u8str(pb[1][0].data) : "", + sheets: [] + }; + var shapeoffs = mappa(pb[2], parse_TSP_Reference); + shapeoffs.forEach(function (off) { + M[off].forEach(function (m) { + var mtype = varint_to_i32(m.meta[1][0].data); + if (mtype == 6e3) + out.sheets.push(parse_TST_TableInfoArchive(M, m, opts)); + }); + }); + return out; +} +function parse_TN_DocumentArchive(M, root, opts) { + var _a; + var out = book_new(); + out.Workbook = { WBProps: { date1904: true } }; + var pb = parse_shallow(root.data); + if ((_a = pb[2]) == null ? void 0 : _a[0]) + throw new Error("Keynote presentations are not supported"); + var sheetoffs = mappa(pb[1], parse_TSP_Reference); + sheetoffs.forEach(function (off) { + M[off].forEach(function (m) { + var mtype = varint_to_i32(m.meta[1][0].data); + if (mtype == 2) { + var root2 = parse_TN_SheetArchive(M, m, opts); + root2.sheets.forEach(function (sheet, idx) { + book_append_sheet(out, sheet, idx == 0 ? root2.name : root2.name + "_" + idx, true); + }); + } + }); + }); + if (out.SheetNames.length == 0) + throw new Error("Empty NUMBERS file"); + out.bookType = "numbers"; + return out; +} +function parse_numbers_iwa(cfb, opts) { + var _a, _b, _c, _d, _e, _f, _g; + var M = {}, indices = []; + cfb.FullPaths.forEach(function (p) { + if (p.match(/\.iwpv2/)) + throw new Error("Unsupported password protection"); + }); + cfb.FileIndex.forEach(function (s) { + if (!s.name.match(/\.iwa$/)) + return; + if (s.content[0] != 0) + return; + var o; + try { + o = decompress_iwa_file(s.content); + } + catch (e) { + return console.log("?? " + s.content.length + " " + (e.message || e)); + } + var packets; + try { + packets = parse_iwa_file(o); + } + catch (e) { + return console.log("## " + (e.message || e)); + } + packets.forEach(function (packet) { + M[packet.id] = packet.messages; + indices.push(packet.id); + }); + }); + if (!indices.length) + throw new Error("File has no messages"); + if (((_c = (_b = (_a = M == null ? void 0 : M[1]) == null ? void 0 : _a[0].meta) == null ? void 0 : _b[1]) == null ? void 0 : _c[0].data) && varint_to_i32(M[1][0].meta[1][0].data) == 1e4) + throw new Error("Pages documents are not supported"); + var docroot = ((_g = (_f = (_e = (_d = M == null ? void 0 : M[1]) == null ? void 0 : _d[0]) == null ? void 0 : _e.meta) == null ? void 0 : _f[1]) == null ? void 0 : _g[0].data) && varint_to_i32(M[1][0].meta[1][0].data) == 1 && M[1][0]; + if (!docroot) + indices.forEach(function (idx) { + M[idx].forEach(function (iwam) { + var mtype = varint_to_i32(iwam.meta[1][0].data) >>> 0; + if (mtype == 1) { + if (!docroot) + docroot = iwam; + else + throw new Error("Document has multiple roots"); + } + }); + }); + if (!docroot) + throw new Error("Cannot find Document root"); + return parse_TN_DocumentArchive(M, docroot, opts); +} +function write_TST_TileRowInfo(data, lut, wide) { + var _a, _b, _c; + var tri = [ + [], + [{ type: 0, data: write_varint49(0) }], + [{ type: 0, data: write_varint49(0) }], + [{ type: 2, data: new Uint8Array([]) }], + [{ type: 2, data: new Uint8Array(Array.from({ length: 510 }, function () { + return 255; + })) }], + [{ type: 0, data: write_varint49(5) }], + [{ type: 2, data: new Uint8Array([]) }], + [{ type: 2, data: new Uint8Array(Array.from({ length: 510 }, function () { + return 255; + })) }], + [{ type: 0, data: write_varint49(1) }] + ]; + if (!((_a = tri[6]) == null ? void 0 : _a[0]) || !((_b = tri[7]) == null ? void 0 : _b[0])) + throw "Mutation only works on post-BNC storages!"; + var cnt = 0; + if (tri[7][0].data.length < 2 * data.length) { + var new_7 = new Uint8Array(2 * data.length); + new_7.set(tri[7][0].data); + tri[7][0].data = new_7; + } + if (tri[4][0].data.length < 2 * data.length) { + var new_4 = new Uint8Array(2 * data.length); + new_4.set(tri[4][0].data); + tri[4][0].data = new_4; + } + var dv = u8_to_dataview(tri[7][0].data), last_offset = 0, cell_storage = []; + var _dv = u8_to_dataview(tri[4][0].data), _last_offset = 0, _cell_storage = []; + var width = wide ? 4 : 1; + for (var C = 0; C < data.length; ++C) { + if (data[C] == null || data[C].t == "z" && !((_c = data[C].c) == null ? void 0 : _c.length) || data[C].t == "e") { + dv.setUint16(C * 2, 65535, true); + _dv.setUint16(C * 2, 65535); + continue; + } + dv.setUint16(C * 2, last_offset / width, true); + _dv.setUint16(C * 2, _last_offset / width, true); + var celload, _celload; + switch (data[C].t) { + case "d": + if (data[C].v instanceof Date) { + celload = write_new_storage(data[C], lut); + _celload = write_old_storage(data[C], lut); + break; + } + celload = write_new_storage(data[C], lut); + _celload = write_old_storage(data[C], lut); + break; + case "s": + case "n": + case "b": + case "z": + celload = write_new_storage(data[C], lut); + _celload = write_old_storage(data[C], lut); + break; + default: + throw new Error("Unsupported value " + data[C]); + } + cell_storage.push(celload); + last_offset += celload.length; + { + _cell_storage.push(_celload); + _last_offset += _celload.length; + } + ++cnt; + } + tri[2][0].data = write_varint49(cnt); + tri[5][0].data = write_varint49(5); + for (; C < tri[7][0].data.length / 2; ++C) { + dv.setUint16(C * 2, 65535, true); + _dv.setUint16(C * 2, 65535, true); + } + tri[6][0].data = u8concat(cell_storage); + tri[3][0].data = u8concat(_cell_storage); + tri[8] = [{ type: 0, data: write_varint49(wide ? 1 : 0) }]; + return tri; +} +function write_iwam(type, payload) { + return { + meta: [ + [], + [{ type: 0, data: write_varint49(type) }] + ], + data: payload + }; +} +function get_unique_msgid(dep, dependents) { + if (!dependents.last) + dependents.last = 927262; + for (var i = dependents.last; i < 2e6; ++i) + if (!dependents[i]) { + dependents[dependents.last = i] = dep; + return i; + } + throw new Error("Too many messages"); +} +function build_numbers_deps(cfb) { + var dependents = {}; + var indices = []; + cfb.FileIndex.map(function (fi, idx) { + return [fi, cfb.FullPaths[idx]]; + }).forEach(function (row) { + var fi = row[0], fp = row[1]; + if (fi.type != 2) + return; + if (!fi.name.match(/\.iwa/)) + return; + if (fi.content[0] != 0) + return; + parse_iwa_file(decompress_iwa_file(fi.content)).forEach(function (packet) { + indices.push(packet.id); + dependents[packet.id] = { deps: [], location: fp, type: varint_to_i32(packet.messages[0].meta[1][0].data) }; + }); + }); + cfb.FileIndex.forEach(function (fi) { + if (!fi.name.match(/\.iwa/)) + return; + if (fi.content[0] != 0) + return; + parse_iwa_file(decompress_iwa_file(fi.content)).forEach(function (ia) { + ia.messages.forEach(function (mess) { + [5, 6].forEach(function (f) { + if (!mess.meta[f]) + return; + mess.meta[f].forEach(function (x) { + dependents[ia.id].deps.push(varint_to_i32(x.data)); + }); + }); + }); + }); + }); + return dependents; +} +function write_TSP_Color_RGB(r, g, b) { + return write_shallow([ + [], + [{ type: 0, data: write_varint49(1) }], + [], + [{ type: 5, data: new Uint8Array(Float32Array.from([r / 255]).buffer) }], + [{ type: 5, data: new Uint8Array(Float32Array.from([g / 255]).buffer) }], + [{ type: 5, data: new Uint8Array(Float32Array.from([b / 255]).buffer) }], + [{ type: 5, data: new Uint8Array(Float32Array.from([1]).buffer) }], + [], + [], + [], + [], + [], + [{ type: 0, data: write_varint49(1) }] + ]); +} +function get_author_color(n) { + switch (n) { + case 0: + return write_TSP_Color_RGB(99, 222, 171); + case 1: + return write_TSP_Color_RGB(162, 197, 240); + case 2: + return write_TSP_Color_RGB(255, 189, 189); + } + return write_TSP_Color_RGB(Math.random() * 255, Math.random() * 255, Math.random() * 255); +} +function write_numbers_iwa(wb, opts) { + if (!opts || !opts.numbers) + throw new Error("Must pass a `numbers` option -- check the README"); + var cfb = CFB.read(opts.numbers, { type: "base64" }); + var deps = build_numbers_deps(cfb); + var docroot = numbers_iwa_find(cfb, deps, 1); + if (docroot == null) + throw "Could not find message ".concat(1, " in Numbers template"); + var sheetrefs = mappa(parse_shallow(docroot.messages[0].data)[1], parse_TSP_Reference); + if (sheetrefs.length > 1) + throw new Error("Template NUMBERS file must have exactly one sheet"); + wb.SheetNames.forEach(function (name, idx) { + if (idx >= 1) { + numbers_add_ws(cfb, deps, idx + 1); + docroot = numbers_iwa_find(cfb, deps, 1); + sheetrefs = mappa(parse_shallow(docroot.messages[0].data)[1], parse_TSP_Reference); + } + write_numbers_ws(cfb, deps, wb.Sheets[name], name, idx, sheetrefs[idx]); + }); + return cfb; +} +function numbers_iwa_doit(cfb, deps, id, cb) { + var entry = CFB.find(cfb, deps[id].location); + if (!entry) + throw "Could not find ".concat(deps[id].location, " in Numbers template"); + var x = parse_iwa_file(decompress_iwa_file(entry.content)); + var ainfo = x.find(function (packet) { + return packet.id == id; + }); + cb(ainfo, x); + entry.content = compress_iwa_file(write_iwa_file(x)); + entry.size = entry.content.length; +} +function numbers_iwa_find(cfb, deps, id) { + var entry = CFB.find(cfb, deps[id].location); + if (!entry) + throw "Could not find ".concat(deps[id].location, " in Numbers template"); + var x = parse_iwa_file(decompress_iwa_file(entry.content)); + var ainfo = x.find(function (packet) { + return packet.id == id; + }); + return ainfo; +} +function numbers_add_meta(mlist, newid, newloc) { + mlist[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(newid) }], + [{ type: 2, data: stru8(newloc.replace(/-.*$/, "")) }], + [{ type: 2, data: stru8(newloc) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [], + [], + [], + [], + [{ type: 0, data: write_varint49(0) }], + [], + [{ type: 0, data: write_varint49(0) }] + ]) }); + mlist[1] = [{ type: 0, data: write_varint49(Math.max(newid + 1, varint_to_i32(mlist[1][0].data))) }]; +} +function numbers_add_msg(cfb, type, msg, path, deps, id) { + if (!id) + id = get_unique_msgid({ deps: [], location: "", type: type }, deps); + var loc = "".concat(path, "-").concat(id, ".iwa"); + deps[id].location = "Root Entry" + loc; + CFB.utils.cfb_add(cfb, loc, compress_iwa_file(write_iwa_file([{ + id: id, + messages: [write_iwam(type, write_shallow(msg))] + }]))); + var newloc = loc.replace(/^[\/]/, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_add_meta(mlist, id || 0, newloc); + ai.messages[0].data = write_shallow(mlist); + }); + return id; +} +function numbers_meta_add_dep(mlist, deps, id, dep) { + var loc = deps[id].location.replace(/^Root Entry\//, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + var parentidx = mlist[3].findIndex(function (m) { + var _a, _b; + var mm = parse_shallow(m.data); + if ((_a = mm[3]) == null ? void 0 : _a[0]) + return u8str(mm[3][0].data) == loc; + if (((_b = mm[2]) == null ? void 0 : _b[0]) && u8str(mm[2][0].data) == loc) + return true; + return false; + }); + var parent = parse_shallow(mlist[3][parentidx].data); + if (!parent[6]) + parent[6] = []; + (Array.isArray(dep) ? dep : [dep]).forEach(function (dep2) { + parent[6].push({ + type: 2, + data: write_shallow([ + [], + [{ type: 0, data: write_varint49(dep2) }] + ]) + }); + }); + mlist[3][parentidx].data = write_shallow(parent); +} +function numbers_meta_del_dep(mlist, deps, id, dep) { + var loc = deps[id].location.replace(/^Root Entry\//, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + var parentidx = mlist[3].findIndex(function (m) { + var _a, _b; + var mm = parse_shallow(m.data); + if ((_a = mm[3]) == null ? void 0 : _a[0]) + return u8str(mm[3][0].data) == loc; + if (((_b = mm[2]) == null ? void 0 : _b[0]) && u8str(mm[2][0].data) == loc) + return true; + return false; + }); + var parent = parse_shallow(mlist[3][parentidx].data); + if (!parent[6]) + parent[6] = []; + parent[6] = parent[6].filter(function (m) { + return varint_to_i32(parse_shallow(m.data)[1][0].data) != dep; + }); + mlist[3][parentidx].data = write_shallow(parent); +} +function numbers_add_ws(cfb, deps, wsidx) { + var sheetref = -1, newsheetref = -1; + var remap = {}; + numbers_iwa_doit(cfb, deps, 1, function (docroot, arch) { + var doc = parse_shallow(docroot.messages[0].data); + sheetref = parse_TSP_Reference(parse_shallow(docroot.messages[0].data)[1][0].data); + newsheetref = get_unique_msgid({ deps: [1], location: deps[sheetref].location, type: 2 }, deps); + remap[sheetref] = newsheetref; + numbers_add_oref(docroot, newsheetref); + doc[1].push({ type: 2, data: write_TSP_Reference(newsheetref) }); + var sheet = numbers_iwa_find(cfb, deps, sheetref); + sheet.id = newsheetref; + if (deps[1].location == deps[newsheetref].location) + arch.push(sheet); + else + numbers_iwa_doit(cfb, deps, newsheetref, function (_, x) { + return x.push(sheet); + }); + docroot.messages[0].data = write_shallow(doc); + }); + var tiaref = -1; + numbers_iwa_doit(cfb, deps, newsheetref, function (sheetroot, arch) { + var sa = parse_shallow(sheetroot.messages[0].data); + for (var i = 3; i <= 69; ++i) + delete sa[i]; + var drawables = mappa(sa[2], parse_TSP_Reference); + drawables.forEach(function (n) { + return numbers_del_oref(sheetroot, n); + }); + tiaref = get_unique_msgid({ deps: [newsheetref], location: deps[drawables[0]].location, type: deps[drawables[0]].type }, deps); + numbers_add_oref(sheetroot, tiaref); + remap[drawables[0]] = tiaref; + sa[2] = [{ type: 2, data: write_TSP_Reference(tiaref) }]; + var tia = numbers_iwa_find(cfb, deps, drawables[0]); + tia.id = tiaref; + if (deps[drawables[0]].location == deps[newsheetref].location) + arch.push(tia); + else { + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, newsheetref, tiaref); + ai.messages[0].data = write_shallow(mlist); + }); + numbers_iwa_doit(cfb, deps, tiaref, function (_, x) { + return x.push(tia); + }); + } + sheetroot.messages[0].data = write_shallow(sa); + }); + var tmaref = -1; + numbers_iwa_doit(cfb, deps, tiaref, function (tiaroot, arch) { + var tia = parse_shallow(tiaroot.messages[0].data); + var da = parse_shallow(tia[1][0].data); + for (var i = 3; i <= 69; ++i) + delete da[i]; + var dap = parse_TSP_Reference(da[2][0].data); + da[2][0].data = write_TSP_Reference(remap[dap]); + tia[1][0].data = write_shallow(da); + var oldtmaref = parse_TSP_Reference(tia[2][0].data); + numbers_del_oref(tiaroot, oldtmaref); + tmaref = get_unique_msgid({ deps: [tiaref], location: deps[oldtmaref].location, type: deps[oldtmaref].type }, deps); + numbers_add_oref(tiaroot, tmaref); + remap[oldtmaref] = tmaref; + tia[2][0].data = write_TSP_Reference(tmaref); + var tma = numbers_iwa_find(cfb, deps, oldtmaref); + tma.id = tmaref; + if (deps[tiaref].location == deps[tmaref].location) + arch.push(tma); + else + numbers_iwa_doit(cfb, deps, tmaref, function (_, x) { + return x.push(tma); + }); + tiaroot.messages[0].data = write_shallow(tia); + }); + numbers_iwa_doit(cfb, deps, tmaref, function (tmaroot, arch) { + var _a, _b; + var tma = parse_shallow(tmaroot.messages[0].data); + var uuid = u8str(tma[1][0].data), new_uuid = uuid.replace(/-[A-Z0-9]*/, "-".concat(("0000" + wsidx.toString(16)).slice(-4))); + tma[1][0].data = stru8(new_uuid); + [12, 13, 29, 31, 32, 33, 39, 44, 47, 81, 82, 84].forEach(function (n) { + return delete tma[n]; + }); + if (tma[45]) { + var srrta = parse_shallow(tma[45][0].data); + var ref = parse_TSP_Reference(srrta[1][0].data); + numbers_del_oref(tmaroot, ref); + delete tma[45]; + } + if (tma[70]) { + var hsoa = parse_shallow(tma[70][0].data); + (_a = hsoa[2]) == null ? void 0 : _a.forEach(function (item) { + var hsa = parse_shallow(item.data); + [2, 3].map(function (n) { + return hsa[n][0]; + }).forEach(function (hseadata) { + var hsea = parse_shallow(hseadata.data); + if (!hsea[8]) + return; + var ref2 = parse_TSP_Reference(hsea[8][0].data); + numbers_del_oref(tmaroot, ref2); + }); + }); + delete tma[70]; + } + [ + 46, + 30, + 34, + 35, + 36, + 38, + 48, + 49, + 60, + 61, + 62, + 63, + 64, + 71, + 72, + 73, + 74, + 75, + 85, + 86, + 87, + 88, + 89 + ].forEach(function (n) { + if (!tma[n]) + return; + var ref2 = parse_TSP_Reference(tma[n][0].data); + delete tma[n]; + numbers_del_oref(tmaroot, ref2); + }); + var store = parse_shallow(tma[4][0].data); + { + [2, 4, 5, 6, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22].forEach(function (n) { + var _a2; + if (!((_a2 = store[n]) == null ? void 0 : _a2[0])) + return; + var oldref = parse_TSP_Reference(store[n][0].data); + var newref = get_unique_msgid({ deps: [tmaref], location: deps[oldref].location, type: deps[oldref].type }, deps); + numbers_del_oref(tmaroot, oldref); + numbers_add_oref(tmaroot, newref); + remap[oldref] = newref; + var msg = numbers_iwa_find(cfb, deps, oldref); + msg.id = newref; + if (deps[oldref].location == deps[tmaref].location) + arch.push(msg); + else { + deps[newref].location = deps[oldref].location.replace(oldref.toString(), newref.toString()); + if (deps[newref].location == deps[oldref].location) + deps[newref].location = deps[newref].location.replace(/\.iwa/, "-".concat(newref, ".iwa")); + CFB.utils.cfb_add(cfb, deps[newref].location, compress_iwa_file(write_iwa_file([msg]))); + var newloc = deps[newref].location.replace(/^Root Entry\//, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_add_meta(mlist, newref, newloc); + numbers_meta_add_dep(mlist, deps, tmaref, newref); + ai.messages[0].data = write_shallow(mlist); + }); + } + store[n][0].data = write_TSP_Reference(newref); + }); + var row_headers = parse_shallow(store[1][0].data); + { + (_b = row_headers[2]) == null ? void 0 : _b.forEach(function (tspref) { + var oldref = parse_TSP_Reference(tspref.data); + var newref = get_unique_msgid({ deps: [tmaref], location: deps[oldref].location, type: deps[oldref].type }, deps); + numbers_del_oref(tmaroot, oldref); + numbers_add_oref(tmaroot, newref); + remap[oldref] = newref; + var msg = numbers_iwa_find(cfb, deps, oldref); + msg.id = newref; + if (deps[oldref].location == deps[tmaref].location) { + arch.push(msg); + } + else { + deps[newref].location = deps[oldref].location.replace(oldref.toString(), newref.toString()); + if (deps[newref].location == deps[oldref].location) + deps[newref].location = deps[newref].location.replace(/\.iwa/, "-".concat(newref, ".iwa")); + CFB.utils.cfb_add(cfb, deps[newref].location, compress_iwa_file(write_iwa_file([msg]))); + var newloc = deps[newref].location.replace(/^Root Entry\//, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_add_meta(mlist, newref, newloc); + numbers_meta_add_dep(mlist, deps, tmaref, newref); + ai.messages[0].data = write_shallow(mlist); + }); + } + tspref.data = write_TSP_Reference(newref); + }); + } + store[1][0].data = write_shallow(row_headers); + var tiles = parse_shallow(store[3][0].data); + { + tiles[1].forEach(function (t) { + var tst = parse_shallow(t.data); + var oldtileref = parse_TSP_Reference(tst[2][0].data); + var newtileref = remap[oldtileref]; + if (!remap[oldtileref]) { + newtileref = get_unique_msgid({ deps: [tmaref], location: "", type: deps[oldtileref].type }, deps); + deps[newtileref].location = "Root Entry/Index/Tables/Tile-".concat(newtileref, ".iwa"); + remap[oldtileref] = newtileref; + var oldtile = numbers_iwa_find(cfb, deps, oldtileref); + oldtile.id = newtileref; + numbers_del_oref(tmaroot, oldtileref); + numbers_add_oref(tmaroot, newtileref); + CFB.utils.cfb_add(cfb, "/Index/Tables/Tile-".concat(newtileref, ".iwa"), compress_iwa_file(write_iwa_file([oldtile]))); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + mlist[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(newtileref) }], + [{ type: 2, data: stru8("Tables/Tile") }], + [{ type: 2, data: stru8("Tables/Tile-".concat(newtileref)) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [], + [], + [], + [], + [{ type: 0, data: write_varint49(0) }], + [], + [{ type: 0, data: write_varint49(0) }] + ]) }); + mlist[1] = [{ type: 0, data: write_varint49(Math.max(newtileref + 1, varint_to_i32(mlist[1][0].data))) }]; + numbers_meta_add_dep(mlist, deps, tmaref, newtileref); + ai.messages[0].data = write_shallow(mlist); + }); + } + tst[2][0].data = write_TSP_Reference(newtileref); + t.data = write_shallow(tst); + }); + } + store[3][0].data = write_shallow(tiles); + } + tma[4][0].data = write_shallow(store); + tmaroot.messages[0].data = write_shallow(tma); + }); +} +function write_numbers_ws(cfb, deps, ws, wsname, sheetidx, rootref) { + var drawables = []; + numbers_iwa_doit(cfb, deps, rootref, function (docroot) { + var sheetref = parse_shallow(docroot.messages[0].data); + { + sheetref[1] = [{ type: 2, data: stru8(wsname) }]; + drawables = mappa(sheetref[2], parse_TSP_Reference); + } + docroot.messages[0].data = write_shallow(sheetref); + }); + var tia = numbers_iwa_find(cfb, deps, drawables[0]); + var tmaref = parse_TSP_Reference(parse_shallow(tia.messages[0].data)[2][0].data); + numbers_iwa_doit(cfb, deps, tmaref, function (docroot, x) { + return write_numbers_tma(cfb, deps, ws, docroot, x, tmaref); + }); +} +var USE_WIDE_ROWS = true; +function write_numbers_tma(cfb, deps, ws, tmaroot, tmafile, tmaref) { + var range = decode_range(ws["!ref"]); + range.s.r = range.s.c = 0; + var trunc = false; + if (range.e.c > 999) { + trunc = true; + range.e.c = 999; + } + if (range.e.r > 999999) { + trunc = true; + range.e.r = 999999; + } + if (trunc) + console.error("Truncating to ".concat(encode_range(range))); + var data = []; + if (ws["!data"]) + data = ws["!data"]; + else { + var colstr = []; + for (var _C = 0; _C <= range.e.c; ++_C) + colstr[_C] = encode_col(_C); + for (var R_ = 0; R_ <= range.e.r; ++R_) { + data[R_] = []; + var _R = "" + (R_ + 1); + for (_C = 0; _C <= range.e.c; ++_C) { + var _cell = ws[colstr[_C] + _R]; + if (!_cell) + continue; + data[R_][_C] = _cell; + } + } + } + var LUT = { + cmnt: [{ a: "~54ee77S~", t: "... the people who are crazy enough to think they can change the world, are the ones who do." }], + ferr: [], + fmla: [], + nfmt: [], + ofmt: [], + rsst: [{ v: "~54ee77S~", l: "https://sheetjs.com/" }], + sst: ["~Sh33tJ5~"] + }; + var pb = parse_shallow(tmaroot.messages[0].data); + { + pb[6][0].data = write_varint49(range.e.r + 1); + pb[7][0].data = write_varint49(range.e.c + 1); + delete pb[46]; + var store = parse_shallow(pb[4][0].data); + { + var row_header_ref = parse_TSP_Reference(parse_shallow(store[1][0].data)[2][0].data); + numbers_iwa_doit(cfb, deps, row_header_ref, function (rowhead, _x) { + var _a; + var base_bucket = parse_shallow(rowhead.messages[0].data); + if ((_a = base_bucket == null ? void 0 : base_bucket[2]) == null ? void 0 : _a[0]) + for (var R2 = 0; R2 < data.length; ++R2) { + var _bucket = parse_shallow(base_bucket[2][0].data); + _bucket[1][0].data = write_varint49(R2); + _bucket[4][0].data = write_varint49(data[R2].length); + base_bucket[2][R2] = { type: base_bucket[2][0].type, data: write_shallow(_bucket) }; + } + rowhead.messages[0].data = write_shallow(base_bucket); + }); + var col_header_ref = parse_TSP_Reference(store[2][0].data); + numbers_iwa_doit(cfb, deps, col_header_ref, function (colhead, _x) { + var base_bucket = parse_shallow(colhead.messages[0].data); + for (var C = 0; C <= range.e.c; ++C) { + var _bucket = parse_shallow(base_bucket[2][0].data); + _bucket[1][0].data = write_varint49(C); + _bucket[4][0].data = write_varint49(range.e.r + 1); + base_bucket[2][C] = { type: base_bucket[2][0].type, data: write_shallow(_bucket) }; + } + colhead.messages[0].data = write_shallow(base_bucket); + }); + var rbtree = parse_shallow(store[9][0].data); + rbtree[1] = []; + var tilestore = parse_shallow(store[3][0].data); + { + var tstride = 256; + tilestore[2] = [{ type: 0, data: write_varint49(tstride) }]; + var tileref = parse_TSP_Reference(parse_shallow(tilestore[1][0].data)[2][0].data); + var save_token = function () { + var metadata = numbers_iwa_find(cfb, deps, 2); + var mlist = parse_shallow(metadata.messages[0].data); + var mlst = mlist[3].filter(function (m) { + return varint_to_i32(parse_shallow(m.data)[1][0].data) == tileref; + }); + return (mlst == null ? void 0 : mlst.length) ? varint_to_i32(parse_shallow(mlst[0].data)[12][0].data) : 0; + }(); + { + CFB.utils.cfb_del(cfb, deps[tileref].location); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + mlist[3] = mlist[3].filter(function (m) { + return varint_to_i32(parse_shallow(m.data)[1][0].data) != tileref; + }); + numbers_meta_del_dep(mlist, deps, tmaref, tileref); + ai.messages[0].data = write_shallow(mlist); + }); + numbers_del_oref(tmaroot, tileref); + } + tilestore[1] = []; + var ntiles = Math.ceil((range.e.r + 1) / tstride); + for (var tidx = 0; tidx < ntiles; ++tidx) { + var newtileid = get_unique_msgid({ + deps: [], + location: "", + type: 6002 + }, deps); + deps[newtileid].location = "Root Entry/Index/Tables/Tile-".concat(newtileid, ".iwa"); + var tiledata = [ + [], + [{ type: 0, data: write_varint49(0) }], + [{ type: 0, data: write_varint49(Math.min(range.e.r + 1, (tidx + 1) * tstride)) }], + [{ type: 0, data: write_varint49(0) }], + [{ type: 0, data: write_varint49(Math.min((tidx + 1) * tstride, range.e.r + 1) - tidx * tstride) }], + [], + [{ type: 0, data: write_varint49(5) }], + [{ type: 0, data: write_varint49(1) }], + [{ type: 0, data: write_varint49(USE_WIDE_ROWS ? 1 : 0) }] + ]; + for (var R = tidx * tstride; R <= Math.min(range.e.r, (tidx + 1) * tstride - 1); ++R) { + var tilerow = write_TST_TileRowInfo(data[R], LUT, USE_WIDE_ROWS); + tilerow[1][0].data = write_varint49(R - tidx * tstride); + tiledata[5].push({ data: write_shallow(tilerow), type: 2 }); + } + tilestore[1].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(tidx) }], + [{ type: 2, data: write_TSP_Reference(newtileid) }] + ]) }); + var newtile = { + id: newtileid, + messages: [write_iwam(6002, write_shallow(tiledata))] + }; + var tilecontent = compress_iwa_file(write_iwa_file([newtile])); + CFB.utils.cfb_add(cfb, "/Index/Tables/Tile-".concat(newtileid, ".iwa"), tilecontent); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + mlist[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(newtileid) }], + [{ type: 2, data: stru8("Tables/Tile") }], + [{ type: 2, data: stru8("Tables/Tile-".concat(newtileid)) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [], + [], + [], + [], + [{ type: 0, data: write_varint49(0) }], + [], + [{ type: 0, data: write_varint49(save_token) }] + ]) }); + mlist[1] = [{ type: 0, data: write_varint49(Math.max(newtileid + 1, varint_to_i32(mlist[1][0].data))) }]; + numbers_meta_add_dep(mlist, deps, tmaref, newtileid); + ai.messages[0].data = write_shallow(mlist); + }); + numbers_add_oref(tmaroot, newtileid); + rbtree[1].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(tidx * tstride) }], + [{ type: 0, data: write_varint49(tidx) }] + ]) }); + } + } + store[3][0].data = write_shallow(tilestore); + store[9][0].data = write_shallow(rbtree); + store[10] = [{ type: 2, data: new Uint8Array([]) }]; + if (ws["!merges"]) { + var mergeid = get_unique_msgid({ + type: 6144, + deps: [tmaref], + location: deps[tmaref].location + }, deps); + tmafile.push({ + id: mergeid, + messages: [write_iwam(6144, write_shallow([ + [], + ws["!merges"].map(function (m) { + return { type: 2, data: write_shallow([ + [], + [{ type: 2, data: write_shallow([ + [], + [{ type: 5, data: new Uint8Array(new Uint16Array([m.s.r, m.s.c]).buffer) }] + ]) }], + [{ type: 2, data: write_shallow([ + [], + [{ type: 5, data: new Uint8Array(new Uint16Array([m.e.r - m.s.r + 1, m.e.c - m.s.c + 1]).buffer) }] + ]) }] + ]) }; + }) + ]))] + }); + store[13] = [{ type: 2, data: write_TSP_Reference(mergeid) }]; + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, tmaref, mergeid); + ai.messages[0].data = write_shallow(mlist); + }); + numbers_add_oref(tmaroot, mergeid); + } + else + delete store[13]; + var sstref = parse_TSP_Reference(store[4][0].data); + numbers_iwa_doit(cfb, deps, sstref, function (sstroot) { + var sstdata = parse_shallow(sstroot.messages[0].data); + { + sstdata[3] = []; + LUT.sst.forEach(function (str, i) { + if (i == 0) + return; + sstdata[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(i) }], + [{ type: 0, data: write_varint49(1) }], + [{ type: 2, data: stru8(str) }] + ]) }); + }); + } + sstroot.messages[0].data = write_shallow(sstdata); + }); + var rsstref = parse_TSP_Reference(store[17][0].data); + numbers_iwa_doit(cfb, deps, rsstref, function (rsstroot) { + var rsstdata = parse_shallow(rsstroot.messages[0].data); + rsstdata[3] = []; + var style_indices = [ + 904980, + 903835, + 903815, + 903845 + ]; + LUT.rsst.forEach(function (rsst, i) { + if (i == 0) + return; + var tswpsa = [ + [], + [{ type: 0, data: new Uint8Array([5]) }], + [], + [{ type: 2, data: stru8(rsst.v) }] + ]; + tswpsa[10] = [{ type: 0, data: new Uint8Array([1]) }]; + tswpsa[19] = [{ type: 2, data: new Uint8Array([10, 6, 8, 0, 18, 2, 101, 110]) }]; + tswpsa[5] = [{ type: 2, data: new Uint8Array([10, 8, 8, 0, 18, 4, 8, 155, 149, 55]) }]; + tswpsa[2] = [{ type: 2, data: new Uint8Array([8, 148, 158, 55]) }]; + tswpsa[6] = [{ type: 2, data: new Uint8Array([10, 6, 8, 0, 16, 0, 24, 0]) }]; + tswpsa[7] = [{ type: 2, data: new Uint8Array([10, 8, 8, 0, 18, 4, 8, 135, 149, 55]) }]; + tswpsa[8] = [{ type: 2, data: new Uint8Array([10, 8, 8, 0, 18, 4, 8, 165, 149, 55]) }]; + tswpsa[14] = [{ type: 2, data: new Uint8Array([10, 6, 8, 0, 16, 0, 24, 0]) }]; + tswpsa[24] = [{ type: 2, data: new Uint8Array([10, 6, 8, 0, 16, 0, 24, 0]) }]; + var tswpsaid = get_unique_msgid({ deps: [], location: "", type: 2001 }, deps); + var tswpsarefs = []; + if (rsst.l) { + var newhlinkid = numbers_add_msg(cfb, 2032, [ + [], + [], + [{ type: 2, data: stru8(rsst.l) }] + ], "/Index/Tables/DataList", deps); + tswpsa[11] = []; + var smartfield = [[], []]; + if (!smartfield[1]) + smartfield[1] = []; + smartfield[1].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(0) }], + [{ type: 2, data: write_TSP_Reference(newhlinkid) }] + ]) }); + tswpsa[11][0] = { type: 2, data: write_shallow(smartfield) }; + tswpsarefs.push(newhlinkid); + } + numbers_add_msg(cfb, 2001, tswpsa, "/Index/Tables/DataList", deps, tswpsaid); + numbers_iwa_doit(cfb, deps, tswpsaid, function (iwa) { + style_indices.forEach(function (ref) { + return numbers_add_oref(iwa, ref); + }); + tswpsarefs.forEach(function (ref) { + return numbers_add_oref(iwa, ref); + }); + }); + var rtpaid = numbers_add_msg(cfb, 6218, [ + [], + [{ type: 2, data: write_TSP_Reference(tswpsaid) }], + [], + [{ type: 2, data: new Uint8Array([13, 255, 255, 255, 0, 18, 10, 16, 255, 255, 1, 24, 255, 255, 255, 255, 7]) }] + ], "/Index/Tables/DataList", deps); + numbers_iwa_doit(cfb, deps, rtpaid, function (iwa) { + return numbers_add_oref(iwa, tswpsaid); + }); + rsstdata[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(i) }], + [{ type: 0, data: write_varint49(1) }], + [], + [], + [], + [], + [], + [], + [{ type: 2, data: write_TSP_Reference(rtpaid) }] + ]) }); + numbers_add_oref(rsstroot, rtpaid); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, rsstref, rtpaid); + numbers_meta_add_dep(mlist, deps, rtpaid, tswpsaid); + numbers_meta_add_dep(mlist, deps, tswpsaid, tswpsarefs); + numbers_meta_add_dep(mlist, deps, tswpsaid, style_indices); + ai.messages[0].data = write_shallow(mlist); + }); + }); + rsstroot.messages[0].data = write_shallow(rsstdata); + }); + if (LUT.cmnt.length > 1) { + var cmntref = parse_TSP_Reference(store[19][0].data); + var authors = {}, iauthor = 0; + numbers_iwa_doit(cfb, deps, cmntref, function (cmntroot) { + var cmntdata = parse_shallow(cmntroot.messages[0].data); + { + cmntdata[3] = []; + LUT.cmnt.forEach(function (cc, i) { + if (i == 0) + return; + var replies = []; + if (cc.replies) + cc.replies.forEach(function (c) { + if (!authors[c.a || ""]) + authors[c.a || ""] = numbers_add_msg(cfb, 212, [ + [], + [{ type: 2, data: stru8(c.a || "") }], + [{ type: 2, data: get_author_color(++iauthor) }], + [], + [{ type: 0, data: write_varint49(0) }] + ], "/Index/Tables/DataList", deps); + var aaaid2 = authors[c.a || ""]; + var csaid2 = numbers_add_msg(cfb, 3056, [ + [], + [{ type: 2, data: stru8(c.t || "") }], + [{ type: 2, data: write_shallow([ + [], + [{ type: 1, data: new Uint8Array([0, 0, 0, 128, 116, 109, 182, 65]) }] + ]) }], + [{ type: 2, data: write_TSP_Reference(aaaid2) }] + ], "/Index/Tables/DataList", deps); + numbers_iwa_doit(cfb, deps, csaid2, function (iwa) { + return numbers_add_oref(iwa, aaaid2); + }); + replies.push(csaid2); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, csaid2, aaaid2); + ai.messages[0].data = write_shallow(mlist); + }); + }); + if (!authors[cc.a || ""]) + authors[cc.a || ""] = numbers_add_msg(cfb, 212, [ + [], + [{ type: 2, data: stru8(cc.a || "") }], + [{ type: 2, data: get_author_color(++iauthor) }], + [], + [{ type: 0, data: write_varint49(0) }] + ], "/Index/Tables/DataList", deps); + var aaaid = authors[cc.a || ""]; + var csaid = numbers_add_msg(cfb, 3056, [ + [], + [{ type: 2, data: stru8(cc.t || "") }], + [{ type: 2, data: write_shallow([ + [], + [{ type: 1, data: new Uint8Array([0, 0, 0, 128, 116, 109, 182, 65]) }] + ]) }], + [{ type: 2, data: write_TSP_Reference(aaaid) }], + replies.map(function (r) { + return { type: 2, data: write_TSP_Reference(r) }; + }), + [{ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(i) }], + [{ type: 0, data: write_varint49(0) }] + ]) }] + ], "/Index/Tables/DataList", deps); + numbers_iwa_doit(cfb, deps, csaid, function (iwa) { + numbers_add_oref(iwa, aaaid); + replies.forEach(function (r) { + return numbers_add_oref(iwa, r); + }); + }); + cmntdata[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(i) }], + [{ type: 0, data: write_varint49(1) }], + [], + [], + [], + [], + [], + [], + [], + [{ type: 2, data: write_TSP_Reference(csaid) }] + ]) }); + numbers_add_oref(cmntroot, csaid); + numbers_iwa_doit(cfb, deps, 2, function (ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, cmntref, csaid); + numbers_meta_add_dep(mlist, deps, csaid, aaaid); + if (replies.length) + numbers_meta_add_dep(mlist, deps, csaid, replies); + ai.messages[0].data = write_shallow(mlist); + }); + }); + } + cmntdata[2][0].data = write_varint49(LUT.cmnt.length + 1); + cmntroot.messages[0].data = write_shallow(cmntdata); + }); + } + } + pb[4][0].data = write_shallow(store); + } + tmaroot.messages[0].data = write_shallow(pb); +} +function fix_opts_func(defaults /*:Array >*/) { + return function fix_opts(opts) { + for (var i = 0; i != defaults.length; ++i) { + var d = defaults[i]; + if (opts[d[0]] === undefined) + opts[d[0]] = d[1]; + if (d[2] === 'n') + opts[d[0]] = Number(opts[d[0]]); + } + }; +} +function fix_read_opts(opts) { + fix_opts_func([ + ['cellNF', false], + ['cellHTML', true], + ['cellFormula', true], + ['cellStyles', false], + ['cellText', true], + ['cellDates', false], + ['sheetStubs', false], + ['sheetRows', 0, 'n'], + ['bookDeps', false], + ['bookSheets', false], + ['bookProps', false], + ['bookFiles', false], + ['bookVBA', false], + ['password', ''], + ['WTF', false] /* WTF mode (throws errors) */ + ])(opts); +} +function fix_write_opts(opts) { + fix_opts_func([ + ['cellDates', false], + ['bookSST', false], + ['bookType', 'xlsx'], + ['compression', false], + ['WTF', false] /* WTF mode (throws errors) */ + ])(opts); +} +function get_sheet_type(n /*:string*/) { + if (RELS.WS.indexOf(n) > -1) + return "sheet"; + if (RELS.CS && n == RELS.CS) + return "chart"; + if (RELS.DS && n == RELS.DS) + return "dialog"; + if (RELS.MS && n == RELS.MS) + return "macro"; + return (n && n.length) ? n : "sheet"; +} +function safe_parse_wbrels(wbrels, sheets) { + if (!wbrels) + return 0; + try { + wbrels = sheets.map(function pwbr(w) { if (!w.id) + w.id = w.strRelID; return [w.name, wbrels['!id'][w.id].Target, get_sheet_type(wbrels['!id'][w.id].Type)]; }); + } + catch (e) { + return null; + } + return !wbrels || wbrels.length === 0 ? null : wbrels; +} +function parse_sheet_legacy_drawing(sheet, type, zip, path, idx, opts, wb, comments) { + if (!sheet || !sheet['!legdrawel']) + return; + var dfile = resolve_path(sheet['!legdrawel'].Target, path); + var draw = getzipstr(zip, dfile, true); + if (draw) + parse_vml(utf8read(draw), sheet, comments || []); +} +function safe_parse_sheet(zip, path /*:string*/, relsPath /*:string*/, sheet, idx /*:number*/, sheetRels, sheets, stype /*:string*/, opts, wb, themes, styles) { + try { + sheetRels[sheet] = parse_rels(getzipstr(zip, relsPath, true), path); + var data = getzipdata(zip, path); + var _ws; + switch (stype) { + case 'sheet': + _ws = parse_ws(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); + break; + case 'chart': + _ws = parse_cs(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); + if (!_ws || !_ws['!drawel']) + break; + var dfile = resolve_path(_ws['!drawel'].Target, path); + var drelsp = get_rels_path(dfile); + var draw = parse_drawing(getzipstr(zip, dfile, true), parse_rels(getzipstr(zip, drelsp, true), dfile)); + var chartp = resolve_path(draw, dfile); + var crelsp = get_rels_path(chartp); + _ws = parse_chart(getzipstr(zip, chartp, true), chartp, opts, parse_rels(getzipstr(zip, crelsp, true), chartp), wb, _ws); + break; + case 'macro': + _ws = parse_ms(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); + break; + case 'dialog': + _ws = parse_ds(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); + break; + default: throw new Error("Unrecognized sheet type " + stype); + } + sheets[sheet] = _ws; + /* scan rels for comments and threaded comments */ + var comments = [], tcomments = []; + if (sheetRels && sheetRels[sheet]) + keys(sheetRels[sheet]).forEach(function (n) { + var dfile = ""; + if (sheetRels[sheet][n].Type == RELS.CMNT) { + dfile = resolve_path(sheetRels[sheet][n].Target, path); + comments = parse_cmnt(getzipdata(zip, dfile, true), dfile, opts); + if (!comments || !comments.length) + return; + sheet_insert_comments(_ws, comments, false); + } + if (sheetRels[sheet][n].Type == RELS.TCMNT) { + dfile = resolve_path(sheetRels[sheet][n].Target, path); + tcomments = tcomments.concat(parse_tcmnt_xml(getzipdata(zip, dfile, true), opts)); + } + }); + if (tcomments && tcomments.length) + sheet_insert_comments(_ws, tcomments, true, opts.people || []); + parse_sheet_legacy_drawing(_ws, stype, zip, path, idx, opts, wb, comments); + } + catch (e) { + if (opts.WTF) + throw e; + } +} +function strip_front_slash(x /*:string*/) { return x.charAt(0) == '/' ? x.slice(1) : x; } +function parse_zip(zip /*:ZIP*/, opts /*:?ParseOpts*/) { + make_ssf(); + opts = opts || {}; + fix_read_opts(opts); + /* OpenDocument Part 3 Section 2.2.1 OpenDocument Package */ + if (safegetzipfile(zip, 'META-INF/manifest.xml')) + return parse_ods(zip, opts); + /* UOC */ + if (safegetzipfile(zip, 'objectdata.xml')) + return parse_ods(zip, opts); + /* Numbers */ + if (safegetzipfile(zip, 'Index/Document.iwa')) { + if (typeof Uint8Array == "undefined") + throw new Error('NUMBERS file parsing requires Uint8Array support'); + if (typeof parse_numbers_iwa != "undefined") { + if (zip.FileIndex) + return parse_numbers_iwa(zip, opts); + var _zip = CFB.utils.cfb_new(); + zipentries(zip).forEach(function (e) { zip_add_file(_zip, e, getzipbin(zip, e)); }); + return parse_numbers_iwa(_zip, opts); + } + throw new Error('Unsupported NUMBERS file'); + } + if (!safegetzipfile(zip, '[Content_Types].xml')) { + if (safegetzipfile(zip, 'index.xml.gz')) + throw new Error('Unsupported NUMBERS 08 file'); + if (safegetzipfile(zip, 'index.xml')) + throw new Error('Unsupported NUMBERS 09 file'); + var index_zip = CFB.find(zip, 'Index.zip'); + if (index_zip) { + opts = dup(opts); + delete opts.type; + if (typeof index_zip.content == "string") + opts.type = "binary"; + // TODO: Bun buffer bug + if (typeof Bun !== "undefined" && Buffer.isBuffer(index_zip.content)) + return readSync(new Uint8Array(index_zip.content), opts); + return readSync(index_zip.content, opts); + } + throw new Error('Unsupported ZIP file'); + } + var entries = zipentries(zip); + var dir = parse_ct((getzipstr(zip, '[Content_Types].xml') /*:?any*/)); + var xlsb = false; + var sheets, binname; + if (dir.workbooks.length === 0) { + binname = "xl/workbook.xml"; + if (getzipdata(zip, binname, true)) + dir.workbooks.push(binname); + } + if (dir.workbooks.length === 0) { + binname = "xl/workbook.bin"; + if (!getzipdata(zip, binname, true)) + throw new Error("Could not find workbook"); + dir.workbooks.push(binname); + xlsb = true; + } + if (dir.workbooks[0].slice(-3) == "bin") + xlsb = true; + var themes = ({} /*:any*/); + var styles = ({} /*:any*/); + if (!opts.bookSheets && !opts.bookProps) { + strs = []; + if (dir.sst) + try { + strs = parse_sst(getzipdata(zip, strip_front_slash(dir.sst)), dir.sst, opts); + } + catch (e) { + if (opts.WTF) + throw e; + } + if (opts.cellStyles && dir.themes.length) + themes = parse_theme_xml(getzipstr(zip, dir.themes[0].replace(/^\//, ''), true) || "", opts); + if (dir.style) + styles = parse_sty(getzipdata(zip, strip_front_slash(dir.style)), dir.style, themes, opts); + } + /*var externbooks = */ dir.links.map(function (link) { + try { + var rels = parse_rels(getzipstr(zip, get_rels_path(strip_front_slash(link))), link); + return parse_xlink(getzipdata(zip, strip_front_slash(link)), rels, link, opts); + } + catch (e) { } + }); + var wb = parse_wb(getzipdata(zip, strip_front_slash(dir.workbooks[0])), dir.workbooks[0], opts); + var props = {}, propdata = ""; + if (dir.coreprops.length) { + propdata = getzipdata(zip, strip_front_slash(dir.coreprops[0]), true); + if (propdata) + props = parse_core_props(propdata); + if (dir.extprops.length !== 0) { + propdata = getzipdata(zip, strip_front_slash(dir.extprops[0]), true); + if (propdata) + parse_ext_props(propdata, props, opts); + } + } + var custprops = {}; + if (!opts.bookSheets || opts.bookProps) { + if (dir.custprops.length !== 0) { + propdata = getzipstr(zip, strip_front_slash(dir.custprops[0]), true); + if (propdata) + custprops = parse_cust_props(propdata, opts); + } + } + var out = ({} /*:any*/); + if (opts.bookSheets || opts.bookProps) { + if (wb.Sheets) + sheets = wb.Sheets.map(function pluck(x) { return x.name; }); + else if (props.Worksheets && props.SheetNames.length > 0) + sheets = props.SheetNames; + if (opts.bookProps) { + out.Props = props; + out.Custprops = custprops; + } + if (opts.bookSheets && typeof sheets !== 'undefined') + out.SheetNames = sheets; + if (opts.bookSheets ? out.SheetNames : opts.bookProps) + return out; + } + sheets = {}; + var deps = {}; + if (opts.bookDeps && dir.calcchain) + deps = parse_cc(getzipdata(zip, strip_front_slash(dir.calcchain)), dir.calcchain, opts); + var i = 0; + var sheetRels = ({} /*:any*/); + var path, relsPath; + { + var wbsheets = wb.Sheets; + props.Worksheets = wbsheets.length; + props.SheetNames = []; + for (var j = 0; j != wbsheets.length; ++j) { + props.SheetNames[j] = wbsheets[j].name; + } + } + var wbext = xlsb ? "bin" : "xml"; + var wbrelsi = dir.workbooks[0].lastIndexOf("/"); + var wbrelsfile = (dir.workbooks[0].slice(0, wbrelsi + 1) + "_rels/" + dir.workbooks[0].slice(wbrelsi + 1) + ".rels").replace(/^\//, ""); + if (!safegetzipfile(zip, wbrelsfile)) + wbrelsfile = 'xl/_rels/workbook.' + wbext + '.rels'; + var wbrels = parse_rels(getzipstr(zip, wbrelsfile, true), wbrelsfile.replace(/_rels.*/, "s5s")); + if ((dir.metadata || []).length >= 1) { + /* TODO: MDX and other types of metadata */ + opts.xlmeta = parse_xlmeta(getzipdata(zip, strip_front_slash(dir.metadata[0])), dir.metadata[0], opts); + } + if ((dir.people || []).length >= 1) { + opts.people = parse_people_xml(getzipdata(zip, strip_front_slash(dir.people[0])), opts); + } + if (wbrels) + wbrels = safe_parse_wbrels(wbrels, wb.Sheets); + /* Numbers iOS hack */ + var nmode = (getzipdata(zip, "xl/worksheets/sheet.xml", true)) ? 1 : 0; + wsloop: for (i = 0; i != props.Worksheets; ++i) { + var stype = "sheet"; + if (wbrels && wbrels[i]) { + path = 'xl/' + (wbrels[i][1]).replace(/[\/]?xl\//, ""); + if (!safegetzipfile(zip, path)) + path = wbrels[i][1]; + if (!safegetzipfile(zip, path)) + path = wbrelsfile.replace(/_rels\/.*$/, "") + wbrels[i][1]; + stype = wbrels[i][2]; + } + else { + path = 'xl/worksheets/sheet' + (i + 1 - nmode) + "." + wbext; + path = path.replace(/sheet0\./, "sheet."); + } + relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels"); + if (opts && opts.sheets != null) + switch (typeof opts.sheets) { + case "number": + if (i != opts.sheets) + continue wsloop; + break; + case "string": + if (props.SheetNames[i].toLowerCase() != opts.sheets.toLowerCase()) + continue wsloop; + break; + default: if (Array.isArray && Array.isArray(opts.sheets)) { + var snjseen = false; + for (var snj = 0; snj != opts.sheets.length; ++snj) { + if (typeof opts.sheets[snj] == "number" && opts.sheets[snj] == i) + snjseen = 1; + if (typeof opts.sheets[snj] == "string" && opts.sheets[snj].toLowerCase() == props.SheetNames[i].toLowerCase()) + snjseen = 1; + } + if (!snjseen) + continue wsloop; + } + } + safe_parse_sheet(zip, path, relsPath, props.SheetNames[i], i, sheetRels, sheets, stype, opts, wb, themes, styles); + } + out = ({ + Directory: dir, + Workbook: wb, + Props: props, + Custprops: custprops, + Deps: deps, + Sheets: sheets, + SheetNames: props.SheetNames, + Strings: strs, + Styles: styles, + Themes: themes, + SSF: dup(table_fmt) + } /*:any*/); + if (opts && opts.bookFiles) { + if (zip.files) { + out.keys = entries; + out.files = zip.files; + } + else { + out.keys = []; + out.files = {}; + zip.FullPaths.forEach(function (p, idx) { + p = p.replace(/^Root Entry[\/]/, ""); + out.keys.push(p); + out.files[p] = zip.FileIndex[idx]; + }); + } + } + if (opts && opts.bookVBA) { + if (dir.vba.length > 0) + out.vbaraw = getzipdata(zip, strip_front_slash(dir.vba[0]), true); + else if (dir.defaults && dir.defaults.bin === CT_VBA) + out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin', true); + } + // TODO: pass back content types metdata for xlsm/xlsx resolution + out.bookType = xlsb ? "xlsb" : "xlsx"; + return out; +} +/* [MS-OFFCRYPTO] 2.1.1 */ +function parse_xlsxcfb(cfb, _opts /*:?ParseOpts*/) { + var opts = _opts || {}; + var f = 'Workbook', data = CFB.find(cfb, f); + try { + f = '/!DataSpaces/Version'; + data = CFB.find(cfb, f); + if (!data || !data.content) + throw new Error("ECMA-376 Encrypted file missing " + f); + /*var version = */ parse_DataSpaceVersionInfo(data.content); + /* 2.3.4.1 */ + f = '/!DataSpaces/DataSpaceMap'; + data = CFB.find(cfb, f); + if (!data || !data.content) + throw new Error("ECMA-376 Encrypted file missing " + f); + var dsm = parse_DataSpaceMap(data.content); + if (dsm.length !== 1 || dsm[0].comps.length !== 1 || dsm[0].comps[0].t !== 0 || dsm[0].name !== "StrongEncryptionDataSpace" || dsm[0].comps[0].v !== "EncryptedPackage") + throw new Error("ECMA-376 Encrypted file bad " + f); + /* 2.3.4.2 */ + f = '/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace'; + data = CFB.find(cfb, f); + if (!data || !data.content) + throw new Error("ECMA-376 Encrypted file missing " + f); + var seds = parse_DataSpaceDefinition(data.content); + if (seds.length != 1 || seds[0] != "StrongEncryptionTransform") + throw new Error("ECMA-376 Encrypted file bad " + f); + /* 2.3.4.3 */ + f = '/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary'; + data = CFB.find(cfb, f); + if (!data || !data.content) + throw new Error("ECMA-376 Encrypted file missing " + f); + /*var hdr = */ parse_Primary(data.content); + } + catch (e) { } + f = '/EncryptionInfo'; + data = CFB.find(cfb, f); + if (!data || !data.content) + throw new Error("ECMA-376 Encrypted file missing " + f); + var einfo = parse_EncryptionInfo(data.content); + /* 2.3.4.4 */ + f = '/EncryptedPackage'; + data = CFB.find(cfb, f); + if (!data || !data.content) + throw new Error("ECMA-376 Encrypted file missing " + f); + /*global decrypt_agile */ + /*:: declare var decrypt_agile:any; */ + if (einfo[0] == 0x04 && typeof decrypt_agile !== 'undefined') + return decrypt_agile(einfo[1], data.content, opts.password || "", opts); + /*global decrypt_std76 */ + /*:: declare var decrypt_std76:any; */ + if (einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') + return decrypt_std76(einfo[1], data.content, opts.password || "", opts); + throw new Error("File is password-protected"); +} +function write_zip_xlsb(wb /*:Workbook*/, opts /*:WriteOpts*/) { + if (wb && !wb.SSF) { + wb.SSF = dup(table_fmt); + } + if (wb && wb.SSF) { + make_ssf(); + SSF_load_table(wb.SSF); + // $FlowIgnore + opts.revssf = evert_num(wb.SSF); + opts.revssf[wb.SSF[65535]] = 0; + opts.ssf = wb.SSF; + } + opts.rels = {}; + opts.wbrels = {}; + opts.Strings = /*::((*/ [] /*:: :any):SST)*/; + opts.Strings.Count = 0; + opts.Strings.Unique = 0; + if (browser_has_Map) + opts.revStrings = new Map(); + else { + opts.revStrings = {}; + opts.revStrings.foo = []; + delete opts.revStrings.foo; + } + var wbext = "bin"; + var vbafmt = true; + var ct = new_ct(); + fix_write_opts(opts = opts || {}); + var zip = zip_new(); + var f = "", rId = 0; + opts.cellXfs = []; + get_cell_style(opts.cellXfs, {}, { revssf: { "General": 0 } }); + if (!wb.Props) + wb.Props = {}; + f = "docProps/core.xml"; + zip_add_file(zip, f, write_core_props(wb.Props, opts)); + ct.coreprops.push(f); + add_rels(opts.rels, 2, f, RELS.CORE_PROPS); + /*::if(!wb.Props) throw "unreachable"; */ + f = "docProps/app.xml"; + if (wb.Props && wb.Props.SheetNames) { /* empty */ } + else if (!wb.Workbook || !wb.Workbook.Sheets) + wb.Props.SheetNames = wb.SheetNames; + else { + var _sn = []; + for (var _i = 0; _i < wb.SheetNames.length; ++_i) + if ((wb.Workbook.Sheets[_i] || {}).Hidden != 2) + _sn.push(wb.SheetNames[_i]); + wb.Props.SheetNames = _sn; + } + wb.Props.Worksheets = wb.Props.SheetNames.length; + zip_add_file(zip, f, write_ext_props(wb.Props, opts)); + ct.extprops.push(f); + add_rels(opts.rels, 3, f, RELS.EXT_PROPS); + if (wb.Custprops !== wb.Props && keys(wb.Custprops || {}).length > 0) { + f = "docProps/custom.xml"; + zip_add_file(zip, f, write_cust_props(wb.Custprops, opts)); + ct.custprops.push(f); + add_rels(opts.rels, 4, f, RELS.CUST_PROPS); + } + var people = ["SheetJ5"]; + opts.tcid = 0; + for (rId = 1; rId <= wb.SheetNames.length; ++rId) { + var wsrels = { '!id': {} }; + var ws = wb.Sheets[wb.SheetNames[rId - 1]]; + var _type = (ws || {})["!type"] || "sheet"; + switch (_type) { + case "chart": + /* falls through */ + default: + f = "xl/worksheets/sheet" + rId + "." + wbext; + zip_add_file(zip, f, write_ws_bin(rId - 1, opts, wb, wsrels)); + ct.sheets.push(f); + add_rels(opts.wbrels, -1, "worksheets/sheet" + rId + "." + wbext, RELS.WS[0]); + } + if (ws) { + var comments = ws['!comments']; + var need_vml = false; + var cf = ""; + if (comments && comments.length > 0) { + var needtc = false; + comments.forEach(function (carr) { + carr[1].forEach(function (c) { if (c.T == true) + needtc = true; }); + }); + if (needtc) { + cf = "xl/threadedComments/threadedComment" + rId + ".xml"; + zip_add_file(zip, cf, write_tcmnt_xml(comments, people, opts)); + ct.threadedcomments.push(cf); + add_rels(wsrels, -1, "../threadedComments/threadedComment" + rId + ".xml", RELS.TCMNT); + } + cf = "xl/comments" + rId + "." + wbext; + zip_add_file(zip, cf, write_comments_bin(comments, opts)); + ct.comments.push(cf); + add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT); + need_vml = true; + } + if (ws['!legacy']) { + if (need_vml) + zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments'])); + } + delete ws['!comments']; + delete ws['!legacy']; + } + if (wsrels['!id'].rId1) + zip_add_file(zip, get_rels_path(f), write_rels(wsrels)); + } + if (opts.Strings != null && opts.Strings.length > 0) { + f = "xl/sharedStrings." + wbext; + zip_add_file(zip, f, write_sst_bin(opts.Strings, opts)); + ct.strs.push(f); + add_rels(opts.wbrels, -1, "sharedStrings." + wbext, RELS.SST); + } + f = "xl/workbook." + wbext; + zip_add_file(zip, f, write_wb_bin(wb, opts)); + ct.workbooks.push(f); + add_rels(opts.rels, 1, f, RELS.WB); + /* TODO: something more intelligent with themes */ + f = "xl/theme/theme1.xml"; + var ww = write_theme(wb.Themes, opts); + zip_add_file(zip, f, ww); + ct.themes.push(f); + add_rels(opts.wbrels, -1, "theme/theme1.xml", RELS.THEME); + /* TODO: something more intelligent with styles */ + f = "xl/styles." + wbext; + zip_add_file(zip, f, write_sty_bin(wb, opts)); + ct.styles.push(f); + add_rels(opts.wbrels, -1, "styles." + wbext, RELS.STY); + if (wb.vbaraw && vbafmt) { + f = "xl/vbaProject.bin"; + zip_add_file(zip, f, wb.vbaraw); + ct.vba.push(f); + add_rels(opts.wbrels, -1, "vbaProject.bin", RELS.VBA); + } + f = "xl/metadata." + wbext; + zip_add_file(zip, f, write_xlmeta_bin()); + ct.metadata.push(f); + add_rels(opts.wbrels, -1, "metadata." + wbext, RELS.XLMETA); + if (people.length > 1) { + f = "xl/persons/person.xml"; + zip_add_file(zip, f, write_people_xml(people, opts)); + ct.people.push(f); + add_rels(opts.wbrels, -1, "persons/person.xml", RELS.PEOPLE); + } + zip_add_file(zip, "[Content_Types].xml", write_ct(ct, opts)); + zip_add_file(zip, '_rels/.rels', write_rels(opts.rels)); + zip_add_file(zip, 'xl/_rels/workbook.' + wbext + '.rels', write_rels(opts.wbrels)); + delete opts.revssf; + delete opts.ssf; + return zip; +} +function write_zip_xlsx(wb /*:Workbook*/, opts /*:WriteOpts*/) { + if (wb && !wb.SSF) { + wb.SSF = dup(table_fmt); + } + if (wb && wb.SSF) { + make_ssf(); + SSF_load_table(wb.SSF); + // $FlowIgnore + opts.revssf = evert_num(wb.SSF); + opts.revssf[wb.SSF[65535]] = 0; + opts.ssf = wb.SSF; + } + opts.rels = {}; + opts.wbrels = {}; + opts.Strings = /*::((*/ [] /*:: :any):SST)*/; + opts.Strings.Count = 0; + opts.Strings.Unique = 0; + if (browser_has_Map) + opts.revStrings = new Map(); + else { + opts.revStrings = {}; + opts.revStrings.foo = []; + delete opts.revStrings.foo; + } + var wbext = "xml"; + var vbafmt = VBAFMTS.indexOf(opts.bookType) > -1; + var ct = new_ct(); + fix_write_opts(opts = opts || {}); + var zip = zip_new(); + var f = "", rId = 0; + opts.cellXfs = []; + get_cell_style(opts.cellXfs, {}, { revssf: { "General": 0 } }); + if (!wb.Props) + wb.Props = {}; + f = "docProps/core.xml"; + zip_add_file(zip, f, write_core_props(wb.Props, opts)); + ct.coreprops.push(f); + add_rels(opts.rels, 2, f, RELS.CORE_PROPS); + /*::if(!wb.Props) throw "unreachable"; */ + f = "docProps/app.xml"; + if (wb.Props && wb.Props.SheetNames) { /* empty */ } + else if (!wb.Workbook || !wb.Workbook.Sheets) + wb.Props.SheetNames = wb.SheetNames; + else { + var _sn = []; + for (var _i = 0; _i < wb.SheetNames.length; ++_i) + if ((wb.Workbook.Sheets[_i] || {}).Hidden != 2) + _sn.push(wb.SheetNames[_i]); + wb.Props.SheetNames = _sn; + } + wb.Props.Worksheets = wb.Props.SheetNames.length; + zip_add_file(zip, f, write_ext_props(wb.Props, opts)); + ct.extprops.push(f); + add_rels(opts.rels, 3, f, RELS.EXT_PROPS); + if (wb.Custprops !== wb.Props && keys(wb.Custprops || {}).length > 0) { + f = "docProps/custom.xml"; + zip_add_file(zip, f, write_cust_props(wb.Custprops, opts)); + ct.custprops.push(f); + add_rels(opts.rels, 4, f, RELS.CUST_PROPS); + } + var people = ["SheetJ5"]; + opts.tcid = 0; + for (rId = 1; rId <= wb.SheetNames.length; ++rId) { + var wsrels = { '!id': {} }; + var ws = wb.Sheets[wb.SheetNames[rId - 1]]; + var _type = (ws || {})["!type"] || "sheet"; + switch (_type) { + case "chart": + /* falls through */ + default: + f = "xl/worksheets/sheet" + rId + "." + wbext; + zip_add_file(zip, f, write_ws_xml(rId - 1, opts, wb, wsrels)); + ct.sheets.push(f); + add_rels(opts.wbrels, -1, "worksheets/sheet" + rId + "." + wbext, RELS.WS[0]); + } + if (ws) { + var comments = ws['!comments']; + var need_vml = false; + var cf = ""; + if (comments && comments.length > 0) { + var needtc = false; + comments.forEach(function (carr) { + carr[1].forEach(function (c) { if (c.T == true) + needtc = true; }); + }); + if (needtc) { + cf = "xl/threadedComments/threadedComment" + rId + ".xml"; + zip_add_file(zip, cf, write_tcmnt_xml(comments, people, opts)); + ct.threadedcomments.push(cf); + add_rels(wsrels, -1, "../threadedComments/threadedComment" + rId + ".xml", RELS.TCMNT); + } + cf = "xl/comments" + rId + "." + wbext; + zip_add_file(zip, cf, write_comments_xml(comments, opts)); + ct.comments.push(cf); + add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT); + need_vml = true; + } + if (ws['!legacy']) { + if (need_vml) + zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments'])); + } + delete ws['!comments']; + delete ws['!legacy']; + } + if (wsrels['!id'].rId1) + zip_add_file(zip, get_rels_path(f), write_rels(wsrels)); + } + if (opts.Strings != null && opts.Strings.length > 0) { + f = "xl/sharedStrings." + wbext; + zip_add_file(zip, f, write_sst_xml(opts.Strings, opts)); + ct.strs.push(f); + add_rels(opts.wbrels, -1, "sharedStrings." + wbext, RELS.SST); + } + f = "xl/workbook." + wbext; + zip_add_file(zip, f, write_wb_xml(wb, opts)); + ct.workbooks.push(f); + add_rels(opts.rels, 1, f, RELS.WB); + /* TODO: something more intelligent with themes */ + f = "xl/theme/theme1.xml"; + zip_add_file(zip, f, write_theme(wb.Themes, opts)); + ct.themes.push(f); + add_rels(opts.wbrels, -1, "theme/theme1.xml", RELS.THEME); + /* TODO: something more intelligent with styles */ + f = "xl/styles." + wbext; + zip_add_file(zip, f, write_sty_xml(wb, opts)); + ct.styles.push(f); + add_rels(opts.wbrels, -1, "styles." + wbext, RELS.STY); + if (wb.vbaraw && vbafmt) { + f = "xl/vbaProject.bin"; + zip_add_file(zip, f, wb.vbaraw); + ct.vba.push(f); + add_rels(opts.wbrels, -1, "vbaProject.bin", RELS.VBA); + } + f = "xl/metadata." + wbext; + zip_add_file(zip, f, write_xlmeta_xml()); + ct.metadata.push(f); + add_rels(opts.wbrels, -1, "metadata." + wbext, RELS.XLMETA); + if (people.length > 1) { + f = "xl/persons/person.xml"; + zip_add_file(zip, f, write_people_xml(people, opts)); + ct.people.push(f); + add_rels(opts.wbrels, -1, "persons/person.xml", RELS.PEOPLE); + } + zip_add_file(zip, "[Content_Types].xml", write_ct(ct, opts)); + zip_add_file(zip, '_rels/.rels', write_rels(opts.rels)); + zip_add_file(zip, 'xl/_rels/workbook.' + wbext + '.rels', write_rels(opts.wbrels)); + delete opts.revssf; + delete opts.ssf; + return zip; +} +function firstbyte(f /*:RawData*/, o /*:?TypeOpts*/) { + var x = ""; + switch ((o || {}).type || "base64") { + case 'buffer': return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]]; + case 'base64': + x = Base64_decode(f.slice(0, 12)); + break; + case 'binary': + x = f; + break; + case 'array': return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]]; + default: throw new Error("Unrecognized type " + (o && o.type || "undefined")); + } + return [x.charCodeAt(0), x.charCodeAt(1), x.charCodeAt(2), x.charCodeAt(3), x.charCodeAt(4), x.charCodeAt(5), x.charCodeAt(6), x.charCodeAt(7)]; +} +function read_cfb(cfb /*:CFBContainer*/, opts /*:?ParseOpts*/) { + if (CFB.find(cfb, "EncryptedPackage")) + return parse_xlsxcfb(cfb, opts); + return parse_xlscfb(cfb, opts); +} +function read_zip(data /*:RawData*/, opts /*:?ParseOpts*/) { + var zip, d = data; + var o = opts || {}; + if (!o.type) + o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; + zip = zip_read(d, o); + return parse_zip(zip, o); +} +function read_plaintext(data /*:string*/, o /*:ParseOpts*/) { + var i = 0; + main: while (i < data.length) + switch (data.charCodeAt(i)) { + case 0x0A: + case 0x0D: + case 0x20: + ++i; + break; + case 0x3C: return parse_xlml(data.slice(i), o); + default: break main; + } + return PRN.to_workbook(data, o); +} +function read_plaintext_raw(data /*:RawData*/, o /*:ParseOpts*/) { + var str = "", bytes = firstbyte(data, o); + switch (o.type) { + case 'base64': + str = Base64_decode(data); + break; + case 'binary': + str = data; + break; + case 'buffer': + str = data.toString('binary'); + break; + case 'array': + str = cc2str(data); + break; + default: throw new Error("Unrecognized type " + o.type); + } + if (bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) + str = utf8read(str); + o.type = "binary"; + return read_plaintext(str, o); +} +function read_utf16(data /*:RawData*/, o /*:ParseOpts*/) { + var d = data; + if (o.type == 'base64') + d = Base64_decode(d); + if (typeof ArrayBuffer !== "undefined" && data instanceof ArrayBuffer) + d = new Uint8Array(data); + d = typeof $cptable !== "undefined" ? $cptable.utils.decode(1200, d.slice(2), 'str') : ((has_buf && Buffer.isBuffer(data)) ? data.slice(2).toString("utf16le") : + (typeof Uint8Array !== "undefined" && d instanceof Uint8Array) ? (typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le").decode(d.slice(2)) : utf16lereadu(d.slice(2))) : utf16leread(d.slice(2))); + o.type = "binary"; + return read_plaintext(d, o); +} +function bstrify(data /*:string*/) { + return !data.match(/[^\x00-\x7F]/) ? data : utf8write(data); +} +function read_prn(data, d, o, str) { + if (str) { + o.type = "string"; + return PRN.to_workbook(data, o); + } + return PRN.to_workbook(d, o); +} +function readSync(data /*:RawData*/, opts /*:?ParseOpts*/) { + reset_cp(); + var o = opts || {}; + if (o.codepage && typeof $cptable === "undefined") + console.error("Codepage tables are not loaded. Non-ASCII characters may not give expected results"); + if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) + return readSync(new Uint8Array(data), (o = dup(o), o.type = "array", o)); + if (typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && !o.type) + o.type = typeof Deno !== "undefined" ? "buffer" : "array"; + var d = data, n = [0, 0, 0, 0], str = false; + if (o.cellStyles) { + o.cellNF = true; + o.sheetStubs = true; + } + _ssfopts = {}; + if (o.dateNF) + _ssfopts.dateNF = o.dateNF; + if (!o.type) + o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; + if (o.type == "file") { + o.type = has_buf ? "buffer" : "binary"; + d = read_binary(data); + if (typeof Uint8Array !== 'undefined' && !has_buf) + o.type = "array"; + } + if (o.type == "string") { + str = true; + o.type = "binary"; + o.codepage = 65001; + d = bstrify(data); + } + if (o.type == 'array' && typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && typeof ArrayBuffer !== 'undefined') { + // $FlowIgnore + var ab = new ArrayBuffer(3), vu = new Uint8Array(ab); + vu.foo = "bar"; + // $FlowIgnore + if (!vu.foo) { + o = dup(o); + o.type = 'array'; + return readSync(ab2a(d), o); + } + } + switch ((n = firstbyte(d, o))[0]) { + case 0xD0: + if (n[1] === 0xCF && n[2] === 0x11 && n[3] === 0xE0 && n[4] === 0xA1 && n[5] === 0xB1 && n[6] === 0x1A && n[7] === 0xE1) + return read_cfb(CFB.read(d, o), o); + break; + case 0x09: + if (n[1] <= 0x08) + return parse_xlscfb(d, o); + break; + case 0x3C: return parse_xlml(d, o); + case 0x49: + if (n[1] === 0x49 && n[2] === 0x2a && n[3] === 0x00) + throw new Error("TIFF Image File is not a spreadsheet"); + if (n[1] === 0x44) + return read_wb_ID(d, o); + break; + case 0x54: + if (n[1] === 0x41 && n[2] === 0x42 && n[3] === 0x4C) + return DIF.to_workbook(d, o); + break; + case 0x50: return (n[1] === 0x4B && n[2] < 0x09 && n[3] < 0x09) ? read_zip(d, o) : read_prn(data, d, o, str); + case 0xEF: return n[3] === 0x3C ? parse_xlml(d, o) : read_prn(data, d, o, str); + case 0xFF: + if (n[1] === 0xFE) { + return read_utf16(d, o); + } + else if (n[1] === 0x00 && n[2] === 0x02 && n[3] === 0x00) + return WK_.to_workbook(d, o); + break; + case 0x00: + if (n[1] === 0x00) { + if (n[2] >= 0x02 && n[3] === 0x00) + return WK_.to_workbook(d, o); + if (n[2] === 0x00 && (n[3] === 0x08 || n[3] === 0x09)) + return WK_.to_workbook(d, o); + } + break; + case 0x03: + case 0x83: + case 0x8B: + case 0x8C: return DBF.to_workbook(d, o); + case 0x7B: + if (n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) + return rtf_to_workbook(d, o); + break; + case 0x0A: + case 0x0D: + case 0x20: return read_plaintext_raw(d, o); + case 0x89: + if (n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) + throw new Error("PNG Image File is not a spreadsheet"); + break; + case 0x08: + if (n[1] === 0xE7) + throw new Error("Unsupported Multiplan 1.x file!"); + break; + case 0x0C: + if (n[1] === 0xEC) + throw new Error("Unsupported Multiplan 2.x file!"); + if (n[1] === 0xED) + throw new Error("Unsupported Multiplan 3.x file!"); + break; + } + if (DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) + return DBF.to_workbook(d, o); + return read_prn(data, d, o, str); +} +function readFileSync(filename /*:string*/, opts /*:?ParseOpts*/) { + var o = opts || {}; + o.type = 'file'; + return readSync(filename, o); +} +function write_cfb_ctr(cfb /*:CFBContainer*/, o /*:WriteOpts*/) { + switch (o.type) { + case "base64": + case "binary": break; + case "buffer": + case "array": + o.type = ""; + break; + case "file": return write_dl(o.file, CFB.write(cfb, { type: has_buf ? 'buffer' : "" })); + case "string": throw new Error("'string' output type invalid for '" + o.bookType + "' files"); + default: throw new Error("Unrecognized type " + o.type); + } + return CFB.write(cfb, o); +} +function write_zip(wb /*:Workbook*/, opts /*:WriteOpts*/) { + switch (opts.bookType) { + case "ods": return write_ods(wb, opts); + case "numbers": return write_numbers_iwa(wb, opts); + case "xlsb": return write_zip_xlsb(wb, opts); + default: return write_zip_xlsx(wb, opts); + } +} +/*:: declare var encrypt_agile:any; */ +function write_zip_type(wb /*:Workbook*/, opts /*:?WriteOpts*/) { + var o = dup(opts || {}); + var z = write_zip(wb, o); + return write_zip_denouement(z, o); +} +function write_zip_typeXLSX(wb /*:Workbook*/, opts /*:?WriteOpts*/) { + var o = dup(opts || {}); + var z = write_zip_xlsx(wb, o); + return write_zip_denouement(z, o); +} +function write_zip_denouement(z /*:any*/, o /*:?WriteOpts*/) { + var oopts = {}; + var ftype = has_buf ? "nodebuffer" : (typeof Uint8Array !== "undefined" ? "array" : "string"); + if (o.compression) + oopts.compression = 'DEFLATE'; + if (o.password) + oopts.type = ftype; + else + switch (o.type) { + case "base64": + oopts.type = "base64"; + break; + case "binary": + oopts.type = "string"; + break; + case "string": throw new Error("'string' output type invalid for '" + o.bookType + "' files"); + case "buffer": + case "file": + oopts.type = ftype; + break; + default: throw new Error("Unrecognized type " + o.type); + } + var out = z.FullPaths ? CFB.write(z, { fileType: "zip", type: /*::(*/ { "nodebuffer": "buffer", "string": "binary" } /*:: :any)*/[oopts.type] || oopts.type, compression: !!o.compression }) : z.generate(oopts); + if (typeof Deno !== "undefined") { + if (typeof out == "string") { + if (o.type == "binary" || o.type == "base64") + return out; + out = new Uint8Array(s2ab(out)); + } + } + /*jshint -W083 */ + if (o.password && typeof encrypt_agile !== 'undefined') + return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef + /*jshint +W083 */ + if (o.type === "file") + return write_dl(o.file, out); + return o.type == "string" ? utf8read(/*::(*/ out /*:: :any)*/) : out; +} +function write_cfb_type(wb /*:Workbook*/, opts /*:?WriteOpts*/) { + var o = opts || {}; + var cfb /*:CFBContainer*/ = write_xlscfb(wb, o); + return write_cfb_ctr(cfb, o); +} +function write_string_type(out /*:string*/, opts /*:WriteOpts*/, bom /*:?string*/) { + if (!bom) + bom = ""; + var o = bom + out; + switch (opts.type) { + case "base64": return Base64_encode(utf8write(o)); + case "binary": return utf8write(o); + case "string": return out; + case "file": return write_dl(opts.file, o, 'utf8'); + case "buffer": { + if (has_buf) + return Buffer_from(o, 'utf8'); + else if (typeof TextEncoder !== "undefined") + return new TextEncoder().encode(o); + else + return write_string_type(o, { type: 'binary' }).split("").map(function (c) { return c.charCodeAt(0); }); + } + } + throw new Error("Unrecognized type " + opts.type); +} +function write_stxt_type(out /*:string*/, opts /*:WriteOpts*/) { + switch (opts.type) { + case "base64": return Base64_encode_pass(out); + case "binary": return out; + case "string": return out; /* override in sheet_to_txt */ + case "file": return write_dl(opts.file, out, 'binary'); + case "buffer": { + if (has_buf) + return Buffer_from(out, 'binary'); + else + return out.split("").map(function (c) { return c.charCodeAt(0); }); + } + } + throw new Error("Unrecognized type " + opts.type); +} +/* TODO: test consistency */ +function write_binary_type(out, opts /*:WriteOpts*/) { + switch (opts.type) { + case "string": + case "base64": + case "binary": + var bstr = ""; + // $FlowIgnore + for (var i = 0; i < out.length; ++i) + bstr += String.fromCharCode(out[i]); + return opts.type == 'base64' ? Base64_encode(bstr) : opts.type == 'string' ? utf8read(bstr) : bstr; + case "file": return write_dl(opts.file, out); + case "buffer": return out; + default: throw new Error("Unrecognized type " + opts.type); + } +} +function writeSyncXLSX(wb /*:Workbook*/, opts /*:?WriteOpts*/) { + reset_cp(); + check_wb(wb); + var o = dup(opts || {}); + if (o.cellStyles) { + o.cellNF = true; + o.sheetStubs = true; + } + if (o.type == "array") { + o.type = "binary"; + var out /*:string*/ = (writeSyncXLSX(wb, o) /*:any*/); + o.type = "array"; + return s2ab(out); + } + return write_zip_typeXLSX(wb, o); +} +function writeSync(wb /*:Workbook*/, opts /*:?WriteOpts*/) { + reset_cp(); + check_wb(wb); + var o = dup(opts || {}); + if (o.cellStyles) { + o.cellNF = true; + o.sheetStubs = true; + } + if (o.type == "array") { + o.type = "binary"; + var out /*:string*/ = (writeSync(wb, o) /*:any*/); + o.type = "array"; + return s2ab(out); + } + var idx = 0; + if (o.sheet) { + if (typeof o.sheet == "number") + idx = o.sheet; + else + idx = wb.SheetNames.indexOf(o.sheet); + if (!wb.SheetNames[idx]) + throw new Error("Sheet not found: " + o.sheet + " : " + (typeof o.sheet)); + } + switch (o.bookType || 'xlsb') { + case 'xml': + case 'xlml': return write_string_type(write_xlml(wb, o), o); + case 'slk': + case 'sylk': return write_string_type(SYLK.from_sheet(wb.Sheets[wb.SheetNames[idx]], o, wb), o); + case 'htm': + case 'html': return write_string_type(sheet_to_html(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'txt': return write_stxt_type(sheet_to_txt(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'csv': return write_string_type(sheet_to_csv(wb.Sheets[wb.SheetNames[idx]], o), o, "\ufeff"); + case 'dif': return write_string_type(DIF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'dbf': return write_binary_type(DBF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'prn': return write_string_type(PRN.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'rtf': return write_string_type(sheet_to_rtf(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'eth': return write_string_type(ETH.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'fods': return write_string_type(write_ods(wb, o), o); + case 'wk1': return write_binary_type(WK_.sheet_to_wk1(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'wk3': return write_binary_type(WK_.book_to_wk3(wb, o), o); + case 'biff2': if (!o.biff) + o.biff = 2; /* falls through */ + case 'biff3': if (!o.biff) + o.biff = 3; /* falls through */ + case 'biff4': + if (!o.biff) + o.biff = 4; + return write_binary_type(write_biff_buf(wb, o), o); + case 'biff5': if (!o.biff) + o.biff = 5; /* falls through */ + case 'biff8': + case 'xla': + case 'xls': + if (!o.biff) + o.biff = 8; + return write_cfb_type(wb, o); + case 'xlsx': + case 'xlsm': + case 'xlam': + case 'xlsb': + case 'numbers': + case 'ods': return write_zip_type(wb, o); + default: throw new Error("Unrecognized bookType |" + o.bookType + "|"); + } +} +function resolve_book_type(o /*:WriteFileOpts*/) { + if (o.bookType) + return; + var _BT = { + "xls": "biff8", + "htm": "html", + "slk": "sylk", + "socialcalc": "eth", + "Sh33tJS": "WTF" + }; + var ext = o.file.slice(o.file.lastIndexOf(".")).toLowerCase(); + if (ext.match(/^\.[a-z]+$/)) + o.bookType = ext.slice(1); + o.bookType = _BT[o.bookType] || o.bookType; +} +function writeFileSync(wb /*:Workbook*/, filename /*:string*/, opts /*:?WriteFileOpts*/) { + var o = opts || {}; + o.type = 'file'; + o.file = filename; + resolve_book_type(o); + return writeSync(wb, o); +} +function writeFileSyncXLSX(wb /*:Workbook*/, filename /*:string*/, opts /*:?WriteFileOpts*/) { + var o = opts || {}; + o.type = 'file'; + o.file = filename; + resolve_book_type(o); + return writeSyncXLSX(wb, o); +} +function writeFileAsync(filename /*:string*/, wb /*:Workbook*/, opts /*:?WriteFileOpts*/, cb /*:?(e?:ErrnoError)=>void*/) { + var o = opts || {}; + o.type = 'file'; + o.file = filename; + resolve_book_type(o); + o.type = 'buffer'; + var _cb = cb; + if (!(_cb instanceof Function)) + _cb = (opts /*:any*/); + return _fs.writeFile(filename, writeSync(wb, o), _cb); +} +/*:: +type MJRObject = { + row: any; + isempty: boolean; +}; +*/ +function make_json_row(sheet /*:Worksheet*/, r /*:Range*/, R /*:number*/, cols /*:Array*/, header /*:number*/, hdr /*:Array*/, o /*:Sheet2JSONOpts*/) { + var rr = encode_row(R); + var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw"); + var isempty = true, dense = (sheet["!data"] != null); + var row /*:any*/ = (header === 1) ? [] : {}; + if (header !== 1) { + if (Object.defineProperty) + try { + Object.defineProperty(row, '__rowNum__', { value: R, enumerable: false }); + } + catch (e) { + row.__rowNum__ = R; + } + else + row.__rowNum__ = R; + } + if (!dense || sheet["!data"][R]) + for (var C = r.s.c; C <= r.e.c; ++C) { + var val = dense ? (sheet["!data"][R] || [])[C] : sheet[cols[C] + rr]; + if (val == null || val.t === undefined) { + if (defval === undefined) + continue; + if (hdr[C] != null) { + row[hdr[C]] = defval; + } + continue; + } + var v = val.v; + switch (val.t) { + case 'z': + if (v == null) + break; + continue; + case 'e': + v = (v == 0 ? null : void 0); + break; + case 's': + case 'b': + case 'n': + if (!val.z || !fmt_is_date(val.z)) + break; + v = numdate(v); // TODO: date1904 setting should also be stored in worksheet object + if (typeof v == "number") + break; + /* falls through */ + case 'd': + if (!(o && o.UTC)) + v = utc_to_local(v); + break; + default: throw new Error('unrecognized type ' + val.t); + } + if (hdr[C] != null) { + if (v == null) { + if (val.t == "e" && v === null) + row[hdr[C]] = null; + else if (defval !== undefined) + row[hdr[C]] = defval; + else if (raw && v === null) + row[hdr[C]] = null; + else + continue; + } + else { + row[hdr[C]] = raw && (val.t !== "n" || (val.t === "n" && o.rawNumbers !== false)) ? v : format_cell(val, v, o); + } + if (v != null) + isempty = false; + } + } + return { row: row, isempty: isempty }; +} +function sheet_to_json(sheet /*:Worksheet*/, opts /*:?Sheet2JSONOpts*/) { + if (sheet == null || sheet["!ref"] == null) + return []; + var val = { t: 'n', v: 0 }, header = 0, offset = 1, hdr /*:Array*/ = [], v = 0, vv = ""; + var r = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + var o = opts || {}; + var range = o.range != null ? o.range : sheet["!ref"]; + if (o.header === 1) + header = 1; + else if (o.header === "A") + header = 2; + else if (Array.isArray(o.header)) + header = 3; + else if (o.header == null) + header = 0; + switch (typeof range) { + case 'string': + r = safe_decode_range(range); + break; + case 'number': + r = safe_decode_range(sheet["!ref"]); + r.s.r = range; + break; + default: r = range; + } + if (header > 0) + offset = 0; + var rr = encode_row(r.s.r); + var cols /*:Array*/ = []; + var out /*:Array*/ = []; + var outi = 0, counter = 0; + var dense = sheet["!data"] != null; + var R = r.s.r, C = 0; + var header_cnt = {}; + if (dense && !sheet["!data"][R]) + sheet["!data"][R] = []; + var colinfo /*:Array*/ = o.skipHidden && sheet["!cols"] || []; + var rowinfo /*:Array*/ = o.skipHidden && sheet["!rows"] || []; + for (C = r.s.c; C <= r.e.c; ++C) { + if (((colinfo[C] || {}).hidden)) + continue; + cols[C] = encode_col(C); + val = dense ? sheet["!data"][R][C] : sheet[cols[C] + rr]; + switch (header) { + case 1: + hdr[C] = C - r.s.c; + break; + case 2: + hdr[C] = cols[C]; + break; + case 3: + hdr[C] = o.header[C - r.s.c]; + break; + default: + if (val == null) + val = { w: "__EMPTY", t: "s" }; + vv = v = format_cell(val, null, o); + counter = header_cnt[v] || 0; + if (!counter) + header_cnt[v] = 1; + else { + do { + vv = v + "_" + (counter++); + } while (header_cnt[vv]); + header_cnt[v] = counter; + header_cnt[vv] = 1; + } + hdr[C] = vv; + } + } + for (R = r.s.r + offset; R <= r.e.r; ++R) { + if ((rowinfo[R] || {}).hidden) + continue; + var row = make_json_row(sheet, r, R, cols, header, hdr, o); + if ((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) + out[outi++] = row.row; + } + out.length = outi; + return out; +} +var qreg = /"/g; +function make_csv_row(sheet /*:Worksheet*/, r /*:Range*/, R /*:number*/, cols /*:Array*/, fs /*:number*/, rs /*:number*/, FS /*:string*/, o /*:Sheet2CSVOpts*/) { + var isempty = true; + var row /*:Array*/ = [], txt = "", rr = encode_row(R); + var dense = sheet["!data"] != null; + var datarow = dense && sheet["!data"][R] || []; + for (var C = r.s.c; C <= r.e.c; ++C) { + if (!cols[C]) + continue; + var val = dense ? datarow[C] : sheet[cols[C] + rr]; + if (val == null) + txt = ""; + else if (val.v != null) { + isempty = false; + txt = '' + (o.rawNumbers && val.t == "n" ? val.v : format_cell(val, null, o)); + for (var i = 0, cc = 0; i !== txt.length; ++i) + if ((cc = txt.charCodeAt(i)) === fs || cc === rs || cc === 34 || o.forceQuotes) { + txt = "\"" + txt.replace(qreg, '""') + "\""; + break; + } + if (txt == "ID") + txt = '"ID"'; + } + else if (val.f != null && !val.F) { + isempty = false; + txt = '=' + val.f; + if (txt.indexOf(",") >= 0) + txt = '"' + txt.replace(qreg, '""') + '"'; + } + else + txt = ""; + /* NOTE: Excel CSV does not support array formulae */ + row.push(txt); + } + if (o.blankrows === false && isempty) + return null; + return row.join(FS); +} +function sheet_to_csv(sheet /*:Worksheet*/, opts /*:?Sheet2CSVOpts*/) { + var out /*:Array*/ = []; + var o = opts == null ? {} : opts; + if (sheet == null || sheet["!ref"] == null) + return ""; + var r = safe_decode_range(sheet["!ref"]); + var FS = o.FS !== undefined ? o.FS : ",", fs = FS.charCodeAt(0); + var RS = o.RS !== undefined ? o.RS : "\n", rs = RS.charCodeAt(0); + var endregex = new RegExp((FS == "|" ? "\\|" : FS) + "+$"); + var row = "", cols /*:Array*/ = []; + var colinfo /*:Array*/ = o.skipHidden && sheet["!cols"] || []; + var rowinfo /*:Array*/ = o.skipHidden && sheet["!rows"] || []; + for (var C = r.s.c; C <= r.e.c; ++C) + if (!((colinfo[C] || {}).hidden)) + cols[C] = encode_col(C); + var w = 0; + for (var R = r.s.r; R <= r.e.r; ++R) { + if ((rowinfo[R] || {}).hidden) + continue; + row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o); + if (row == null) { + continue; + } + if (o.strip) + row = row.replace(endregex, ""); + if (row || (o.blankrows !== false)) + out.push((w++ ? RS : "") + row); + } + return out.join(""); +} +function sheet_to_txt(sheet /*:Worksheet*/, opts /*:?Sheet2CSVOpts*/) { + if (!opts) + opts = {}; + opts.FS = "\t"; + opts.RS = "\n"; + var s = sheet_to_csv(sheet, opts); + if (typeof $cptable == 'undefined' || opts.type == 'string') + return s; + var o = $cptable.utils.encode(1200, s, 'str'); + return String.fromCharCode(255) + String.fromCharCode(254) + o; +} +function sheet_to_formulae(sheet /*:Worksheet*/) { + var y = "", x, val = ""; + if (sheet == null || sheet["!ref"] == null) + return []; + var r = safe_decode_range(sheet['!ref']), rr = "", cols /*:Array*/ = [], C; + var cmds /*:Array*/ = []; + var dense = sheet["!data"] != null; + for (C = r.s.c; C <= r.e.c; ++C) + cols[C] = encode_col(C); + for (var R = r.s.r; R <= r.e.r; ++R) { + rr = encode_row(R); + for (C = r.s.c; C <= r.e.c; ++C) { + y = cols[C] + rr; + x = dense ? (sheet["!data"][R] || [])[C] : sheet[y]; + val = ""; + if (x === undefined) + continue; + else if (x.F != null) { + y = x.F; + if (!x.f) + continue; + val = x.f; + if (y.indexOf(":") == -1) + y = y + ":" + y; + } + if (x.f != null) + val = x.f; + else if (x.t == 'z') + continue; + else if (x.t == 'n' && x.v != null) + val = "" + x.v; + else if (x.t == 'b') + val = x.v ? "TRUE" : "FALSE"; + else if (x.w !== undefined) + val = "'" + x.w; + else if (x.v === undefined) + continue; + else if (x.t == 's') + val = "'" + x.v; + else + val = "" + x.v; + cmds[cmds.length] = y + "=" + val; + } + } + return cmds; +} +function sheet_add_json(_ws /*:?Worksheet*/, js /*:Array*/, opts) { + var o = opts || {}; + var dense = _ws ? (_ws["!data"] != null) : o.dense; + if (DENSE != null && dense == null) + dense = DENSE; + var offset = +!o.skipHeader; + var ws /*:Worksheet*/ = _ws || ({}); + if (!_ws && dense) + ws["!data"] = []; + var _R = 0, _C = 0; + if (ws && o.origin != null) { + if (typeof o.origin == 'number') + _R = o.origin; + else { + var _origin /*:CellAddress*/ = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin; + _R = _origin.r; + _C = _origin.c; + } + } + var range /*:Range*/ = ({ s: { c: 0, r: 0 }, e: { c: _C, r: _R + js.length - 1 + offset } } /*:any*/); + if (ws['!ref']) { + var _range = safe_decode_range(ws['!ref']); + range.e.c = Math.max(range.e.c, _range.e.c); + range.e.r = Math.max(range.e.r, _range.e.r); + if (_R == -1) { + _R = _range.e.r + 1; + range.e.r = _R + js.length - 1 + offset; + } + } + else { + if (_R == -1) { + _R = 0; + range.e.r = js.length - 1 + offset; + } + } + var hdr /*:Array*/ = o.header || [], C = 0; + var ROW = []; + js.forEach(function (JS, R /*:number*/) { + if (dense && !ws["!data"][_R + R + offset]) + ws["!data"][_R + R + offset] = []; + if (dense) + ROW = ws["!data"][_R + R + offset]; + keys(JS).forEach(function (k) { + if ((C = hdr.indexOf(k)) == -1) + hdr[C = hdr.length] = k; + var v = JS[k]; + var t = 'z'; + var z = ""; + var ref = dense ? "" : (encode_col(_C + C) + encode_row(_R + R + offset)); + var cell /*:Cell*/ = dense ? ROW[_C + C] : ws[ref]; + if (v && typeof v === 'object' && !(v instanceof Date)) { + if (dense) + ROW[_C + C] = v; + else + ws[ref] = v; + } + else { + if (typeof v == 'number') + t = 'n'; + else if (typeof v == 'boolean') + t = 'b'; + else if (typeof v == 'string') + t = 's'; + else if (v instanceof Date) { + t = 'd'; + if (!o.UTC) + v = local_to_utc(v); + if (!o.cellDates) { + t = 'n'; + v = datenum(v); + } + z = (cell != null && cell.z && fmt_is_date(cell.z)) ? cell.z : (o.dateNF || table_fmt[14]); + } + else if (v === null && o.nullError) { + t = 'e'; + v = 0; + } + if (!cell) { + if (!dense) + ws[ref] = cell = ({ t: t, v: v } /*:any*/); + else + ROW[_C + C] = cell = ({ t: t, v: v } /*:any*/); + } + else { + cell.t = t; + cell.v = v; + delete cell.w; + delete cell.R; + if (z) + cell.z = z; + } + if (z) + cell.z = z; + } + }); + }); + range.e.c = Math.max(range.e.c, _C + hdr.length - 1); + var __R = encode_row(_R); + if (dense && !ws["!data"][_R]) + ws["!data"][_R] = []; + if (offset) + for (C = 0; C < hdr.length; ++C) { + if (dense) + ws["!data"][_R][C + _C] = { t: 's', v: hdr[C] }; + else + ws[encode_col(C + _C) + __R] = { t: 's', v: hdr[C] }; + } + ws['!ref'] = encode_range(range); + return ws; +} +function json_to_sheet(js /*:Array*/, opts) { return sheet_add_json(null, js, opts); } +/* get cell, creating a stub if necessary */ +function ws_get_cell_stub(ws /*:Worksheet*/, R, C /*:?number*/) { + /* A1 cell address */ + if (typeof R == "string") { + if (ws["!data"] != null) { + var RC = decode_cell(R); + if (!ws["!data"][RC.r]) + ws["!data"][RC.r] = []; + return ws["!data"][RC.r][RC.c] || (ws["!data"][RC.r][RC.c] = { t: 'z' }); + } + return ws[R] || (ws[R] = { t: 'z' }); + } + /* cell address object */ + if (typeof R != "number") + return ws_get_cell_stub(ws, encode_cell(R)); + /* R and C are 0-based indices */ + return ws_get_cell_stub(ws, encode_col(C || 0) + encode_row(R)); +} +/* find sheet index for given name / validate index */ +function wb_sheet_idx(wb /*:Workbook*/, sh /*:number|string*/) { + if (typeof sh == "number") { + if (sh >= 0 && wb.SheetNames.length > sh) + return sh; + throw new Error("Cannot find sheet # " + sh); + } + else if (typeof sh == "string") { + var idx = wb.SheetNames.indexOf(sh); + if (idx > -1) + return idx; + throw new Error("Cannot find sheet name |" + sh + "|"); + } + else + throw new Error("Cannot find sheet |" + sh + "|"); +} +/* simple blank workbook object */ +function book_new() { + return { SheetNames: [], Sheets: {} }; +} +/* add a worksheet to the end of a given workbook */ +function book_append_sheet(wb /*:Workbook*/, ws /*:Worksheet*/, name /*:?string*/, roll /*:?boolean*/) { + var i = 1; + if (!name) + for (; i <= 0xFFFF; ++i, name = undefined) + if (wb.SheetNames.indexOf(name = "Sheet" + i) == -1) + break; + if (!name || wb.SheetNames.length >= 0xFFFF) + throw new Error("Too many worksheets"); + if (roll && wb.SheetNames.indexOf(name) >= 0) { + var m = name.match(/(^.*?)(\d+)$/); + i = m && +m[2] || 0; + var root = m && m[1] || name; + for (++i; i <= 0xFFFF; ++i) + if (wb.SheetNames.indexOf(name = root + i) == -1) + break; + } + check_ws_name(name); + if (wb.SheetNames.indexOf(name) >= 0) + throw new Error("Worksheet with name |" + name + "| already exists!"); + wb.SheetNames.push(name); + wb.Sheets[name] = ws; + return name; +} +/* set sheet visibility (visible/hidden/very hidden) */ +function book_set_sheet_visibility(wb /*:Workbook*/, sh /*:number|string*/, vis /*:number*/) { + if (!wb.Workbook) + wb.Workbook = {}; + if (!wb.Workbook.Sheets) + wb.Workbook.Sheets = []; + var idx = wb_sheet_idx(wb, sh); + // $FlowIgnore + if (!wb.Workbook.Sheets[idx]) + wb.Workbook.Sheets[idx] = {}; + switch (vis) { + case 0: + case 1: + case 2: break; + default: throw new Error("Bad sheet visibility setting " + vis); + } + // $FlowIgnore + wb.Workbook.Sheets[idx].Hidden = vis; +} +/* set number format */ +function cell_set_number_format(cell /*:Cell*/, fmt /*:string|number*/) { + cell.z = fmt; + return cell; +} +/* set cell hyperlink */ +function cell_set_hyperlink(cell /*:Cell*/, target /*:string*/, tooltip /*:?string*/) { + if (!target) { + delete cell.l; + } + else { + cell.l = ({ Target: target } /*:Hyperlink*/); + if (tooltip) + cell.l.Tooltip = tooltip; + } + return cell; +} +function cell_set_internal_link(cell /*:Cell*/, range /*:string*/, tooltip /*:?string*/) { return cell_set_hyperlink(cell, "#" + range, tooltip); } +/* add to cell comments */ +function cell_add_comment(cell /*:Cell*/, text /*:string*/, author /*:?string*/) { + if (!cell.c) + cell.c = []; + cell.c.push({ t: text, a: author || "SheetJS" }); +} +/* set array formula and flush related cells */ +function sheet_set_array_formula(ws /*:Worksheet*/, range, formula /*:string*/, dynamic /*:boolean*/) { + var rng = typeof range != "string" ? range : safe_decode_range(range); + var rngstr = typeof range == "string" ? range : encode_range(range); + for (var R = rng.s.r; R <= rng.e.r; ++R) + for (var C = rng.s.c; C <= rng.e.c; ++C) { + var cell = ws_get_cell_stub(ws, R, C); + cell.t = 'n'; + cell.F = rngstr; + delete cell.v; + if (R == rng.s.r && C == rng.s.c) { + cell.f = formula; + if (dynamic) + cell.D = true; + } + } + var wsr = decode_range(ws["!ref"]); + if (wsr.s.r > rng.s.r) + wsr.s.r = rng.s.r; + if (wsr.s.c > rng.s.c) + wsr.s.c = rng.s.c; + if (wsr.e.r < rng.e.r) + wsr.e.r = rng.e.r; + if (wsr.e.c < rng.e.c) + wsr.e.c = rng.e.c; + ws["!ref"] = encode_range(wsr); + return ws; +} +var utils /*:any*/ = { + encode_col: encode_col, + encode_row: encode_row, + encode_cell: encode_cell, + encode_range: encode_range, + decode_col: decode_col, + decode_row: decode_row, + split_cell: split_cell, + decode_cell: decode_cell, + decode_range: decode_range, + format_cell: format_cell, + sheet_add_aoa: sheet_add_aoa, + sheet_add_json: sheet_add_json, + sheet_add_dom: sheet_add_dom, + aoa_to_sheet: aoa_to_sheet, + json_to_sheet: json_to_sheet, + table_to_sheet: parse_dom_table, + table_to_book: table_to_book, + sheet_to_csv: sheet_to_csv, + sheet_to_txt: sheet_to_txt, + sheet_to_json: sheet_to_json, + sheet_to_html: sheet_to_html, + sheet_to_formulae: sheet_to_formulae, + sheet_to_row_object_array: sheet_to_json, + sheet_get_cell: ws_get_cell_stub, + book_new: book_new, + book_append_sheet: book_append_sheet, + book_set_sheet_visibility: book_set_sheet_visibility, + cell_set_number_format: cell_set_number_format, + cell_set_hyperlink: cell_set_hyperlink, + cell_set_internal_link: cell_set_internal_link, + cell_add_comment: cell_add_comment, + sheet_set_array_formula: sheet_set_array_formula, + consts: { + SHEET_VISIBLE: 0, + SHEET_HIDDEN: 1, + SHEET_VERY_HIDDEN: 2 + } +}; +var _Readable; +function set_readable(R) { _Readable = R; } +function write_csv_stream(sheet /*:Worksheet*/, opts /*:?Sheet2CSVOpts*/) { + var stream = _Readable(); + var o = opts == null ? {} : opts; + if (sheet == null || sheet["!ref"] == null) { + stream.push(null); + return stream; + } + var r = safe_decode_range(sheet["!ref"]); + var FS = o.FS !== undefined ? o.FS : ",", fs = FS.charCodeAt(0); + var RS = o.RS !== undefined ? o.RS : "\n", rs = RS.charCodeAt(0); + var endregex = new RegExp((FS == "|" ? "\\|" : FS) + "+$"); + var row /*:?string*/ = "", cols /*:Array*/ = []; + var colinfo /*:Array*/ = o.skipHidden && sheet["!cols"] || []; + var rowinfo /*:Array*/ = o.skipHidden && sheet["!rows"] || []; + for (var C = r.s.c; C <= r.e.c; ++C) + if (!((colinfo[C] || {}).hidden)) + cols[C] = encode_col(C); + var R = r.s.r; + var BOM = false, w = 0; + stream._read = function () { + if (!BOM) { + BOM = true; + return stream.push("\uFEFF"); + } + while (R <= r.e.r) { + ++R; + if ((rowinfo[R - 1] || {}).hidden) + continue; + row = make_csv_row(sheet, r, R - 1, cols, fs, rs, FS, o); + if (row != null) { + if (o.strip) + row = row.replace(endregex, ""); + if (row || (o.blankrows !== false)) + return stream.push((w++ ? RS : "") + row); + } + } + return stream.push(null); + }; + return stream; +} +function write_html_stream(ws /*:Worksheet*/, opts /*:?Sheet2HTMLOpts*/) { + var stream = _Readable(); + var o = opts || {}; + var header = o.header != null ? o.header : HTML_BEGIN; + var footer = o.footer != null ? o.footer : HTML_END; + stream.push(header); + var r = decode_range(ws['!ref']); + stream.push(make_html_preamble(ws, r, o)); + var R = r.s.r; + var end = false; + stream._read = function () { + if (R > r.e.r) { + if (!end) { + end = true; + stream.push("" + footer); + } + return stream.push(null); + } + while (R <= r.e.r) { + stream.push(make_html_row(ws, r, R, o)); + ++R; + break; + } + }; + return stream; +} +function write_json_stream(sheet /*:Worksheet*/, opts /*:?Sheet2CSVOpts*/) { + var stream = _Readable({ objectMode: true }); + if (sheet == null || sheet["!ref"] == null) { + stream.push(null); + return stream; + } + var val = { t: 'n', v: 0 }, header = 0, offset = 1, hdr /*:Array*/ = [], v = 0, vv = ""; + var r = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + var o = opts || {}; + var range = o.range != null ? o.range : sheet["!ref"]; + if (o.header === 1) + header = 1; + else if (o.header === "A") + header = 2; + else if (Array.isArray(o.header)) + header = 3; + switch (typeof range) { + case 'string': + r = safe_decode_range(range); + break; + case 'number': + r = safe_decode_range(sheet["!ref"]); + r.s.r = range; + break; + default: r = range; + } + if (header > 0) + offset = 0; + var rr = encode_row(r.s.r); + var cols /*:Array*/ = []; + var counter = 0; + var dense = sheet["!data"] != null; + var R = r.s.r, C = 0; + var header_cnt = {}; + if (dense && !sheet["!data"][R]) + sheet["!data"][R] = []; + var colinfo /*:Array*/ = o.skipHidden && sheet["!cols"] || []; + var rowinfo /*:Array*/ = o.skipHidden && sheet["!rows"] || []; + for (C = r.s.c; C <= r.e.c; ++C) { + if (((colinfo[C] || {}).hidden)) + continue; + cols[C] = encode_col(C); + val = dense ? sheet["!data"][R][C] : sheet[cols[C] + rr]; + switch (header) { + case 1: + hdr[C] = C - r.s.c; + break; + case 2: + hdr[C] = cols[C]; + break; + case 3: + hdr[C] = o.header[C - r.s.c]; + break; + default: + if (val == null) + val = { w: "__EMPTY", t: "s" }; + vv = v = format_cell(val, null, o); + counter = header_cnt[v] || 0; + if (!counter) + header_cnt[v] = 1; + else { + do { + vv = v + "_" + (counter++); + } while (header_cnt[vv]); + header_cnt[v] = counter; + header_cnt[vv] = 1; + } + hdr[C] = vv; + } + } + R = r.s.r + offset; + stream._read = function () { + while (R <= r.e.r) { + if ((rowinfo[R - 1] || {}).hidden) + continue; + var row = make_json_row(sheet, r, R, cols, header, hdr, o); + ++R; + if ((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) { + stream.push(row.row); + return; + } + } + return stream.push(null); + }; + return stream; +} +var __stream = { + to_json: write_json_stream, + to_html: write_html_stream, + to_csv: write_csv_stream, + set_readable: set_readable +}; +export const version = XLSX.version; +export { parse_xlscfb, parse_zip, readSync as read, readFileSync as readFile, readFileSync, writeSync as write, writeFileSync as writeFile, writeFileSync, writeFileAsync, writeSyncXLSX as writeXLSX, writeFileSyncXLSX as writeFileXLSX, utils, set_fs, set_cptable, __stream as stream, SSF, CFB }; +export default { + parse_xlscfb, + parse_zip, + read: readSync, + readFile: readFileSync, + readFileSync, + write: writeSync, + writeFile: writeFileSync, + writeFileSync, + writeFileAsync, + writeXLSX: writeSyncXLSX, + writeFileXLSX: writeFileSyncXLSX, + utils, + set_fs, + set_cptable, + stream: __stream, + SSF, + CFB +}; diff --git a/PWA/public/FetchEventHandlers/BeneficiaryDataUploadHandler.js b/PWA/public/FetchEventHandlers/BeneficiaryDataUploadHandler.js new file mode 100644 index 0000000..5c49bce --- /dev/null +++ b/PWA/public/FetchEventHandlers/BeneficiaryDataUploadHandler.js @@ -0,0 +1,19 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { Database } from "../Services/Database.js"; +import { BenificiarySpreadSheetRowsDeserializationService } from "../Services/BenificiarySpreadSheetRowsDeserializationService.js"; +export class BeneficiaryDataUploadHandler { + canHandleEvent(event) { + return event.request.url.endsWith("/uploader"); + } + async handleEvent(event) { + try { + const beneficiaries = await BenificiarySpreadSheetRowsDeserializationService.deserializeFormDataFromRequest(event.request); + await beneficiaries.forEach(async (benificiary) => await Database.instance.addBenificiary(benificiary)); + } + catch (error) { + console.log("something went wrong " + error); + return fetch(RouteEvents.home); + } + return fetch(RouteEvents.home); + } +} diff --git a/PWA/public/FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.js b/PWA/public/FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.js new file mode 100644 index 0000000..0c1fd02 --- /dev/null +++ b/PWA/public/FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.js @@ -0,0 +1,10 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +export class ChooseBenificiaryCodeInputMethodHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.chooseBenificiaryCodeInputMethod); + } + async handleEvent(event) { + return ResponseTools.wrapInHtmlTemplate(RouteEvents.chooseBenificiaryCodeInputMethodPage); + } +} diff --git a/PWA/public/FetchEventHandlers/CreateDistributionRequestHandler.js b/PWA/public/FetchEventHandlers/CreateDistributionRequestHandler.js new file mode 100644 index 0000000..89f776b --- /dev/null +++ b/PWA/public/FetchEventHandlers/CreateDistributionRequestHandler.js @@ -0,0 +1,35 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; +import { DeserialisationService } from "../Services/DeserialisationService.js"; +import { BenificiaryInfoService } from "../Services/BenificiaryInfoService.js"; +export class CreateDistributionRequestHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.postCreateDistribution); + } + async handleEvent(event) { + const distribution = await DeserialisationService.deserializeFormDataFromRequest(event.request); + try { + await Database.instance.addDistribution(distribution); + } + catch { + console.log("something went wrong"); + } + if (!this.isFilled(distribution.distrib_name) || + !this.isFilled(distribution.distrib_place) || + !this.isFilled(distribution.distrib_date)) { + return ResponseTools.replaceTemplateKeysWithValues(await caches.match(RouteEvents.nameDistribution), { errorMessages: ["Specify the name, location and date of the distribution."] }); + } + else { + return await ResponseTools.replaceTemplateKeysWithValues(await fetch(RouteEvents.distributionsHome), { + "distrib_name": distribution.distrib_name, + "distrib_place": distribution.distrib_place, + "distrib_date": distribution.distrib_date, + beneficiary_info: await BenificiaryInfoService.benificiaryInfoTextFromDistribution(distribution) + }); + } + } + isFilled(field) { + return field.length != 0; + } +} diff --git a/PWA/public/FetchEventHandlers/DeleteDistribitionPostHandler.js b/PWA/public/FetchEventHandlers/DeleteDistribitionPostHandler.js new file mode 100644 index 0000000..d326ee1 --- /dev/null +++ b/PWA/public/FetchEventHandlers/DeleteDistribitionPostHandler.js @@ -0,0 +1,14 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { Database } from "../Services/Database.js"; +import { DeserialisationService } from "../Services/DeserialisationService.js"; +export class DeleteDistributionPostHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.postDeleteDistribution); + } + async handleEvent(event) { + const post = await DeserialisationService.deserializeFormDataFromRequest(event.request); + const distributionToDelete = (await Database.instance.distributionsWithName(post.distrib_id))[0]; + await Database.instance.deleteDistributionWithName(distributionToDelete.distrib_name); + return fetch(RouteEvents.home); + } +} diff --git a/PWA/public/FetchEventHandlers/DeleteDistributionHandler.js b/PWA/public/FetchEventHandlers/DeleteDistributionHandler.js new file mode 100644 index 0000000..d2fb59c --- /dev/null +++ b/PWA/public/FetchEventHandlers/DeleteDistributionHandler.js @@ -0,0 +1,23 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { Distribution } from "../Models/Distribution.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; +export class DeleteDistributionRequestHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.deleteDistribution); + } + async handleEvent(event) { + try { + const distributions = await Database.instance.readDistributions(); + console.log(distributions); + return ResponseTools.replaceTemplateKeysWithValues(await fetch(RouteEvents.deleteDistribution), { + columns: Distribution.colums, + rows: distributions + }); + } + catch { + console.log("something went wrong"); + } + return fetch(RouteEvents.home); + } +} diff --git a/PWA/public/FetchEventHandlers/DeleteDistributionPostHandler.js b/PWA/public/FetchEventHandlers/DeleteDistributionPostHandler.js new file mode 100644 index 0000000..d326ee1 --- /dev/null +++ b/PWA/public/FetchEventHandlers/DeleteDistributionPostHandler.js @@ -0,0 +1,14 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { Database } from "../Services/Database.js"; +import { DeserialisationService } from "../Services/DeserialisationService.js"; +export class DeleteDistributionPostHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.postDeleteDistribution); + } + async handleEvent(event) { + const post = await DeserialisationService.deserializeFormDataFromRequest(event.request); + const distributionToDelete = (await Database.instance.distributionsWithName(post.distrib_id))[0]; + await Database.instance.deleteDistributionWithName(distributionToDelete.distrib_name); + return fetch(RouteEvents.home); + } +} diff --git a/PWA/public/FetchEventHandlers/DeleteDistributionRequestHandler.js b/PWA/public/FetchEventHandlers/DeleteDistributionRequestHandler.js new file mode 100644 index 0000000..d2fb59c --- /dev/null +++ b/PWA/public/FetchEventHandlers/DeleteDistributionRequestHandler.js @@ -0,0 +1,23 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { Distribution } from "../Models/Distribution.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; +export class DeleteDistributionRequestHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.deleteDistribution); + } + async handleEvent(event) { + try { + const distributions = await Database.instance.readDistributions(); + console.log(distributions); + return ResponseTools.replaceTemplateKeysWithValues(await fetch(RouteEvents.deleteDistribution), { + columns: Distribution.colums, + rows: distributions + }); + } + catch { + console.log("something went wrong"); + } + return fetch(RouteEvents.home); + } +} diff --git a/PWA/public/FetchEventHandlers/FetchEvent.js b/PWA/public/FetchEventHandlers/FetchEvent.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/PWA/public/FetchEventHandlers/FetchEvent.js @@ -0,0 +1 @@ +export {}; diff --git a/PWA/public/FetchEventHandlers/FetchEventHandler.js b/PWA/public/FetchEventHandlers/FetchEventHandler.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/PWA/public/FetchEventHandlers/FetchEventHandler.js @@ -0,0 +1 @@ +export {}; diff --git a/PWA/public/FetchEventHandlers/FetchEventHandlers.js b/PWA/public/FetchEventHandlers/FetchEventHandlers.js new file mode 100644 index 0000000..039da3f --- /dev/null +++ b/PWA/public/FetchEventHandlers/FetchEventHandlers.js @@ -0,0 +1,35 @@ +import { CreateDistributionRequestHandler } from "./CreateDistributionRequestHandler.js"; +import { NameDistributionRequestHandler } from "./NameDistributionRequestHandler.js"; +import { ListDistributionRequestHandler } from "./ListDistributionRequestHandler.js"; +import { SelectDistributionRequestHandler } from "./SelectDistributionRequestHandler.js"; +import { DeleteDistributionRequestHandler } from "./DeleteDistributionRequestHandler.js"; +import { UploadDataHandler } from "./UploadDataHandler.js"; +import { BeneficiaryDataUploadHandler } from "./BeneficiaryDataUploadHandler.js"; +import { DeleteDistributionPostHandler } from "./DeleteDistributionPostHandler.js"; +import { ChooseBenificiaryCodeInputMethodHandler } from "./ChooseBenificiaryCodeInputMethodHandler.js"; +export class FetchEventHandlers { + constructor() { + this.all = [ + new CreateDistributionRequestHandler(), + new NameDistributionRequestHandler(), + new ListDistributionRequestHandler(), + new SelectDistributionRequestHandler(), + new DeleteDistributionRequestHandler(), + new DeleteDistributionPostHandler(), + new UploadDataHandler(), + new BeneficiaryDataUploadHandler(), + new ChooseBenificiaryCodeInputMethodHandler() + ]; + } + handlersForEvent(event) { + return this.all.filter((handler) => handler.canHandleEvent(event)); + } + canHandleEvent(event) { + return this.handlersForEvent(event).length > 0; + } + handleEvent(event) { + var _a; + console.log("Will handle " + event.request.url); + return (_a = this.handlersForEvent(event)) === null || _a === void 0 ? void 0 : _a[0].handleEvent(event); + } +} diff --git a/PWA/public/FetchEventHandlers/LatestDistributionRequestHandler.js b/PWA/public/FetchEventHandlers/LatestDistributionRequestHandler.js new file mode 100644 index 0000000..33dee57 --- /dev/null +++ b/PWA/public/FetchEventHandlers/LatestDistributionRequestHandler.js @@ -0,0 +1,37 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database, ObjectStore } from "../Database/Database.js"; +export class LatestDistributionRequestHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.latestDistribution); + } + /* + {% if number_beneficiaries > 0 %} + + {% else %} + + {% endif %} + */ + async handleEvent(event) { + try { + const distributions = await Database.instance.getElement(ObjectStore.distribution); + const latestDistribution = distributions[distributions.length - 1]; + //TODO: move distributions display logic to shared handler (if current handler is still needed) + return ResponseTools.replaceTemplateKeysWithValues(await fetch(RouteEvents.distributionsHome), { + distrib_name: latestDistribution.distrib_name, + distrib_place: latestDistribution.distrib_place, + distrib_date: latestDistribution.distrib_date, + beneficiary_info: this.benificiaryInfoTextFromDistribution(latestDistribution) + }); + } + catch { + return Promise.reject("database error"); + } + } + isFilled(field) { + return field.length != 0; + } + benificiaryInfoTextFromDistribution(distribution) { + return "Progress.."; + } +} diff --git a/PWA/public/FetchEventHandlers/ListDistributionRequestHandler.js b/PWA/public/FetchEventHandlers/ListDistributionRequestHandler.js new file mode 100644 index 0000000..b3d529f --- /dev/null +++ b/PWA/public/FetchEventHandlers/ListDistributionRequestHandler.js @@ -0,0 +1,24 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { Distribution } from "../Models/Distribution.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; +export class ListDistributionRequestHandler { + canHandleEvent(event) { + const url = event.request.url; + return url.endsWith(RouteEvents.listDistributions) || url.endsWith(RouteEvents.listDistributionsFormAction); + } + async handleEvent(event) { + try { + const distributions = await Database.instance.readDistributions(); + console.log(distributions); + return ResponseTools.replaceTemplateKeysWithValues(await fetch(RouteEvents.listDistributions), { + columns: Distribution.colums, + rows: distributions + }); + } + catch { + console.log("something went wrong"); + } + return fetch(RouteEvents.home); + } +} diff --git a/PWA/public/FetchEventHandlers/NameDistributionRequestHandler.js b/PWA/public/FetchEventHandlers/NameDistributionRequestHandler.js new file mode 100644 index 0000000..56c3ead --- /dev/null +++ b/PWA/public/FetchEventHandlers/NameDistributionRequestHandler.js @@ -0,0 +1,10 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +export class NameDistributionRequestHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.nameDistribution); + } + async handleEvent(event) { + return ResponseTools.replaceTemplateKeysWithValues(await caches.match(event.request), { errorMessages: [] }); + } +} diff --git a/PWA/public/FetchEventHandlers/SelectDistributionHandler.js b/PWA/public/FetchEventHandlers/SelectDistributionHandler.js new file mode 100644 index 0000000..adb8d27 --- /dev/null +++ b/PWA/public/FetchEventHandlers/SelectDistributionHandler.js @@ -0,0 +1,23 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; +import { DeserialisationService } from "../Services/DeserialisationService.js"; +import { BenificiaryInfoService } from "../Services/BenificiaryInfoService.js"; +export class SelectDistributionRequestHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.postSelectDistribution); + } + async handleEvent(event) { + const post = await DeserialisationService.deserializeFormDataFromRequest(event.request); + const selectedDistribution = (await Database.instance.distributionsWithName(post.distrib_name))[0]; + return await ResponseTools.replaceTemplateKeysWithValues(await fetch(RouteEvents.distributionsHome), { + "distrib_name": selectedDistribution.distrib_name, + "distrib_place": selectedDistribution.distrib_place, + "distrib_date": selectedDistribution.distrib_date, + beneficiary_info: await BenificiaryInfoService.benificiaryInfoTextFromDistribution(selectedDistribution) + }); + } + isFilled(field) { + return field.length != 0; + } +} diff --git a/PWA/public/FetchEventHandlers/SelectDistributionRequestHandler.js b/PWA/public/FetchEventHandlers/SelectDistributionRequestHandler.js new file mode 100644 index 0000000..adb8d27 --- /dev/null +++ b/PWA/public/FetchEventHandlers/SelectDistributionRequestHandler.js @@ -0,0 +1,23 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; +import { DeserialisationService } from "../Services/DeserialisationService.js"; +import { BenificiaryInfoService } from "../Services/BenificiaryInfoService.js"; +export class SelectDistributionRequestHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.postSelectDistribution); + } + async handleEvent(event) { + const post = await DeserialisationService.deserializeFormDataFromRequest(event.request); + const selectedDistribution = (await Database.instance.distributionsWithName(post.distrib_name))[0]; + return await ResponseTools.replaceTemplateKeysWithValues(await fetch(RouteEvents.distributionsHome), { + "distrib_name": selectedDistribution.distrib_name, + "distrib_place": selectedDistribution.distrib_place, + "distrib_date": selectedDistribution.distrib_date, + beneficiary_info: await BenificiaryInfoService.benificiaryInfoTextFromDistribution(selectedDistribution) + }); + } + isFilled(field) { + return field.length != 0; + } +} diff --git a/PWA/public/FetchEventHandlers/UploadDataHandler.js b/PWA/public/FetchEventHandlers/UploadDataHandler.js new file mode 100644 index 0000000..9c640a5 --- /dev/null +++ b/PWA/public/FetchEventHandlers/UploadDataHandler.js @@ -0,0 +1,9 @@ +import { RouteEvents } from "../RouteEvents.js"; +export class UploadDataHandler { + canHandleEvent(event) { + return event.request.url.endsWith("/upload_data?"); + } + async handleEvent(event) { + return fetch(RouteEvents.uploadData); + } +} diff --git a/PWA/public/Interfaces/FetchEvent.js b/PWA/public/Interfaces/FetchEvent.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/PWA/public/Interfaces/FetchEvent.js @@ -0,0 +1 @@ +export {}; diff --git a/PWA/public/Interfaces/FetchEventHandler.js b/PWA/public/Interfaces/FetchEventHandler.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/PWA/public/Interfaces/FetchEventHandler.js @@ -0,0 +1 @@ +export {}; diff --git a/PWA/public/Models/BenificiarySpreadSheetRow.js b/PWA/public/Models/BenificiarySpreadSheetRow.js new file mode 100644 index 0000000..cdf1d64 --- /dev/null +++ b/PWA/public/Models/BenificiarySpreadSheetRow.js @@ -0,0 +1,5 @@ +export class BenificiarySpreadSheetRow { + constructor(comma_separated_cells) { + this.comma_separated_cells = comma_separated_cells; + } +} diff --git a/PWA/public/Models/DeleteDistributionPost.js b/PWA/public/Models/DeleteDistributionPost.js new file mode 100644 index 0000000..3a440bb --- /dev/null +++ b/PWA/public/Models/DeleteDistributionPost.js @@ -0,0 +1,5 @@ +export class DeleteDistributionPost { + constructor(distrib_id) { + this.distrib_id = distrib_id; + } +} diff --git a/PWA/public/Models/Distribution.js b/PWA/public/Models/Distribution.js new file mode 100644 index 0000000..c8477c2 --- /dev/null +++ b/PWA/public/Models/Distribution.js @@ -0,0 +1,16 @@ +class Distribution { + constructor(distrib_items, distrib_date, distrib_place, distrib_name) { + this.distrib_date = distrib_date; + this.distrib_items = distrib_items; + this.distrib_place = distrib_place; + this.distrib_name = distrib_name; + } +} +Distribution.colums = [ + "Name", + "Location", + "Date", + "Items Distributed", + "Donor", +]; +export { Distribution }; diff --git a/PWA/public/Models/FetchEvent.js b/PWA/public/Models/FetchEvent.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/PWA/public/Models/FetchEvent.js @@ -0,0 +1 @@ +export {}; diff --git a/PWA/public/Models/SelectDistributionPost.js b/PWA/public/Models/SelectDistributionPost.js new file mode 100644 index 0000000..190ce9f --- /dev/null +++ b/PWA/public/Models/SelectDistributionPost.js @@ -0,0 +1,5 @@ +export class SelectDistributionPost { + constructor(distrib_name) { + this.distrib_name = distrib_name; + } +} diff --git a/PWA/public/ResponseTools.js b/PWA/public/ResponseTools.js new file mode 100644 index 0000000..5e600a0 --- /dev/null +++ b/PWA/public/ResponseTools.js @@ -0,0 +1,70 @@ +export class ResponseTools { + static async replaceTemplateKeysWithValues(oldResponse, keysAndValues) { + return this.changeResponseText(oldResponse, (oldResponseText) => { + return Object.keys(keysAndValues).reduce((previousResponseText, currentKey) => { + return this.replaceAllOccurrencesOf(this.wrapInHandleBars(currentKey), keysAndValues[currentKey], previousResponseText); + }, oldResponseText); + }); + } + static async repeatInsertionOfValues(oldResponse, enumerationIdentifier, values) { + return this.changeResponseText(oldResponse, (oldResponseText) => { + const rawTemplate = this.enumerationTemplateFromStringWithIdentfier(oldResponseText, enumerationIdentifier); + const cleanTemplate = this.removeTemplateCodeFromString(rawTemplate); + const populatedTemplate = values.reduce((previousText, currentValue) => { + return previousText + "\n" + this.replaceAllOccurrencesOf(this.wrapInHandleBars(enumerationIdentifier), currentValue, cleanTemplate); + }, ""); + return this.replaceAllOccurrencesOf(rawTemplate, populatedTemplate, oldResponseText); + }); + } + static async replaceHandleBarContent(oldResponse, match, replacementString) { + return this.replaceResponseBody(oldResponse, this.wrapInHandleBars(match), replacementString); + } + static async replaceResponseBody(oldResponse, match, replacementString) { + return this.changeResponseText(oldResponse, (oldResponseText) => { + return this.replaceAllOccurrencesOf(match, replacementString, oldResponseText); + }); + } + static async changeResponseText(oldResponse, responseTextChanger) { + try { + const oldResponseText = await oldResponse.text(); + const newResponseText = responseTextChanger(oldResponseText); + return new Response(newResponseText, oldResponse); + } + catch (error) { + console.log(error); + return oldResponse; + } + } + static async removeFromResponseBody(oldResponse, match) { + return this.replaceResponseBody(oldResponse, match, ""); + } + static replaceAllOccurrencesOf(match, replacement, stringToAlter) { + if (this.isMatchAvailableInString(match, stringToAlter)) { + return this.replaceAllOccurrencesOf(match, replacement, stringToAlter.replace(match, replacement)); + } + else { + return stringToAlter; + } + } + static isMatchAvailableInString(match, string) { + if (typeof match === "string") { + return string.includes(match); + } + else { + return string.match(match) != null; + } + } + static wrapInHandleBars(string) { + return "{{ " + string + " }}"; + } + static enumerationTemplateFromStringWithIdentfier(string, identifier) { + var _a, _b; + return (_b = (_a = string.match(this.enumerationTemplateRegex(identifier))) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : ""; + } + static removeTemplateCodeFromString(string) { + return this.replaceAllOccurrencesOf(/{% .* %}/, "", string); + } + static enumerationTemplateRegex(identifier) { + return RegExp("{% for " + identifier + " in .* %}(\n|.)*?{% endfor %}"); + } +} diff --git a/PWA/public/RouteEvents.js b/PWA/public/RouteEvents.js new file mode 100644 index 0000000..7997ca5 --- /dev/null +++ b/PWA/public/RouteEvents.js @@ -0,0 +1,18 @@ +class RouteEvents { +} +RouteEvents.home = "/index.html"; +RouteEvents.distributionsHome = "/distrib.html"; +RouteEvents.nameDistribution = "/name_distrib.html"; +RouteEvents.listDistributions = "/list_distrib.html"; +RouteEvents.deleteDistribution = "/list_distrib_delete.html"; +RouteEvents.uploadData = "/upload_data.html"; +RouteEvents.uploadDataError = "/upload_error.html"; +RouteEvents.template = "/template.html"; +RouteEvents.chooseBenificiaryCodeInputMethodPage = "/choose_input_method.html"; +//Non page route events +RouteEvents.postCreateDistribution = "/create_distrib"; +RouteEvents.postSelectDistribution = "/select_distrib"; +RouteEvents.postDeleteDistribution = "/delete_distrib_confirm"; +RouteEvents.listDistributionsFormAction = "/distrib?"; +RouteEvents.chooseBenificiaryCodeInputMethod = "/choose_input_method"; +export { RouteEvents }; diff --git a/PWA/public/Services/BenificiaryDataParser.js b/PWA/public/Services/BenificiaryDataParser.js new file mode 100644 index 0000000..d34e9f2 --- /dev/null +++ b/PWA/public/Services/BenificiaryDataParser.js @@ -0,0 +1,23 @@ +export class BenificiaryJsonValidator { + static isValidBenificiaryJson(json) { + const rows = this.rowsFromJson(json); + if (rows.length == 0) { + console.log("Expected more than zero rows of data"); + return false; + } + for (const row in rows) { + if (!this.rowHasCodeColumn(row)) { + console.log("Expected row to have column named code"); + return false; + } + } + return true; + } + static rowsFromJson(json) { + return Object.values(json); + } + static rowHasCodeColumn(jsonRow) { + return Object.keys(jsonRow) + .indexOf("code") > -1; + } +} diff --git a/PWA/public/Services/BenificiaryInfoService.js b/PWA/public/Services/BenificiaryInfoService.js new file mode 100644 index 0000000..85e8685 --- /dev/null +++ b/PWA/public/Services/BenificiaryInfoService.js @@ -0,0 +1,14 @@ +import { BenificiarySpreadSheetRow } from "../Models/BenificiarySpreadSheetRow.js"; +export class BenificiaryInfoService { + static async benificiaryInfoTextFromDistribution(distribution) { + const benificiaries = [new BenificiarySpreadSheetRow("one, two")]; //await Database.instance.benificiariesForDistribution(distribution) + const numberOfServedBenificiaries = 42; //TODO: implement proper calculation + if (benificiaries.length > 0) { + //Beneficiaries served: {{ number_recipients }} / {{ number_beneficiaries }} + return "Beneficiaries served: " + numberOfServedBenificiaries; + } + else { + return "No beneficiary data found"; + } + } +} diff --git a/PWA/public/Services/BenificiaryJsonValidator.js b/PWA/public/Services/BenificiaryJsonValidator.js new file mode 100644 index 0000000..770c9bb --- /dev/null +++ b/PWA/public/Services/BenificiaryJsonValidator.js @@ -0,0 +1,22 @@ +export class BenificiaryJsonValidator { + static isValidBenificiaryJson(json) { + const rows = this.rowsFromJson(json); + if (rows.length == 0) { + console.log("Expected more than zero rows of data"); + return false; + } + //All table rows have same keys, therefore only checking first + if (!this.rowHasCodeColumn(rows[0])) { + console.log("Expected row to have column named code"); + return false; + } + return true; + } + static rowsFromJson(json) { + return Object.values(json); + } + static rowHasCodeColumn(jsonRow) { + return Object.keys(jsonRow) + .indexOf("code") > -1; + } +} diff --git a/PWA/public/Services/BenificiarySpreadSheetRowsDeserializationService.js b/PWA/public/Services/BenificiarySpreadSheetRowsDeserializationService.js new file mode 100644 index 0000000..dac3a02 --- /dev/null +++ b/PWA/public/Services/BenificiarySpreadSheetRowsDeserializationService.js @@ -0,0 +1,40 @@ +import { BenificiarySpreadSheetRow } from "../Models/BenificiarySpreadSheetRow.js"; +import { BenificiaryJsonValidator } from "./BenificiaryJsonValidator.js"; +import { FormParser } from "./FormParser.js"; +import { SpreadSheetFileParser } from "./SpreadSheetFileParser.js"; +export class BenificiarySpreadSheetRowsDeserializationService { + static async deserializeFormDataFromRequest(request) { + return new Promise(async (resolve, reject) => { + const possibleFile = FormParser.firstFileFromFormData(await request.formData()); + if (possibleFile instanceof File) { + const json = await SpreadSheetFileParser.jsonFromSpreadSheetFile(possibleFile); + if (BenificiaryJsonValidator.isValidBenificiaryJson(json)) { + const rows = this.rowsFromJson(json) + .map((row) => this.commaSeparatedValuesFromJsonRow(row)) + .map((commaSeparatedRowValues) => { + return new BenificiarySpreadSheetRow(commaSeparatedRowValues); + }); + return resolve(rows); + } + else { + return reject("Invalid format for benificiary rows"); + } + } + else { + return reject("Expected upload item of file type"); + } + }); + } + static rowsFromJson(json) { + return Object.values(json); + } + static commaSeparatedValuesFromJsonRow(json) { + return Object.keys(json) + .map((key) => { + return json[key]; + }) + .reduce((previousValue, currentValue, currentIndex, array) => { + return previousValue + "," + currentValue; + }); + } +} diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js new file mode 100644 index 0000000..2b1429e --- /dev/null +++ b/PWA/public/Services/CacheFilePathService.js @@ -0,0 +1,109 @@ +import { BeneficiaryDataUploadHandler } from "../FetchEventHandlers/BeneficiaryDataUploadHandler.js"; +import { ChooseBenificiaryCodeInputMethodHandler } from "../FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.js"; +import { CreateDistributionRequestHandler } from "../FetchEventHandlers/CreateDistributionRequestHandler.js"; +import { DeleteDistributionPostHandler } from "../FetchEventHandlers/DeleteDistributionPostHandler.js"; +import { FetchEventHandlers } from "../FetchEventHandlers/FetchEventHandlers.js"; +import { ListDistributionRequestHandler } from "../FetchEventHandlers/ListDistributionRequestHandler.js"; +import { NameDistributionRequestHandler } from "../FetchEventHandlers/NameDistributionRequestHandler.js"; +import { SelectDistributionRequestHandler } from "../FetchEventHandlers/SelectDistributionRequestHandler.js"; +import { UploadDataHandler } from "../FetchEventHandlers/UploadDataHandler.js"; +import { BenificiarySpreadSheetRow } from "../Models/BenificiarySpreadSheetRow.js"; +import { DeleteDistributionPost } from "../Models/DeleteDistributionPost.js"; +import { Distribution } from "../Models/Distribution.js"; +import { SelectDistributionPost } from "../Models/SelectDistributionPost.js"; +import { RouteEvents } from "../RouteEvents.js"; +import { BenificiaryInfoService } from "./BenificiaryInfoService.js"; +import { BenificiaryJsonValidator } from "./BenificiaryJsonValidator.js"; +import { Database } from "./Database.js"; +import { DeserialisationService } from "./DeserialisationService.js"; +import { FormParser } from "./FormParser.js"; +export class CacheFilePathService { + pathsOfFilesToCache() { + return [ + this.pagePaths(), + this.modelPaths(), + this.toplevelScriptsPaths(), + this.fetchEventHanderPaths(), + this.interfacesPaths(), + this.externalLibrariesPaths(), + this.servicePaths() + ].reduce((previousArray, currentValue) => { + return previousArray.concat(currentValue); + }, []); + } + pagePaths() { + return [ + RouteEvents.template, + RouteEvents.home, + RouteEvents.distributionsHome, + RouteEvents.nameDistribution, + RouteEvents.listDistributions, + RouteEvents.deleteDistribution, + RouteEvents.uploadData, + RouteEvents.uploadDataError, + RouteEvents.chooseBenificiaryCodeInputMethodPage + ]; + } + toplevelScriptsPaths() { + return this.pathsForTypesInFolder("", [ + "app", + "sw", + "navbar-burger", + RouteEvents.name + ]); + } + externalLibrariesPaths() { + return this.pathsForTypesInFolder("ExternalLibraries", [ + "mustache", + "xlsx.full.min" + ]); + } + modelPaths() { + return this.pathsForTypesInFolder("Models", [ + BenificiarySpreadSheetRow.name, + Distribution.name, + DeleteDistributionPost.name, + SelectDistributionPost.name, + ]); + } + servicePaths() { + return this.pathsForTypesInFolder("Services", [ + BenificiaryInfoService.name, + BenificiaryJsonValidator.name, + CacheFilePathService.name, + Database.name, + DeserialisationService.name, + FormParser.name, + ]); + } + fetchEventHanderPaths() { + return this.pathsForTypesInFolder("FetchEventHandlers", [ + BeneficiaryDataUploadHandler.name, + CreateDistributionRequestHandler.name, + DeleteDistributionPostHandler.name, + FetchEventHandlers.name, + ListDistributionRequestHandler.name, + NameDistributionRequestHandler.name, + SelectDistributionRequestHandler.name, + UploadDataHandler.name, + ChooseBenificiaryCodeInputMethodHandler.name + ]); + } + interfacesPaths() { + return this.pathsForTypesInFolder("Interfaces", [ + "FetchEvent", + "FetchEventHandler" + ]); + } + pathsForTypesInFolder(folder, typeNames, extension = ".js") { + return typeNames.map((name) => this.pathForTypeInFolder(name, folder, extension)); + } + pathForTypeInFolder(typeName, folder, extension = ".js") { + let path = "/"; + if (folder.length > 0) { + path += folder + "/"; + } + path += typeName + extension; + return path; + } +} diff --git a/PWA/public/Services/Database.js b/PWA/public/Services/Database.js new file mode 100644 index 0000000..eba24e9 --- /dev/null +++ b/PWA/public/Services/Database.js @@ -0,0 +1,145 @@ +import { BenificiarySpreadSheetRow } from "../Models/BenificiarySpreadSheetRow.js"; +import { Distribution } from "../Models/Distribution.js"; +let db; +export var ObjectStoreName; +(function (ObjectStoreName) { + ObjectStoreName["distribution"] = "Distributions"; + ObjectStoreName["benificiary"] = "Beneficiaries"; +})(ObjectStoreName || (ObjectStoreName = {})); +const allObjectStoreNames = [ObjectStoreName.benificiary, ObjectStoreName.distribution]; +function columnsForObjectStore(objectStore) { + switch (objectStore) { + case ObjectStoreName.distribution: + return [ + { name: "distrib_name", isUnique: true }, + { name: "distrib_place", isUnique: false }, + { name: "distrib_date", isUnique: false }, + { name: "distrib_items", isUnique: false } + ]; + case ObjectStoreName.benificiary: + return [ + { name: "comma_separated_cells", isUnique: true } + ]; + } +} +class Database { + constructor() { + let db; + const request = indexedDB.open("data", 1); + request.onerror = (err) => console.error(`IndexedDB error: ${request.error}`, err); + request.onsuccess = () => (db = request.result); + request.onupgradeneeded = () => { + const db = request.result; + allObjectStoreNames.forEach((storeName) => { + const postsStore = db.createObjectStore(storeName, { + keyPath: storeName, + autoIncrement: true, + }); + columnsForObjectStore(storeName).forEach((column) => postsStore.createIndex(column.name, column.name, { + unique: column.isUnique, + })); + }); + }; + //Temporarily seed for debuging purposes + this.addDistribution(new Distribution("24", "1/2/3", "Utrecht", "Sandwhiches")); + this.addBenificiary(new BenificiarySpreadSheetRow("one, two, three")); + } + async readDistributions() { + return this.getElement(ObjectStoreName.distribution); + } + async distributionsWithName(name) { + const distributions = await this.readDistributions(); + return distributions.filter((distribution) => distribution.distrib_name == name); + } + async addDistribution(distribution) { + return this.addElement(ObjectStoreName.distribution, distribution); + } + async deleteDistributionWithName(name) { + return this.removeElement(ObjectStoreName.distribution, await this.keyForDistributionWithName(name)); + } + async benificiariesForDistribution(distribution) { + return this.getElement(ObjectStoreName.benificiary); + } + async addBenificiary(beneficiary) { + return this.addElement(ObjectStoreName.benificiary, beneficiary); + } + async keyForDistributionWithName(name) { + const distributions = await this.readDistributions(); + const keys = await this.performRequestForObjectStoreNamed(ObjectStoreName.distribution, "readonly", (store) => { + return store.getAllKeys(); + }); + let distributionIndex = 0; + for (let i = 0; i < distributions.length; i++) { + if (distributions[i].distrib_name == name) { + distributionIndex = i; + break; + } + } + return keys[distributionIndex]; + } + getElement(storeName, key = `all`) { + return this.performRequestForObjectStoreNamed(storeName, "readonly", (store) => { + return key === "all" ? store.getAll() : store.get(key); + }); + } + addElement(storeName, payload) { + return this.performRequestForObjectStoreNamed(storeName, "readwrite", (store) => { + const serialized = JSON.parse(JSON.stringify(payload)); + return store.add(serialized); + }); + } + removeElement(storeName, key) { + console.log("Will remove element " + key + " from store " + storeName); + return this.performRequestForObjectStoreNamed(storeName, "readwrite", (store) => { + return key === "all" ? store.clear() : store.delete(key); + }); + } + performRequestForObjectStoreNamed(storeName, transactionMode, makeRequest) { + const open = indexedDB.open("data"); + return new Promise((resolve, reject) => { + open.onsuccess = () => { + db = open.result; + if ([...db.objectStoreNames].find((name) => name === storeName)) { + const transaction = db.transaction(storeName, transactionMode); + const objectStore = transaction.objectStore(storeName); + const request = makeRequest(objectStore); + request.onerror = () => reject(request.error); + request.onsuccess = () => resolve(request.result); + transaction.oncomplete = () => db.close(); + } + else { + indexedDB.deleteDatabase("data"); + } + }; + }); + } + editElement(store, key, payload) { + const open = indexedDB.open("data"); + return new Promise((resolve, reject) => { + open.onsuccess = () => { + let request; + db = open.result; + if ([...db.objectStoreNames].find((name) => name === store)) { + const transaction = db.transaction(store, "readwrite"); + const objectStore = transaction.objectStore(store); + if (key === "all") + request = objectStore.getAll(); + else + request = objectStore.get(key); + request.onerror = () => reject(request.error); + request.onsuccess = () => { + const serialized = JSON.parse(JSON.stringify(payload)); + const updateRequest = objectStore.put(serialized); + updateRequest.onsuccess = () => resolve(request.result); + }; + transaction.oncomplete = () => db.close(); + } + else { + indexedDB.deleteDatabase("data"); + } + }; + }); + } +} +Database.instance = new Database(); +export { Database }; diff --git a/PWA/public/Services/DeserialisationService.js b/PWA/public/Services/DeserialisationService.js new file mode 100644 index 0000000..de62cda --- /dev/null +++ b/PWA/public/Services/DeserialisationService.js @@ -0,0 +1,6 @@ +export class DeserialisationService { + static async deserializeFormDataFromRequest(request) { + const formData = await request.clone().formData(); + return Object.fromEntries(formData.entries()); + } +} diff --git a/PWA/public/Services/FormParser.js b/PWA/public/Services/FormParser.js new file mode 100644 index 0000000..d5e9a7b --- /dev/null +++ b/PWA/public/Services/FormParser.js @@ -0,0 +1,35 @@ +export class FormParser { + static firstFileFromFormData(formData) { + for (const keyValuePair of formData.entries()) { + const possibleFile = keyValuePair[1]; + if (possibleFile instanceof File) { + return possibleFile; + } + } + return null; + } +} +// TODO: Move +export class BenificiaryDataParser { + static isValidBenificiaryJson(json) { + const rows = this.rowsFromJson(json); + if (rows.length == 0) { + console.log("Expected more than zero rows of data"); + return false; + } + for (const row in rows) { + if (!this.rowHasCodeColumn(row)) { + console.log("Expected row to have column named code"); + return false; + } + } + return true; + } + static rowsFromJson(json) { + return Object.values(json); + } + static rowHasCodeColumn(jsonRow) { + return Object.keys(jsonRow) + .indexOf("code") > -1; + } +} diff --git a/PWA/public/Services/ResponseTools.js b/PWA/public/Services/ResponseTools.js new file mode 100644 index 0000000..3199d11 --- /dev/null +++ b/PWA/public/Services/ResponseTools.js @@ -0,0 +1,30 @@ +import mustache from "../ExternalLibraries/mustache.js"; +import { RouteEvents } from "../RouteEvents.js"; +export class ResponseTools { + static async replaceTemplateKeysWithValues(oldResponse, keysAndValues) { + return this.changeResponseText(oldResponse, (oldResponseText) => { + const untypedMustache = mustache; + const changedText = untypedMustache.render(oldResponseText, keysAndValues); + return changedText; + }); + } + static async wrapInHtmlTemplate(routeEvent) { + return this.replaceTemplateKeysWithValues(await this.cachedPage(RouteEvents.template), { + content: (await this.cachedPage(routeEvent)).text() + }); + } + static async changeResponseText(oldResponse, responseTextChanger) { + try { + const oldResponseText = await oldResponse.text(); + const newResponseText = responseTextChanger(oldResponseText); + return new Response(newResponseText, oldResponse); + } + catch (error) { + console.log(error); + return oldResponse; + } + } + static async cachedPage(routeEvent) { + return await caches.match(routeEvent); + } +} diff --git a/PWA/public/Services/SpreadSheetFileParser.js b/PWA/public/Services/SpreadSheetFileParser.js new file mode 100644 index 0000000..6a5fafa --- /dev/null +++ b/PWA/public/Services/SpreadSheetFileParser.js @@ -0,0 +1,15 @@ +import { read, utils } from "../ExternalLibraries/xlsx.full.min.js"; +export class SpreadSheetFileParser { + static async firstSheetFromSpreadSheetFile(spreadSheetFile) { + const workBook = read(await spreadSheetFile.arrayBuffer(), { + type: "array", + }); + const spreadSheetNames = workBook.SheetNames; + const firstSheet = workBook.Sheets[spreadSheetNames[0]]; + return firstSheet; + } + static async jsonFromSpreadSheetFile(spreadSheetFile) { + const spreadSheet = await this.firstSheetFromSpreadSheetFile(spreadSheetFile); + return utils.sheet_to_json(spreadSheet); + } +} diff --git a/PWA/public/app.js b/PWA/public/app.js new file mode 100644 index 0000000..0ac3a54 --- /dev/null +++ b/PWA/public/app.js @@ -0,0 +1,12 @@ +"use strict"; +if ('serviceWorker' in navigator) { + console.log("Will register serviceworker.."); + navigator.serviceWorker + .register('/sw.js', { type: 'module' }) + .then(function () { + console.log('Service worker registered!'); + }); +} +else { + console.log('Service worker not supported in this browser..'); +} diff --git a/PWA/public/apple-touch-icon-precomposed.png b/PWA/public/apple-touch-icon-precomposed.png new file mode 100644 index 0000000000000000000000000000000000000000..d9da11a70235d52c3f68546c6d150c0b4c5fd74b GIT binary patch literal 24078 zcmZs?Q+O^+4=!BWwrzLSwr#B1wr$&dYTLGLx2v|@?)Uo-{(Z6!GRe#&b6v?%lDQM9 zC@%pIg98Hu1OzW7DXRP*Z~h-aLHxJ!%|NjH$AF!cC4_-$XYtPe+lZQKN}0*Y0nz*? zLjeJYTLOXoPvt+t`Hz5rKns9@K>y>w|2r!H`TuX53qb#`{69tYl{8NvAVDB0Q6W_i z;Oibp7r=(=o+mAEXpDF*gS2{MP1D2X>g2ATPOIyz^k%`1 z@s#$2khV8Dmn45HRbuNjnKYVIA}gGT{6!=mD_^d&@N9W=->>hUhT0hfPN+D|(?0NX zX!>5yuY2F8Q&C6*dy{zJX9&o|CjifSM6)0^TDMwsv;WMo{-5Sv{8!7o z4Ea-PjU)%sCEe(wb(!em9<&)|o@&3m7vqD$v;S`LRvDtj0-ub;p5h`Xg{VU<3%Qh< zzsA9*Ui&OdRFg}xR<%kkd$i1Y$dlmP%c?WRwSssED#uZg^6H6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-8^T-$uU%7LiqS~1=Ip_lB3_Y9NNQr!L&8*|8FeAsagrT?-bLb4csgtJ(eTt zH9#*pm8C#bfEgz@%@zRXC+O4ey=22@Uk2RlJu-ORvKq0Jr1ma3Bscxf+xBm@!ukiS z?I0WQuy=M)Q0|OBPUoF=UjuYqaGVKJKFTPao4$~d0UJK`ExY;3*DN>Gi}Xcpk#gPK z!WITQtl`n0VuI49HNANT-mL+82BIvtRcHWej8U@O6%@8O<6Q8uK^wVt#)eKlXA_s+ zV$Q~-ZTrvh4aU%*ECJ;4K}I4^ zy + + + + + + + + ReliefBox + + + + + + +
+ + + +
+
+ +
+ + + + + +
+ +
+
+ + + + +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+ +
+
+ + + + \ No newline at end of file diff --git a/PWA/public/favicon.ico b/PWA/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..2323a711dc9bea42e68d593aca6bba6395729fc2 GIT binary patch literal 15406 zcmeHO`EyiPc2+9+113LYnQ<0Zs%GM3vbZLbOr?^_jFYL#)XY?VNX?9G3^uFn8NA^Q z8ygUt!4kt_BN&VUNeBVjg(Q%KgoF^fo-@EnYJNM~HEzw3T12!r9Ro!~8 z-*WG{=br6;=X6xm??wH7)Hl8n#q*<4FaAMP)W1YUMLqhc_WQ9vjEXwLdyhXp_xw9i zQ5Am_74;b3;V1k;yU$bD0}&h^Uoe8V7QZq(3mE!rIGQtnUFn1H1$ZNZ!|w7UzkUka z61(t1T&rqtoF72#kayXy>$}WY_u)-!Jl3+Py%OJxqqiK((vV*}il?HlVcntIZ1q@w zqz+ztwJBY`>XT`uk5Wn8+MBWu2L>`JqyvXhI zsBuQ^{`o$-C+#Tfvm&L{f!KT}{`i|_)&BZ#toX@K?HC%?B)dj$I$aq$9i>RgSok-Qz~(xDPX~AU3{i z#*D*{adQxRVqGY&^CPw0f$KfidAdU{gr2e?56VWpXe2!;jWZhmxqg?~Z|R^L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wy%2B6Z06}UWOTKG|HUlv KN4e$q>3;w@iI1xQ literal 0 HcmV?d00001 diff --git a/PWA/public/images/ReliefBox-horizontal-nobackground.png b/PWA/public/images/ReliefBox-horizontal-nobackground.png new file mode 100644 index 0000000000000000000000000000000000000000..8c0b6f2d1e4265f190ff49eb4420d0c4f601acd3 GIT binary patch literal 41658 zcmc$`gL7rU);>I$Ol<4Kwmq>XIx#18(*7K}-R@V+!1WF;n-7?3195S_l>)6{eZ8kF1eb%{=z_fTxc+}|#|9d|}B4~o4 zznaL$@$51oyCEPKt0*;>hKqNBWOkDw+W1vToE%_EkCT#0&WiWq^mHR+!+Q?|kK3|m zyduxmiFQc+Z_QHp!=_SA`;c1a1bR!cr z$3`1$Jb&IIyeKDHyE0pZ<9&cP;S-eDO~Av)tY?>xB!eZw=Jy}JVnrar=1~tiGmaT` z21F9AN08~&W%sf@`HSRkEyy>6$}`W}HfX9|e{lU=GFmxzaPs)S8E}5ifHG)(Q(`?= zJ{!(Tikqit+z480kWTWh#jtB+c&BwEC!&}(w02>ax zTV;t9v*P~0A&|y?rCX5`3=K!&y4iJ^n#l~8;mIFHS6zoTy*pca49Y)c$eSJ3 z;j+?jh+*@KW2Y6$<9DFwrsltw7g?7Lzy#uy+&NG|DdhykkR4s@)Qz!v;MHBiKVkIa zuJB2PWD?e}y*=>!?Id1K?KL)Y>+ue;L?TGaJQe<5fbxxIVDl+yGA2phf5_e5x(nHv zM4IfsAmgR>CM2!iwXD@2Z!A9&)iStG)v&Xd-S<=zdph1-CixbPbU&pA$m(s@U6&>p z^D;OAunBR^ZR;TODc_t@YN2hWxE&a5jMP;io{ww%!lUDC1j$%`__~ zN;?Ij@Puig7(Bo08G+t$e@zbGpVzeQZ){;>dks3Y5^-1dGJ)Obt;qjpb_;fA^}}y^ zrti~h8(o|~t9A2>Qo;@WjH9`R!~&xoz=r*CjDzZK+380sNyGO7Hs);?=B&42hGq}= zMXR1tDbmXP?RRI5Gw02#(-yI|{FougcI8Dv8mvH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q%|PmnJqId$1;Y0I$x1JfV) Ar2qf` literal 0 HcmV?d00001 diff --git a/PWA/public/images/ReliefBox-horizontal.png b/PWA/public/images/ReliefBox-horizontal.png new file mode 100644 index 0000000000000000000000000000000000000000..5d17279a0f9b5b2bf3264532100070e7283f6c09 GIT binary patch literal 39473 zcmcG#g;yKf8!lYjCAd=p#VG`LcX!v|?ry~)xE7~Kaff0>in~+X-5mP}Up5-8YA(8UFc=I2xD{(lf z^^>hLO7ZVfw^85tb|!DTb&R3=5keDk_hKP6O+zJ?c+5 zY#b6>=V!eT!8n{|wzh0)@z-agtK8Sq{bFLQTJz_IqsHv-f3~&nYZpQqcd5z9$~Y1# z|JyUfTb4Bcy;Q+5pZO*#_1{g3OawCNe-EiplhV8W|0CQ=r~dDN{Qu_zwu(gYw5VyL zU<;*p2sTe#NQ>ekhM?NnMH}CsLQ};MbuD`BbD$+>%qc>ooxA7H|M zCK=YMk_3iA;{*e@d+Y!L60qNoE_E#+PDlwpaR5cXqbNTYJ$Y8bWLXI1f{VDO48b~U zcr@Anf%LF+iU(iX6u^^v6q>*8B%VO^JEZi~m%z{sv06_&seW=WNKOJ+lj6wH4UoB3 zh@?`Y9~@=++Kb}H9mbmd4XzB4_A9ciBKaKOYN{%e%^3R^l@V|G9A94eE z#hqHL$$QohSezb^06ZN)2}qKNxbjD6iMT;)SQ?8O)J>XCzMYgkgST_srKqRaChEZl z_?s<2k5%aQdz39aGd-)sb~pe(F#R-2wRAF$Y-kVn-zn^6i-b+I3X?$60G~qW%b#+4 zesz~9BZ9qstDHhGkwjbSLezs#e2Oip@#?T2lRi5x;BRe5X>V1;J>$t>PxnIEkzh&T zVn=&HNC0Z@-#~gPH@nqn@I|#uBNP)iMSq!|{6DOCXwuz8Y2r-1a?b)V`3zA5myfUr zNdnEAAJ@exCE%=8Q~nOetFy{fNUs7{FF)E$3IvzBUt%Y|9Mr`Y`}&hsOaM)s`N#p~SI z7`kTHi9y;s%2NNMlT;Ilu+#!VdG>!2QfI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TxlU7x{ znE*8iUhycC4^^#7xAi099{n3Vq_SR&nQBwq)1N%eyGPMSp8eUYz>gX&UA)Xx zfa|?p*&q3c=kLS}dJ*zV4HSvXTs%mv5p8+#F!)?E=0c(WCtsjjI4AEY%k}LVQtKok Oesp0*S~XC+$o~PX3*_|x literal 0 HcmV?d00001 diff --git a/PWA/public/images/ReliefBox.PNG b/PWA/public/images/ReliefBox.PNG new file mode 100644 index 0000000000000000000000000000000000000000..65b2e9739fe0895d69170af96397d6ca2bc8fa83 GIT binary patch literal 649828 zcmeFYWmjBV6EzA1_n?h67J>$McMDE%cbDMq7HBNNAz0(?E`i3K;10ndcoQ__CCNGG zzIWVTaL0H)(9k`aJ@#I!YR*}+YJE^qlEFYFMumZa!H|=cRD*#*`UV4okbn&L{K-}( zvE%bESXVU}ahR$J(!=LB@K$1qVlXhZ@o0}G2+!|PoMm-fVPG&Jzkgr{ol4AMV15WhR|E1dha_V2S_#aUGi=_VpivK?Y#Y`O& zJ@Fsjypr}{p()lktS5E87?#F+ML8-xgV)>ivyJq%o};JrKY=eI_zyuoD%dlx0i%>z zR=8tT0|%$e7|?8e_WA3$h;=6;cU`m-Sg@HRy(4m8QV9o|@>^yJLoRSr^G2x<(p3`J z!*fv>msMyQEWb@eKibqd)-ICIN1SnDwxpll`dBk<#B?`u{3Y`MCDJ0E-wS+aGv%In z$#(BejZ+3AG|r>t=UD~AL9CRKCeBQNx+QKC3aYxib8aEsyJGJq-P^~;ym~vNKu9b^ z7Nq)Wg*b_JTv^+vXM61vY7; zSeGT!A+0ZOy}!E5iIwGZnSOy5&sxVO$zy&RHQ{5qy4t$DcD`%U@1oCPnH+VI{&{ie z{OG{{lm?_1FL2yqJ3lX zZkRv40!#n$(ttaQV}vO8KE6R)EV|Or$$d`sQ~$C@O_DDyzdryrK;|kWXgA0$L*Q1MlxG* zcEg`nzL(lDJN0g5>(N52;OW@qiMZGAu4&9FBY>YYP#`NHGcHFj4VbqRJ;cEoFY~Qn z55NtYxDmWx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--git a/PWA/public/images/icons/app-icon-192x192.png b/PWA/public/images/icons/app-icon-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..bb21d1064b20cfe4739cb6a870d2559788f80030 GIT binary patch literal 26842 zcmV)bK&iipP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91z@P&F1ONa40RR91zyJUM08KkN$^ZaB07*naRCodHy?2ylTVCJyyQy-H zopX5oLeC5H=1pQA!@w{Cfk(CsMza2pkU*@35Rw%Z_VSW!BpJ{`_VQXbM#vTjkOYGa zm=O$bU=qAZFNaRAU*}xiT{+(9&-b^_x%XCeRrRgzs_I+awX5zq`|P}bY5#UklrXkw zHX-ncLLm8w)_b$sn-FjaY%;(mAw1F$*kpi58vUD<-(-MI8hE53u*m?AH2OCyzsUfb zH1J46V3PqJY4mSaev<(RtO1Li8vzt5*EeZG;0rmO$N9h7(?_0S9^*O{g}-SpS1Mc zh)eoBl0J!Q1Axh)fLqZD5Ox6xpG>yUDs=MeK~3s}DVkx1q_+VmQZND3Uy8bCn~ZQj z7`kiRO$N9th?WUZDk8NZ)cm+*hfkyX-?XHQai}(hPG2ez83rgJ=^<#5xHSD-ahkUX zoL{QZ5->u#smqd0-8eN_B8jR*%i(5|0RkM>=vns+AOSjG9gswg&3aP@9b6Hyq%#uT z%T}DR+{jrgPG5K8M!Zuv2;Ykt%2!YvS_3hMTuSN(AnDPO_`sKhO4eYBbTchN8$8j0 zn$$td&<;a1IFpHWl(LMc>gfwO0UqjFE0vJ3!mc-Lyl5Nlv7s11=!I-zoI7KzFPa0f zi3FW!i*uGAea{M$*DRH!BoQ&*jS3R98l|GhH87Ef=UXNLL*&&#R!hJrQo6CtGEH=% zQI+^0PF&+)bEZ&3<1G$vm?F}zA^BT1iBJa2Ub8-8MdxVfmQK#y*q4Z#3`=p_5a0K6nYBb=>gQ}20- z*dWa8E`Vub>|Soa`yLz+BQF>eJV+4*@35n4QF22?IJel9^6RHuG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RJz=;L8O|hD$v6zST|Z`@wYApFs7d`*8+r(jE^ zQG-C!kYJ(P+^vhKN2hG|;&JPJ@&#)>_)$iTbQk^Rl7~BBxroCi11tiRdT|Q0uO$=O zyPWYMQT3dq)oXaOJitlEcW(AJqebji%WxZx7QH>+{M)*yST#}yM+*&&*dPn$pFhiXVdSYhrs3(;X{w&%?d6DflUTj4mz8D4?P4n z8Q`Hu@n!{=gTN*OEC-!UzlRK{8 literal 0 HcmV?d00001 diff --git a/PWA/public/images/icons/app-icon-512x512.png b/PWA/public/images/icons/app-icon-512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..0b998b8f80100d6c3d1dd0b1c21036eb4910208e GIT binary patch literal 136808 zcmeFZ^;6u<69%}u_~Py!2=4Cg4#C|C1b26LcbDK2+&w^W_uvk}9dhKY``%sMpKx{6 z^{JWNogaFqr@Nndx_2X#6eJPBcwhhkfG8~`rUC$fKBgc5EcC~4>puVdF#w%ZBt-x< zlLW^fFT~6=rOoB#0W=?TSO7503IO?U$;X5D@c;l2`9J`~#|ZrQUOwo5pMn7S5dZi5 z-$MAurVs!?2p}yctmY0p>(YuZ8Fl%c=2lrzbCH{i*lS1u>;DPB0tf_{1q6yGVH7ao zM8*%G`ZgQ98i#c%?F5k#IQAkXmRjog+6NPo^4iQL+sx^TC8#eq;wFo!U|`1sgaO$= zbAK&Qb5Db>9UXsr{*Jz0xY>QVW9jQ7d8kqd(4A zC(uIC{GU<*QaTkX`JeQ{6$^acoS-0J#E)yRh0+^8Y6v z${_tu6*chxugw4UMdhEF{=c>}&nb}qj>AJ3$f@ACQF-D@iy8XplZXtJ{(UauoDENM zWfsqd?}_teO6;b%;-SU&5_hOD5Hgd~P&gM7AEdi&Jlb-gAb?!IC5-En@!h|Z#-)Ps z9o(DnOu)|iGXo?`hOsS}cl?t#4IE(0y(!JAReCLve(yddY1Qo|Am5@de{&&mQZ1O# z-qn;0jbF~HiQOBTZ&|}Xlma5n<`-87b8JzM1|!$BIjre{L{}O8_XY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0aad606j@?Uh?}RZgPkg+! z?NZ++g4CR%OC$LeX1!8Z zV)k8J%-n00X45A0`moHddsBa1=XJHQE_~{I>%YzMf6K31e9POAyYx}aF5~8jvn{x} z|37DV*g0qS-i=OQA8Wg0&%g8K@Pnmo&zGOu&lo##-sLI3X2e>{e&@gS{IO~Ap7o&A O%i!ti=d#Wzp$Pz>A2mh* literal 0 HcmV?d00001 diff --git a/PWA/public/images/icons/favicon-32x32.png b/PWA/public/images/icons/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..3eafb1b1f048407fda96908b67178164a569755b GIT binary patch literal 1763 zcmV<91|0c`P)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91AfN*P1ONa40RR91AOHXW0IY^$^8f$_O-V#SR9FecS4(UgMHv2eXV!1$ zVaIv8t{YnQMNtY=R7KEIsz^Lkl{-=?6u6=u;DA&K3Ak|J0^*JYf+Ghm9DtTeh*zqX zlBRXqrb$EMB#s?B@ngNa!$0HNX&l>$3aBHEcXuBD|NY_m{}6??+E0r7!bmSrm?yu0_D^th~ivDx9*1Ki9q-DfO*5TR;ydz`crEb15RlP zrRkr*JnbaB8@eY1-5r9Jz6NJyYE=&rAZ!PYZPFNn?j<0>0Wg0rf!~R7LB2;zn}EoRiHrF6%e+3mf;8uJlGH39s>^ykc`G;uNxJP zg~HT%XjT!LRIX`cRUfg?i=dGPMv~A8kl7c7uQNh|s~{YRL{Bj5tXzkfw}X#(ZU zEm+6YWnp+YwD2ytJb|YBYXHo}1kBVZ7&9OUxkN9`cXBBp2iOxU z5aqHGByw5UzyAifJ#fYoaHj9T{mLo0UOin?l=|WuFrR^eqmPkG91>MW_T7~=0GUh% zmgz#k?Z8mhGg4T9oxDZ9O(Xxtdo|(K<;%z&e-SKBE*TzHV%g?YG>*C`Ro(47{=rc`l{77VTt-WDH( zD^Q_cl(Hz@IY)uq4_EJg=*&}FTLVxX35I$gyR~!!wqen80eXKFfiJ%X$OX$MUk2N| z7v6WzLi2iHjf|+R_ShKM(Eh3zv=ck93q-&4fKBf<%=9>HGY|i^XKU*kI!2~qIdzq? zNq~oX!J~uVM~;9WKCCwC9i8f%J#i3PRh3|P$96Sd z{b>lmT)YOmn1y4NC=QBL>1cD4rpM#(zWomDL;|^E&me#1EjU!Hs!duiyCXaI!_^V1 zPO0ZQ7YM3;=KQEqDkyq|ckD+%_Fj*@~fQ$})`XqR)2hP|vxKEsb zJ{W~PKdUUR0+4JPq1`oRswmb0D5nw>c*TlvqR$p4N(-YXrxVb)0sYYqI84Bty-<}w zPYu>q2MaI|^~}Jgnjo75Pc$k9EMdUkwU&OlW}OQbW~WdrRq|afkbZN>1-5dB35Q(b zP-alESJRarVkR5{vx`XnaSquBSD|zH*rV&61*0oYD6SId$sE#5hR9Cv)Zc61mQh$vidG$IvV_VQY7=zF6Q7I}5lmsDzHARsh@>U4d4Niv< zM>x6@2=64;=&sPDHDsW=mXRf}=u{-jIB{K=n#B0++wepp2*_ZM)af9iLyf!Kfb30LO8`0vNEgyD7)P7mC9{wMi6mvxSh%=|S+^G*u>n}w zER8d8vYgQ!LYKg4kMKpBs9hay34pse`O`q&G!f=r@;g;E6_nE10xnU4IdM~l0}QT_ zPJ^tbla#s>*$2ZPTGiC#tu+9{rIhRB14gG?rPV)aRI)-%G9Y~~Gy|Tkhbn^`{I&$p zJv2xQqR4aWXcME~Xhv}8bPkf&Pv;3KLRGjj?^cI;>RQ$j~=U6a1oy2$!X zDwo?gWS~xm`jmN{p=y`8avr7Bq!gpZdv?%u{m`4>|2KeDPy+dxn^?T^1D0=GMBl+< zXdilMb$SzT_r*XXx#g85^?!kR+Zs(b9sAD!G}W-d#6Javs9vLYSX=-A002ovPDHLk FV1h0u8I%A3 literal 0 HcmV?d00001 diff --git a/PWA/public/index.html b/PWA/public/index.html new file mode 100644 index 0000000..145b385 --- /dev/null +++ b/PWA/public/index.html @@ -0,0 +1,108 @@ + + + + + + + + + ReliefBox + + + + + + +

+ + + + + + +
+ + + \ No newline at end of file diff --git a/PWA/public/list_distrib.html b/PWA/public/list_distrib.html new file mode 100644 index 0000000..4e0f89c --- /dev/null +++ b/PWA/public/list_distrib.html @@ -0,0 +1,129 @@ + + + + + + + + + ReliefBox + + + + + + +
+ + + +
+
+ +
+ + + + + +
+ +
+
+
+ {{#columns}} +
+ +
+ {{/columns}} +
+ {{#rows}} +
+
+
+ + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ {{/rows}} +
+
+
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/PWA/public/list_distrib_delete.html b/PWA/public/list_distrib_delete.html new file mode 100644 index 0000000..06c628f --- /dev/null +++ b/PWA/public/list_distrib_delete.html @@ -0,0 +1,129 @@ + + + + + + + + + ReliefBox + + + + + + +
+ + + +
+
+ +
+ + + + + +
+ +
+
+
+ {{#columns}} +
+ +
+ {{/columns}} +
+ {{#rows}} +
+
+
+ + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ {{/rows}} +
+
+
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/PWA/public/manifest.json b/PWA/public/manifest.json new file mode 100644 index 0000000..7fc5bec --- /dev/null +++ b/PWA/public/manifest.json @@ -0,0 +1,25 @@ +{ + "name": "ReliefBox", + "short_name": "ReliefBox", + "icons": [ + { + "src": "/images/icons/app-icon-192x192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "/images/icons/app-icon-512x512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": "/index.html", + "scope": ".", + "display": "standalone", + "orientation": "portrait-primary", + "background_color": "#00d1b2", + "theme_color": "#00d1b2", + "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", + "dir": "ltr", + "lang": "en-US" +} \ No newline at end of file diff --git a/PWA/public/name_distrib.html b/PWA/public/name_distrib.html new file mode 100644 index 0000000..d349ee7 --- /dev/null +++ b/PWA/public/name_distrib.html @@ -0,0 +1,138 @@ + + + + + + + + + ReliefBox + + + + + + +
+ + + +
+
+ +
+ + + + + +
+ +
+
+ {{#errorMessages }} +
+ {{ . }} +
+ {{/errorMessages }} +
+
+
+ +
+
+
+
+ +
+
+
+
+
Date
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/PWA/public/navbar-burger.js b/PWA/public/navbar-burger.js new file mode 100644 index 0000000..d1b8758 --- /dev/null +++ b/PWA/public/navbar-burger.js @@ -0,0 +1,19 @@ +"use strict"; +document.addEventListener('DOMContentLoaded', () => { + // Get all "navbar-burger" elements + const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); + // Check if there are any navbar burgers + if ($navbarBurgers.length > 0) { + // Add a click event on each of them + $navbarBurgers.forEach(el => { + el.addEventListener('click', () => { + // Get the target from the "data-target" attribute + const target = el.dataset.target; + const $target = document.getElementById(target); + // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" + el.classList.toggle('is-active'); + $target === null || $target === void 0 ? void 0 : $target.classList.toggle('is-active'); + }); + }); + } +}); diff --git a/PWA/public/sw.d.ts b/PWA/public/sw.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/PWA/public/sw.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/PWA/public/sw.js b/PWA/public/sw.js new file mode 100644 index 0000000..c2bfebe --- /dev/null +++ b/PWA/public/sw.js @@ -0,0 +1,50 @@ +import { FetchEventHandlers } from "./FetchEventHandlers/FetchEventHandlers.js"; +import { CacheFilePathService } from "./Services/CacheFilePathService.js"; +var CACHE_STATIC_NAME = "static-v10"; +var CACHE_DYNAMIC_NAME = "dynamic-v2"; +self.addEventListener("install", function (event) { + console.log("[Service Worker] Installing Service Worker ...", event); + console.log(new CacheFilePathService().pathsOfFilesToCache()); + event.waitUntil(caches.open(CACHE_STATIC_NAME) + .then(function (cache) { + console.log("[Service Worker] Precaching App Shell"); + cache.addAll([ + "/", + "https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css", + "/favicon.ico", + "/manifest.json", + "/images/ReliefBox-horizontal-nobackground.png", + "/images/510logo.jpg", + "/images/ReliefBox-horizontal.png", + "/images/ReliefBox.PNG", + "/apple-touch-icon.png", + "/apple-touch-icon-precomposed.png" + ] + .concat(new CacheFilePathService().pathsOfFilesToCache())); + })); +}); +self.addEventListener("activate", function (event) { + console.log("[Service Worker] Activating Service Worker ....", event); + event.waitUntil(caches.keys().then(function (keyList) { + return Promise.all(keyList.map(function (key) { + if (key !== CACHE_STATIC_NAME && key !== CACHE_DYNAMIC_NAME) { + console.log("[Service Worker] Removing old cache.", key); + return caches.delete(key); + } + })); + })); + return self.clients.claim(); +}); +// Cache-only +self.addEventListener("fetch", function (event) { + let customHandlers = new FetchEventHandlers(); + console.log("Handling fetch request " + event.request.url); + if (customHandlers.canHandleEvent(event)) { + console.log("using custom event handler"); + event.respondWith(customHandlers.handleEvent(event)); + } + else { + console.log("using custom cache"); + event.respondWith(caches.match(event.request)); + } +}); diff --git a/PWA/public/template.html b/PWA/public/template.html new file mode 100644 index 0000000..c27d0f5 --- /dev/null +++ b/PWA/public/template.html @@ -0,0 +1,95 @@ + + + + + + + + + ReliefBox + + + + + + +
+ + + +
+
+ +
+ + + + + +
+ + {{content}} +
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/PWA/public/upload_data.html b/PWA/public/upload_data.html new file mode 100644 index 0000000..d7ab0b2 --- /dev/null +++ b/PWA/public/upload_data.html @@ -0,0 +1,109 @@ + + + + + + + + + ReliefBox + + + + + + +
+ + + +
+
+ +
+ + + + + +
+
+
+ + + +
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/PWA/public/upload_error.html b/PWA/public/upload_error.html new file mode 100644 index 0000000..f407d36 --- /dev/null +++ b/PWA/public/upload_error.html @@ -0,0 +1,106 @@ + + + + + + + + + ReliefBox + + + + + + +
+ + + +
+
+ +
+ + + + + +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/PWA/src/ExternalLibraries/mustache.js b/PWA/src/ExternalLibraries/mustache.js new file mode 100644 index 0000000..dee49a9 --- /dev/null +++ b/PWA/src/ExternalLibraries/mustache.js @@ -0,0 +1,764 @@ +/*! + * mustache.js - Logic-less {{mustache}} templates with JavaScript + * http://github.com/janl/mustache.js + */ + +var objectToString = Object.prototype.toString; +var isArray = Array.isArray || function isArrayPolyfill (object) { + return objectToString.call(object) === '[object Array]'; +}; + +function isFunction (object) { + return typeof object === 'function'; +} + +/** + * More correct typeof string handling array + * which normally returns typeof 'object' + */ +function typeStr (obj) { + return isArray(obj) ? 'array' : typeof obj; +} + +function escapeRegExp (string) { + return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&'); +} + +/** + * Null safe way of checking whether or not an object, + * including its prototype, has a given property + */ +function hasProperty (obj, propName) { + return obj != null && typeof obj === 'object' && (propName in obj); +} + +/** + * Safe way of detecting whether or not the given thing is a primitive and + * whether it has the given property + */ +function primitiveHasOwnProperty (primitive, propName) { + return ( + primitive != null + && typeof primitive !== 'object' + && primitive.hasOwnProperty + && primitive.hasOwnProperty(propName) + ); +} + +// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577 +// See https://github.com/janl/mustache.js/issues/189 +var regExpTest = RegExp.prototype.test; +function testRegExp (re, string) { + return regExpTest.call(re, string); +} + +var nonSpaceRe = /\S/; +function isWhitespace (string) { + return !testRegExp(nonSpaceRe, string); +} + +var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' +}; + +function escapeHtml (string) { + return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap (s) { + return entityMap[s]; + }); +} + +var whiteRe = /\s*/; +var spaceRe = /\s+/; +var equalsRe = /\s*=/; +var curlyRe = /\s*\}/; +var tagRe = /#|\^|\/|>|\{|&|=|!/; + +/** + * Breaks up the given `template` string into a tree of tokens. If the `tags` + * argument is given here it must be an array with two string values: the + * opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of + * course, the default is to use mustaches (i.e. mustache.tags). + * + * A token is an array with at least 4 elements. The first element is the + * mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag + * did not contain a symbol (i.e. {{myValue}}) this element is "name". For + * all text that appears outside a symbol this element is "text". + * + * The second element of a token is its "value". For mustache tags this is + * whatever else was inside the tag besides the opening symbol. For text tokens + * this is the text itself. + * + * The third and fourth elements of the token are the start and end indices, + * respectively, of the token in the original template. + * + * Tokens that are the root node of a subtree contain two more elements: 1) an + * array of tokens in the subtree and 2) the index in the original template at + * which the closing tag for that section begins. + * + * Tokens for partials also contain two more elements: 1) a string value of + * indendation prior to that tag and 2) the index of that tag on that line - + * eg a value of 2 indicates the partial is the third tag on this line. + */ +function parseTemplate (template, tags) { + if (!template) + return []; + var lineHasNonSpace = false; + var sections = []; // Stack to hold section tokens + var tokens = []; // Buffer to hold the tokens + var spaces = []; // Indices of whitespace tokens on the current line + var hasTag = false; // Is there a {{tag}} on the current line? + var nonSpace = false; // Is there a non-space char on the current line? + var indentation = ''; // Tracks indentation for tags that use it + var tagIndex = 0; // Stores a count of number of tags encountered on a line + + // Strips all whitespace tokens array for the current line + // if there was a {{#tag}} on it and otherwise only space. + function stripSpace () { + if (hasTag && !nonSpace) { + while (spaces.length) + delete tokens[spaces.pop()]; + } else { + spaces = []; + } + + hasTag = false; + nonSpace = false; + } + + var openingTagRe, closingTagRe, closingCurlyRe; + function compileTags (tagsToCompile) { + if (typeof tagsToCompile === 'string') + tagsToCompile = tagsToCompile.split(spaceRe, 2); + + if (!isArray(tagsToCompile) || tagsToCompile.length !== 2) + throw new Error('Invalid tags: ' + tagsToCompile); + + openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\s*'); + closingTagRe = new RegExp('\\s*' + escapeRegExp(tagsToCompile[1])); + closingCurlyRe = new RegExp('\\s*' + escapeRegExp('}' + tagsToCompile[1])); + } + + compileTags(tags || mustache.tags); + + var scanner = new Scanner(template); + + var start, type, value, chr, token, openSection; + while (!scanner.eos()) { + start = scanner.pos; + + // Match any text between tags. + value = scanner.scanUntil(openingTagRe); + + if (value) { + for (var i = 0, valueLength = value.length; i < valueLength; ++i) { + chr = value.charAt(i); + + if (isWhitespace(chr)) { + spaces.push(tokens.length); + indentation += chr; + } else { + nonSpace = true; + lineHasNonSpace = true; + indentation += ' '; + } + + tokens.push([ 'text', chr, start, start + 1 ]); + start += 1; + + // Check for whitespace on the current line. + if (chr === '\n') { + stripSpace(); + indentation = ''; + tagIndex = 0; + lineHasNonSpace = false; + } + } + } + + // Match the opening tag. + if (!scanner.scan(openingTagRe)) + break; + + hasTag = true; + + // Get the tag type. + type = scanner.scan(tagRe) || 'name'; + scanner.scan(whiteRe); + + // Get the tag value. + if (type === '=') { + value = scanner.scanUntil(equalsRe); + scanner.scan(equalsRe); + scanner.scanUntil(closingTagRe); + } else if (type === '{') { + value = scanner.scanUntil(closingCurlyRe); + scanner.scan(curlyRe); + scanner.scanUntil(closingTagRe); + type = '&'; + } else { + value = scanner.scanUntil(closingTagRe); + } + + // Match the closing tag. + if (!scanner.scan(closingTagRe)) + throw new Error('Unclosed tag at ' + scanner.pos); + + if (type == '>') { + token = [ type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace ]; + } else { + token = [ type, value, start, scanner.pos ]; + } + tagIndex++; + tokens.push(token); + + if (type === '#' || type === '^') { + sections.push(token); + } else if (type === '/') { + // Check section nesting. + openSection = sections.pop(); + + if (!openSection) + throw new Error('Unopened section "' + value + '" at ' + start); + + if (openSection[1] !== value) + throw new Error('Unclosed section "' + openSection[1] + '" at ' + start); + } else if (type === 'name' || type === '{' || type === '&') { + nonSpace = true; + } else if (type === '=') { + // Set the tags for the next time around. + compileTags(value); + } + } + + stripSpace(); + + // Make sure there are no open sections when we're done. + openSection = sections.pop(); + + if (openSection) + throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos); + + return nestTokens(squashTokens(tokens)); +} + +/** + * Combines the values of consecutive text tokens in the given `tokens` array + * to a single token. + */ +function squashTokens (tokens) { + var squashedTokens = []; + + var token, lastToken; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + token = tokens[i]; + + if (token) { + if (token[0] === 'text' && lastToken && lastToken[0] === 'text') { + lastToken[1] += token[1]; + lastToken[3] = token[3]; + } else { + squashedTokens.push(token); + lastToken = token; + } + } + } + + return squashedTokens; +} + +/** + * Forms the given array of `tokens` into a nested tree structure where + * tokens that represent a section have two additional items: 1) an array of + * all tokens that appear in that section and 2) the index in the original + * template that represents the end of that section. + */ +function nestTokens (tokens) { + var nestedTokens = []; + var collector = nestedTokens; + var sections = []; + + var token, section; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + token = tokens[i]; + + switch (token[0]) { + case '#': + case '^': + collector.push(token); + sections.push(token); + collector = token[4] = []; + break; + case '/': + section = sections.pop(); + section[5] = token[2]; + collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens; + break; + default: + collector.push(token); + } + } + + return nestedTokens; +} + +/** + * A simple string scanner that is used by the template parser to find + * tokens in template strings. + */ +function Scanner (string) { + this.string = string; + this.tail = string; + this.pos = 0; +} + +/** + * Returns `true` if the tail is empty (end of string). + */ +Scanner.prototype.eos = function eos () { + return this.tail === ''; +}; + +/** + * Tries to match the given regular expression at the current position. + * Returns the matched text if it can match, the empty string otherwise. + */ +Scanner.prototype.scan = function scan (re) { + var match = this.tail.match(re); + + if (!match || match.index !== 0) + return ''; + + var string = match[0]; + + this.tail = this.tail.substring(string.length); + this.pos += string.length; + + return string; +}; + +/** + * Skips all text until the given regular expression can be matched. Returns + * the skipped string, which is the entire tail if no match can be made. + */ +Scanner.prototype.scanUntil = function scanUntil (re) { + var index = this.tail.search(re), match; + + switch (index) { + case -1: + match = this.tail; + this.tail = ''; + break; + case 0: + match = ''; + break; + default: + match = this.tail.substring(0, index); + this.tail = this.tail.substring(index); + } + + this.pos += match.length; + + return match; +}; + +/** + * Represents a rendering context by wrapping a view object and + * maintaining a reference to the parent context. + */ +function Context (view, parentContext) { + this.view = view; + this.cache = { '.': this.view }; + this.parent = parentContext; +} + +/** + * Creates a new context using the given view with this context + * as the parent. + */ +Context.prototype.push = function push (view) { + return new Context(view, this); +}; + +/** + * Returns the value of the given name in this context, traversing + * up the context hierarchy if the value is absent in this context's view. + */ +Context.prototype.lookup = function lookup (name) { + var cache = this.cache; + + var value; + if (cache.hasOwnProperty(name)) { + value = cache[name]; + } else { + var context = this, intermediateValue, names, index, lookupHit = false; + + while (context) { + if (name.indexOf('.') > 0) { + intermediateValue = context.view; + names = name.split('.'); + index = 0; + + /** + * Using the dot notion path in `name`, we descend through the + * nested objects. + * + * To be certain that the lookup has been successful, we have to + * check if the last object in the path actually has the property + * we are looking for. We store the result in `lookupHit`. + * + * This is specially necessary for when the value has been set to + * `undefined` and we want to avoid looking up parent contexts. + * + * In the case where dot notation is used, we consider the lookup + * to be successful even if the last "object" in the path is + * not actually an object but a primitive (e.g., a string, or an + * integer), because it is sometimes useful to access a property + * of an autoboxed primitive, such as the length of a string. + **/ + while (intermediateValue != null && index < names.length) { + if (index === names.length - 1) + lookupHit = ( + hasProperty(intermediateValue, names[index]) + || primitiveHasOwnProperty(intermediateValue, names[index]) + ); + + intermediateValue = intermediateValue[names[index++]]; + } + } else { + intermediateValue = context.view[name]; + + /** + * Only checking against `hasProperty`, which always returns `false` if + * `context.view` is not an object. Deliberately omitting the check + * against `primitiveHasOwnProperty` if dot notation is not used. + * + * Consider this example: + * ``` + * Mustache.render("The length of a football field is {{#length}}{{length}}{{/length}}.", {length: "100 yards"}) + * ``` + * + * If we were to check also against `primitiveHasOwnProperty`, as we do + * in the dot notation case, then render call would return: + * + * "The length of a football field is 9." + * + * rather than the expected: + * + * "The length of a football field is 100 yards." + **/ + lookupHit = hasProperty(context.view, name); + } + + if (lookupHit) { + value = intermediateValue; + break; + } + + context = context.parent; + } + + cache[name] = value; + } + + if (isFunction(value)) + value = value.call(this.view); + + return value; +}; + +/** + * A Writer knows how to take a stream of tokens and render them to a + * string, given a context. It also maintains a cache of templates to + * avoid the need to parse the same template twice. + */ +function Writer () { + this.templateCache = { + _cache: {}, + set: function set (key, value) { + this._cache[key] = value; + }, + get: function get (key) { + return this._cache[key]; + }, + clear: function clear () { + this._cache = {}; + } + }; +} + +/** + * Clears all cached templates in this writer. + */ +Writer.prototype.clearCache = function clearCache () { + if (typeof this.templateCache !== 'undefined') { + this.templateCache.clear(); + } +}; + +/** + * Parses and caches the given `template` according to the given `tags` or + * `mustache.tags` if `tags` is omitted, and returns the array of tokens + * that is generated from the parse. + */ +Writer.prototype.parse = function parse (template, tags) { + var cache = this.templateCache; + var cacheKey = template + ':' + (tags || mustache.tags).join(':'); + var isCacheEnabled = typeof cache !== 'undefined'; + var tokens = isCacheEnabled ? cache.get(cacheKey) : undefined; + + if (tokens == undefined) { + tokens = parseTemplate(template, tags); + isCacheEnabled && cache.set(cacheKey, tokens); + } + return tokens; +}; + +/** + * High-level method that is used to render the given `template` with + * the given `view`. + * + * The optional `partials` argument may be an object that contains the + * names and templates of partials that are used in the template. It may + * also be a function that is used to load partial templates on the fly + * that takes a single argument: the name of the partial. + * + * If the optional `config` argument is given here, then it should be an + * object with a `tags` attribute or an `escape` attribute or both. + * If an array is passed, then it will be interpreted the same way as + * a `tags` attribute on a `config` object. + * + * The `tags` attribute of a `config` object must be an array with two + * string values: the opening and closing tags used in the template (e.g. + * [ "<%", "%>" ]). The default is to mustache.tags. + * + * The `escape` attribute of a `config` object must be a function which + * accepts a string as input and outputs a safely escaped string. + * If an `escape` function is not provided, then an HTML-safe string + * escaping function is used as the default. + */ +Writer.prototype.render = function render (template, view, partials, config) { + var tags = this.getConfigTags(config); + var tokens = this.parse(template, tags); + var context = (view instanceof Context) ? view : new Context(view, undefined); + return this.renderTokens(tokens, context, partials, template, config); +}; + +/** + * Low-level method that renders the given array of `tokens` using + * the given `context` and `partials`. + * + * Note: The `originalTemplate` is only ever used to extract the portion + * of the original template that was contained in a higher-order section. + * If the template doesn't use higher-order sections, this argument may + * be omitted. + */ +Writer.prototype.renderTokens = function renderTokens (tokens, context, partials, originalTemplate, config) { + var buffer = ''; + + var token, symbol, value; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + value = undefined; + token = tokens[i]; + symbol = token[0]; + + if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate, config); + else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate, config); + else if (symbol === '>') value = this.renderPartial(token, context, partials, config); + else if (symbol === '&') value = this.unescapedValue(token, context); + else if (symbol === 'name') value = this.escapedValue(token, context, config); + else if (symbol === 'text') value = this.rawValue(token); + + if (value !== undefined) + buffer += value; + } + + return buffer; +}; + +Writer.prototype.renderSection = function renderSection (token, context, partials, originalTemplate, config) { + var self = this; + var buffer = ''; + var value = context.lookup(token[1]); + + // This function is used to render an arbitrary template + // in the current context by higher-order sections. + function subRender (template) { + return self.render(template, context, partials, config); + } + + if (!value) return; + + if (isArray(value)) { + for (var j = 0, valueLength = value.length; j < valueLength; ++j) { + buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate, config); + } + } else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') { + buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate, config); + } else if (isFunction(value)) { + if (typeof originalTemplate !== 'string') + throw new Error('Cannot use higher-order sections without the original template'); + + // Extract the portion of the original template that the section contains. + value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender); + + if (value != null) + buffer += value; + } else { + buffer += this.renderTokens(token[4], context, partials, originalTemplate, config); + } + return buffer; +}; + +Writer.prototype.renderInverted = function renderInverted (token, context, partials, originalTemplate, config) { + var value = context.lookup(token[1]); + + // Use JavaScript's definition of falsy. Include empty arrays. + // See https://github.com/janl/mustache.js/issues/186 + if (!value || (isArray(value) && value.length === 0)) + return this.renderTokens(token[4], context, partials, originalTemplate, config); +}; + +Writer.prototype.indentPartial = function indentPartial (partial, indentation, lineHasNonSpace) { + var filteredIndentation = indentation.replace(/[^ \t]/g, ''); + var partialByNl = partial.split('\n'); + for (var i = 0; i < partialByNl.length; i++) { + if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) { + partialByNl[i] = filteredIndentation + partialByNl[i]; + } + } + return partialByNl.join('\n'); +}; + +Writer.prototype.renderPartial = function renderPartial (token, context, partials, config) { + if (!partials) return; + var tags = this.getConfigTags(config); + + var value = isFunction(partials) ? partials(token[1]) : partials[token[1]]; + if (value != null) { + var lineHasNonSpace = token[6]; + var tagIndex = token[5]; + var indentation = token[4]; + var indentedValue = value; + if (tagIndex == 0 && indentation) { + indentedValue = this.indentPartial(value, indentation, lineHasNonSpace); + } + var tokens = this.parse(indentedValue, tags); + return this.renderTokens(tokens, context, partials, indentedValue, config); + } +}; + +Writer.prototype.unescapedValue = function unescapedValue (token, context) { + var value = context.lookup(token[1]); + if (value != null) + return value; +}; + +Writer.prototype.escapedValue = function escapedValue (token, context, config) { + var escape = this.getConfigEscape(config) || mustache.escape; + var value = context.lookup(token[1]); + if (value != null) + return (typeof value === 'number' && escape === mustache.escape) ? String(value) : escape(value); +}; + +Writer.prototype.rawValue = function rawValue (token) { + return token[1]; +}; + +Writer.prototype.getConfigTags = function getConfigTags (config) { + if (isArray(config)) { + return config; + } + else if (config && typeof config === 'object') { + return config.tags; + } + else { + return undefined; + } +}; + +Writer.prototype.getConfigEscape = function getConfigEscape (config) { + if (config && typeof config === 'object' && !isArray(config)) { + return config.escape; + } + else { + return undefined; + } +}; + +var mustache = { + name: 'mustache.js', + version: '4.2.0', + tags: [ '{{', '}}' ], + clearCache: undefined, + escape: undefined, + parse: undefined, + render: undefined, + Scanner: undefined, + Context: undefined, + Writer: undefined, + /** + * Allows a user to override the default caching strategy, by providing an + * object with set, get and clear methods. This can also be used to disable + * the cache by setting it to the literal `undefined`. + */ + set templateCache (cache) { + defaultWriter.templateCache = cache; + }, + /** + * Gets the default or overridden caching object from the default writer. + */ + get templateCache () { + return defaultWriter.templateCache; + } +}; + +// All high-level mustache.* functions use this writer. +var defaultWriter = new Writer(); + +/** + * Clears all cached templates in the default writer. + */ +mustache.clearCache = function clearCache () { + return defaultWriter.clearCache(); +}; + +/** + * Parses and caches the given template in the default writer and returns the + * array of tokens it contains. Doing this ahead of time avoids the need to + * parse templates on the fly as they are rendered. + */ +mustache.parse = function parse (template, tags) { + return defaultWriter.parse(template, tags); +}; + +/** + * Renders the `template` with the given `view`, `partials`, and `config` + * using the default writer. + */ +mustache.render = function render (template, view, partials, config) { + if (typeof template !== 'string') { + throw new TypeError('Invalid template! Template should be a "string" ' + + 'but "' + typeStr(template) + '" was given as the first ' + + 'argument for mustache#render(template, view, partials)'); + } + + return defaultWriter.render(template, view, partials, config); +}; + +// Export the escaping function so that the user may override it. +// See https://github.com/janl/mustache.js/issues/244 +mustache.escape = escapeHtml; + +// Export these mainly for testing, but also for advanced usage. +mustache.Scanner = Scanner; +mustache.Context = Context; +mustache.Writer = Writer; + +export default mustache; \ No newline at end of file diff --git a/PWA/src/ExternalLibraries/xlsx.full.min.js b/PWA/src/ExternalLibraries/xlsx.full.min.js new file mode 100644 index 0000000..8fa977b --- /dev/null +++ b/PWA/src/ExternalLibraries/xlsx.full.min.js @@ -0,0 +1,27714 @@ +/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */ +/* vim: set ts=2: */ +/*exported XLSX */ +/*global process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */ +var XLSX = {}; +XLSX.version = '0.20.0'; +var current_codepage = 1200, current_ansi = 1252; +/*:: declare var cptable:any; */ +/*global cptable:true, window */ +var $cptable; + +var VALID_ANSI = [ 874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000 ]; +/* ECMA-376 Part I 18.4.1 charset to codepage mapping */ +var CS2CP = ({ + /*::[*/0/*::]*/: 1252, /* ANSI */ + /*::[*/1/*::]*/: 65001, /* DEFAULT */ + /*::[*/2/*::]*/: 65001, /* SYMBOL */ + /*::[*/77/*::]*/: 10000, /* MAC */ + /*::[*/128/*::]*/: 932, /* SHIFTJIS */ + /*::[*/129/*::]*/: 949, /* HANGUL */ + /*::[*/130/*::]*/: 1361, /* JOHAB */ + /*::[*/134/*::]*/: 936, /* GB2312 */ + /*::[*/136/*::]*/: 950, /* CHINESEBIG5 */ + /*::[*/161/*::]*/: 1253, /* GREEK */ + /*::[*/162/*::]*/: 1254, /* TURKISH */ + /*::[*/163/*::]*/: 1258, /* VIETNAMESE */ + /*::[*/177/*::]*/: 1255, /* HEBREW */ + /*::[*/178/*::]*/: 1256, /* ARABIC */ + /*::[*/186/*::]*/: 1257, /* BALTIC */ + /*::[*/204/*::]*/: 1251, /* RUSSIAN */ + /*::[*/222/*::]*/: 874, /* THAI */ + /*::[*/238/*::]*/: 1250, /* EASTEUROPE */ + /*::[*/255/*::]*/: 1252, /* OEM */ + /*::[*/69/*::]*/: 6969 /* MISC */ +}/*:any*/); + +var set_ansi = function(cp/*:number*/) { if(VALID_ANSI.indexOf(cp) == -1) return; current_ansi = CS2CP[0] = cp; }; +function reset_ansi() { set_ansi(1252); } + +var set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); }; +function reset_cp() { set_cp(1200); reset_ansi(); } + +function char_codes(data/*:string*/)/*:Array*/ { var o/*:Array*/ = []; for(var i = 0, len = data.length; i < len; ++i) o[i] = data.charCodeAt(i); return o; } + +function utf16leread(data/*:string*/)/*:string*/ { + var o/*:Array*/ = []; + for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i) + (data.charCodeAt(2*i+1)<<8)); + return o.join(""); +} +function utf16lereadu(data/*:Uint8Array*/)/*:string*/ { + var o/*:Array*/ = []; + for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data[2*i] + (data[2*i+1]<<8)); + return o.join(""); +} +function utf16beread(data/*:string*/)/*:string*/ { + var o/*:Array*/ = []; + for(var i = 0; i < (data.length>>1); ++i) o[i] = String.fromCharCode(data.charCodeAt(2*i+1) + (data.charCodeAt(2*i)<<8)); + return o.join(""); +} + +var debom = function(data/*:string*/)/*:string*/ { + var c1 = data.charCodeAt(0), c2 = data.charCodeAt(1); + if(c1 == 0xFF && c2 == 0xFE) return utf16leread(data.slice(2)); + if(c1 == 0xFE && c2 == 0xFF) return utf16beread(data.slice(2)); + if(c1 == 0xFEFF) return data.slice(1); + return data; +}; + +var _getchar = function _gc1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; +var _getansi = function _ga1(x/*:number*/)/*:string*/ { return String.fromCharCode(x); }; + +function set_cptable(cptable) { + $cptable = cptable; + set_cp = function(cp/*:number*/) { current_codepage = cp; set_ansi(cp); }; + debom = function(data/*:string*/) { + if(data.charCodeAt(0) === 0xFF && data.charCodeAt(1) === 0xFE) { return $cptable.utils.decode(1200, char_codes(data.slice(2))); } + return data; + }; + _getchar = function _gc2(x/*:number*/)/*:string*/ { + if(current_codepage === 1200) return String.fromCharCode(x); + return $cptable.utils.decode(current_codepage, [x&255,x>>8])[0]; + }; + _getansi = function _ga2(x/*:number*/)/*:string*/ { + return $cptable.utils.decode(current_ansi, [x])[0]; + }; + cpdoit(); +} +var DENSE = null; +var DIF_XL = true; +var Base64_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; +function Base64_encode(input) { + var o = ""; + var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; + for (var i = 0; i < input.length; ) { + c1 = input.charCodeAt(i++); + e1 = c1 >> 2; + c2 = input.charCodeAt(i++); + e2 = (c1 & 3) << 4 | c2 >> 4; + c3 = input.charCodeAt(i++); + e3 = (c2 & 15) << 2 | c3 >> 6; + e4 = c3 & 63; + if (isNaN(c2)) { + e3 = e4 = 64; + } else if (isNaN(c3)) { + e4 = 64; + } + o += Base64_map.charAt(e1) + Base64_map.charAt(e2) + Base64_map.charAt(e3) + Base64_map.charAt(e4); + } + return o; +} +function Base64_encode_pass(input) { + var o = ""; + var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; + for (var i = 0; i < input.length; ) { + c1 = input.charCodeAt(i++); + if (c1 > 255) + c1 = 95; + e1 = c1 >> 2; + c2 = input.charCodeAt(i++); + if (c2 > 255) + c2 = 95; + e2 = (c1 & 3) << 4 | c2 >> 4; + c3 = input.charCodeAt(i++); + if (c3 > 255) + c3 = 95; + e3 = (c2 & 15) << 2 | c3 >> 6; + e4 = c3 & 63; + if (isNaN(c2)) { + e3 = e4 = 64; + } else if (isNaN(c3)) { + e4 = 64; + } + o += Base64_map.charAt(e1) + Base64_map.charAt(e2) + Base64_map.charAt(e3) + Base64_map.charAt(e4); + } + return o; +} +function Base64_encode_arr(input) { + var o = ""; + var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; + for (var i = 0; i < input.length; ) { + c1 = input[i++]; + e1 = c1 >> 2; + c2 = input[i++]; + e2 = (c1 & 3) << 4 | c2 >> 4; + c3 = input[i++]; + e3 = (c2 & 15) << 2 | c3 >> 6; + e4 = c3 & 63; + if (isNaN(c2)) { + e3 = e4 = 64; + } else if (isNaN(c3)) { + e4 = 64; + } + o += Base64_map.charAt(e1) + Base64_map.charAt(e2) + Base64_map.charAt(e3) + Base64_map.charAt(e4); + } + return o; +} +function Base64_decode(input) { + var o = ""; + var c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0; + input = input.replace(/^data:([^\/]+\/[^\/]+)?;base64\,/, "").replace(/[^\w\+\/\=]/g, ""); + for (var i = 0; i < input.length; ) { + e1 = Base64_map.indexOf(input.charAt(i++)); + e2 = Base64_map.indexOf(input.charAt(i++)); + c1 = e1 << 2 | e2 >> 4; + o += String.fromCharCode(c1); + e3 = Base64_map.indexOf(input.charAt(i++)); + c2 = (e2 & 15) << 4 | e3 >> 2; + if (e3 !== 64) { + o += String.fromCharCode(c2); + } + e4 = Base64_map.indexOf(input.charAt(i++)); + c3 = (e3 & 3) << 6 | e4; + if (e4 !== 64) { + o += String.fromCharCode(c3); + } + } + return o; +} +var has_buf = /*#__PURE__*/(function() { return typeof Buffer !== 'undefined' && typeof process !== 'undefined' && typeof process.versions !== 'undefined' && !!process.versions.node; })(); + +var Buffer_from = /*#__PURE__*/(function() { + if(typeof Buffer !== 'undefined') { + var nbfs = !Buffer.from; + if(!nbfs) try { Buffer.from("foo", "utf8"); } catch(e) { nbfs = true; } + return nbfs ? function(buf, enc) { return (enc) ? new Buffer(buf, enc) : new Buffer(buf); } : Buffer.from.bind(Buffer); + } + return function() {}; +})(); +var buf_utf16le = /*#__PURE__*/(function() { + if(typeof Buffer === 'undefined') return false; + var x = Buffer_from([65,0]); + if(!x) return false; + var o = x.toString("utf16le"); + return o.length == 1; +})(); + + +function new_raw_buf(len/*:number*/) { + /* jshint -W056 */ + if(has_buf) return Buffer.alloc ? Buffer.alloc(len) : new Buffer(len); + return typeof Uint8Array != "undefined" ? new Uint8Array(len) : new Array(len); + /* jshint +W056 */ +} + +function new_unsafe_buf(len/*:number*/) { + /* jshint -W056 */ + if(has_buf) return Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : new Buffer(len); + return typeof Uint8Array != "undefined" ? new Uint8Array(len) : new Array(len); + /* jshint +W056 */ +} + +var s2a = function s2a(s/*:string*/)/*:any*/ { + if(has_buf) return Buffer_from(s, "binary"); + return s.split("").map(function(x/*:string*/)/*:number*/{ return x.charCodeAt(0) & 0xff; }); +}; + +function s2ab(s/*:string*/)/*:any*/ { + if(typeof ArrayBuffer === 'undefined') return s2a(s); + var buf = new ArrayBuffer(s.length), view = new Uint8Array(buf); + for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; + return buf; +} + +function a2s(data/*:any*/)/*:string*/ { + if(Array.isArray(data)) return data.map(function(c) { return String.fromCharCode(c); }).join(""); + var o/*:Array*/ = []; for(var i = 0; i < data.length; ++i) o[i] = String.fromCharCode(data[i]); return o.join(""); +} + +function a2u(data/*:Array*/)/*:Uint8Array*/ { + if(typeof Uint8Array === 'undefined') throw new Error("Unsupported"); + return new Uint8Array(data); +} + +function ab2a(data/*:ArrayBuffer|Uint8Array*/)/*:Array*/ { + if(typeof ArrayBuffer == 'undefined') throw new Error("Unsupported"); + if(data instanceof ArrayBuffer) return ab2a(new Uint8Array(data)); + /*:: if(data instanceof ArrayBuffer) throw new Error("unreachable"); */ + var o = new Array(data.length); + for(var i = 0; i < data.length; ++i) o[i] = data[i]; + return o; +} + +var bconcat = has_buf ? function(bufs) { return Buffer.concat(bufs.map(function(buf) { return Buffer.isBuffer(buf) ? buf : Buffer_from(buf); })); } : function(bufs) { + if(typeof Uint8Array !== "undefined") { + var i = 0, maxlen = 0; + for(i = 0; i < bufs.length; ++i) maxlen += bufs[i].length; + var o = new Uint8Array(maxlen); + var len = 0; + for(i = 0, maxlen = 0; i < bufs.length; maxlen += len, ++i) { + len = bufs[i].length; + if(bufs[i] instanceof Uint8Array) o.set(bufs[i], maxlen); + else if(typeof bufs[i] == "string") o.set(new Uint8Array(s2a(bufs[i])), maxlen); + else o.set(new Uint8Array(bufs[i]), maxlen); + } + return o; + } + return [].concat.apply([], bufs.map(function(buf) { return Array.isArray(buf) ? buf : [].slice.call(buf); })); +}; + +function utf8decode(content/*:string*/) { + var out = [], widx = 0, L = content.length + 250; + var o = new_raw_buf(content.length + 255); + for(var ridx = 0; ridx < content.length; ++ridx) { + var c = content.charCodeAt(ridx); + if(c < 0x80) o[widx++] = c; + else if(c < 0x800) { + o[widx++] = (192|((c>>6)&31)); + o[widx++] = (128|(c&63)); + } else if(c >= 0xD800 && c < 0xE000) { + c = (c&1023)+64; + var d = content.charCodeAt(++ridx)&1023; + o[widx++] = (240|((c>>8)&7)); + o[widx++] = (128|((c>>2)&63)); + o[widx++] = (128|((d>>6)&15)|((c&3)<<4)); + o[widx++] = (128|(d&63)); + } else { + o[widx++] = (224|((c>>12)&15)); + o[widx++] = (128|((c>>6)&63)); + o[widx++] = (128|(c&63)); + } + if(widx > L) { + out.push(o.slice(0, widx)); + widx = 0; + o = new_raw_buf(65535); + L = 65530; + } + } + out.push(o.slice(0, widx)); + return bconcat(out); +} + +var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g; +/*:: +declare type Block = any; +declare type BufArray = { + newblk(sz:number):Block; + next(sz:number):Block; + end():any; + push(buf:Block):void; +}; + +type RecordHopperCB = {(d:any, Rn:string, RT:number):?boolean;}; + +type EvertType = {[string]:string}; +type EvertNumType = {[string]:number}; +type EvertArrType = {[string]:Array}; + +type StringConv = {(string):string}; + +*/ +/* ssf.js (C) 2013-present SheetJS -- http://sheetjs.com */ +/*jshint -W041 */ +function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; } +function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;} +function pad_(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v;return t.length>=d?t:fill(' ',d-t.length)+t;} +function rpad_(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:t+fill(' ',d-t.length);} +function pad0r1(v/*:any*/,d/*:number*/)/*:string*/{var t=""+Math.round(v); return t.length>=d?t:fill('0',d-t.length)+t;} +function pad0r2(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;} +var p2_32 = /*#__PURE__*/Math.pow(2,32); +function pad0r(v/*:any*/,d/*:number*/)/*:string*/{if(v>p2_32||v<-p2_32) return pad0r1(v,d); var i = Math.round(v); return pad0r2(i,d); } +/* yes, in 2022 this is still faster than string compare */ +function SSF_isgeneral(s/*:string*/, i/*:?number*/)/*:boolean*/ { i = i || 0; return s.length >= 7 + i && (s.charCodeAt(i)|32) === 103 && (s.charCodeAt(i+1)|32) === 101 && (s.charCodeAt(i+2)|32) === 110 && (s.charCodeAt(i+3)|32) === 101 && (s.charCodeAt(i+4)|32) === 114 && (s.charCodeAt(i+5)|32) === 97 && (s.charCodeAt(i+6)|32) === 108; } +var days/*:Array >*/ = [ + ['Sun', 'Sunday'], + ['Mon', 'Monday'], + ['Tue', 'Tuesday'], + ['Wed', 'Wednesday'], + ['Thu', 'Thursday'], + ['Fri', 'Friday'], + ['Sat', 'Saturday'] +]; +var months/*:Array >*/ = [ + ['J', 'Jan', 'January'], + ['F', 'Feb', 'February'], + ['M', 'Mar', 'March'], + ['A', 'Apr', 'April'], + ['M', 'May', 'May'], + ['J', 'Jun', 'June'], + ['J', 'Jul', 'July'], + ['A', 'Aug', 'August'], + ['S', 'Sep', 'September'], + ['O', 'Oct', 'October'], + ['N', 'Nov', 'November'], + ['D', 'Dec', 'December'] +]; +function SSF_init_table(t/*:any*/) { + if(!t) t = {}; + t[0]= 'General'; + t[1]= '0'; + t[2]= '0.00'; + t[3]= '#,##0'; + t[4]= '#,##0.00'; + t[9]= '0%'; + t[10]= '0.00%'; + t[11]= '0.00E+00'; + t[12]= '# ?/?'; + t[13]= '# ??/??'; + t[14]= 'm/d/yy'; + t[15]= 'd-mmm-yy'; + t[16]= 'd-mmm'; + t[17]= 'mmm-yy'; + t[18]= 'h:mm AM/PM'; + t[19]= 'h:mm:ss AM/PM'; + t[20]= 'h:mm'; + t[21]= 'h:mm:ss'; + t[22]= 'm/d/yy h:mm'; + t[37]= '#,##0 ;(#,##0)'; + t[38]= '#,##0 ;[Red](#,##0)'; + t[39]= '#,##0.00;(#,##0.00)'; + t[40]= '#,##0.00;[Red](#,##0.00)'; + t[45]= 'mm:ss'; + t[46]= '[h]:mm:ss'; + t[47]= 'mmss.0'; + t[48]= '##0.0E+0'; + t[49]= '@'; + t[56]= '"上午/下午 "hh"時"mm"分"ss"秒 "'; + return t; +} +/* repeated to satiate webpack */ +var table_fmt = { + 0: 'General', + 1: '0', + 2: '0.00', + 3: '#,##0', + 4: '#,##0.00', + 9: '0%', + 10: '0.00%', + 11: '0.00E+00', + 12: '# ?/?', + 13: '# ??/??', + 14: 'm/d/yy', + 15: 'd-mmm-yy', + 16: 'd-mmm', + 17: 'mmm-yy', + 18: 'h:mm AM/PM', + 19: 'h:mm:ss AM/PM', + 20: 'h:mm', + 21: 'h:mm:ss', + 22: 'm/d/yy h:mm', + 37: '#,##0 ;(#,##0)', + 38: '#,##0 ;[Red](#,##0)', + 39: '#,##0.00;(#,##0.00)', + 40: '#,##0.00;[Red](#,##0.00)', + 45: 'mm:ss', + 46: '[h]:mm:ss', + 47: 'mmss.0', + 48: '##0.0E+0', + 49: '@', + 56: '"上午/下午 "hh"時"mm"分"ss"秒 "' +}; + +/* Defaults determined by systematically testing in Excel 2019 */ + +/* These formats appear to default to other formats in the table */ +var SSF_default_map = { + 5: 37, 6: 38, 7: 39, 8: 40, // 5 -> 37 ... 8 -> 40 + + 23: 0, 24: 0, 25: 0, 26: 0, // 23 -> 0 ... 26 -> 0 + + 27: 14, 28: 14, 29: 14, 30: 14, 31: 14, // 27 -> 14 ... 31 -> 14 + + 50: 14, 51: 14, 52: 14, 53: 14, 54: 14, // 50 -> 14 ... 58 -> 14 + 55: 14, 56: 14, 57: 14, 58: 14, + 59: 1, 60: 2, 61: 3, 62: 4, // 59 -> 1 ... 62 -> 4 + + 67: 9, 68: 10, // 67 -> 9 ... 68 -> 10 + 69: 12, 70: 13, 71: 14, // 69 -> 12 ... 71 -> 14 + 72: 14, 73: 15, 74: 16, 75: 17, // 72 -> 14 ... 75 -> 17 + 76: 20, 77: 21, 78: 22, // 76 -> 20 ... 78 -> 22 + 79: 45, 80: 46, 81: 47, // 79 -> 45 ... 81 -> 47 + 82: 0 // 82 -> 0 ... 65536 -> 0 (omitted) +}; + + +/* These formats technically refer to Accounting formats with no equivalent */ +var SSF_default_str = { + // 5 -- Currency, 0 decimal, black negative + 5: '"$"#,##0_);\\("$"#,##0\\)', + 63: '"$"#,##0_);\\("$"#,##0\\)', + + // 6 -- Currency, 0 decimal, red negative + 6: '"$"#,##0_);[Red]\\("$"#,##0\\)', + 64: '"$"#,##0_);[Red]\\("$"#,##0\\)', + + // 7 -- Currency, 2 decimal, black negative + 7: '"$"#,##0.00_);\\("$"#,##0.00\\)', + 65: '"$"#,##0.00_);\\("$"#,##0.00\\)', + + // 8 -- Currency, 2 decimal, red negative + 8: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + 66: '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + + // 41 -- Accounting, 0 decimal, No Symbol + 41: '_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)', + + // 42 -- Accounting, 0 decimal, $ Symbol + 42: '_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)', + + // 43 -- Accounting, 2 decimal, No Symbol + 43: '_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)', + + // 44 -- Accounting, 2 decimal, $ Symbol + 44: '_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)' +}; + +function SSF_frac(x/*:number*/, D/*:number*/, mixed/*:?boolean*/)/*:Array*/ { + var sgn = x < 0 ? -1 : 1; + var B = x * sgn; + var P_2 = 0, P_1 = 1, P = 0; + var Q_2 = 1, Q_1 = 0, Q = 0; + var A = Math.floor(B); + while(Q_1 < D) { + A = Math.floor(B); + P = A * P_1 + P_2; + Q = A * Q_1 + Q_2; + if((B - A) < 0.00000005) break; + B = 1 / (B - A); + P_2 = P_1; P_1 = P; + Q_2 = Q_1; Q_1 = Q; + } + if(Q > D) { if(Q_1 > D) { Q = Q_2; P = P_2; } else { Q = Q_1; P = P_1; } } + if(!mixed) return [0, sgn * P, Q]; + var q = Math.floor(sgn * P/Q); + return [q, sgn*P - q*Q, Q]; +} +function SSF_parse_date_code(v/*:number*/,opts/*:?any*/,b2/*:?boolean*/) { + if(v > 2958465 || v < 0) return null; + var date = (v|0), time = Math.floor(86400 * (v - date)), dow=0; + var dout=[]; + var out={D:date, T:time, u:86400*(v-date)-time,y:0,m:0,d:0,H:0,M:0,S:0,q:0}; + if(Math.abs(out.u) < 1e-6) out.u = 0; + if(opts && opts.date1904) date += 1462; + if(out.u > 0.9999) { + out.u = 0; + if(++time == 86400) { out.T = time = 0; ++date; ++out.D; } + } + if(date === 60) {dout = b2 ? [1317,10,29] : [1900,2,29]; dow=3;} + else if(date === 0) {dout = b2 ? [1317,8,29] : [1900,1,0]; dow=6;} + else { + if(date > 60) --date; + /* 1 = Jan 1 1900 in Gregorian */ + var d = new Date(1900, 0, 1); + d.setDate(d.getDate() + date - 1); + dout = [d.getFullYear(), d.getMonth()+1,d.getDate()]; + dow = d.getDay(); + if(date < 60) dow = (dow + 6) % 7; + if(b2) dow = SSF_fix_hijri(d, dout); + } + out.y = dout[0]; out.m = dout[1]; out.d = dout[2]; + out.S = time % 60; time = Math.floor(time / 60); + out.M = time % 60; time = Math.floor(time / 60); + out.H = time; + out.q = dow; + return out; +} +/* ECMA-376 18.8.30 numFmt*/ +/* Note: `toPrecision` uses standard form when prec > E and E >= -6 */ +/* exponent >= -9 and <= 9 */ +function SSF_strip_decimal(o/*:string*/)/*:string*/ { + return (o.indexOf(".") == -1) ? o : o.replace(/(?:\.0*|(\.\d*[1-9])0+)$/, "$1"); +} + +/* General Exponential always shows 2 digits exp and trims the mantissa */ +function SSF_normalize_exp(o/*:string*/)/*:string*/ { + if(o.indexOf("E") == -1) return o; + return o.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2"); +} + +/* exponent >= -9 and <= 9 */ +function SSF_small_exp(v/*:number*/)/*:string*/ { + var w = (v<0?12:11); + var o = SSF_strip_decimal(v.toFixed(12)); if(o.length <= w) return o; + o = v.toPrecision(10); if(o.length <= w) return o; + return v.toExponential(5); +} + +/* exponent >= 11 or <= -10 likely exponential */ +function SSF_large_exp(v/*:number*/)/*:string*/ { + var o = SSF_strip_decimal(v.toFixed(11)); + return (o.length > (v<0?12:11) || o === "0" || o === "-0") ? v.toPrecision(6) : o; +} + +function SSF_general_num(v/*:number*/)/*:string*/ { + var V = Math.floor(Math.log(Math.abs(v))*Math.LOG10E), o; + + if(V >= -4 && V <= -1) o = v.toPrecision(10+V); + else if(Math.abs(V) <= 9) o = SSF_small_exp(v); + else if(V === 10) o = v.toFixed(10).substr(0,12); + else o = SSF_large_exp(v); + + return SSF_strip_decimal(SSF_normalize_exp(o.toUpperCase())); +} + + +/* + "General" rules: + - text is passed through ("@") + - booleans are rendered as TRUE/FALSE + - "up to 11 characters" displayed for numbers + - Default date format (code 14) used for Dates + + The longest 32-bit integer text is "-2147483648", exactly 11 chars + TODO: technically the display depends on the width of the cell +*/ +function SSF_general(v/*:any*/, opts/*:any*/) { + switch(typeof v) { + case 'string': return v; + case 'boolean': return v ? "TRUE" : "FALSE"; + case 'number': return (v|0) === v ? v.toString(10) : SSF_general_num(v); + case 'undefined': return ""; + case 'object': + if(v == null) return ""; + if(v instanceof Date) return SSF_format(14, datenum(v, opts && opts.date1904), opts); + } + throw new Error("unsupported value in General format: " + v); +} + +function SSF_fix_hijri(date/*:Date*/, o/*:[number, number, number]*/) { + /* TODO: properly adjust y/m/d and */ + o[0] -= 581; + var dow = date.getDay(); + if(date < 60) dow = (dow + 6) % 7; + return dow; +} +//var THAI_DIGITS = "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59".split(""); +function SSF_write_date(type/*:number*/, fmt/*:string*/, val, ss0/*:?number*/)/*:string*/ { + var o="", ss=0, tt=0, y = val.y, out, outl = 0; + switch(type) { + case 98: /* 'b' buddhist year */ + y = val.y + 543; + /* falls through */ + case 121: /* 'y' year */ + switch(fmt.length) { + case 1: case 2: out = y % 100; outl = 2; break; + default: out = y % 10000; outl = 4; break; + } break; + case 109: /* 'm' month */ + switch(fmt.length) { + case 1: case 2: out = val.m; outl = fmt.length; break; + case 3: return months[val.m-1][1]; + case 5: return months[val.m-1][0]; + default: return months[val.m-1][2]; + } break; + case 100: /* 'd' day */ + switch(fmt.length) { + case 1: case 2: out = val.d; outl = fmt.length; break; + case 3: return days[val.q][0]; + default: return days[val.q][1]; + } break; + case 104: /* 'h' 12-hour */ + switch(fmt.length) { + case 1: case 2: out = 1+(val.H+11)%12; outl = fmt.length; break; + default: throw 'bad hour format: ' + fmt; + } break; + case 72: /* 'H' 24-hour */ + switch(fmt.length) { + case 1: case 2: out = val.H; outl = fmt.length; break; + default: throw 'bad hour format: ' + fmt; + } break; + case 77: /* 'M' minutes */ + switch(fmt.length) { + case 1: case 2: out = val.M; outl = fmt.length; break; + default: throw 'bad minute format: ' + fmt; + } break; + case 115: /* 's' seconds */ + if(fmt != 's' && fmt != 'ss' && fmt != '.0' && fmt != '.00' && fmt != '.000') throw 'bad second format: ' + fmt; + if(val.u === 0 && (fmt == "s" || fmt == "ss")) return pad0(val.S, fmt.length); + /*::if(!ss0) ss0 = 0; */ + if(ss0 >= 2) tt = ss0 === 3 ? 1000 : 100; + else tt = ss0 === 1 ? 10 : 1; + ss = Math.round((tt)*(val.S + val.u)); + if(ss >= 60*tt) ss = 0; + if(fmt === 's') return ss === 0 ? "0" : ""+ss/tt; + o = pad0(ss,2 + ss0); + if(fmt === 'ss') return o.substr(0,2); + return "." + o.substr(2,fmt.length-1); + case 90: /* 'Z' absolute time */ + switch(fmt) { + case '[h]': case '[hh]': out = val.D*24+val.H; break; + case '[m]': case '[mm]': out = (val.D*24+val.H)*60+val.M; break; + case '[s]': case '[ss]': out = ((val.D*24+val.H)*60+val.M)*60+Math.round(val.S+val.u); break; + default: throw 'bad abstime format: ' + fmt; + } outl = fmt.length === 3 ? 1 : 2; break; + case 101: /* 'e' era */ + out = y; outl = 1; break; + } + var outstr = outl > 0 ? pad0(out, outl) : ""; + return outstr; +} + + +/*jshint -W086 */ +/*jshint +W086 */ +function commaify(s/*:string*/)/*:string*/ { + var w = 3; + if(s.length <= w) return s; + var j = (s.length % w), o = s.substr(0,j); + for(; j!=s.length; j+=w) o+=(o.length > 0 ? "," : "") + s.substr(j,w); + return o; +} +var pct1 = /%/g; +function write_num_pct(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/{ + var sfmt = fmt.replace(pct1,""), mul = fmt.length - sfmt.length; + return write_num(type, sfmt, val * Math.pow(10,2*mul)) + fill("%",mul); +} + +function write_num_cm(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/{ + var idx = fmt.length - 1; + while(fmt.charCodeAt(idx-1) === 44) --idx; + return write_num(type, fmt.substr(0,idx), val / Math.pow(10,3*(fmt.length-idx))); +} + +function write_num_exp(fmt/*:string*/, val/*:number*/)/*:string*/{ + var o/*:string*/; + var idx = fmt.indexOf("E") - fmt.indexOf(".") - 1; + if(fmt.match(/^#+0.0E\+0$/)) { + if(val == 0) return "0.0E+0"; + else if(val < 0) return "-" + write_num_exp(fmt, -val); + var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E'); + var ee = Math.floor(Math.log(val)*Math.LOG10E)%period; + if(ee < 0) ee += period; + o = (val/Math.pow(10,ee)).toPrecision(idx+1+(period+ee)%period); + if(o.indexOf("e") === -1) { + var fakee = Math.floor(Math.log(val)*Math.LOG10E); + if(o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length+ee); + else o += "E+" + (fakee - ee); + while(o.substr(0,2) === "0.") { + o = o.charAt(0) + o.substr(2,period) + "." + o.substr(2+period); + o = o.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0."); + } + o = o.replace(/\+-/,"-"); + } + o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function($$,$1,$2,$3) { return $1 + $2 + $3.substr(0,(period+ee)%period) + "." + $3.substr(ee) + "E"; }); + } else o = val.toExponential(idx); + if(fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0,o.length-1) + "0" + o.charAt(o.length-1); + if(fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/,"e"); + return o.replace("e","E"); +} +var frac1 = /# (\?+)( ?)\/( ?)(\d+)/; +function write_num_f1(r/*:Array*/, aval/*:number*/, sign/*:string*/)/*:string*/ { + var den = parseInt(r[4],10), rr = Math.round(aval * den), base = Math.floor(rr/den); + var myn = (rr - base*den), myd = den; + return sign + (base === 0 ? "" : ""+base) + " " + (myn === 0 ? fill(" ", r[1].length + 1 + r[4].length) : pad_(myn,r[1].length) + r[2] + "/" + r[3] + pad0(myd,r[4].length)); +} +function write_num_f2(r/*:Array*/, aval/*:number*/, sign/*:string*/)/*:string*/ { + return sign + (aval === 0 ? "" : ""+aval) + fill(" ", r[1].length + 2 + r[4].length); +} +var dec1 = /^#*0*\.([0#]+)/; +var closeparen = /\).*[0#]/; +var phone = /\(###\) ###\\?-####/; +function hashq(str/*:string*/)/*:string*/ { + var o = "", cc; + for(var i = 0; i != str.length; ++i) switch((cc=str.charCodeAt(i))) { + case 35: break; + case 63: o+= " "; break; + case 48: o+= "0"; break; + default: o+= String.fromCharCode(cc); + } + return o; +} +function rnd(val/*:number*/, d/*:number*/)/*:string*/ { var dd = Math.pow(10,d); return ""+(Math.round(val * dd)/dd); } +function dec(val/*:number*/, d/*:number*/)/*:number*/ { + var _frac = val - Math.floor(val), dd = Math.pow(10,d); + if (d < ('' + Math.round(_frac * dd)).length) return 0; + return Math.round(_frac * dd); +} +function carry(val/*:number*/, d/*:number*/)/*:number*/ { + if (d < ('' + Math.round((val-Math.floor(val))*Math.pow(10,d))).length) { + return 1; + } + return 0; +} +function flr(val/*:number*/)/*:string*/ { + if(val < 2147483647 && val > -2147483648) return ""+(val >= 0 ? (val|0) : (val-1|0)); + return ""+Math.floor(val); +} +function write_num_flt(type/*:string*/, fmt/*:string*/, val/*:number*/)/*:string*/ { + if(type.charCodeAt(0) === 40 && !fmt.match(closeparen)) { + var ffmt = fmt.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,""); + if(val >= 0) return write_num_flt('n', ffmt, val); + return '(' + write_num_flt('n', ffmt, -val) + ')'; + } + if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm(type, fmt, val); + if(fmt.indexOf('%') !== -1) return write_num_pct(type, fmt, val); + if(fmt.indexOf('E') !== -1) return write_num_exp(fmt, val); + if(fmt.charCodeAt(0) === 36) return "$"+write_num_flt(type,fmt.substr(fmt.charAt(1)==' '?2:1),val); + var o; + var r/*:?Array*/, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : ""; + if(fmt.match(/^00+$/)) return sign + pad0r(aval,fmt.length); + if(fmt.match(/^[#?]+$/)) { + o = pad0r(val,0); if(o === "0") o = ""; + return o.length > fmt.length ? o : hashq(fmt.substr(0,fmt.length-o.length)) + o; + } + if((r = fmt.match(frac1))) return write_num_f1(r, aval, sign); + if(fmt.match(/^#+0+$/)) return sign + pad0r(aval,fmt.length - fmt.indexOf("0")); + if((r = fmt.match(dec1))) { + o = rnd(val, r[1].length).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1])).replace(/\.(\d*)$/,function($$, $1) { return "." + $1 + fill("0", hashq(/*::(*/r/*::||[""])*/[1]).length-$1.length); }); + return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./,"."); + } + fmt = fmt.replace(/^#+([0.])/, "$1"); + if((r = fmt.match(/^(0*)\.(#*)$/))) { + return sign + rnd(aval, r[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":"."); + } + if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify(pad0r(aval,0)); + if((r = fmt.match(/^#,##0\.([#0]*0)$/))) { + return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify(""+(Math.floor(val) + carry(val, r[1].length))) + "." + pad0(dec(val, r[1].length),r[1].length); + } + if((r = fmt.match(/^#,#*,#0/))) return write_num_flt(type,fmt.replace(/^#,#*,/,""),val); + if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) { + o = _strrev(write_num_flt(type, fmt.replace(/[\\-]/g,""), val)); + ri = 0; + return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri= 0) return write_num_int('n', ffmt, val); + return '(' + write_num_int('n', ffmt, -val) + ')'; + } + if(fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm2(type, fmt, val); + if(fmt.indexOf('%') !== -1) return write_num_pct2(type, fmt, val); + if(fmt.indexOf('E') !== -1) return write_num_exp2(fmt, val); + if(fmt.charCodeAt(0) === 36) return "$"+write_num_int(type,fmt.substr(fmt.charAt(1)==' '?2:1),val); + var o; + var r/*:?Array*/, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : ""; + if(fmt.match(/^00+$/)) return sign + pad0(aval,fmt.length); + if(fmt.match(/^[#?]+$/)) { + o = (""+val); if(val === 0) o = ""; + return o.length > fmt.length ? o : hashq(fmt.substr(0,fmt.length-o.length)) + o; + } + if((r = fmt.match(frac1))) return write_num_f2(r, aval, sign); + if(fmt.match(/^#+0+$/)) return sign + pad0(aval,fmt.length - fmt.indexOf("0")); + if((r = fmt.match(dec1))) { + /*:: if(!Array.isArray(r)) throw new Error("unreachable"); */ + o = (""+val).replace(/^([^\.]+)$/,"$1."+hashq(r[1])).replace(/\.$/,"."+hashq(r[1])); + o = o.replace(/\.(\d*)$/,function($$, $1) { + /*:: if(!Array.isArray(r)) throw new Error("unreachable"); */ + return "." + $1 + fill("0", hashq(r[1]).length-$1.length); }); + return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./,"."); + } + fmt = fmt.replace(/^#+([0.])/, "$1"); + if((r = fmt.match(/^(0*)\.(#*)$/))) { + return sign + (""+aval).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,r[1].length?"0.":"."); + } + if((r = fmt.match(/^#{1,3},##0(\.?)$/))) return sign + commaify((""+aval)); + if((r = fmt.match(/^#,##0\.([#0]*0)$/))) { + return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify((""+val)) + "." + fill('0',r[1].length); + } + if((r = fmt.match(/^#,#*,#0/))) return write_num_int(type,fmt.replace(/^#,#*,/,""),val); + if((r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/))) { + o = _strrev(write_num_int(type, fmt.replace(/[\\-]/g,""), val)); + ri = 0; + return _strrev(_strrev(fmt.replace(/\\/g,"")).replace(/[0#]/g,function(x){return ri*/ { + var out/*:Array*/ = []; + var in_str = false/*, cc*/; + for(var i = 0, j = 0; i < fmt.length; ++i) switch((/*cc=*/fmt.charCodeAt(i))) { + case 34: /* '"' */ + in_str = !in_str; break; + case 95: case 42: case 92: /* '_' '*' '\\' */ + ++i; break; + case 59: /* ';' */ + out[out.length] = fmt.substr(j,i-j); + j = i+1; + } + out[out.length] = fmt.substr(j); + if(in_str === true) throw new Error("Format |" + fmt + "| unterminated string "); + return out; +} + +var SSF_abstime = /\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/; +function fmt_is_date(fmt/*:string*/)/*:boolean*/ { + var i = 0, /*cc = 0,*/ c = "", o = ""; + while(i < fmt.length) { + switch((c = fmt.charAt(i))) { + case 'G': if(SSF_isgeneral(fmt, i)) i+= 6; i++; break; + case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break; + case '\\': i+=2; break; + case '_': i+=2; break; + case '@': ++i; break; + case 'B': case 'b': + if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") return true; + /* falls through */ + case 'M': case 'D': case 'Y': case 'H': case 'S': case 'E': + /* falls through */ + case 'm': case 'd': case 'y': case 'h': case 's': case 'e': case 'g': return true; + case 'A': case 'a': case '上': + if(fmt.substr(i, 3).toUpperCase() === "A/P") return true; + if(fmt.substr(i, 5).toUpperCase() === "AM/PM") return true; + if(fmt.substr(i, 5).toUpperCase() === "上午/下午") return true; + ++i; break; + case '[': + o = c; + while(fmt.charAt(i++) !== ']' && i < fmt.length) o += fmt.charAt(i); + if(o.match(SSF_abstime)) return true; + break; + case '.': + /* falls through */ + case '0': case '#': + while(i < fmt.length && ("0#?.,E+-%".indexOf(c=fmt.charAt(++i)) > -1 || (c=='\\' && fmt.charAt(i+1) == "-" && "0#".indexOf(fmt.charAt(i+2))>-1))){/* empty */} + break; + case '?': while(fmt.charAt(++i) === c){/* empty */} break; + case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break; + case '(': case ')': ++i; break; + case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1){/* empty */} break; + case ' ': ++i; break; + default: ++i; break; + } + } + return false; +} + +function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) { + var out = [], o = "", i = 0, c = "", lst='t', dt, j, cc; + var hr='H'; + /* Tokenize */ + while(i < fmt.length) { + switch((c = fmt.charAt(i))) { + case 'G': /* General */ + if(!SSF_isgeneral(fmt, i)) throw new Error('unrecognized character ' + c + ' in ' +fmt); + out[out.length] = {t:'G', v:'General'}; i+=7; break; + case '"': /* Literal text */ + for(o="";(cc=fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) o += String.fromCharCode(cc); + out[out.length] = {t:'t', v:o}; ++i; break; + case '\\': var w = fmt.charAt(++i), t = (w === "(" || w === ")") ? w : 't'; + out[out.length] = {t:t, v:w}; ++i; break; + case '_': out[out.length] = {t:'t', v:" "}; i+=2; break; + case '@': /* Text Placeholder */ + out[out.length] = {t:'T', v:v}; ++i; break; + case 'B': case 'b': + if(fmt.charAt(i+1) === "1" || fmt.charAt(i+1) === "2") { + if(dt==null) { dt=SSF_parse_date_code(v, opts, fmt.charAt(i+1) === "2"); if(dt==null) return ""; } + out[out.length] = {t:'X', v:fmt.substr(i,2)}; lst = c; i+=2; break; + } + /* falls through */ + case 'M': case 'D': case 'Y': case 'H': case 'S': case 'E': + c = c.toLowerCase(); + /* falls through */ + case 'm': case 'd': case 'y': case 'h': case 's': case 'e': case 'g': + if(v < 0) return ""; + if(dt==null) { dt=SSF_parse_date_code(v, opts); if(dt==null) return ""; } + o = c; while(++i < fmt.length && fmt.charAt(i).toLowerCase() === c) o+=c; + if(c === 'm' && lst.toLowerCase() === 'h') c = 'M'; + if(c === 'h') c = hr; + out[out.length] = {t:c, v:o}; lst = c; break; + case 'A': case 'a': case '上': + var q={t:c, v:c}; + if(dt==null) dt=SSF_parse_date_code(v, opts); + if(fmt.substr(i, 3).toUpperCase() === "A/P") { if(dt!=null) q.v = dt.H >= 12 ? fmt.charAt(i+2) : c; q.t = 'T'; hr='h';i+=3;} + else if(fmt.substr(i,5).toUpperCase() === "AM/PM") { if(dt!=null) q.v = dt.H >= 12 ? "PM" : "AM"; q.t = 'T'; i+=5; hr='h'; } + else if(fmt.substr(i,5).toUpperCase() === "上午/下午") { if(dt!=null) q.v = dt.H >= 12 ? "下午" : "上午"; q.t = 'T'; i+=5; hr='h'; } + else { q.t = "t"; ++i; } + if(dt==null && q.t === 'T') return ""; + out[out.length] = q; lst = c; break; + case '[': + o = c; + while(fmt.charAt(i++) !== ']' && i < fmt.length) o += fmt.charAt(i); + if(o.slice(-1) !== ']') throw 'unterminated "[" block: |' + o + '|'; + if(o.match(SSF_abstime)) { + if(dt==null) { dt=SSF_parse_date_code(v, opts); if(dt==null) return ""; } + out[out.length] = {t:'Z', v:o.toLowerCase()}; + lst = o.charAt(1); + } else if(o.indexOf("$") > -1) { + o = (o.match(/\$([^-\[\]]*)/)||[])[1]||"$"; + if(!fmt_is_date(fmt)) out[out.length] = {t:'t',v:o}; + } + break; + /* Numbers */ + case '.': + if(dt != null) { + o = c; while(++i < fmt.length && (c=fmt.charAt(i)) === "0") o += c; + out[out.length] = {t:'s', v:o}; break; + } + /* falls through */ + case '0': case '#': + o = c; while(++i < fmt.length && "0#?.,E+-%".indexOf(c=fmt.charAt(i)) > -1) o += c; + out[out.length] = {t:'n', v:o}; break; + case '?': + o = c; while(fmt.charAt(++i) === c) o+=c; + out[out.length] = {t:c, v:o}; lst = c; break; + case '*': ++i; if(fmt.charAt(i) == ' ' || fmt.charAt(i) == '*') ++i; break; // ** + case '(': case ')': out[out.length] = {t:(flen===1?'t':c), v:c}; ++i; break; + case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i); + out[out.length] = {t:'D', v:o}; break; + case ' ': out[out.length] = {t:c, v:c}; ++i; break; + case '$': out[out.length] = {t:'t', v:'$'}; ++i; break; + default: + if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt); + out[out.length] = {t:'t', v:c}; ++i; break; + } + } + + /* Scan for date/time parts */ + var bt = 0, ss0 = 0, ssm; + for(i=out.length-1, lst='t'; i >= 0; --i) { + switch(out[i].t) { + case 'h': case 'H': out[i].t = hr; lst='h'; if(bt < 1) bt = 1; break; + case 's': + if((ssm=out[i].v.match(/\.0+$/))) ss0=Math.max(ss0,ssm[0].length-1); + if(bt < 3) bt = 3; + /* falls through */ + case 'd': case 'y': case 'M': case 'e': lst=out[i].t; break; + case 'm': if(lst === 's') { out[i].t = 'M'; if(bt < 2) bt = 2; } break; + case 'X': /*if(out[i].v === "B2");*/ + break; + case 'Z': + if(bt < 1 && out[i].v.match(/[Hh]/)) bt = 1; + if(bt < 2 && out[i].v.match(/[Mm]/)) bt = 2; + if(bt < 3 && out[i].v.match(/[Ss]/)) bt = 3; + } + } + /* time rounding depends on presence of minute / second / usec fields */ + switch(bt) { + case 0: break; + case 1: + /*::if(!dt) break;*/ + if(dt.u >= 0.5) { dt.u = 0; ++dt.S; } + if(dt.S >= 60) { dt.S = 0; ++dt.M; } + if(dt.M >= 60) { dt.M = 0; ++dt.H; } + break; + case 2: + /*::if(!dt) break;*/ + if(dt.u >= 0.5) { dt.u = 0; ++dt.S; } + if(dt.S >= 60) { dt.S = 0; ++dt.M; } + break; + } + + /* replace fields */ + var nstr = "", jj; + for(i=0; i < out.length; ++i) { + switch(out[i].t) { + case 't': case 'T': case ' ': case 'D': break; + case 'X': out[i].v = ""; out[i].t = ";"; break; + case 'd': case 'm': case 'y': case 'h': case 'H': case 'M': case 's': case 'e': case 'b': case 'Z': + /*::if(!dt) throw "unreachable"; */ + out[i].v = SSF_write_date(out[i].t.charCodeAt(0), out[i].v, dt, ss0); + out[i].t = 't'; break; + case 'n': case '?': + jj = i+1; + while(out[jj] != null && ( + (c=out[jj].t) === "?" || c === "D" || + ((c === " " || c === "t") && out[jj+1] != null && (out[jj+1].t === '?' || out[jj+1].t === "t" && out[jj+1].v === '/')) || + (out[i].t === '(' && (c === ' ' || c === 'n' || c === ')')) || + (c === 't' && (out[jj].v === '/' || out[jj].v === ' ' && out[jj+1] != null && out[jj+1].t == '?')) + )) { + out[i].v += out[jj].v; + out[jj] = {v:"", t:";"}; ++jj; + } + nstr += out[i].v; + i = jj-1; break; + case 'G': out[i].t = 't'; out[i].v = SSF_general(v,opts); break; + } + } + var vv = "", myv, ostr; + if(nstr.length > 0) { + if(nstr.charCodeAt(0) == 40) /* '(' */ { + myv = (v<0&&nstr.charCodeAt(0) === 45 ? -v : v); + ostr = write_num('n', nstr, myv); + } else { + myv = (v<0 && flen > 1 ? -v : v); + ostr = write_num('n', nstr, myv); + if(myv < 0 && out[0] && out[0].t == 't') { + ostr = ostr.substr(1); + out[0].v = "-" + out[0].v; + } + } + jj=ostr.length-1; + var decpt = out.length; + for(i=0; i < out.length; ++i) if(out[i] != null && out[i].t != 't' && out[i].v.indexOf(".") > -1) { decpt = i; break; } + var lasti=out.length; + if(decpt === out.length && ostr.indexOf("E") === -1) { + for(i=out.length-1; i>= 0;--i) { + if(out[i] == null || 'n?'.indexOf(out[i].t) === -1) continue; + if(jj>=out[i].v.length-1) { jj -= out[i].v.length; out[i].v = ostr.substr(jj+1, out[i].v.length); } + else if(jj < 0) out[i].v = ""; + else { out[i].v = ostr.substr(0, jj+1); jj = -1; } + out[i].t = 't'; + lasti = i; + } + if(jj>=0 && lasti= 0; --i) { + if(out[i] == null || 'n?'.indexOf(out[i].t) === -1) continue; + j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")-1:out[i].v.length-1; + vv = out[i].v.substr(j+1); + for(; j>=0; --j) { + if(jj>=0 && (out[i].v.charAt(j) === "0" || out[i].v.charAt(j) === "#")) vv = ostr.charAt(jj--) + vv; + } + out[i].v = vv; + out[i].t = 't'; + lasti = i; + } + if(jj>=0 && lasti-1&&i===decpt?out[i].v.indexOf(".")+1:0; + vv = out[i].v.substr(0,j); + for(; j-1) { + myv = (flen >1 && v < 0 && i>0 && out[i-1].v === "-" ? -v:v); + out[i].v = write_num(out[i].t, out[i].v, myv); + out[i].t = 't'; + } + var retval = ""; + for(i=0; i !== out.length; ++i) if(out[i] != null) retval += out[i].v; + return retval; +} + +var cfregex2 = /\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/; +function chkcond(v, rr) { + if(rr == null) return false; + var thresh = parseFloat(rr[2]); + switch(rr[1]) { + case "=": if(v == thresh) return true; break; + case ">": if(v > thresh) return true; break; + case "<": if(v < thresh) return true; break; + case "<>": if(v != thresh) return true; break; + case ">=": if(v >= thresh) return true; break; + case "<=": if(v <= thresh) return true; break; + } + return false; +} +function choose_fmt(f/*:string*/, v/*:any*/) { + var fmt = SSF_split_fmt(f); + var l = fmt.length, lat = fmt[l-1].indexOf("@"); + if(l<4 && lat>-1) --l; + if(fmt.length > 4) throw new Error("cannot find right format for |" + fmt.join("|") + "|"); + if(typeof v !== "number") return [4, fmt.length === 4 || lat>-1?fmt[fmt.length-1]:"@"]; + switch(fmt.length) { + case 1: fmt = lat>-1 ? ["General", "General", "General", fmt[0]] : [fmt[0], fmt[0], fmt[0], "@"]; break; + case 2: fmt = lat>-1 ? [fmt[0], fmt[0], fmt[0], fmt[1]] : [fmt[0], fmt[1], fmt[0], "@"]; break; + case 3: fmt = lat>-1 ? [fmt[0], fmt[1], fmt[0], fmt[2]] : [fmt[0], fmt[1], fmt[2], "@"]; break; + case 4: break; + } + var ff = v > 0 ? fmt[0] : v < 0 ? fmt[1] : fmt[2]; + if(fmt[0].indexOf("[") === -1 && fmt[1].indexOf("[") === -1) return [l, ff]; + if(fmt[0].match(/\[[=<>]/) != null || fmt[1].match(/\[[=<>]/) != null) { + var m1 = fmt[0].match(cfregex2); + var m2 = fmt[1].match(cfregex2); + return chkcond(v, m1) ? [l, fmt[0]] : chkcond(v, m2) ? [l, fmt[1]] : [l, fmt[m1 != null && m2 != null ? 2 : 1]]; + } + return [l, ff]; +} +function SSF_format(fmt/*:string|number*/,v/*:any*/,o/*:?any*/) { + if(o == null) o = {}; + var sfmt = ""; + switch(typeof fmt) { + case "string": + if(fmt == "m/d/yy" && o.dateNF) sfmt = o.dateNF; + else sfmt = fmt; + break; + case "number": + if(fmt == 14 && o.dateNF) sfmt = o.dateNF; + else sfmt = (o.table != null ? (o.table/*:any*/) : table_fmt)[fmt]; + if(sfmt == null) sfmt = (o.table && o.table[SSF_default_map[fmt]]) || table_fmt[SSF_default_map[fmt]]; + if(sfmt == null) sfmt = SSF_default_str[fmt] || "General"; + break; + } + if(SSF_isgeneral(sfmt,0)) return SSF_general(v, o); + if(v instanceof Date) v = datenum(v, o.date1904); + var f = choose_fmt(sfmt, v); + if(SSF_isgeneral(f[1])) return SSF_general(v, o); + if(v === true) v = "TRUE"; else if(v === false) v = "FALSE"; + else if(v === "" || v == null) return ""; + return eval_fmt(f[1], v, o, f[0]); +} +function SSF_load(fmt/*:string*/, idx/*:?number*/)/*:number*/ { + if(typeof idx != 'number') { + idx = +idx || -1; +/*::if(typeof idx != 'number') return 0x188; */ + for(var i = 0; i < 0x0188; ++i) { +/*::if(typeof idx != 'number') return 0x188; */ + if(table_fmt[i] == undefined) { if(idx < 0) idx = i; continue; } + if(table_fmt[i] == fmt) { idx = i; break; } + } +/*::if(typeof idx != 'number') return 0x188; */ + if(idx < 0) idx = 0x187; + } +/*::if(typeof idx != 'number') return 0x188; */ + table_fmt[idx] = fmt; + return idx; +} +function SSF_load_table(tbl/*:SSFTable*/)/*:void*/ { + for(var i=0; i!=0x0188; ++i) + if(tbl[i] !== undefined) SSF_load(tbl[i], i); +} + +function make_ssf() { + table_fmt = SSF_init_table(); +} + +var SSF = { + format: SSF_format, + load: SSF_load, + _table: table_fmt, + load_table: SSF_load_table, + parse_date_code: SSF_parse_date_code, + is_date: fmt_is_date, + get_table: function get_table() { return SSF._table = table_fmt; } +}; + +var SSFImplicit/*{[number]:string}*/ = ({ + "5": '"$"#,##0_);\\("$"#,##0\\)', + "6": '"$"#,##0_);[Red]\\("$"#,##0\\)', + "7": '"$"#,##0.00_);\\("$"#,##0.00\\)', + "8": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "23": 'General', "24": 'General', "25": 'General', "26": 'General', + "27": 'm/d/yy', "28": 'm/d/yy', "29": 'm/d/yy', "30": 'm/d/yy', "31": 'm/d/yy', + "32": 'h:mm:ss', "33": 'h:mm:ss', "34": 'h:mm:ss', "35": 'h:mm:ss', + "36": 'm/d/yy', + "41": '_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)', + "42": '_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)', + "43": '_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)', + "44": '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)', + "50": 'm/d/yy', "51": 'm/d/yy', "52": 'm/d/yy', "53": 'm/d/yy', "54": 'm/d/yy', + "55": 'm/d/yy', "56": 'm/d/yy', "57": 'm/d/yy', "58": 'm/d/yy', + "59": '0', + "60": '0.00', + "61": '#,##0', + "62": '#,##0.00', + "63": '"$"#,##0_);\\("$"#,##0\\)', + "64": '"$"#,##0_);[Red]\\("$"#,##0\\)', + "65": '"$"#,##0.00_);\\("$"#,##0.00\\)', + "66": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "67": '0%', + "68": '0.00%', + "69": '# ?/?', + "70": '# ??/??', + "71": 'm/d/yy', + "72": 'm/d/yy', + "73": 'd-mmm-yy', + "74": 'd-mmm', + "75": 'mmm-yy', + "76": 'h:mm', + "77": 'h:mm:ss', + "78": 'm/d/yy h:mm', + "79": 'mm:ss', + "80": '[h]:mm:ss', + "81": 'mmss.0' +}/*:any*/); + +/* dateNF parse TODO: move to SSF */ +var dateNFregex = /[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g; +function dateNF_regex(dateNF/*:string|number*/)/*:RegExp*/ { + var fmt = typeof dateNF == "number" ? table_fmt[dateNF] : dateNF; + fmt = fmt.replace(dateNFregex, "(\\d+)"); + dateNFregex.lastIndex = 0; + return new RegExp("^" + fmt + "$"); +} +function dateNF_fix(str/*:string*/, dateNF/*:string*/, match/*:Array*/)/*:string*/ { + var Y = -1, m = -1, d = -1, H = -1, M = -1, S = -1; + (dateNF.match(dateNFregex)||[]).forEach(function(n, i) { + var v = parseInt(match[i+1], 10); + switch(n.toLowerCase().charAt(0)) { + case 'y': Y = v; break; case 'd': d = v; break; + case 'h': H = v; break; case 's': S = v; break; + case 'm': if(H >= 0) M = v; else m = v; break; + } + }); + dateNFregex.lastIndex = 0; + if(S >= 0 && M == -1 && m >= 0) { M = m; m = -1; } + var datestr = (("" + (Y>=0?Y: new Date().getFullYear())).slice(-4) + "-" + ("00" + (m>=1?m:1)).slice(-2) + "-" + ("00" + (d>=1?d:1)).slice(-2)); + if(datestr.length == 7) datestr = "0" + datestr; + if(datestr.length == 8) datestr = "20" + datestr; + var timestr = (("00" + (H>=0?H:0)).slice(-2) + ":" + ("00" + (M>=0?M:0)).slice(-2) + ":" + ("00" + (S>=0?S:0)).slice(-2)); + if(H == -1 && M == -1 && S == -1) return datestr; + if(Y == -1 && m == -1 && d == -1) return timestr; + return datestr + "T" + timestr; +} + +/* table of bad formats written by third-party tools */ +var bad_formats = { + "d.m": "d\\.m" // Issue #2571 Google Sheets writes invalid format 'd.m', correct format is 'd"."m' or 'd\\.m' +}; + +function SSF__load(fmt, idx) { + return SSF_load(bad_formats[fmt] || fmt, idx); +} + +/*:: +declare var ReadShift:any; +declare var CheckField:any; +declare var prep_blob:any; +declare var __readUInt32LE:any; +declare var __readInt32LE:any; +declare var __toBuffer:any; +declare var __utf16le:any; +declare var bconcat:any; +declare var s2a:any; +declare var chr0:any; +declare var chr1:any; +declare var has_buf:boolean; +declare var new_buf:any; +declare var new_raw_buf:any; +declare var new_unsafe_buf:any; +declare var Buffer_from:any; +*/ +/* cfb.js (C) 2013-present SheetJS -- http://sheetjs.com */ +/* vim: set ts=2: */ +/*jshint eqnull:true */ +/*exported CFB */ +/*global Uint8Array:false, Uint16Array:false */ + +/*:: +type SectorEntry = { + name?:string; + nodes?:Array; + data:RawBytes; +}; +type SectorList = { + [k:string|number]:SectorEntry; + name:?string; + fat_addrs:Array; + ssz:number; +} +type CFBFiles = {[n:string]:CFBEntry}; +*/ +/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */ +/* vim: set ts=2: */ +/*exported CRC32 */ +var CRC32 = /*#__PURE__*/(function() { +var CRC32 = {}; +CRC32.version = '1.2.0'; +/* see perf/crc32table.js */ +/*global Int32Array */ +function signed_crc_table()/*:any*/ { + var c = 0, table/*:Array*/ = new Array(256); + + for(var n =0; n != 256; ++n){ + c = n; + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1)); + table[n] = c; + } + + return typeof Int32Array !== 'undefined' ? new Int32Array(table) : table; +} + +var T0 = signed_crc_table(); +function slice_by_16_tables(T) { + var c = 0, v = 0, n = 0, table/*:Array*/ = typeof Int32Array !== 'undefined' ? new Int32Array(4096) : new Array(4096) ; + + for(n = 0; n != 256; ++n) table[n] = T[n]; + for(n = 0; n != 256; ++n) { + v = T[n]; + for(c = 256 + n; c < 4096; c += 256) v = table[c] = (v >>> 8) ^ T[v & 0xFF]; + } + var out = []; + for(n = 1; n != 16; ++n) out[n - 1] = typeof Int32Array !== 'undefined' && typeof table.subarray == "function" ? table.subarray(n * 256, n * 256 + 256) : table.slice(n * 256, n * 256 + 256); + return out; +} +var TT = slice_by_16_tables(T0); +var T1 = TT[0], T2 = TT[1], T3 = TT[2], T4 = TT[3], T5 = TT[4]; +var T6 = TT[5], T7 = TT[6], T8 = TT[7], T9 = TT[8], Ta = TT[9]; +var Tb = TT[10], Tc = TT[11], Td = TT[12], Te = TT[13], Tf = TT[14]; +function crc32_bstr(bstr/*:string*/, seed/*:number*/)/*:number*/ { + var C = seed/*:: ? 0 : 0 */ ^ -1; + for(var i = 0, L = bstr.length; i < L;) C = (C>>>8) ^ T0[(C^bstr.charCodeAt(i++))&0xFF]; + return ~C; +} + +function crc32_buf(B/*:Uint8Array|Array*/, seed/*:number*/)/*:number*/ { + var C = seed/*:: ? 0 : 0 */ ^ -1, L = B.length - 15, i = 0; + for(; i < L;) C = + Tf[B[i++] ^ (C & 255)] ^ + Te[B[i++] ^ ((C >> 8) & 255)] ^ + Td[B[i++] ^ ((C >> 16) & 255)] ^ + Tc[B[i++] ^ (C >>> 24)] ^ + Tb[B[i++]] ^ Ta[B[i++]] ^ T9[B[i++]] ^ T8[B[i++]] ^ + T7[B[i++]] ^ T6[B[i++]] ^ T5[B[i++]] ^ T4[B[i++]] ^ + T3[B[i++]] ^ T2[B[i++]] ^ T1[B[i++]] ^ T0[B[i++]]; + L += 15; + while(i < L) C = (C>>>8) ^ T0[(C^B[i++])&0xFF]; + return ~C; +} + +function crc32_str(str/*:string*/, seed/*:number*/)/*:number*/ { + var C = seed ^ -1; + for(var i = 0, L = str.length, c = 0, d = 0; i < L;) { + c = str.charCodeAt(i++); + if(c < 0x80) { + C = (C>>>8) ^ T0[(C^c)&0xFF]; + } else if(c < 0x800) { + C = (C>>>8) ^ T0[(C ^ (192|((c>>6)&31)))&0xFF]; + C = (C>>>8) ^ T0[(C ^ (128|(c&63)))&0xFF]; + } else if(c >= 0xD800 && c < 0xE000) { + c = (c&1023)+64; d = str.charCodeAt(i++)&1023; + C = (C>>>8) ^ T0[(C ^ (240|((c>>8)&7)))&0xFF]; + C = (C>>>8) ^ T0[(C ^ (128|((c>>2)&63)))&0xFF]; + C = (C>>>8) ^ T0[(C ^ (128|((d>>6)&15)|((c&3)<<4)))&0xFF]; + C = (C>>>8) ^ T0[(C ^ (128|(d&63)))&0xFF]; + } else { + C = (C>>>8) ^ T0[(C ^ (224|((c>>12)&15)))&0xFF]; + C = (C>>>8) ^ T0[(C ^ (128|((c>>6)&63)))&0xFF]; + C = (C>>>8) ^ T0[(C ^ (128|(c&63)))&0xFF]; + } + } + return ~C; +} +CRC32.table = T0; +CRC32.bstr = crc32_bstr; +CRC32.buf = crc32_buf; +CRC32.str = crc32_str; +return CRC32; +})(); +/* [MS-CFB] v20171201 */ +var CFB = /*#__PURE__*/(function _CFB(){ +var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/; +exports.version = '1.2.2'; +/* [MS-CFB] 2.6.4 */ +function namecmp(l/*:string*/, r/*:string*/)/*:number*/ { + var L = l.split("/"), R = r.split("/"); + for(var i = 0, c = 0, Z = Math.min(L.length, R.length); i < Z; ++i) { + if((c = L[i].length - R[i].length)) return c; + if(L[i] != R[i]) return L[i] < R[i] ? -1 : 1; + } + return L.length - R.length; +} +function dirname(p/*:string*/)/*:string*/ { + if(p.charAt(p.length - 1) == "/") return (p.slice(0,-1).indexOf("/") === -1) ? p : dirname(p.slice(0, -1)); + var c = p.lastIndexOf("/"); + return (c === -1) ? p : p.slice(0, c+1); +} + +function filename(p/*:string*/)/*:string*/ { + if(p.charAt(p.length - 1) == "/") return filename(p.slice(0, -1)); + var c = p.lastIndexOf("/"); + return (c === -1) ? p : p.slice(c+1); +} +/* -------------------------------------------------------------------------- */ +/* DOS Date format: + high|YYYYYYYm.mmmddddd.HHHHHMMM.MMMSSSSS|low + add 1980 to stored year + stored second should be doubled +*/ + +/* write JS date to buf as a DOS date */ +function write_dos_date(buf/*:CFBlob*/, date/*:Date|string*/) { + if(typeof date === "string") date = new Date(date); + var hms/*:number*/ = date.getHours(); + hms = hms << 6 | date.getMinutes(); + hms = hms << 5 | (date.getSeconds()>>>1); + buf.write_shift(2, hms); + var ymd/*:number*/ = (date.getFullYear() - 1980); + ymd = ymd << 4 | (date.getMonth()+1); + ymd = ymd << 5 | date.getDate(); + buf.write_shift(2, ymd); +} + +/* read four bytes from buf and interpret as a DOS date */ +function parse_dos_date(buf/*:CFBlob*/)/*:Date*/ { + var hms = buf.read_shift(2) & 0xFFFF; + var ymd = buf.read_shift(2) & 0xFFFF; + var val = new Date(); + var d = ymd & 0x1F; ymd >>>= 5; + var m = ymd & 0x0F; ymd >>>= 4; + val.setMilliseconds(0); + val.setFullYear(ymd + 1980); + val.setMonth(m-1); + val.setDate(d); + var S = hms & 0x1F; hms >>>= 5; + var M = hms & 0x3F; hms >>>= 6; + val.setHours(hms); + val.setMinutes(M); + val.setSeconds(S<<1); + return val; +} +function parse_extra_field(blob/*:CFBlob*/)/*:any*/ { + prep_blob(blob, 0); + var o = /*::(*/{}/*:: :any)*/; + var flags = 0; + while(blob.l <= blob.length - 4) { + var type = blob.read_shift(2); + var sz = blob.read_shift(2), tgt = blob.l + sz; + var p = {}; + switch(type) { + /* UNIX-style Timestamps */ + case 0x5455: { + flags = blob.read_shift(1); + if(flags & 1) p.mtime = blob.read_shift(4); + /* for some reason, CD flag corresponds to LFH */ + if(sz > 5) { + if(flags & 2) p.atime = blob.read_shift(4); + if(flags & 4) p.ctime = blob.read_shift(4); + } + if(p.mtime) p.mt = new Date(p.mtime*1000); + } break; + /* ZIP64 Extended Information Field */ + case 0x0001: { + var sz1 = blob.read_shift(4), sz2 = blob.read_shift(4); + p.usz = (sz2 * Math.pow(2,32) + sz1); + sz1 = blob.read_shift(4); sz2 = blob.read_shift(4); + p.csz = (sz2 * Math.pow(2,32) + sz1); + // NOTE: volume fields are skipped + } break; + } + blob.l = tgt; + o[type] = p; + } + return o; +} +var fs/*:: = require('fs'); */; +function get_fs() { return fs || (fs = _fs); } +function parse(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ { +if(file[0] == 0x50 && file[1] == 0x4b) return parse_zip(file, options); +if((file[0] | 0x20) == 0x6d && (file[1]|0x20) == 0x69) return parse_mad(file, options); +if(file.length < 512) throw new Error("CFB file size " + file.length + " < 512"); +var mver = 3; +var ssz = 512; +var nmfs = 0; // number of mini FAT sectors +var difat_sec_cnt = 0; +var dir_start = 0; +var minifat_start = 0; +var difat_start = 0; + +var fat_addrs/*:Array*/ = []; // locations of FAT sectors + +/* [MS-CFB] 2.2 Compound File Header */ +var blob/*:CFBlob*/ = /*::(*/file.slice(0,512)/*:: :any)*/; +prep_blob(blob, 0); + +/* major version */ +var mv = check_get_mver(blob); +mver = mv[0]; +switch(mver) { + case 3: ssz = 512; break; case 4: ssz = 4096; break; + case 0: if(mv[1] == 0) return parse_zip(file, options); + /* falls through */ + default: throw new Error("Major Version: Expected 3 or 4 saw " + mver); +} + +/* reprocess header */ +if(ssz !== 512) { blob = /*::(*/file.slice(0,ssz)/*:: :any)*/; prep_blob(blob, 28 /* blob.l */); } +/* Save header for final object */ +var header/*:RawBytes*/ = file.slice(0,ssz); + +check_shifts(blob, mver); + +// Number of Directory Sectors +var dir_cnt/*:number*/ = blob.read_shift(4, 'i'); +if(mver === 3 && dir_cnt !== 0) throw new Error('# Directory Sectors: Expected 0 saw ' + dir_cnt); + +// Number of FAT Sectors +blob.l += 4; + +// First Directory Sector Location +dir_start = blob.read_shift(4, 'i'); + +// Transaction Signature +blob.l += 4; + +// Mini Stream Cutoff Size +blob.chk('00100000', 'Mini Stream Cutoff Size: '); + +// First Mini FAT Sector Location +minifat_start = blob.read_shift(4, 'i'); + +// Number of Mini FAT Sectors +nmfs = blob.read_shift(4, 'i'); + +// First DIFAT sector location +difat_start = blob.read_shift(4, 'i'); + +// Number of DIFAT Sectors +difat_sec_cnt = blob.read_shift(4, 'i'); + +// Grab FAT Sector Locations +for(var q = -1, j = 0; j < 109; ++j) { /* 109 = (512 - blob.l)>>>2; */ + q = blob.read_shift(4, 'i'); + if(q<0) break; + fat_addrs[j] = q; +} + +/** Break the file up into sectors */ +var sectors/*:Array*/ = sectorify(file, ssz); + +sleuth_fat(difat_start, difat_sec_cnt, sectors, ssz, fat_addrs); + +/** Chains */ +var sector_list/*:SectorList*/ = make_sector_list(sectors, dir_start, fat_addrs, ssz); + +if(dir_start < sector_list.length) sector_list[dir_start].name = "!Directory"; +if(nmfs > 0 && minifat_start !== ENDOFCHAIN) sector_list[minifat_start].name = "!MiniFAT"; +sector_list[fat_addrs[0]].name = "!FAT"; +sector_list.fat_addrs = fat_addrs; +sector_list.ssz = ssz; + +/* [MS-CFB] 2.6.1 Compound File Directory Entry */ +var files/*:CFBFiles*/ = {}, Paths/*:Array*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array*/ = []; +read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start); + +build_full_paths(FileIndex, FullPaths, Paths); +Paths.shift(); + +var o = { + FileIndex: FileIndex, + FullPaths: FullPaths +}; + +// $FlowIgnore +if(options && options.raw) o.raw = {header: header, sectors: sectors}; +return o; +} // parse + +/* [MS-CFB] 2.2 Compound File Header -- read up to major version */ +function check_get_mver(blob/*:CFBlob*/)/*:[number, number]*/ { + if(blob[blob.l] == 0x50 && blob[blob.l + 1] == 0x4b) return [0, 0]; + // header signature 8 + blob.chk(HEADER_SIGNATURE, 'Header Signature: '); + + // clsid 16 + //blob.chk(HEADER_CLSID, 'CLSID: '); + blob.l += 16; + + // minor version 2 + var mver/*:number*/ = blob.read_shift(2, 'u'); + + return [blob.read_shift(2,'u'), mver]; +} +function check_shifts(blob/*:CFBlob*/, mver/*:number*/)/*:void*/ { + var shift = 0x09; + + // Byte Order + //blob.chk('feff', 'Byte Order: '); // note: some writers put 0xffff + blob.l += 2; + + // Sector Shift + switch((shift = blob.read_shift(2))) { + case 0x09: if(mver != 3) throw new Error('Sector Shift: Expected 9 saw ' + shift); break; + case 0x0c: if(mver != 4) throw new Error('Sector Shift: Expected 12 saw ' + shift); break; + default: throw new Error('Sector Shift: Expected 9 or 12 saw ' + shift); + } + + // Mini Sector Shift + blob.chk('0600', 'Mini Sector Shift: '); + + // Reserved + blob.chk('000000000000', 'Reserved: '); +} + +/** Break the file up into sectors */ +function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array*/ { + var nsectors = Math.ceil(file.length/ssz)-1; + var sectors/*:Array*/ = []; + for(var i=1; i < nsectors; ++i) sectors[i-1] = file.slice(i*ssz,(i+1)*ssz); + sectors[nsectors-1] = file.slice(nsectors*ssz); + return sectors; +} + +/* [MS-CFB] 2.6.4 Red-Black Tree */ +function build_full_paths(FI/*:CFBFileIndex*/, FP/*:Array*/, Paths/*:Array*/)/*:void*/ { + var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length; + var dad/*:Array*/ = [], q/*:Array*/ = []; + + for(; i < pl; ++i) { dad[i]=q[i]=i; FP[i]=Paths[i]; } + + for(; j < q.length; ++j) { + i = q[j]; + L = FI[i].L; R = FI[i].R; C = FI[i].C; + if(dad[i] === i) { + if(L !== -1 /*NOSTREAM*/ && dad[L] !== L) dad[i] = dad[L]; + if(R !== -1 && dad[R] !== R) dad[i] = dad[R]; + } + if(C !== -1 /*NOSTREAM*/) dad[C] = i; + if(L !== -1 && i != dad[i]) { dad[L] = dad[i]; if(q.lastIndexOf(L) < j) q.push(L); } + if(R !== -1 && i != dad[i]) { dad[R] = dad[i]; if(q.lastIndexOf(R) < j) q.push(R); } + } + for(i=1; i < pl; ++i) if(dad[i] === i) { + if(R !== -1 /*NOSTREAM*/ && dad[R] !== R) dad[i] = dad[R]; + else if(L !== -1 && dad[L] !== L) dad[i] = dad[L]; + } + + for(i=1; i < pl; ++i) { + if(FI[i].type === 0 /* unknown */) continue; + j = i; + if(j != dad[j]) do { + j = dad[j]; + FP[i] = FP[j] + "/" + FP[i]; + } while (j !== 0 && -1 !== dad[j] && j != dad[j]); + dad[i] = -1; + } + + FP[0] += "/"; + for(i=1; i < pl; ++i) { + if(FI[i].type !== 2 /* stream */) FP[i] += "/"; + } +} + +function get_mfat_entry(entry/*:CFBEntry*/, payload/*:RawBytes*/, mini/*:?RawBytes*/)/*:CFBlob*/ { + var start = entry.start, size = entry.size; + //return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/); + var o = []; + var idx = start; + while(mini && size > 0 && idx >= 0) { + o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ)); + size -= MSSZ; + idx = __readInt32LE(mini, idx * 4); + } + if(o.length === 0) return (new_buf(0)/*:any*/); + return (bconcat(o).slice(0, entry.size)/*:any*/); +} + +/** Chase down the rest of the DIFAT chain to build a comprehensive list + DIFAT chains by storing the next sector number as the last 32 bits */ +function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array*/, ssz/*:number*/, fat_addrs)/*:void*/ { + var q/*:number*/ = ENDOFCHAIN; + if(idx === ENDOFCHAIN) { + if(cnt !== 0) throw new Error("DIFAT chain shorter than expected"); + } else if(idx !== -1 /*FREESECT*/) { + var sector = sectors[idx], m = (ssz>>>2)-1; + if(!sector) return; + for(var i = 0; i < m; ++i) { + if((q = __readInt32LE(sector,i*4)) === ENDOFCHAIN) break; + fat_addrs.push(q); + } + if(cnt >= 1) sleuth_fat(__readInt32LE(sector,ssz-4),cnt - 1, sectors, ssz, fat_addrs); + } +} + +/** Follow the linked list of sectors for a given starting point */ +function get_sector_list(sectors/*:Array*/, start/*:number*/, fat_addrs/*:Array*/, ssz/*:number*/, chkd/*:?Array*/)/*:SectorEntry*/ { + var buf/*:Array*/ = [], buf_chain/*:Array*/ = []; + if(!chkd) chkd = []; + var modulus = ssz - 1, j = 0, jj = 0; + for(j=start; j>=0;) { + chkd[j] = true; + buf[buf.length] = j; + buf_chain.push(sectors[j]); + var addr = fat_addrs[Math.floor(j*4/ssz)]; + jj = ((j*4) & modulus); + if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz); + if(!sectors[addr]) break; + j = __readInt32LE(sectors[addr], jj); + } + return {nodes: buf, data:__toBuffer([buf_chain])}; +} + +/** Chase down the sector linked lists */ +function make_sector_list(sectors/*:Array*/, dir_start/*:number*/, fat_addrs/*:Array*/, ssz/*:number*/)/*:SectorList*/ { + var sl = sectors.length, sector_list/*:SectorList*/ = ([]/*:any*/); + var chkd/*:Array*/ = [], buf/*:Array*/ = [], buf_chain/*:Array*/ = []; + var modulus = ssz - 1, i=0, j=0, k=0, jj=0; + for(i=0; i < sl; ++i) { + buf = ([]/*:Array*/); + k = (i + dir_start); if(k >= sl) k-=sl; + if(chkd[k]) continue; + buf_chain = []; + var seen = []; + for(j=k; j>=0;) { + seen[j] = true; + chkd[j] = true; + buf[buf.length] = j; + buf_chain.push(sectors[j]); + var addr/*:number*/ = fat_addrs[Math.floor(j*4/ssz)]; + jj = ((j*4) & modulus); + if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz); + if(!sectors[addr]) break; + j = __readInt32LE(sectors[addr], jj); + if(seen[j]) break; + } + sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])}/*:SectorEntry*/); + } + return sector_list; +} + +/* [MS-CFB] 2.6.1 Compound File Directory Entry */ +function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array*/, Paths/*:Array*/, nmfs, files, FileIndex, mini) { + var minifat_store = 0, pl = (Paths.length?2:0); + var sector = sector_list[dir_start].data; + var i = 0, namelen = 0, name; + for(; i < sector.length; i+= 128) { + var blob/*:CFBlob*/ = /*::(*/sector.slice(i, i+128)/*:: :any)*/; + prep_blob(blob, 64); + namelen = blob.read_shift(2); + name = __utf16le(blob,0,namelen-pl); + Paths.push(name); + var o/*:CFBEntry*/ = ({ + name: name, + type: blob.read_shift(1), + color: blob.read_shift(1), + L: blob.read_shift(4, 'i'), + R: blob.read_shift(4, 'i'), + C: blob.read_shift(4, 'i'), + clsid: blob.read_shift(16), + state: blob.read_shift(4, 'i'), + start: 0, + size: 0 + }); + var ctime/*:number*/ = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2); + if(ctime !== 0) o.ct = read_date(blob, blob.l-8); + var mtime/*:number*/ = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2); + if(mtime !== 0) o.mt = read_date(blob, blob.l-8); + o.start = blob.read_shift(4, 'i'); + o.size = blob.read_shift(4, 'i'); + if(o.size < 0 && o.start < 0) { o.size = o.type = 0; o.start = ENDOFCHAIN; o.name = ""; } + if(o.type === 5) { /* root */ + minifat_store = o.start; + if(nmfs > 0 && minifat_store !== ENDOFCHAIN) sector_list[minifat_store].name = "!StreamData"; + /*minifat_size = o.size;*/ + } else if(o.size >= 4096 /* MSCSZ */) { + o.storage = 'fat'; + if(sector_list[o.start] === undefined) sector_list[o.start] = get_sector_list(sectors, o.start, sector_list.fat_addrs, sector_list.ssz); + sector_list[o.start].name = o.name; + o.content = (sector_list[o.start].data.slice(0,o.size)/*:any*/); + } else { + o.storage = 'minifat'; + if(o.size < 0) o.size = 0; + else if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) { + o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data); + } + } + if(o.content) prep_blob(o.content, 0); + files[name] = o; + FileIndex.push(o); + } +} + +function read_date(blob/*:RawBytes|CFBlob*/, offset/*:number*/)/*:Date*/ { + return new Date(( ( (__readUInt32LE(blob,offset+4)/1e7)*Math.pow(2,32)+__readUInt32LE(blob,offset)/1e7 ) - 11644473600)*1000); +} + +function read_file(filename/*:string*/, options/*:CFBReadOpts*/) { + get_fs(); + return parse(fs.readFileSync(filename), options); +} + +function read(blob/*:RawBytes|string*/, options/*:CFBReadOpts*/) { + var type = options && options.type; + if(!type) { + if(has_buf && Buffer.isBuffer(blob)) type = "buffer"; + } + switch(type || "base64") { + case "file": /*:: if(typeof blob !== 'string') throw "Must pass a filename when type='file'"; */return read_file(blob, options); + case "base64": /*:: if(typeof blob !== 'string') throw "Must pass a base64-encoded binary string when type='file'"; */return parse(s2a(Base64_decode(blob)), options); + case "binary": /*:: if(typeof blob !== 'string') throw "Must pass a binary string when type='file'"; */return parse(s2a(blob), options); + } + return parse(/*::typeof blob == 'string' ? new Buffer(blob, 'utf-8') : */blob, options); +} + +function init_cfb(cfb/*:CFBContainer*/, opts/*:?any*/)/*:void*/ { + var o = opts || {}, root = o.root || "Root Entry"; + if(!cfb.FullPaths) cfb.FullPaths = []; + if(!cfb.FileIndex) cfb.FileIndex = []; + if(cfb.FullPaths.length !== cfb.FileIndex.length) throw new Error("inconsistent CFB structure"); + if(cfb.FullPaths.length === 0) { + cfb.FullPaths[0] = root + "/"; + cfb.FileIndex[0] = ({ name: root, type: 5 }/*:any*/); + } + if(o.CLSID) cfb.FileIndex[0].clsid = o.CLSID; + seed_cfb(cfb); +} +function seed_cfb(cfb/*:CFBContainer*/)/*:void*/ { + var nm = "\u0001Sh33tJ5"; + if(CFB.find(cfb, "/" + nm)) return; + var p = new_buf(4); p[0] = 55; p[1] = p[3] = 50; p[2] = 54; + cfb.FileIndex.push(({ name: nm, type: 2, content:p, size:4, L:69, R:69, C:69 }/*:any*/)); + cfb.FullPaths.push(cfb.FullPaths[0] + nm); + rebuild_cfb(cfb); +} +function rebuild_cfb(cfb/*:CFBContainer*/, f/*:?boolean*/)/*:void*/ { + init_cfb(cfb); + var gc = false, s = false; + for(var i = cfb.FullPaths.length - 1; i >= 0; --i) { + var _file = cfb.FileIndex[i]; + switch(_file.type) { + case 0: + if(s) gc = true; + else { cfb.FileIndex.pop(); cfb.FullPaths.pop(); } + break; + case 1: case 2: case 5: + s = true; + if(isNaN(_file.R * _file.L * _file.C)) gc = true; + if(_file.R > -1 && _file.L > -1 && _file.R == _file.L) gc = true; + break; + default: gc = true; break; + } + } + if(!gc && !f) return; + + var now = new Date(1987, 1, 19), j = 0; + // Track which names exist + var fullPaths = Object.create ? Object.create(null) : {}; + var data/*:Array<[string, CFBEntry]>*/ = []; + for(i = 0; i < cfb.FullPaths.length; ++i) { + fullPaths[cfb.FullPaths[i]] = true; + if(cfb.FileIndex[i].type === 0) continue; + data.push([cfb.FullPaths[i], cfb.FileIndex[i]]); + } + for(i = 0; i < data.length; ++i) { + var dad = dirname(data[i][0]); + s = fullPaths[dad]; + while(!s) { + while(dirname(dad) && !fullPaths[dirname(dad)]) dad = dirname(dad); + + data.push([dad, ({ + name: filename(dad).replace("/",""), + type: 1, + clsid: HEADER_CLSID, + ct: now, mt: now, + content: null + }/*:any*/)]); + + // Add name to set + fullPaths[dad] = true; + + dad = dirname(data[i][0]); + s = fullPaths[dad]; + } + } + + data.sort(function(x,y) { return namecmp(x[0], y[0]); }); + cfb.FullPaths = []; cfb.FileIndex = []; + for(i = 0; i < data.length; ++i) { cfb.FullPaths[i] = data[i][0]; cfb.FileIndex[i] = data[i][1]; } + for(i = 0; i < data.length; ++i) { + var elt = cfb.FileIndex[i]; + var nm = cfb.FullPaths[i]; + + elt.name = filename(nm).replace("/",""); + elt.L = elt.R = elt.C = -(elt.color = 1); + elt.size = elt.content ? elt.content.length : 0; + elt.start = 0; + elt.clsid = (elt.clsid || HEADER_CLSID); + if(i === 0) { + elt.C = data.length > 1 ? 1 : -1; + elt.size = 0; + elt.type = 5; + } else if(nm.slice(-1) == "/") { + for(j=i+1;j < data.length; ++j) if(dirname(cfb.FullPaths[j])==nm) break; + elt.C = j >= data.length ? -1 : j; + for(j=i+1;j < data.length; ++j) if(dirname(cfb.FullPaths[j])==dirname(nm)) break; + elt.R = j >= data.length ? -1 : j; + elt.type = 1; + } else { + if(dirname(cfb.FullPaths[i+1]||"") == dirname(nm)) elt.R = i + 1; + elt.type = 2; + } + } + +} + +function _write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes|string*/ { + var _opts = options || {}; + /* MAD is order-sensitive, skip rebuild and sort */ + if(_opts.fileType == 'mad') return write_mad(cfb, _opts); + rebuild_cfb(cfb); + switch(_opts.fileType) { + case 'zip': return write_zip(cfb, _opts); + //case 'mad': return write_mad(cfb, _opts); + } + var L = (function(cfb/*:CFBContainer*/)/*:Array*/{ + var mini_size = 0, fat_size = 0; + for(var i = 0; i < cfb.FileIndex.length; ++i) { + var file = cfb.FileIndex[i]; + if(!file.content) continue; + var flen = file.content.length; + if(flen > 0){ + if(flen < 0x1000) mini_size += (flen + 0x3F) >> 6; + else fat_size += (flen + 0x01FF) >> 9; + } + } + var dir_cnt = (cfb.FullPaths.length +3) >> 2; + var mini_cnt = (mini_size + 7) >> 3; + var mfat_cnt = (mini_size + 0x7F) >> 7; + var fat_base = mini_cnt + fat_size + dir_cnt + mfat_cnt; + var fat_cnt = (fat_base + 0x7F) >> 7; + var difat_cnt = fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt-109)/0x7F); + while(((fat_base + fat_cnt + difat_cnt + 0x7F) >> 7) > fat_cnt) difat_cnt = ++fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt-109)/0x7F); + var L = [1, difat_cnt, fat_cnt, mfat_cnt, dir_cnt, fat_size, mini_size, 0]; + cfb.FileIndex[0].size = mini_size << 6; + L[7] = (cfb.FileIndex[0].start=L[0]+L[1]+L[2]+L[3]+L[4]+L[5])+((L[6]+7) >> 3); + return L; + })(cfb); + var o = new_buf(L[7] << 9); + var i = 0, T = 0; + { + for(i = 0; i < 8; ++i) o.write_shift(1, HEADER_SIG[i]); + for(i = 0; i < 8; ++i) o.write_shift(2, 0); + o.write_shift(2, 0x003E); + o.write_shift(2, 0x0003); + o.write_shift(2, 0xFFFE); + o.write_shift(2, 0x0009); + o.write_shift(2, 0x0006); + for(i = 0; i < 3; ++i) o.write_shift(2, 0); + o.write_shift(4, 0); + o.write_shift(4, L[2]); + o.write_shift(4, L[0] + L[1] + L[2] + L[3] - 1); + o.write_shift(4, 0); + o.write_shift(4, 1<<12); + o.write_shift(4, L[3] ? L[0] + L[1] + L[2] - 1: ENDOFCHAIN); + o.write_shift(4, L[3]); + o.write_shift(-4, L[1] ? L[0] - 1: ENDOFCHAIN); + o.write_shift(4, L[1]); + for(i = 0; i < 109; ++i) o.write_shift(-4, i < L[2] ? L[1] + i : -1); + } + if(L[1]) { + for(T = 0; T < L[1]; ++T) { + for(; i < 236 + T * 127; ++i) o.write_shift(-4, i < L[2] ? L[1] + i : -1); + o.write_shift(-4, T === L[1] - 1 ? ENDOFCHAIN : T + 1); + } + } + var chainit = function(w/*:number*/)/*:void*/ { + for(T += w; i> 9); + } + chainit((L[6] + 7) >> 3); + while(o.l & 0x1FF) o.write_shift(-4, consts.ENDOFCHAIN); + T = i = 0; + for(j = 0; j < cfb.FileIndex.length; ++j) { + file = cfb.FileIndex[j]; + if(!file.content) continue; + /*:: if(file.content == null) throw new Error("unreachable"); */ + flen = file.content.length; + if(!flen || flen >= 0x1000) continue; + file.start = T; + chainit((flen + 0x3F) >> 6); + } + while(o.l & 0x1FF) o.write_shift(-4, consts.ENDOFCHAIN); + for(i = 0; i < L[4]<<2; ++i) { + var nm = cfb.FullPaths[i]; + if(!nm || nm.length === 0) { + for(j = 0; j < 17; ++j) o.write_shift(4, 0); + for(j = 0; j < 3; ++j) o.write_shift(4, -1); + for(j = 0; j < 12; ++j) o.write_shift(4, 0); + continue; + } + file = cfb.FileIndex[i]; + if(i === 0) file.start = file.size ? file.start - 1 : ENDOFCHAIN; + var _nm/*:string*/ = (i === 0 && _opts.root) || file.name; + if(_nm.length > 32) { + console.error("Name " + _nm + " will be truncated to " + _nm.slice(0,32)); + _nm = _nm.slice(0, 32); + } + flen = 2*(_nm.length+1); + o.write_shift(64, _nm, "utf16le"); + o.write_shift(2, flen); + o.write_shift(1, file.type); + o.write_shift(1, file.color); + o.write_shift(-4, file.L); + o.write_shift(-4, file.R); + o.write_shift(-4, file.C); + if(!file.clsid) for(j = 0; j < 4; ++j) o.write_shift(4, 0); + else o.write_shift(16, file.clsid, "hex"); + o.write_shift(4, file.state || 0); + o.write_shift(4, 0); o.write_shift(4, 0); + o.write_shift(4, 0); o.write_shift(4, 0); + o.write_shift(4, file.start); + o.write_shift(4, file.size); o.write_shift(4, 0); + } + for(i = 1; i < cfb.FileIndex.length; ++i) { + file = cfb.FileIndex[i]; + /*:: if(!file.content) throw new Error("unreachable"); */ + if(file.size >= 0x1000) { + o.l = (file.start+1) << 9; + if (has_buf && Buffer.isBuffer(file.content)) { + file.content.copy(o, o.l, 0, file.size); + // o is a 0-filled Buffer so just set next offset + o.l += (file.size + 511) & -512; + } else { + for(j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]); + for(; j & 0x1FF; ++j) o.write_shift(1, 0); + } + } + } + for(i = 1; i < cfb.FileIndex.length; ++i) { + file = cfb.FileIndex[i]; + /*:: if(!file.content) throw new Error("unreachable"); */ + if(file.size > 0 && file.size < 0x1000) { + if (has_buf && Buffer.isBuffer(file.content)) { + file.content.copy(o, o.l, 0, file.size); + // o is a 0-filled Buffer so just set next offset + o.l += (file.size + 63) & -64; + } else { + for(j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]); + for(; j & 0x3F; ++j) o.write_shift(1, 0); + } + } + } + if (has_buf) { + o.l = o.length; + } else { + // When using Buffer, already 0-filled + while(o.l < o.length) o.write_shift(1, 0); + } + return o; +} +/* [MS-CFB] 2.6.4 (Unicode 3.0.1 case conversion) */ +function find(cfb/*:CFBContainer*/, path/*:string*/)/*:?CFBEntry*/ { + var UCFullPaths/*:Array*/ = cfb.FullPaths.map(function(x) { return x.toUpperCase(); }); + var UCPaths/*:Array*/ = UCFullPaths.map(function(x) { var y = x.split("/"); return y[y.length - (x.slice(-1) == "/" ? 2 : 1)]; }); + var k/*:boolean*/ = false; + if(path.charCodeAt(0) === 47 /* "/" */) { k = true; path = UCFullPaths[0].slice(0, -1) + path; } + else k = path.indexOf("/") !== -1; + var UCPath/*:string*/ = path.toUpperCase(); + var w/*:number*/ = k === true ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath); + if(w !== -1) return cfb.FileIndex[w]; + + var m = !UCPath.match(chr1); + UCPath = UCPath.replace(chr0,''); + if(m) UCPath = UCPath.replace(chr1,'!'); + for(w = 0; w < UCFullPaths.length; ++w) { + if((m ? UCFullPaths[w].replace(chr1,'!') : UCFullPaths[w]).replace(chr0,'') == UCPath) return cfb.FileIndex[w]; + if((m ? UCPaths[w].replace(chr1,'!') : UCPaths[w]).replace(chr0,'') == UCPath) return cfb.FileIndex[w]; + } + return null; +} +/** CFB Constants */ +var MSSZ = 64; /* Mini Sector Size = 1<<6 */ +//var MSCSZ = 4096; /* Mini Stream Cutoff Size */ +/* 2.1 Compound File Sector Numbers and Types */ +var ENDOFCHAIN = -2; +/* 2.2 Compound File Header */ +var HEADER_SIGNATURE = 'd0cf11e0a1b11ae1'; +var HEADER_SIG = [0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]; +var HEADER_CLSID = '00000000000000000000000000000000'; +var consts = { + /* 2.1 Compund File Sector Numbers and Types */ + MAXREGSECT: -6, + DIFSECT: -4, + FATSECT: -3, + ENDOFCHAIN: ENDOFCHAIN, + FREESECT: -1, + /* 2.2 Compound File Header */ + HEADER_SIGNATURE: HEADER_SIGNATURE, + HEADER_MINOR_VERSION: '3e00', + MAXREGSID: -6, + NOSTREAM: -1, + HEADER_CLSID: HEADER_CLSID, + /* 2.6.1 Compound File Directory Entry */ + EntryTypes: ['unknown','storage','stream','lockbytes','property','root'] +}; + +function write_file(cfb/*:CFBContainer*/, filename/*:string*/, options/*:CFBWriteOpts*/)/*:void*/ { + get_fs(); + var o = _write(cfb, options); + /*:: if(typeof Buffer == 'undefined' || !Buffer.isBuffer(o) || !(o instanceof Buffer)) throw new Error("unreachable"); */ + fs.writeFileSync(filename, o); +} + +function a2s(o/*:RawBytes*/)/*:string*/ { + var out = new Array(o.length); + for(var i = 0; i < o.length; ++i) out[i] = String.fromCharCode(o[i]); + return out.join(""); +} + +function write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes|string*/ { + var o = _write(cfb, options); + switch(options && options.type || "buffer") { + case "file": get_fs(); fs.writeFileSync(options.filename, (o/*:any*/)); return o; + case "binary": return typeof o == "string" ? o : a2s(o); + case "base64": return Base64_encode(typeof o == "string" ? o : a2s(o)); + case "buffer": if(has_buf) return Buffer.isBuffer(o) ? o : Buffer_from(o); + /* falls through */ + case "array": return typeof o == "string" ? s2a(o) : o; + } + return o; +} +/* node < 8.1 zlib does not expose bytesRead, so default to pure JS */ +var _zlib; +function use_zlib(zlib) { try { + var InflateRaw = zlib.InflateRaw; + var InflRaw = new InflateRaw(); + InflRaw._processChunk(new Uint8Array([3, 0]), InflRaw._finishFlushFlag); + if(InflRaw.bytesRead) _zlib = zlib; + else throw new Error("zlib does not expose bytesRead"); +} catch(e) {console.error("cannot use native zlib: " + (e.message || e)); } } + +function _inflateRawSync(payload, usz) { + if(!_zlib) return _inflate(payload, usz); + var InflateRaw = _zlib.InflateRaw; + var InflRaw = new InflateRaw(); + var out = InflRaw._processChunk(payload.slice(payload.l), InflRaw._finishFlushFlag); + payload.l += InflRaw.bytesRead; + return out; +} + +function _deflateRawSync(payload) { + return _zlib ? _zlib.deflateRawSync(payload) : _deflate(payload); +} +var CLEN_ORDER = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; + +/* LEN_ID = [ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285 ]; */ +var LEN_LN = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13 , 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258 ]; + +/* DST_ID = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ]; */ +var DST_LN = [ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 ]; + +function bit_swap_8(n) { var t = (((((n<<1)|(n<<11)) & 0x22110) | (((n<<5)|(n<<15)) & 0x88440))); return ((t>>16) | (t>>8) |t)&0xFF; } + +var use_typed_arrays = typeof Uint8Array !== 'undefined'; + +var bitswap8 = use_typed_arrays ? new Uint8Array(1<<8) : []; +for(var q = 0; q < (1<<8); ++q) bitswap8[q] = bit_swap_8(q); + +function bit_swap_n(n, b) { + var rev = bitswap8[n & 0xFF]; + if(b <= 8) return rev >>> (8-b); + rev = (rev << 8) | bitswap8[(n>>8)&0xFF]; + if(b <= 16) return rev >>> (16-b); + rev = (rev << 8) | bitswap8[(n>>16)&0xFF]; + return rev >>> (24-b); +} + +/* helpers for unaligned bit reads */ +function read_bits_2(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 6 ? 0 : buf[h+1]<<8))>>>w)& 0x03; } +function read_bits_3(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 5 ? 0 : buf[h+1]<<8))>>>w)& 0x07; } +function read_bits_4(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 4 ? 0 : buf[h+1]<<8))>>>w)& 0x0F; } +function read_bits_5(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 3 ? 0 : buf[h+1]<<8))>>>w)& 0x1F; } +function read_bits_7(buf, bl) { var w = (bl&7), h = (bl>>>3); return ((buf[h]|(w <= 1 ? 0 : buf[h+1]<<8))>>>w)& 0x7F; } + +/* works up to n = 3 * 8 + 1 = 25 */ +function read_bits_n(buf, bl, n) { + var w = (bl&7), h = (bl>>>3), f = ((1<>> w; + if(n < 8 - w) return v & f; + v |= buf[h+1]<<(8-w); + if(n < 16 - w) return v & f; + v |= buf[h+2]<<(16-w); + if(n < 24 - w) return v & f; + v |= buf[h+3]<<(24-w); + return v & f; +} + +/* helpers for unaligned bit writes */ +function write_bits_3(buf, bl, v) { var w = bl & 7, h = bl >>> 3; + if(w <= 5) buf[h] |= (v & 7) << w; + else { + buf[h] |= (v << w) & 0xFF; + buf[h+1] = (v&7) >> (8-w); + } + return bl + 3; +} + +function write_bits_1(buf, bl, v) { + var w = bl & 7, h = bl >>> 3; + v = (v&1) << w; + buf[h] |= v; + return bl + 1; +} +function write_bits_8(buf, bl, v) { + var w = bl & 7, h = bl >>> 3; + v <<= w; + buf[h] |= v & 0xFF; v >>>= 8; + buf[h+1] = v; + return bl + 8; +} +function write_bits_16(buf, bl, v) { + var w = bl & 7, h = bl >>> 3; + v <<= w; + buf[h] |= v & 0xFF; v >>>= 8; + buf[h+1] = v & 0xFF; + buf[h+2] = v >>> 8; + return bl + 16; +} + +/* until ArrayBuffer#realloc is a thing, fake a realloc */ +function realloc(b, sz/*:number*/) { + var L = b.length, M = 2*L > sz ? 2*L : sz + 5, i = 0; + if(L >= sz) return b; + if(has_buf) { + var o = new_unsafe_buf(M); + // $FlowIgnore + if(b.copy) b.copy(o); + else for(; i < b.length; ++i) o[i] = b[i]; + return o; + } else if(use_typed_arrays) { + var a = new Uint8Array(M); + if(a.set) a.set(b); + else for(; i < L; ++i) a[i] = b[i]; + return a; + } + b.length = M; + return b; +} + +/* zero-filled arrays for older browsers */ +function zero_fill_array(n) { + var o = new Array(n); + for(var i = 0; i < n; ++i) o[i] = 0; + return o; +} + +/* build tree (used for literals and lengths) */ +function build_tree(clens, cmap, MAX/*:number*/)/*:number*/ { + var maxlen = 1, w = 0, i = 0, j = 0, ccode = 0, L = clens.length; + + var bl_count = use_typed_arrays ? new Uint16Array(32) : zero_fill_array(32); + for(i = 0; i < 32; ++i) bl_count[i] = 0; + + for(i = L; i < MAX; ++i) clens[i] = 0; + L = clens.length; + + var ctree = use_typed_arrays ? new Uint16Array(L) : zero_fill_array(L); // [] + + /* build code tree */ + for(i = 0; i < L; ++i) { + bl_count[(w = clens[i])]++; + if(maxlen < w) maxlen = w; + ctree[i] = 0; + } + bl_count[0] = 0; + for(i = 1; i <= maxlen; ++i) bl_count[i+16] = (ccode = (ccode + bl_count[i-1])<<1); + for(i = 0; i < L; ++i) { + ccode = clens[i]; + if(ccode != 0) ctree[i] = bl_count[ccode+16]++; + } + + /* cmap[maxlen + 4 bits] = (off&15) + (lit<<4) reverse mapping */ + var cleni = 0; + for(i = 0; i < L; ++i) { + cleni = clens[i]; + if(cleni != 0) { + ccode = bit_swap_n(ctree[i], maxlen)>>(maxlen-cleni); + for(j = (1<<(maxlen + 4 - cleni)) - 1; j>=0; --j) + cmap[ccode|(j<*/ = []; + var i = 0; + for(;i<32; i++) dlens.push(5); + build_tree(dlens, fix_dmap, 32); + + var clens/*:Array*/ = []; + i = 0; + for(; i<=143; i++) clens.push(8); + for(; i<=255; i++) clens.push(9); + for(; i<=279; i++) clens.push(7); + for(; i<=287; i++) clens.push(8); + build_tree(clens, fix_lmap, 288); +})();var _deflateRaw = /*#__PURE__*/(function _deflateRawIIFE() { + var DST_LN_RE = use_typed_arrays ? new Uint8Array(0x8000) : []; + var j = 0, k = 0; + for(; j < DST_LN.length - 1; ++j) { + for(; k < DST_LN[j+1]; ++k) DST_LN_RE[k] = j; + } + for(;k < 32768; ++k) DST_LN_RE[k] = 29; + + var LEN_LN_RE = use_typed_arrays ? new Uint8Array(0x103) : []; + for(j = 0, k = 0; j < LEN_LN.length - 1; ++j) { + for(; k < LEN_LN[j+1]; ++k) LEN_LN_RE[k] = j; + } + + function write_stored(data, out) { + var boff = 0; + while(boff < data.length) { + var L = Math.min(0xFFFF, data.length - boff); + var h = boff + L == data.length; + out.write_shift(1, +h); + out.write_shift(2, L); + out.write_shift(2, (~L) & 0xFFFF); + while(L-- > 0) out[out.l++] = data[boff++]; + } + return out.l; + } + + /* Fixed Huffman */ + function write_huff_fixed(data, out) { + var bl = 0; + var boff = 0; + var addrs = use_typed_arrays ? new Uint16Array(0x8000) : []; + while(boff < data.length) { + var L = /* data.length - boff; */ Math.min(0xFFFF, data.length - boff); + + /* write a stored block for short data */ + if(L < 10) { + bl = write_bits_3(out, bl, +!!(boff + L == data.length)); // jshint ignore:line + if(bl & 7) bl += 8 - (bl & 7); + out.l = (bl / 8) | 0; + out.write_shift(2, L); + out.write_shift(2, (~L) & 0xFFFF); + while(L-- > 0) out[out.l++] = data[boff++]; + bl = out.l * 8; + continue; + } + + bl = write_bits_3(out, bl, +!!(boff + L == data.length) + 2); // jshint ignore:line + var hash = 0; + while(L-- > 0) { + var d = data[boff]; + hash = ((hash << 5) ^ d) & 0x7FFF; + + var match = -1, mlen = 0; + + if((match = addrs[hash])) { + match |= boff & ~0x7FFF; + if(match > boff) match -= 0x8000; + if(match < boff) while(data[match + mlen] == data[boff + mlen] && mlen < 250) ++mlen; + } + + if(mlen > 2) { + /* Copy Token */ + d = LEN_LN_RE[mlen]; + if(d <= 22) bl = write_bits_8(out, bl, bitswap8[d+1]>>1) - 1; + else { + write_bits_8(out, bl, 3); + bl += 5; + write_bits_8(out, bl, bitswap8[d-23]>>5); + bl += 3; + } + var len_eb = (d < 8) ? 0 : ((d - 4)>>2); + if(len_eb > 0) { + write_bits_16(out, bl, mlen - LEN_LN[d]); + bl += len_eb; + } + + d = DST_LN_RE[boff - match]; + bl = write_bits_8(out, bl, bitswap8[d]>>3); + bl -= 3; + + var dst_eb = d < 4 ? 0 : (d-2)>>1; + if(dst_eb > 0) { + write_bits_16(out, bl, boff - match - DST_LN[d]); + bl += dst_eb; + } + for(var q = 0; q < mlen; ++q) { + addrs[hash] = boff & 0x7FFF; + hash = ((hash << 5) ^ data[boff]) & 0x7FFF; + ++boff; + } + L-= mlen - 1; + } else { + /* Literal Token */ + if(d <= 143) d = d + 48; + else bl = write_bits_1(out, bl, 1); + bl = write_bits_8(out, bl, bitswap8[d]); + addrs[hash] = boff & 0x7FFF; + ++boff; + } + } + + bl = write_bits_8(out, bl, 0) - 1; + } + out.l = ((bl + 7)/8)|0; + return out.l; + } + return function _deflateRaw(data, out) { + if(data.length < 8) return write_stored(data, out); + return write_huff_fixed(data, out); + }; +})(); + +function _deflate(data) { + var buf = new_buf(50+Math.floor(data.length*1.1)); + var off = _deflateRaw(data, buf); + return buf.slice(0, off); +} +/* modified inflate function also moves original read head */ + +var dyn_lmap = use_typed_arrays ? new Uint16Array(32768) : zero_fill_array(32768); +var dyn_dmap = use_typed_arrays ? new Uint16Array(32768) : zero_fill_array(32768); +var dyn_cmap = use_typed_arrays ? new Uint16Array(128) : zero_fill_array(128); +var dyn_len_1 = 1, dyn_len_2 = 1; + +/* 5.5.3 Expanding Huffman Codes */ +function dyn(data, boff/*:number*/) { + /* nomenclature from RFC1951 refers to bit values; these are offset by the implicit constant */ + var _HLIT = read_bits_5(data, boff) + 257; boff += 5; + var _HDIST = read_bits_5(data, boff) + 1; boff += 5; + var _HCLEN = read_bits_4(data, boff) + 4; boff += 4; + var w = 0; + + /* grab and store code lengths */ + var clens = use_typed_arrays ? new Uint8Array(19) : zero_fill_array(19); + var ctree = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + var maxlen = 1; + var bl_count = use_typed_arrays ? new Uint8Array(8) : zero_fill_array(8); + var next_code = use_typed_arrays ? new Uint8Array(8) : zero_fill_array(8); + var L = clens.length; /* 19 */ + for(var i = 0; i < _HCLEN; ++i) { + clens[CLEN_ORDER[i]] = w = read_bits_3(data, boff); + if(maxlen < w) maxlen = w; + bl_count[w]++; + boff += 3; + } + + /* build code tree */ + var ccode = 0; + bl_count[0] = 0; + for(i = 1; i <= maxlen; ++i) next_code[i] = ccode = (ccode + bl_count[i-1])<<1; + for(i = 0; i < L; ++i) if((ccode = clens[i]) != 0) ctree[i] = next_code[ccode]++; + /* cmap[7 bits from stream] = (off&7) + (lit<<3) */ + var cleni = 0; + for(i = 0; i < L; ++i) { + cleni = clens[i]; + if(cleni != 0) { + ccode = bitswap8[ctree[i]]>>(8-cleni); + for(var j = (1<<(7-cleni))-1; j>=0; --j) dyn_cmap[ccode|(j<*/ = []; + maxlen = 1; + for(; hcodes.length < _HLIT + _HDIST;) { + ccode = dyn_cmap[read_bits_7(data, boff)]; + boff += ccode & 7; + switch((ccode >>>= 3)) { + case 16: + w = 3 + read_bits_2(data, boff); boff += 2; + ccode = hcodes[hcodes.length - 1]; + while(w-- > 0) hcodes.push(ccode); + break; + case 17: + w = 3 + read_bits_3(data, boff); boff += 3; + while(w-- > 0) hcodes.push(0); + break; + case 18: + w = 11 + read_bits_7(data, boff); boff += 7; + while(w -- > 0) hcodes.push(0); + break; + default: + hcodes.push(ccode); + if(maxlen < ccode) maxlen = ccode; + break; + } + } + + /* build literal / length trees */ + var h1 = hcodes.slice(0, _HLIT), h2 = hcodes.slice(_HLIT); + for(i = _HLIT; i < 286; ++i) h1[i] = 0; + for(i = _HDIST; i < 30; ++i) h2[i] = 0; + dyn_len_1 = build_tree(h1, dyn_lmap, 286); + dyn_len_2 = build_tree(h2, dyn_dmap, 30); + return boff; +} + +/* return [ data, bytesRead ] */ +function inflate(data, usz/*:number*/) { + /* shortcircuit for empty buffer [0x03, 0x00] */ + if(data[0] == 3 && !(data[1] & 0x3)) { return [new_raw_buf(usz), 2]; } + + /* bit offset */ + var boff = 0; + + /* header includes final bit and type bits */ + var header = 0; + + var outbuf = new_unsafe_buf(usz ? usz : (1<<18)); + var woff = 0; + var OL = outbuf.length>>>0; + var max_len_1 = 0, max_len_2 = 0; + + while((header&1) == 0) { + header = read_bits_3(data, boff); boff += 3; + if((header >>> 1) == 0) { + /* Stored block */ + if(boff & 7) boff += 8 - (boff&7); + /* 2 bytes sz, 2 bytes bit inverse */ + var sz = data[boff>>>3] | data[(boff>>>3)+1]<<8; + boff += 32; + /* push sz bytes */ + if(sz > 0) { + if(!usz && OL < woff + sz) { outbuf = realloc(outbuf, woff + sz); OL = outbuf.length; } + while(sz-- > 0) { outbuf[woff++] = data[boff>>>3]; boff += 8; } + } + continue; + } else if((header >> 1) == 1) { + /* Fixed Huffman */ + max_len_1 = 9; max_len_2 = 5; + } else { + /* Dynamic Huffman */ + boff = dyn(data, boff); + max_len_1 = dyn_len_1; max_len_2 = dyn_len_2; + } + for(;;) { // while(true) is apparently out of vogue in modern JS circles + if(!usz && (OL < woff + 32767)) { outbuf = realloc(outbuf, woff + 32767); OL = outbuf.length; } + /* ingest code and move read head */ + var bits = read_bits_n(data, boff, max_len_1); + var code = (header>>>1) == 1 ? fix_lmap[bits] : dyn_lmap[bits]; + boff += code & 15; code >>>= 4; + /* 0-255 are literals, 256 is end of block token, 257+ are copy tokens */ + if(((code>>>8)&0xFF) === 0) outbuf[woff++] = code; + else if(code == 256) break; + else { + code -= 257; + var len_eb = (code < 8) ? 0 : ((code-4)>>2); if(len_eb > 5) len_eb = 0; + var tgt = woff + LEN_LN[code]; + /* length extra bits */ + if(len_eb > 0) { + tgt += read_bits_n(data, boff, len_eb); + boff += len_eb; + } + + /* dist code */ + bits = read_bits_n(data, boff, max_len_2); + code = (header>>>1) == 1 ? fix_dmap[bits] : dyn_dmap[bits]; + boff += code & 15; code >>>= 4; + var dst_eb = (code < 4 ? 0 : (code-2)>>1); + var dst = DST_LN[code]; + /* dist extra bits */ + if(dst_eb > 0) { + dst += read_bits_n(data, boff, dst_eb); + boff += dst_eb; + } + + /* in the common case, manual byte copy is faster than TA set / Buffer copy */ + if(!usz && OL < tgt) { outbuf = realloc(outbuf, tgt + 100); OL = outbuf.length; } + while(woff < tgt) { outbuf[woff] = outbuf[woff - dst]; ++woff; } + } + } + } + if(usz) return [outbuf, (boff+7)>>>3]; + return [outbuf.slice(0, woff), (boff+7)>>>3]; +} + +function _inflate(payload, usz) { + var data = payload.slice(payload.l||0); + var out = inflate(data, usz); + payload.l += out[1]; + return out[0]; +} + +function warn_or_throw(wrn, msg) { + if(wrn) { if(typeof console !== 'undefined') console.error(msg); } + else throw new Error(msg); +} + +function parse_zip(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ { + var blob/*:CFBlob*/ = /*::(*/file/*:: :any)*/; + prep_blob(blob, 0); + + var FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array*/ = []; + var o = { + FileIndex: FileIndex, + FullPaths: FullPaths + }; + init_cfb(o, { root: options.root }); + + /* find end of central directory, start just after signature */ + var i = blob.length - 4; + while((blob[i] != 0x50 || blob[i+1] != 0x4b || blob[i+2] != 0x05 || blob[i+3] != 0x06) && i >= 0) --i; + blob.l = i + 4; + + /* parse end of central directory */ + blob.l += 4; + var fcnt = blob.read_shift(2); + blob.l += 6; + var start_cd = blob.read_shift(4); + + /* parse central directory */ + blob.l = start_cd; + + for(i = 0; i < fcnt; ++i) { + /* trust local file header instead of CD entry */ + blob.l += 20; + var csz = blob.read_shift(4); + var usz = blob.read_shift(4); + var namelen = blob.read_shift(2); + var efsz = blob.read_shift(2); + var fcsz = blob.read_shift(2); + blob.l += 8; + var offset = blob.read_shift(4); + var EF = parse_extra_field(/*::(*/blob.slice(blob.l+namelen, blob.l+namelen+efsz)/*:: :any)*/); + blob.l += namelen + efsz + fcsz; + + var L = blob.l; + blob.l = offset + 4; + /* ZIP64 lengths */ + if(EF && EF[0x0001]) { + if((EF[0x0001]||{}).usz) usz = EF[0x0001].usz; + if((EF[0x0001]||{}).csz) csz = EF[0x0001].csz; + } + parse_local_file(blob, csz, usz, o, EF); + blob.l = L; + } + + return o; +} + + +/* head starts just after local file header signature */ +function parse_local_file(blob/*:CFBlob*/, csz/*:number*/, usz/*:number*/, o/*:CFBContainer*/, EF) { + /* [local file header] */ + blob.l += 2; + var flags = blob.read_shift(2); + var meth = blob.read_shift(2); + var date = parse_dos_date(blob); + + if(flags & 0x2041) throw new Error("Unsupported ZIP encryption"); + var crc32 = blob.read_shift(4); + var _csz = blob.read_shift(4); + var _usz = blob.read_shift(4); + + var namelen = blob.read_shift(2); + var efsz = blob.read_shift(2); + + // TODO: flags & (1<<11) // UTF8 + var name = ""; for(var i = 0; i < namelen; ++i) name += String.fromCharCode(blob[blob.l++]); + if(efsz) { + var ef = parse_extra_field(/*::(*/blob.slice(blob.l, blob.l + efsz)/*:: :any)*/); + if((ef[0x5455]||{}).mt) date = ef[0x5455].mt; + if((ef[0x0001]||{}).usz) _usz = ef[0x0001].usz; + if((ef[0x0001]||{}).csz) _csz = ef[0x0001].csz; + if(EF) { + if((EF[0x5455]||{}).mt) date = EF[0x5455].mt; + if((EF[0x0001]||{}).usz) _usz = ef[0x0001].usz; + if((EF[0x0001]||{}).csz) _csz = ef[0x0001].csz; + } + } + blob.l += efsz; + + /* [encryption header] */ + + /* [file data] */ + var data = blob.slice(blob.l, blob.l + _csz); + switch(meth) { + case 8: data = _inflateRawSync(blob, _usz); break; + case 0: break; // TODO: scan for magic number + default: throw new Error("Unsupported ZIP Compression method " + meth); + } + + /* [data descriptor] */ + var wrn = false; + if(flags & 8) { + crc32 = blob.read_shift(4); + if(crc32 == 0x08074b50) { crc32 = blob.read_shift(4); wrn = true; } + _csz = blob.read_shift(4); + _usz = blob.read_shift(4); + } + + if(_csz != csz) warn_or_throw(wrn, "Bad compressed size: " + csz + " != " + _csz); + if(_usz != usz) warn_or_throw(wrn, "Bad uncompressed size: " + usz + " != " + _usz); + //var _crc32 = CRC32.buf(data, 0); + //if((crc32>>0) != (_crc32>>0)) warn_or_throw(wrn, "Bad CRC32 checksum: " + crc32 + " != " + _crc32); + cfb_add(o, name, data, {unsafe: true, mt: date}); +} +function write_zip(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes*/ { + var _opts = options || {}; + var out = [], cdirs = []; + var o/*:CFBlob*/ = new_buf(1); + var method = (_opts.compression ? 8 : 0), flags = 0; + var desc = false; + if(desc) flags |= 8; + var i = 0, j = 0; + + var start_cd = 0, fcnt = 0; + var root = cfb.FullPaths[0], fp = root, fi = cfb.FileIndex[0]; + var crcs = []; + var sz_cd = 0; + + for(i = 1; i < cfb.FullPaths.length; ++i) { + fp = cfb.FullPaths[i].slice(root.length); fi = cfb.FileIndex[i]; + if(!fi.size || !fi.content || fp == "\u0001Sh33tJ5") continue; + var start = start_cd; + + /* TODO: CP437 filename */ + var namebuf = new_buf(fp.length); + for(j = 0; j < fp.length; ++j) namebuf.write_shift(1, fp.charCodeAt(j) & 0x7F); + namebuf = namebuf.slice(0, namebuf.l); + crcs[fcnt] = typeof fi.content == "string" ? CRC32.bstr(fi.content, 0) : CRC32.buf(/*::((*/fi.content/*::||[]):any)*/, 0); + + var outbuf = typeof fi.content == "string" ? s2a(fi.content) : fi.content/*::||[]*/; + if(method == 8) outbuf = _deflateRawSync(outbuf); + + /* local file header */ + o = new_buf(30); + o.write_shift(4, 0x04034b50); + o.write_shift(2, 20); + o.write_shift(2, flags); + o.write_shift(2, method); + /* TODO: last mod file time/date */ + if(fi.mt) write_dos_date(o, fi.mt); + else o.write_shift(4, 0); + o.write_shift(-4, (flags & 8) ? 0 : crcs[fcnt]); + o.write_shift(4, (flags & 8) ? 0 : outbuf.length); + o.write_shift(4, (flags & 8) ? 0 : /*::(*/fi.content/*::||[])*/.length); + o.write_shift(2, namebuf.length); + o.write_shift(2, 0); + + start_cd += o.length; + out.push(o); + start_cd += namebuf.length; + out.push(namebuf); + + /* TODO: extra fields? */ + + /* TODO: encryption header ? */ + + start_cd += outbuf.length; + out.push(outbuf); + + /* data descriptor */ + if(flags & 8) { + o = new_buf(12); + o.write_shift(-4, crcs[fcnt]); + o.write_shift(4, outbuf.length); + o.write_shift(4, /*::(*/fi.content/*::||[])*/.length); + start_cd += o.l; + out.push(o); + } + + /* central directory */ + o = new_buf(46); + o.write_shift(4, 0x02014b50); + o.write_shift(2, 0); + o.write_shift(2, 20); + o.write_shift(2, flags); + o.write_shift(2, method); + o.write_shift(4, 0); /* TODO: last mod file time/date */ + o.write_shift(-4, crcs[fcnt]); + + o.write_shift(4, outbuf.length); + o.write_shift(4, /*::(*/fi.content/*::||[])*/.length); + o.write_shift(2, namebuf.length); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(4, 0); + o.write_shift(4, start); + + sz_cd += o.l; + cdirs.push(o); + sz_cd += namebuf.length; + cdirs.push(namebuf); + ++fcnt; + } + + /* end of central directory */ + o = new_buf(22); + o.write_shift(4, 0x06054b50); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, fcnt); + o.write_shift(2, fcnt); + o.write_shift(4, sz_cd); + o.write_shift(4, start_cd); + o.write_shift(2, 0); + + return bconcat(([bconcat((out/*:any*/)), bconcat(cdirs), o]/*:any*/)); +} +var ContentTypeMap = ({ + "htm": "text/html", + "xml": "text/xml", + + "gif": "image/gif", + "jpg": "image/jpeg", + "png": "image/png", + + "mso": "application/x-mso", + "thmx": "application/vnd.ms-officetheme", + "sh33tj5": "application/octet-stream" +}/*:any*/); + +function get_content_type(fi/*:CFBEntry*/, fp/*:string*/)/*:string*/ { + if(fi.ctype) return fi.ctype; + + var ext = fi.name || "", m = ext.match(/\.([^\.]+)$/); + if(m && ContentTypeMap[m[1]]) return ContentTypeMap[m[1]]; + + if(fp) { + m = (ext = fp).match(/[\.\\]([^\.\\])+$/); + if(m && ContentTypeMap[m[1]]) return ContentTypeMap[m[1]]; + } + + return "application/octet-stream"; +} + +/* 76 character chunks TODO: intertwine encoding */ +function write_base64_76(bstr/*:string*/)/*:string*/ { + var data = Base64_encode(bstr); + var o = []; + for(var i = 0; i < data.length; i+= 76) o.push(data.slice(i, i+76)); + return o.join("\r\n") + "\r\n"; +} + +/* +Rules for QP: + - escape =## applies for all non-display characters and literal "=" + - space or tab at end of line must be encoded + - \r\n newlines can be preserved, but bare \r and \n must be escaped + - lines must not exceed 76 characters, use soft breaks =\r\n + +TODO: Some files from word appear to write line extensions with bare equals: + +``` +*/ = [], split = encoded.split("\r\n"); + for(var si = 0; si < split.length; ++si) { + var str = split[si]; + if(str.length == 0) { o.push(""); continue; } + for(var i = 0; i < str.length;) { + var end = 76; + var tmp = str.slice(i, i + end); + if(tmp.charAt(end - 1) == "=") end --; + else if(tmp.charAt(end - 2) == "=") end -= 2; + else if(tmp.charAt(end - 3) == "=") end -= 3; + tmp = str.slice(i, i + end); + i += end; + if(i < str.length) tmp += "="; + o.push(tmp); + } + } + + return o.join("\r\n"); +} +function parse_quoted_printable(data/*:Array*/)/*:RawBytes*/ { + var o = []; + + /* unify long lines */ + for(var di = 0; di < data.length; ++di) { + var line = data[di]; + while(di <= data.length && line.charAt(line.length - 1) == "=") line = line.slice(0, line.length - 1) + data[++di]; + o.push(line); + } + + /* decode */ + for(var oi = 0; oi < o.length; ++oi) o[oi] = o[oi].replace(/[=][0-9A-Fa-f]{2}/g, function($$) { return String.fromCharCode(parseInt($$.slice(1), 16)); }); + return s2a(o.join("\r\n")); +} + + +function parse_mime(cfb/*:CFBContainer*/, data/*:Array*/, root/*:string*/)/*:void*/ { + var fname = "", cte = "", ctype = "", fdata; + var di = 0; + for(;di < 10; ++di) { + var line = data[di]; + if(!line || line.match(/^\s*$/)) break; + var m = line.match(/^(.*?):\s*([^\s].*)$/); + if(m) switch(m[1].toLowerCase()) { + case "content-location": fname = m[2].trim(); break; + case "content-type": ctype = m[2].trim(); break; + case "content-transfer-encoding": cte = m[2].trim(); break; + } + } + ++di; + switch(cte.toLowerCase()) { + case 'base64': fdata = s2a(Base64_decode(data.slice(di).join(""))); break; + case 'quoted-printable': fdata = parse_quoted_printable(data.slice(di)); break; + default: throw new Error("Unsupported Content-Transfer-Encoding " + cte); + } + var file = cfb_add(cfb, fname.slice(root.length), fdata, {unsafe: true}); + if(ctype) file.ctype = ctype; +} + +function parse_mad(file/*:RawBytes*/, options/*:CFBReadOpts*/)/*:CFBContainer*/ { + if(a2s(file.slice(0,13)).toLowerCase() != "mime-version:") throw new Error("Unsupported MAD header"); + var root = (options && options.root || ""); + // $FlowIgnore + var data = (has_buf && Buffer.isBuffer(file) ? file.toString("binary") : a2s(file)).split("\r\n"); + var di = 0, row = ""; + + /* if root is not specified, scan for the common prefix */ + for(di = 0; di < data.length; ++di) { + row = data[di]; + if(!/^Content-Location:/i.test(row)) continue; + row = row.slice(row.indexOf("file")); + if(!root) root = row.slice(0, row.lastIndexOf("/") + 1); + if(row.slice(0, root.length) == root) continue; + while(root.length > 0) { + root = root.slice(0, root.length - 1); + root = root.slice(0, root.lastIndexOf("/") + 1); + if(row.slice(0,root.length) == root) break; + } + } + + var mboundary = (data[1] || "").match(/boundary="(.*?)"/); + if(!mboundary) throw new Error("MAD cannot find boundary"); + var boundary = "--" + (mboundary[1] || ""); + + var FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array*/ = []; + var o = { + FileIndex: FileIndex, + FullPaths: FullPaths + }; + init_cfb(o); + var start_di, fcnt = 0; + for(di = 0; di < data.length; ++di) { + var line = data[di]; + if(line !== boundary && line !== boundary + "--") continue; + if(fcnt++) parse_mime(o, data.slice(start_di, di), root); + start_di = di; + } + return o; +} + +function write_mad(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:string*/ { + var opts = options || {}; + var boundary = opts.boundary || "SheetJS"; + boundary = '------=' + boundary; + + var out = [ + 'MIME-Version: 1.0', + 'Content-Type: multipart/related; boundary="' + boundary.slice(2) + '"', + '', + '', + '' + ]; + + var root = cfb.FullPaths[0], fp = root, fi = cfb.FileIndex[0]; + for(var i = 1; i < cfb.FullPaths.length; ++i) { + fp = cfb.FullPaths[i].slice(root.length); + fi = cfb.FileIndex[i]; + if(!fi.size || !fi.content || fp == "\u0001Sh33tJ5") continue; + + /* Normalize filename */ + fp = fp.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g, function(c) { + return "_x" + c.charCodeAt(0).toString(16) + "_"; + }).replace(/[\u0080-\uFFFF]/g, function(u) { + return "_u" + u.charCodeAt(0).toString(16) + "_"; + }); + + /* Extract content as binary string */ + var ca = fi.content; + // $FlowIgnore + var cstr = has_buf && Buffer.isBuffer(ca) ? ca.toString("binary") : a2s(ca); + + /* 4/5 of first 1024 chars ascii -> quoted printable, else base64 */ + var dispcnt = 0, L = Math.min(1024, cstr.length), cc = 0; + for(var csl = 0; csl <= L; ++csl) if((cc=cstr.charCodeAt(csl)) >= 0x20 && cc < 0x80) ++dispcnt; + var qp = dispcnt >= L * 4 / 5; + + out.push(boundary); + out.push('Content-Location: ' + (opts.root || 'file:///C:/SheetJS/') + fp); + out.push('Content-Transfer-Encoding: ' + (qp ? 'quoted-printable' : 'base64')); + out.push('Content-Type: ' + get_content_type(fi, fp)); + out.push(''); + + out.push(qp ? write_quoted_printable(cstr) : write_base64_76(cstr)); + } + out.push(boundary + '--\r\n'); + return out.join("\r\n"); +} +function cfb_new(opts/*:?any*/)/*:CFBContainer*/ { + var o/*:CFBContainer*/ = ({}/*:any*/); + init_cfb(o, opts); + return o; +} + +function cfb_add(cfb/*:CFBContainer*/, name/*:string*/, content/*:?RawBytes*/, opts/*:?any*/)/*:CFBEntry*/ { + var unsafe = opts && opts.unsafe; + if(!unsafe) init_cfb(cfb); + var file = !unsafe && CFB.find(cfb, name); + if(!file) { + var fpath/*:string*/ = cfb.FullPaths[0]; + if(name.slice(0, fpath.length) == fpath) fpath = name; + else { + if(fpath.slice(-1) != "/") fpath += "/"; + fpath = (fpath + name).replace("//","/"); + } + file = ({name: filename(name), type: 2}/*:any*/); + cfb.FileIndex.push(file); + cfb.FullPaths.push(fpath); + if(!unsafe) CFB.utils.cfb_gc(cfb); + } + /*:: if(!file) throw new Error("unreachable"); */ + file.content = (content/*:any*/); + file.size = content ? content.length : 0; + if(opts) { + if(opts.CLSID) file.clsid = opts.CLSID; + if(opts.mt) file.mt = opts.mt; + if(opts.ct) file.ct = opts.ct; + } + return file; +} + +function cfb_del(cfb/*:CFBContainer*/, name/*:string*/)/*:boolean*/ { + init_cfb(cfb); + var file = CFB.find(cfb, name); + if(file) for(var j = 0; j < cfb.FileIndex.length; ++j) if(cfb.FileIndex[j] == file) { + cfb.FileIndex.splice(j, 1); + cfb.FullPaths.splice(j, 1); + return true; + } + return false; +} + +function cfb_mov(cfb/*:CFBContainer*/, old_name/*:string*/, new_name/*:string*/)/*:boolean*/ { + init_cfb(cfb); + var file = CFB.find(cfb, old_name); + if(file) for(var j = 0; j < cfb.FileIndex.length; ++j) if(cfb.FileIndex[j] == file) { + cfb.FileIndex[j].name = filename(new_name); + cfb.FullPaths[j] = new_name; + return true; + } + return false; +} + +function cfb_gc(cfb/*:CFBContainer*/)/*:void*/ { rebuild_cfb(cfb, true); } + +exports.find = find; +exports.read = read; +exports.parse = parse; +exports.write = write; +exports.writeFile = write_file; +exports.utils = { + cfb_new: cfb_new, + cfb_add: cfb_add, + cfb_del: cfb_del, + cfb_mov: cfb_mov, + cfb_gc: cfb_gc, + ReadShift: ReadShift, + CheckField: CheckField, + prep_blob: prep_blob, + bconcat: bconcat, + use_zlib: use_zlib, + _deflateRaw: _deflate, + _inflateRaw: _inflate, + consts: consts +}; + +return exports; +})(); + +var _fs; +function set_fs(fs) { _fs = fs; } + +/* normalize data for blob ctor */ +function blobify(data) { + if(typeof data === "string") return s2ab(data); + if(Array.isArray(data)) return a2u(data); + return data; +} +/* write or download file */ +function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) { + /*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */ + if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload); + if(typeof Deno !== 'undefined') { + /* in this spot, it's safe to assume typed arrays and TextEncoder/TextDecoder exist */ + if(enc && typeof payload == "string") switch(enc) { + case "utf8": payload = new TextEncoder(enc).encode(payload); break; + case "binary": payload = s2ab(payload); break; + /* TODO: binary equivalent */ + default: throw new Error("Unsupported encoding " + enc); + } + return Deno.writeFileSync(fname, payload); + } + var data = (enc == "utf8") ? utf8write(payload) : payload; + /*:: declare var IE_SaveFile: any; */ + if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname); + if(typeof Blob !== 'undefined') { + var blob = new Blob([blobify(data)], {type:"application/octet-stream"}); + /*:: declare var navigator: any; */ + if(typeof navigator !== 'undefined' && navigator.msSaveBlob) return navigator.msSaveBlob(blob, fname); + /*:: declare var saveAs: any; */ + if(typeof saveAs !== 'undefined') return saveAs(blob, fname); + if(typeof URL !== 'undefined' && typeof document !== 'undefined' && document.createElement && URL.createObjectURL) { + var url = URL.createObjectURL(blob); + /*:: declare var chrome: any; */ + if(typeof chrome === 'object' && typeof (chrome.downloads||{}).download == "function") { + if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000); + return chrome.downloads.download({ url: url, filename: fname, saveAs: true }); + } + var a = document.createElement("a"); + if(a.download != null) { + /*:: if(document.body == null) throw new Error("unreachable"); */ + a.download = fname; a.href = url; document.body.appendChild(a); a.click(); + /*:: if(document.body == null) throw new Error("unreachable"); */ document.body.removeChild(a); + if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000); + return url; + } + } else if(typeof URL !== 'undefined' && !URL.createObjectURL && typeof chrome === 'object') { + /* manifest v3 extensions -- no URL.createObjectURL */ + var b64 = "data:application/octet-stream;base64," + Base64_encode_arr(new Uint8Array(blobify(data))); + return chrome.downloads.download({ url: b64, filename: fname, saveAs: true }); + } + } + // $FlowIgnore + if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript + // $FlowIgnore + var out = File(fname); out.open("w"); out.encoding = "binary"; + if(Array.isArray(payload)) payload = a2s(payload); + out.write(payload); out.close(); return payload; + } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } + throw new Error("cannot save file " + fname); +} + +/* read binary data from file */ +function read_binary(path/*:string*/) { + if(typeof _fs !== 'undefined') return _fs.readFileSync(path); + if(typeof Deno !== 'undefined') return Deno.readFileSync(path); + // $FlowIgnore + if(typeof $ !== 'undefined' && typeof File !== 'undefined' && typeof Folder !== 'undefined') try { // extendscript + // $FlowIgnore + var infile = File(path); infile.open("r"); infile.encoding = "binary"; + var data = infile.read(); infile.close(); + return data; + } catch(e) { if(!e.message || !e.message.match(/onstruct/)) throw e; } + throw new Error("Cannot access file " + path); +} +function keys(o/*:any*/)/*:Array*/ { + var ks = Object.keys(o), o2 = []; + for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]); + return o2; +} + +function evert_key(obj/*:any*/, key/*:string*/)/*:EvertType*/ { + var o = ([]/*:any*/), K = keys(obj); + for(var i = 0; i !== K.length; ++i) if(o[obj[K[i]][key]] == null) o[obj[K[i]][key]] = K[i]; + return o; +} + +function evert(obj/*:any*/)/*:EvertType*/ { + var o = ([]/*:any*/), K = keys(obj); + for(var i = 0; i !== K.length; ++i) o[obj[K[i]]] = K[i]; + return o; +} + +function evert_num(obj/*:any*/)/*:EvertNumType*/ { + var o = ([]/*:any*/), K = keys(obj); + for(var i = 0; i !== K.length; ++i) o[obj[K[i]]] = parseInt(K[i],10); + return o; +} + +function evert_arr(obj/*:any*/)/*:EvertArrType*/ { + var o/*:EvertArrType*/ = ([]/*:any*/), K = keys(obj); + for(var i = 0; i !== K.length; ++i) { + if(o[obj[K[i]]] == null) o[obj[K[i]]] = []; + o[obj[K[i]]].push(K[i]); + } + return o; +} + +var dnthresh = /*#__PURE__*/Date.UTC(1899, 11, 30, 0, 0, 0); // -2209161600000 +var dnthresh1 = /*#__PURE__*/Date.UTC(1899, 11, 31, 0, 0, 0); // -2209075200000 +var dnthresh2 = /*#__PURE__*/Date.UTC(1904, 0, 1, 0, 0, 0); // -2209075200000 +function datenum(v/*:Date*/, date1904/*:?boolean*/)/*:number*/ { + var epoch = /*#__PURE__*/v.getTime(); + var res = (epoch - dnthresh) / (24 * 60 * 60 * 1000); + if(date1904) { res -= 1462; return res < -1402 ? res - 1 : res; } + return res < 60 ? res - 1 : res; +} +function numdate(v/*:number*/)/*:Date|number*/ { + if(v >= 60 && v < 61) return v; + var out = new Date(); + out.setTime((v>60 ? v : (v+1)) * 24 * 60 * 60 * 1000 + dnthresh); + return out; +} + +/* ISO 8601 Duration */ +function parse_isodur(s) { + var sec = 0, mt = 0, time = false; + var m = s.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/); + if(!m) throw new Error("|" + s + "| is not an ISO8601 Duration"); + for(var i = 1; i != m.length; ++i) { + if(!m[i]) continue; + mt = 1; + if(i > 3) time = true; + switch(m[i].slice(m[i].length-1)) { + case 'Y': + throw new Error("Unsupported ISO Duration Field: " + m[i].slice(m[i].length-1)); + case 'D': mt *= 24; + /* falls through */ + case 'H': mt *= 60; + /* falls through */ + case 'M': + if(!time) throw new Error("Unsupported ISO Duration Field: M"); + else mt *= 60; + /* falls through */ + case 'S': break; + } + sec += mt * parseInt(m[i], 10); + } + return sec; +} + +/* Blame https://bugs.chromium.org/p/v8/issues/detail?id=7863 for the regexide */ +var pdre1 = /^(\d+):(\d+)(:\d+)?(\.\d+)?$/; // HH:MM[:SS[.UUU]] +var pdre2 = /^(\d+)-(\d+)-(\d+)$/; // YYYY-mm-dd +var pdre3 = /^(\d+)-(\d+)-(\d+)[T ](\d+):(\d+)(:\d+)?(\.\d+)?$/; // YYYY-mm-dd(T or space)HH:MM[:SS[.UUU]], sans "Z" +/* parses a date string as a UTC date */ +function parseDate(str/*:string*/, date1904/*:boolean*/)/*:Date*/ { + if(str instanceof Date) return str; + var m = str.match(pdre1); + if(m) return new Date((date1904 ? dnthresh2 : dnthresh1) + ((parseInt(m[1], 10)*60 + parseInt(m[2], 10))*60 + (m[3] ? parseInt(m[3].slice(1), 10) : 0))*1000 + (m[4] ? parseInt((m[4]+"000").slice(1,4), 10) : 0)); + m = str.match(pdre2); + if(m) return new Date(Date.UTC(+m[1], +m[2]-1, +m[3], 0, 0, 0, 0)); + /* TODO: 1900-02-29T00:00:00.000 should return a flag to treat as a date code (affects xlml) */ + m = str.match(pdre3); + if(m) return new Date(Date.UTC(+m[1], +m[2]-1, +m[3], +m[4], +m[5], ((m[6] && parseInt(m[6].slice(1), 10))|| 0), ((m[7] && parseInt(m[7].slice(1), 10))||0))); + var d = new Date(str); + return d; +} + +function cc2str(arr/*:Array*/, debomit)/*:string*/ { + if(has_buf && Buffer.isBuffer(arr)) { + if(debomit && buf_utf16le) { + // TODO: temporary patch + if(arr[0] == 0xFF && arr[1] == 0xFE) return utf8write(arr.slice(2).toString("utf16le")); + if(arr[1] == 0xFE && arr[2] == 0xFF) return utf8write(utf16beread(arr.slice(2).toString("binary"))); + } + return arr.toString("binary"); + } + + if(typeof TextDecoder !== "undefined") try { + if(debomit) { + if(arr[0] == 0xFF && arr[1] == 0xFE) return utf8write(new TextDecoder("utf-16le").decode(arr.slice(2))); + if(arr[0] == 0xFE && arr[1] == 0xFF) return utf8write(new TextDecoder("utf-16be").decode(arr.slice(2))); + } + var rev = { + "\u20ac": "\x80", "\u201a": "\x82", "\u0192": "\x83", "\u201e": "\x84", + "\u2026": "\x85", "\u2020": "\x86", "\u2021": "\x87", "\u02c6": "\x88", + "\u2030": "\x89", "\u0160": "\x8a", "\u2039": "\x8b", "\u0152": "\x8c", + "\u017d": "\x8e", "\u2018": "\x91", "\u2019": "\x92", "\u201c": "\x93", + "\u201d": "\x94", "\u2022": "\x95", "\u2013": "\x96", "\u2014": "\x97", + "\u02dc": "\x98", "\u2122": "\x99", "\u0161": "\x9a", "\u203a": "\x9b", + "\u0153": "\x9c", "\u017e": "\x9e", "\u0178": "\x9f" + }; + if(Array.isArray(arr)) arr = new Uint8Array(arr); + return new TextDecoder("latin1").decode(arr).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g, function(c) { return rev[c] || c; }); + } catch(e) {} + + var o = [], i = 0; + // this cascade is for the browsers and runtimes of antiquity (and for modern runtimes that lack TextEncoder) + try { + for(i = 0; i < arr.length - 65536; i+=65536) o.push(String.fromCharCode.apply(0, arr.slice(i, i + 65536))); + o.push(String.fromCharCode.apply(0, arr.slice(i))); + } catch(e) { try { + for(; i < arr.length - 16384; i+=16384) o.push(String.fromCharCode.apply(0, arr.slice(i, i + 16384))); + o.push(String.fromCharCode.apply(0, arr.slice(i))); + } catch(e) { + for(; i != arr.length; ++i) o.push(String.fromCharCode(arr[i])); + } + } + return o.join(""); +} + +function dup(o/*:any*/)/*:any*/ { + if(typeof JSON != 'undefined' && !Array.isArray(o)) return JSON.parse(JSON.stringify(o)); + if(typeof o != 'object' || o == null) return o; + if(o instanceof Date) return new Date(o.getTime()); + var out = {}; + for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]); + return out; +} + +function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; } + +/* TODO: stress test */ +function fuzzynum(s/*:string*/)/*:number*/ { + var v/*:number*/ = Number(s); + if(!isNaN(v)) return isFinite(v) ? v : NaN; + if(!/\d/.test(s)) return v; + var wt = 1; + var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";}); + if(!isNaN(v = Number(ss))) return v / wt; + ss = ss.replace(/[(](.*)[)]/,function($$, $1) { wt = -wt; return $1;}); + if(!isNaN(v = Number(ss))) return v / wt; + return v; +} + +/* NOTE: Chrome rejects bare times like 1:23 PM */ +var FDRE1 = /^(0?\d|1[0-2])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))\s+([ap])m?$/; +var FDRE2 = /^([01]?\d|2[0-3])(?:|:([0-5]?\d)(?:|(\.\d+)(?:|:([0-5]?\d))|:([0-5]?\d)(|\.\d+)))$/; +var FDISO = /^(\d+)-(\d+)-(\d+)[T ](\d+):(\d+)(:\d+)(\.\d+)?[Z]?$/; // YYYY-mm-dd(T or space)HH:MM:SS[.UUU][Z] + +/* TODO: 1904 adjustment */ +var utc_append_works = new Date("6/9/69 00:00 UTC").valueOf() == -17798400000; +function fuzzytime1(M) /*:Date*/ { + if(!M[2]) return new Date(Date.UTC(1899,11,31,(+M[1]%12) + (M[7] == "p" ? 12 : 0), 0, 0, 0)); + if(M[3]) { + if(M[4]) return new Date(Date.UTC(1899,11,31,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[4], parseFloat(M[3])*1000)); + else return new Date(Date.UTC(1899,11,31,(M[7] == "p" ? 12 : 0), +M[1], +M[2], parseFloat(M[3])*1000)); + } + else if(M[5]) return new Date(Date.UTC(1899,11,31, (+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0)); + else return new Date(Date.UTC(1899,11,31,(+M[1]%12) + (M[7] == "p" ? 12 : 0), +M[2], 0, 0)); +} +function fuzzytime2(M) /*:Date*/ { + if(!M[2]) return new Date(Date.UTC(1899,11,31,+M[1], 0, 0, 0)); + if(M[3]) { + if(M[4]) return new Date(Date.UTC(1899,11,31,+M[1], +M[2], +M[4], parseFloat(M[3])*1000)); + else return new Date(Date.UTC(1899,11,31,0, +M[1], +M[2], parseFloat(M[3])*1000)); + } + else if(M[5]) return new Date(Date.UTC(1899,11,31, +M[1], +M[2], +M[5], M[6] ? parseFloat(M[6]) * 1000 : 0)); + else return new Date(Date.UTC(1899,11,31,+M[1], +M[2], 0, 0)); +} +var lower_months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; +function fuzzydate(s/*:string*/)/*:Date*/ { + // See issue 2863 -- this is technically not supported in Excel but is otherwise useful + if(FDISO.test(s)) return s.indexOf("Z") == -1 ? local_to_utc(new Date(s)) : new Date(s); + var lower = s.toLowerCase(); + var lnos = lower.replace(/\s+/g, " ").trim(); + var M = lnos.match(FDRE1); + if(M) return fuzzytime1(M); + M = lnos.match(FDRE2); + if(M) return fuzzytime2(M); + M = lnos.match(pdre3); + if(M) return new Date(Date.UTC(+M[1], +M[2]-1, +M[3], +M[4], +M[5], ((M[6] && parseInt(M[6].slice(1), 10))|| 0), ((M[7] && parseInt(M[7].slice(1), 10))||0))); + var o = new Date(utc_append_works && s.indexOf("UTC") == -1 ? s + " UTC": s), n = new Date(NaN); + var y = o.getYear(), m = o.getMonth(), d = o.getDate(); + if(isNaN(d)) return n; + if(lower.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)) { + lower = lower.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""); + if(lower.length > 3 && lower_months.indexOf(lower) == -1) return n; + } else if(lower.replace(/[ap]m?/, "").match(/[a-z]/)) return n; + if(y < 0 || y > 8099 || s.match(/[^-0-9:,\/\\\ ]/)) return n; + return o; +} + +var split_regex = /*#__PURE__*/(function() { + var safe_split_regex = "abacaba".split(/(:?b)/i).length == 5; + return function split_regex(str/*:string*/, re, def/*:string*/)/*:Array*/ { + if(safe_split_regex || typeof re == "string") return str.split(re); + var p = str.split(re), o = [p[0]]; + for(var i = 1; i < p.length; ++i) { o.push(def); o.push(p[i]); } + return o; + }; +})(); + +function utc_to_local(utc) { + return new Date(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate(), utc.getUTCHours(), utc.getUTCMinutes(), utc.getUTCSeconds(), utc.getUTCMilliseconds()); +} +function local_to_utc(local) { + return new Date(Date.UTC(local.getFullYear(), local.getMonth(), local.getDate(), local.getHours(), local.getMinutes(), local.getSeconds(), local.getMilliseconds())); +} +function getdatastr(data)/*:?string*/ { + if(!data) return null; + if(data.content && data.type) return cc2str(data.content, true); + if(data.data) return debom(data.data); + if(data.asNodeBuffer && has_buf) return debom(data.asNodeBuffer().toString('binary')); + if(data.asBinary) return debom(data.asBinary()); + if(data._data && data._data.getContent) return debom(cc2str(Array.prototype.slice.call(data._data.getContent(),0))); + return null; +} + +function getdatabin(data) { + if(!data) return null; + if(data.data) return char_codes(data.data); + if(data.asNodeBuffer && has_buf) return data.asNodeBuffer(); + if(data._data && data._data.getContent) { + var o = data._data.getContent(); + if(typeof o == "string") return char_codes(o); + return Array.prototype.slice.call(o); + } + if(data.content && data.type) return data.content; + return null; +} + +function getdata(data) { return (data && data.name.slice(-4) === ".bin") ? getdatabin(data) : getdatastr(data); } + +/* Part 2 Section 10.1.2 "Mapping Content Types" Names are case-insensitive */ +/* OASIS does not comment on filename case sensitivity */ +function safegetzipfile(zip, file/*:string*/) { + var k = zip.FullPaths || keys(zip.files); + var f = file.toLowerCase().replace(/[\/]/g, '\\'), g = f.replace(/\\/g,'\/'); + for(var i=0; i\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g; +var tagregex1=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg, tagregex2 = /<[^>]*>/g; +var tagregex = /*#__PURE__*/XML_HEADER.match(tagregex1) ? tagregex1 : tagregex2; +var nsregex=/<\w*:/, nsregex2 = /<(\/?)\w+:/; +function parsexmltag(tag/*:string*/, skip_root/*:?boolean*/, skip_LC/*:?boolean*/)/*:any*/ { + var z = ({}/*:any*/); + var eq = 0, c = 0; + for(; eq !== tag.length; ++eq) if((c = tag.charCodeAt(eq)) === 32 || c === 10 || c === 13) break; + if(!skip_root) z[0] = tag.slice(0, eq); + if(eq === tag.length) return z; + var m = tag.match(attregexg), j=0, v="", i=0, q="", cc="", quot = 1; + if(m) for(i = 0; i != m.length; ++i) { + cc = m[i]; + for(c=0; c != cc.length; ++c) if(cc.charCodeAt(c) === 61) break; + q = cc.slice(0,c).trim(); + while(cc.charCodeAt(c+1) == 32) ++c; + quot = ((eq=cc.charCodeAt(c+1)) == 34 || eq == 39) ? 1 : 0; + v = cc.slice(c+1+quot, cc.length-quot); + for(j=0;j!=q.length;++j) if(q.charCodeAt(j) === 58) break; + if(j===q.length) { + if(q.indexOf("_") > 0) q = q.slice(0, q.indexOf("_")); // from ods + z[q] = v; + if(!skip_LC) z[q.toLowerCase()] = v; + } + else { + var k = (j===5 && q.slice(0,5)==="xmlns"?"xmlns":"")+q.slice(j+1); + if(z[k] && q.slice(j-3,j) == "ext") continue; // from ods + z[k] = v; + if(!skip_LC) z[k.toLowerCase()] = v; + } + } + return z; +} +function strip_ns(x/*:string*/)/*:string*/ { return x.replace(nsregex2, "<$1"); } + +var encodings = { + '"': '"', + ''': "'", + '>': '>', + '<': '<', + '&': '&' +}; +var rencoding = /*#__PURE__*/evert(encodings); +//var rencstr = "&<>'\"".split(""); + +// TODO: CP remap (need to read file version to determine OS) +var unescapexml/*:StringConv*/ = /*#__PURE__*/(function() { + /* 22.4.2.4 bstr (Basic String) */ + var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig; + function raw_unescapexml(text/*:string*/)/*:string*/ { + var s = text + '', i = s.indexOf("-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));}); + var j = s.indexOf("]]>"); + return raw_unescapexml(s.slice(0, i)) + s.slice(i+9,j) + raw_unescapexml(s.slice(j+3)); + } + return function unescapexml(text/*:string*/, xlsx/*:boolean*/) { + var out = raw_unescapexml(text); + return xlsx ? out.replace(/\r\n/g, "\n") : out; + }; +})(); + +var decregex=/[&<>'"]/g, charegex = /[\u0000-\u0008\u000b-\u001f\uFFFE-\uFFFF]/g; +function escapexml(text/*:string*/)/*:string*/{ + var s = text + ''; + return s.replace(decregex, function(y) { return rencoding[y]; }).replace(charegex,function(s) { return "_x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + "_";}); +} +function escapexmltag(text/*:string*/)/*:string*/{ return escapexml(text).replace(/ /g,"_x0020_"); } + +var htmlcharegex = /[\u0000-\u001f]/g; +function escapehtml(text/*:string*/)/*:string*/{ + var s = text + ''; + return s.replace(decregex, function(y) { return rencoding[y]; }).replace(/\n/g, "
").replace(htmlcharegex,function(s) { return "&#x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + ";"; }); +} + +function escapexlml(text/*:string*/)/*:string*/{ + var s = text + ''; + return s.replace(decregex, function(y) { return rencoding[y]; }).replace(htmlcharegex,function(s) { return "&#x" + (s.charCodeAt(0).toString(16)).toUpperCase() + ";"; }); +} + +/* TODO: handle codepages */ +var xlml_fixstr/*:StringConv*/ = /*#__PURE__*/(function() { + var entregex = /&#(\d+);/g; + function entrepl($$/*:string*/,$1/*:string*/)/*:string*/ { return String.fromCharCode(parseInt($1,10)); } + return function xlml_fixstr(str/*:string*/)/*:string*/ { return str.replace(entregex,entrepl); }; +})(); +function xlml_unfixstr(str/*:string*/)/*:string*/ { return str.replace(/(\r\n|[\r\n])/g,"\ "); } + +/* note: xsd:boolean valid values: true / 1 / false / 0 */ +function parsexmlbool(value/*:any*/)/*:boolean*/ { + switch(value) { + case 1: case true: case '1': case 'true': return true; + case 0: case false: case '0': case 'false': return false; + //default: throw new Error("Invalid xsd:boolean " + value); + } + return false; +} + +function utf8reada(orig/*:string*/)/*:string*/ { + var out = "", i = 0, c = 0, d = 0, e = 0, f = 0, w = 0; + while (i < orig.length) { + c = orig.charCodeAt(i++); + if (c < 128) { out += String.fromCharCode(c); continue; } + d = orig.charCodeAt(i++); + if (c>191 && c<224) { f = ((c & 31) << 6); f |= (d & 63); out += String.fromCharCode(f); continue; } + e = orig.charCodeAt(i++); + if (c < 240) { out += String.fromCharCode(((c & 15) << 12) | ((d & 63) << 6) | (e & 63)); continue; } + f = orig.charCodeAt(i++); + w = (((c & 7) << 18) | ((d & 63) << 12) | ((e & 63) << 6) | (f & 63))-65536; + out += String.fromCharCode(0xD800 + ((w>>>10)&1023)); + out += String.fromCharCode(0xDC00 + (w&1023)); + } + return out; +} + +function utf8readb(data) { + var out = new_raw_buf(2*data.length), w, i, j = 1, k = 0, ww=0, c; + for(i = 0; i < data.length; i+=j) { + j = 1; + if((c=data.charCodeAt(i)) < 128) w = c; + else if(c < 224) { w = (c&31)*64+(data.charCodeAt(i+1)&63); j=2; } + else if(c < 240) { w=(c&15)*4096+(data.charCodeAt(i+1)&63)*64+(data.charCodeAt(i+2)&63); j=3; } + else { j = 4; + w = (c & 7)*262144+(data.charCodeAt(i+1)&63)*4096+(data.charCodeAt(i+2)&63)*64+(data.charCodeAt(i+3)&63); + w -= 65536; ww = 0xD800 + ((w>>>10)&1023); w = 0xDC00 + (w&1023); + } + if(ww !== 0) { out[k++] = ww&255; out[k++] = ww>>>8; ww = 0; } + out[k++] = w%256; out[k++] = w>>>8; + } + return out.slice(0,k).toString('ucs2'); +} + +function utf8readc(data) { return Buffer_from(data, 'binary').toString('utf8'); } + +var utf8corpus = "foo bar baz\u00e2\u0098\u0083\u00f0\u009f\u008d\u00a3"; +var utf8read = has_buf && (/*#__PURE__*/utf8readc(utf8corpus) == /*#__PURE__*/utf8reada(utf8corpus) && utf8readc || /*#__PURE__*/utf8readb(utf8corpus) == /*#__PURE__*/utf8reada(utf8corpus) && utf8readb) || utf8reada; + +var utf8write/*:StringConv*/ = has_buf ? function(data) { return Buffer_from(data, 'utf8').toString("binary"); } : function(orig/*:string*/)/*:string*/ { + var out/*:Array*/ = [], i = 0, c = 0, d = 0; + while(i < orig.length) { + c = orig.charCodeAt(i++); + switch(true) { + case c < 128: out.push(String.fromCharCode(c)); break; + case c < 2048: + out.push(String.fromCharCode(192 + (c >> 6))); + out.push(String.fromCharCode(128 + (c & 63))); + break; + case c >= 55296 && c < 57344: + c -= 55296; d = orig.charCodeAt(i++) - 56320 + (c<<10); + out.push(String.fromCharCode(240 + ((d >>18) & 7))); + out.push(String.fromCharCode(144 + ((d >>12) & 63))); + out.push(String.fromCharCode(128 + ((d >> 6) & 63))); + out.push(String.fromCharCode(128 + (d & 63))); + break; + default: + out.push(String.fromCharCode(224 + (c >> 12))); + out.push(String.fromCharCode(128 + ((c >> 6) & 63))); + out.push(String.fromCharCode(128 + (c & 63))); + } + } + return out.join(""); +}; + +// matches ... extracts content +var matchtag = /*#__PURE__*/(function() { + var mtcache/*:{[k:string]:RegExp}*/ = ({}/*:any*/); + return function matchtag(f/*:string*/,g/*:?string*/)/*:RegExp*/ { + var t = f+"|"+(g||""); + if(mtcache[t]) return mtcache[t]; + return (mtcache[t] = new RegExp('<(?:\\w+:)?'+f+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)',((g||"")/*:any*/))); + }; +})(); + +var htmldecode/*:{(s:string):string}*/ = /*#__PURE__*/(function() { + var entities/*:Array<[RegExp, string]>*/ = [ + ['nbsp', ' '], ['middot', '·'], + ['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&'] + ].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; }); + return function htmldecode(str/*:string*/)/*:string*/ { + var o = str + // Remove new lines and spaces from start of content + .replace(/^[\t\n\r ]+/, "") + // Remove new lines and spaces from end of content + .replace(/[\t\n\r ]+$/,"") + // Added line which removes any white space characters after and before html tags + .replace(/>\s+/g,">").replace(/\s+ tags with new lines + .replace(/<\s*[bB][rR]\s*\/?>/g,"\n") + // Strip HTML elements + .replace(/<[^>]*>/g,""); + for(var i = 0; i < entities.length; ++i) o = o.replace(entities[i][0], entities[i][1]); + return o; + }; +})(); + +var vtregex = /*#__PURE__*/(function(){ var vt_cache = {}; + return function vt_regex(bt) { + if(vt_cache[bt] !== undefined) return vt_cache[bt]; + return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)", 'g') ); +};})(); +var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*)*/ { + var h = parsexmltag(data); + + var matches/*:Array*/ = data.match(vtregex(h.baseType))||[]; + var res/*:Array*/ = []; + if(matches.length != h.size) { + if(opts.WTF) throw new Error("unexpected vector length " + matches.length + " != " + h.size); + return res; + } + matches.forEach(function(x/*:string*/) { + var v = x.replace(vtvregex,"").match(vtmregex); + if(v) res.push({v:utf8read(v[2]), t:v[1]}); + }); + return res; +} + +var wtregex = /(^\s|\s$|\n)/; +function writetag(f/*:string*/,g/*:string*/)/*:string*/ { return '<' + f + (g.match(wtregex)?' xml:space="preserve"' : "") + '>' + g + ''; } + +function wxt_helper(h)/*:string*/ { return keys(h).map(function(k) { return " " + k + '="' + h[k] + '"';}).join(""); } +function writextag(f/*:string*/,g/*:?string*/,h) { return '<' + f + ((h != null) ? wxt_helper(h) : "") + ((g != null) ? (g.match(wtregex)?' xml:space="preserve"' : "") + '>' + g + '';} + +function write_w3cdtf(d/*:Date*/, t/*:?boolean*/)/*:string*/ { try { return d.toISOString().replace(/\.\d*/,""); } catch(e) { if(t) throw e; } return ""; } + +function write_vt(s, xlsx/*:?boolean*/)/*:string*/ { + switch(typeof s) { + case 'string': + var o = writextag('vt:lpwstr', escapexml(s)); + if(xlsx) o = o.replace(/"/g, "_x0022_"); + return o; + case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s))); + case 'boolean': return writextag('vt:bool',s?'true':'false'); + } + if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s)); + throw new Error("Unable to serialize " + s); +} + +function xlml_normalize(d)/*:string*/ { + if(has_buf &&/*::typeof Buffer !== "undefined" && d != null && d instanceof Buffer &&*/ Buffer.isBuffer(d)) return d.toString('utf8'); + if(typeof d === 'string') return d; + /* duktape */ + if(typeof Uint8Array !== 'undefined' && d instanceof Uint8Array) return utf8read(a2s(ab2a(d))); + throw new Error("Bad input format: expected Buffer or string"); +} +/* UOS uses CJK in tags */ +var xlmlregex = /<(\/?)([^\s?>:\/]+)(?:[\s?:\/](?:[^>=]|="[^"]*?")*)?>/mg; +//var xlmlregex = /<(\/?)([a-z0-9]*:|)(\w+)[^>]*>/mg; + +var XMLNS = ({ + CORE_PROPS: 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties', + CUST_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", + EXT_PROPS: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", + CT: 'http://schemas.openxmlformats.org/package/2006/content-types', + RELS: 'http://schemas.openxmlformats.org/package/2006/relationships', + TCMNT: 'http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments', + 'dc': 'http://purl.org/dc/elements/1.1/', + 'dcterms': 'http://purl.org/dc/terms/', + 'dcmitype': 'http://purl.org/dc/dcmitype/', + 'mx': 'http://schemas.microsoft.com/office/mac/excel/2008/main', + 'r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', + 'sjs': 'http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties', + 'vt': 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes', + 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', + 'xsd': 'http://www.w3.org/2001/XMLSchema' +}/*:any*/); + +var XMLNS_main = [ + 'http://schemas.openxmlformats.org/spreadsheetml/2006/main', + 'http://purl.oclc.org/ooxml/spreadsheetml/main', + 'http://schemas.microsoft.com/office/excel/2006/main', + 'http://schemas.microsoft.com/office/excel/2006/2' +]; + +var XLMLNS = ({ + 'o': 'urn:schemas-microsoft-com:office:office', + 'x': 'urn:schemas-microsoft-com:office:excel', + 'ss': 'urn:schemas-microsoft-com:office:spreadsheet', + 'dt': 'uuid:C2F41010-65B3-11d1-A29F-00AA00C14882', + 'mv': 'http://macVmlSchemaUri', + 'v': 'urn:schemas-microsoft-com:vml', + 'html': 'http://www.w3.org/TR/REC-html40' +}/*:any*/); +function read_double_le(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { + var s = 1 - 2 * (b[idx + 7] >>> 7); + var e = ((b[idx + 7] & 0x7f) << 4) + ((b[idx + 6] >>> 4) & 0x0f); + var m = (b[idx+6]&0x0f); + for(var i = 5; i >= 0; --i) m = m * 256 + b[idx + i]; + if(e == 0x7ff) return m == 0 ? (s * Infinity) : NaN; + if(e == 0) e = -1022; + else { e -= 1023; m += Math.pow(2,52); } + return s * Math.pow(2, e - 52) * m; +} + +function write_double_le(b/*:RawBytes|CFBlob*/, v/*:number*/, idx/*:number*/) { + var bs = ((((v < 0) || (1/v == -Infinity)) ? 1 : 0) << 7), e = 0, m = 0; + var av = bs ? (-v) : v; + if(!isFinite(av)) { e = 0x7ff; m = isNaN(v) ? 0x6969 : 0; } + else if(av == 0) e = m = 0; + else { + e = Math.floor(Math.log(av) / Math.LN2); + m = av * Math.pow(2, 52 - e); + if((e <= -1023) && (!isFinite(m) || (m < Math.pow(2,52)))) { e = -1022; } + else { m -= Math.pow(2,52); e+=1023; } + } + for(var i = 0; i <= 5; ++i, m/=256) b[idx + i] = m & 0xff; + b[idx + 6] = ((e & 0x0f) << 4) | (m & 0xf); + b[idx + 7] = (e >> 4) | bs; +} + +var ___toBuffer = function(bufs/*:Array >*/)/*:RawBytes*/ { var x=[],w=10240; for(var i=0;i 0 && Buffer.isBuffer(bufs[0][0])) ? Buffer.concat(bufs[0].map(function(x) { return Buffer.isBuffer(x) ? x : Buffer_from(x); })) : ___toBuffer(bufs);} : ___toBuffer; + +var ___utf16le = function(b/*:RawBytes|CFBlob*/,s/*:number*/,e/*:number*/)/*:string*/ { var ss/*:Array*/=[]; for(var i=s; i*/=[]; for(var i=s; i 0 ? __utf8(b, i+4,i+4+len-1) : "";}; +var __lpstr = ___lpstr; + +var ___cpstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len-1) : "";}; +var __cpstr = ___cpstr; + +var ___lpwstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = 2*__readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len-1) : "";}; +var __lpwstr = ___lpwstr; + +var ___lpp4 = function lpp4_(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? __utf16le(b, i+4,i+4+len) : "";}; +var __lpp4 = ___lpp4; + +var ___8lpp4 = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len) : "";}; +var __8lpp4 = ___8lpp4; + +var ___double = function(b/*:RawBytes|CFBlob*/, idx/*:number*/) { return read_double_le(b, idx);}; +var __double = ___double; + +var is_buf = function is_buf_a(a) { return Array.isArray(a) || (typeof Uint8Array !== "undefined" && a instanceof Uint8Array); }; + +if(has_buf/*:: && typeof Buffer !== 'undefined'*/) { + __lpstr = function lpstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___lpstr(b, i); var len = b.readUInt32LE(i); return len > 0 ? b.toString('utf8',i+4,i+4+len-1) : "";}; + __cpstr = function cpstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___cpstr(b, i); var len = b.readUInt32LE(i); return len > 0 ? b.toString('utf8',i+4,i+4+len-1) : "";}; + __lpwstr = function lpwstr_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/ || !buf_utf16le) return ___lpwstr(b, i); var len = 2*b.readUInt32LE(i); return b.toString('utf16le',i+4,i+4+len-1);}; + __lpp4 = function lpp4_b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/ || !buf_utf16le) return ___lpp4(b, i); var len = b.readUInt32LE(i); return b.toString('utf16le',i+4,i+4+len);}; + __8lpp4 = function lpp4_8b(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(!Buffer.isBuffer(b)/*:: || !(b instanceof Buffer)*/) return ___8lpp4(b, i); var len = b.readUInt32LE(i); return b.toString('utf8',i+4,i+4+len);}; + __double = function double_(b/*:RawBytes|CFBlob*/, i/*:number*/) { if(Buffer.isBuffer(b)/*::&& b instanceof Buffer*/) return b.readDoubleLE(i); return ___double(b,i); }; + is_buf = function is_buf_b(a) { return Buffer.isBuffer(a) || Array.isArray(a) || (typeof Uint8Array !== "undefined" && a instanceof Uint8Array); }; +} + +/* from js-xls */ +function cpdoit() { + __utf16le = function(b/*:RawBytes|CFBlob*/,s/*:number*/,e/*:number*/) { return $cptable.utils.decode(1200, b.slice(s,e)).replace(chr0, ''); }; + __utf8 = function(b/*:RawBytes|CFBlob*/,s/*:number*/,e/*:number*/) { return $cptable.utils.decode(65001, b.slice(s,e)); }; + __lpstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? $cptable.utils.decode(current_ansi, b.slice(i+4, i+4+len-1)) : "";}; + __cpstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? $cptable.utils.decode(current_codepage, b.slice(i+4, i+4+len-1)) : "";}; + __lpwstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = 2*__readUInt32LE(b,i); return len > 0 ? $cptable.utils.decode(1200, b.slice(i+4,i+4+len-1)) : "";}; + __lpp4 = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? $cptable.utils.decode(1200, b.slice(i+4,i+4+len)) : "";}; + __8lpp4 = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? $cptable.utils.decode(65001, b.slice(i+4,i+4+len)) : "";}; +} +if(typeof $cptable !== 'undefined') cpdoit(); + +var __readUInt8 = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return b[idx]; }; +var __readUInt16LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return (b[idx+1]*(1<<8))+b[idx]; }; +var __readInt16LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { var u = (b[idx+1]*(1<<8))+b[idx]; return (u < 0x8000) ? u : ((0xffff - u + 1) * -1); }; +var __readUInt32LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return b[idx+3]*(1<<24)+(b[idx+2]<<16)+(b[idx+1]<<8)+b[idx]; }; +var __readInt32LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return (b[idx+3]<<24)|(b[idx+2]<<16)|(b[idx+1]<<8)|b[idx]; }; +var __readInt32BE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return (b[idx]<<24)|(b[idx+1]<<16)|(b[idx+2]<<8)|b[idx+3]; }; + +function ReadShift(size/*:number*/, t/*:?string*/)/*:number|string*/ { + var o="", oI/*:: :number = 0*/, oR, oo=[], w, vv, i, loc; + switch(t) { + case 'dbcs': + loc = this.l; + if(has_buf && Buffer.isBuffer(this) && buf_utf16le) o = this.slice(this.l, this.l+2*size).toString("utf16le"); + else for(i = 0; i < size; ++i) { o+=String.fromCharCode(__readUInt16LE(this, loc)); loc+=2; } + size *= 2; + break; + + case 'utf8': o = __utf8(this, this.l, this.l + size); break; + case 'utf16le': size *= 2; o = __utf16le(this, this.l, this.l + size); break; + + case 'wstr': + if(typeof $cptable !== 'undefined') o = $cptable.utils.decode(current_codepage, this.slice(this.l, this.l+2*size)); + else return ReadShift.call(this, size, 'dbcs'); + size = 2 * size; break; + + /* [MS-OLEDS] 2.1.4 LengthPrefixedAnsiString */ + case 'lpstr-ansi': o = __lpstr(this, this.l); size = 4 + __readUInt32LE(this, this.l); break; + case 'lpstr-cp': o = __cpstr(this, this.l); size = 4 + __readUInt32LE(this, this.l); break; + /* [MS-OLEDS] 2.1.5 LengthPrefixedUnicodeString */ + case 'lpwstr': o = __lpwstr(this, this.l); size = 4 + 2 * __readUInt32LE(this, this.l); break; + /* [MS-OFFCRYPTO] 2.1.2 Length-Prefixed Padded Unicode String (UNICODE-LP-P4) */ + case 'lpp4': size = 4 + __readUInt32LE(this, this.l); o = __lpp4(this, this.l); if(size & 0x02) size += 2; break; + /* [MS-OFFCRYPTO] 2.1.3 Length-Prefixed UTF-8 String (UTF-8-LP-P4) */ + case '8lpp4': size = 4 + __readUInt32LE(this, this.l); o = __8lpp4(this, this.l); if(size & 0x03) size += 4 - (size & 0x03); break; + + case 'cstr': size = 0; o = ""; + while((w=__readUInt8(this, this.l + size++))!==0) oo.push(_getchar(w)); + o = oo.join(""); break; + case '_wstr': size = 0; o = ""; + while((w=__readUInt16LE(this,this.l +size))!==0){oo.push(_getchar(w));size+=2;} + size+=2; o = oo.join(""); break; + + /* sbcs and dbcs support continue records in the SST way TODO codepages */ + case 'dbcs-cont': o = ""; loc = this.l; + for(i = 0; i < size; ++i) { + if(this.lens && this.lens.indexOf(loc) !== -1) { + w = __readUInt8(this, loc); + this.l = loc + 1; + vv = ReadShift.call(this, size-i, w ? 'dbcs-cont' : 'sbcs-cont'); + return oo.join("") + vv; + } + oo.push(_getchar(__readUInt16LE(this, loc))); + loc+=2; + } o = oo.join(""); size *= 2; break; + + case 'cpstr': + if(typeof $cptable !== 'undefined') { + o = $cptable.utils.decode(current_codepage, this.slice(this.l, this.l + size)); + break; + } + /* falls through */ + case 'sbcs-cont': o = ""; loc = this.l; + for(i = 0; i != size; ++i) { + if(this.lens && this.lens.indexOf(loc) !== -1) { + w = __readUInt8(this, loc); + this.l = loc + 1; + vv = ReadShift.call(this, size-i, w ? 'dbcs-cont' : 'sbcs-cont'); + return oo.join("") + vv; + } + oo.push(_getchar(__readUInt8(this, loc))); + loc+=1; + } o = oo.join(""); break; + + default: + switch(size) { + case 1: oI = __readUInt8(this, this.l); this.l++; return oI; + case 2: oI = (t === 'i' ? __readInt16LE : __readUInt16LE)(this, this.l); this.l += 2; return oI; + case 4: case -4: + if(t === 'i' || ((this[this.l+3] & 0x80)===0)) { oI = ((size > 0) ? __readInt32LE : __readInt32BE)(this, this.l); this.l += 4; return oI; } + else { oR = __readUInt32LE(this, this.l); this.l += 4; } return oR; + case 8: case -8: + if(t === 'f') { + if(size == 8) oR = __double(this, this.l); + else oR = __double([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]], 0); + this.l += 8; return oR; + } else size = 8; + /* falls through */ + case 16: o = __hexlify(this, this.l, size); break; + }} + this.l+=size; return o; +} + +var __writeUInt32LE = function(b/*:RawBytes|CFBlob*/, val/*:number*/, idx/*:number*/)/*:void*/ { b[idx] = (val & 0xFF); b[idx+1] = ((val >>> 8) & 0xFF); b[idx+2] = ((val >>> 16) & 0xFF); b[idx+3] = ((val >>> 24) & 0xFF); }; +var __writeInt32LE = function(b/*:RawBytes|CFBlob*/, val/*:number*/, idx/*:number*/)/*:void*/ { b[idx] = (val & 0xFF); b[idx+1] = ((val >> 8) & 0xFF); b[idx+2] = ((val >> 16) & 0xFF); b[idx+3] = ((val >> 24) & 0xFF); }; +var __writeUInt16LE = function(b/*:RawBytes|CFBlob*/, val/*:number*/, idx/*:number*/)/*:void*/ { b[idx] = (val & 0xFF); b[idx+1] = ((val >>> 8) & 0xFF); }; + +function WriteShift(t/*:number*/, val/*:string|number*/, f/*:?string*/)/*:any*/ { + var size = 0, i = 0; + if(f === 'dbcs') { + /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ + for(i = 0; i != val.length; ++i) __writeUInt16LE(this, val.charCodeAt(i), this.l + 2 * i); + size = 2 * val.length; + } else if(f === 'sbcs' || f == 'cpstr') { + if(typeof $cptable !== 'undefined' && current_ansi == 874) { + /* TODO: use tables directly, don't encode */ + /*:: if(typeof val !== "string") throw new Error("unreachable"); */ + for(i = 0; i != val.length; ++i) { + var cpp = $cptable.utils.encode(current_ansi, val.charAt(i)); + this[this.l + i] = cpp[0]; + } + size = val.length; + } else if(typeof $cptable !== 'undefined' && f == 'cpstr') { + cpp = $cptable.utils.encode(current_codepage, val); + /* replace null bytes with _ when relevant */ + if(cpp.length == val.length) for(i = 0; i < val.length; ++i) if(cpp[i] == 0 && val.charCodeAt(i) != 0) cpp[i] = 0x5F; + if(cpp.length == 2 * val.length) for(i = 0; i < val.length; ++i) if(cpp[2*i] == 0 && cpp[2*i+1] == 0 && val.charCodeAt(i) != 0) cpp[2*i] = 0x5F; + for(i = 0; i < cpp.length; ++i) this[this.l + i] = cpp[i]; + size = cpp.length; + } else { + /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ + val = val.replace(/[^\x00-\x7F]/g, "_"); + /*:: if(typeof val !== 'string') throw new Error("unreachable"); */ + for(i = 0; i != val.length; ++i) this[this.l + i] = (val.charCodeAt(i) & 0xFF); + size = val.length; + } + } else if(f === 'hex') { + for(; i < t; ++i) { + /*:: if(typeof val !== "string") throw new Error("unreachable"); */ + this[this.l++] = (parseInt(val.slice(2*i, 2*i+2), 16)||0); + } return this; + } else if(f === 'utf16le') { + /*:: if(typeof val !== "string") throw new Error("unreachable"); */ + var end/*:number*/ = Math.min(this.l + t, this.length); + for(i = 0; i < Math.min(val.length, t); ++i) { + var cc = val.charCodeAt(i); + this[this.l++] = (cc & 0xff); + this[this.l++] = (cc >> 8); + } + while(this.l < end) this[this.l++] = 0; + return this; + } else /*:: if(typeof val === 'number') */ switch(t) { + case 1: size = 1; this[this.l] = val&0xFF; break; + case 2: size = 2; this[this.l] = val&0xFF; val >>>= 8; this[this.l+1] = val&0xFF; break; + case 3: size = 3; this[this.l] = val&0xFF; val >>>= 8; this[this.l+1] = val&0xFF; val >>>= 8; this[this.l+2] = val&0xFF; break; + case 4: size = 4; __writeUInt32LE(this, val, this.l); break; + case 8: size = 8; if(f === 'f') { write_double_le(this, val, this.l); break; } + /* falls through */ + case 16: break; + case -4: size = 4; __writeInt32LE(this, val, this.l); break; + } + this.l += size; return this; +} + +function CheckField(hexstr/*:string*/, fld/*:string*/)/*:void*/ { + var m = __hexlify(this,this.l,hexstr.length>>1); + if(m !== hexstr) throw new Error(fld + 'Expected ' + hexstr + ' saw ' + m); + this.l += hexstr.length>>1; +} + +function prep_blob(blob, pos/*:number*/)/*:void*/ { + blob.l = pos; + blob.read_shift = /*::(*/ReadShift/*:: :any)*/; + blob.chk = CheckField; + blob.write_shift = WriteShift; +} + +function parsenoop(blob, length/*:: :number, opts?:any */) { blob.l += length; } + +function new_buf(sz/*:number*/)/*:Block*/ { + var o = new_raw_buf(sz); + prep_blob(o, 0); + return o; +} + +/* [MS-XLSB] 2.1.4 Record */ +function recordhopper(data, cb/*:RecordHopperCB*/, opts/*:?any*/) { + if(!data) return; + var tmpbyte, cntbyte, length; + prep_blob(data, data.l || 0); + var L = data.length, RT = 0, tgt = 0; + while(data.l < L) { + RT = data.read_shift(1); + if(RT & 0x80) RT = (RT & 0x7F) + ((data.read_shift(1) & 0x7F)<<7); + var R = XLSBRecordEnum[RT] || XLSBRecordEnum[0xFFFF]; + tmpbyte = data.read_shift(1); + length = tmpbyte & 0x7F; + for(cntbyte = 1; cntbyte <4 && (tmpbyte & 0x80); ++cntbyte) length += ((tmpbyte = data.read_shift(1)) & 0x7F)<<(7*cntbyte); + tgt = data.l + length; + var d = R.f && R.f(data, length, opts); + data.l = tgt; + if(cb(d, R, RT)) return; + } +} + +/* control buffer usage for fixed-length buffers */ +function buf_array()/*:BufArray*/ { + var bufs/*:Array*/ = [], blksz = has_buf ? 256 : 2048; + var newblk = function ba_newblk(sz/*:number*/)/*:Block*/ { + var o/*:Block*/ = (new_buf(sz)/*:any*/); + prep_blob(o, 0); + return o; + }; + + var curbuf/*:Block*/ = newblk(blksz); + + var endbuf = function ba_endbuf() { + if(!curbuf) return; + // workaround for new Buffer(3).slice(0,0) bug in bun 0.1.3 + if(curbuf.l) { + if(curbuf.length > curbuf.l) { curbuf = curbuf.slice(0, curbuf.l); curbuf.l = curbuf.length; } + if(curbuf.length > 0) bufs.push(curbuf); + } + curbuf = null; + }; + + var next = function ba_next(sz/*:number*/)/*:Block*/ { + if(curbuf && (sz < (curbuf.length - curbuf.l))) return curbuf; + endbuf(); + return (curbuf = newblk(Math.max(sz+1, blksz))); + }; + + var end = function ba_end() { + endbuf(); + return bconcat(bufs); + }; + + var push = function ba_push(buf) { endbuf(); curbuf = buf; if(curbuf.l == null) curbuf.l = curbuf.length; next(blksz); }; + + return ({ next:next, push:push, end:end, _bufs:bufs }/*:any*/); +} + +function write_record(ba/*:BufArray*/, type/*:number*/, payload, length/*:?number*/) { + var t/*:number*/ = +type, l; + if(isNaN(t)) return; // TODO: throw something here? + if(!length) length = XLSBRecordEnum[t].p || (payload||[]).length || 0; + l = 1 + (t >= 0x80 ? 1 : 0) + 1/* + length*/; + if(length >= 0x80) ++l; if(length >= 0x4000) ++l; if(length >= 0x200000) ++l; + var o = ba.next(l); + if(t <= 0x7F) o.write_shift(1, t); + else { + o.write_shift(1, (t & 0x7F) + 0x80); + o.write_shift(1, (t >> 7)); + } + for(var i = 0; i != 4; ++i) { + if(length >= 0x80) { o.write_shift(1, (length & 0x7F)+0x80); length >>= 7; } + else { o.write_shift(1, length); break; } + } + if(/*:: length != null &&*/length > 0 && is_buf(payload)) ba.push(payload); +} +/* XLS ranges enforced */ +function shift_cell_xls(cell/*:CellAddress*/, tgt/*:any*/, opts/*:?any*/)/*:CellAddress*/ { + var out = dup(cell); + if(tgt.s) { + if(out.cRel) out.c += tgt.s.c; + if(out.rRel) out.r += tgt.s.r; + } else { + if(out.cRel) out.c += tgt.c; + if(out.rRel) out.r += tgt.r; + } + if(!opts || opts.biff < 12) { + while(out.c >= 0x100) out.c -= 0x100; + while(out.r >= 0x10000) out.r -= 0x10000; + } + return out; +} + +function shift_range_xls(cell, range, opts) { + var out = dup(cell); + out.s = shift_cell_xls(out.s, range.s, opts); + out.e = shift_cell_xls(out.e, range.s, opts); + return out; +} + +function encode_cell_xls(c/*:CellAddress*/, biff/*:number*/)/*:string*/ { + if(c.cRel && c.c < 0) { c = dup(c); while(c.c < 0) c.c += (biff > 8) ? 0x4000 : 0x100; } + if(c.rRel && c.r < 0) { c = dup(c); while(c.r < 0) c.r += (biff > 8) ? 0x100000 : ((biff > 5) ? 0x10000 : 0x4000); } + var s = encode_cell(c); + if(!c.cRel && c.cRel != null) s = fix_col(s); + if(!c.rRel && c.rRel != null) s = fix_row(s); + return s; +} + +function encode_range_xls(r, opts)/*:string*/ { + if(r.s.r == 0 && !r.s.rRel) { + if(r.e.r == (opts.biff >= 12 ? 0xFFFFF : (opts.biff >= 8 ? 0x10000 : 0x4000)) && !r.e.rRel) { + return (r.s.cRel ? "" : "$") + encode_col(r.s.c) + ":" + (r.e.cRel ? "" : "$") + encode_col(r.e.c); + } + } + if(r.s.c == 0 && !r.s.cRel) { + if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) { + return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r); + } + } + return encode_cell_xls(r.s, opts.biff) + ":" + encode_cell_xls(r.e, opts.biff); +} +function decode_row(rowstr/*:string*/)/*:number*/ { return parseInt(unfix_row(rowstr),10) - 1; } +function encode_row(row/*:number*/)/*:string*/ { return "" + (row + 1); } +function fix_row(cstr/*:string*/)/*:string*/ { return cstr.replace(/([A-Z]|^)(\d+)$/,"$1$$$2"); } +function unfix_row(cstr/*:string*/)/*:string*/ { return cstr.replace(/\$(\d+)$/,"$1"); } + +function decode_col(colstr/*:string*/)/*:number*/ { var c = unfix_col(colstr), d = 0, i = 0; for(; i !== c.length; ++i) d = 26*d + c.charCodeAt(i) - 64; return d - 1; } +function encode_col(col/*:number*/)/*:string*/ { if(col < 0) throw new Error("invalid column " + col); var s=""; for(++col; col; col=Math.floor((col-1)/26)) s = String.fromCharCode(((col-1)%26) + 65) + s; return s; } +function fix_col(cstr/*:string*/)/*:string*/ { return cstr.replace(/^([A-Z])/,"$$$1"); } +function unfix_col(cstr/*:string*/)/*:string*/ { return cstr.replace(/^\$([A-Z])/,"$1"); } + +function split_cell(cstr/*:string*/)/*:Array*/ { return cstr.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(","); } +function decode_cell(cstr/*:string*/)/*:CellAddress*/ { + var R = 0, C = 0; + for(var i = 0; i < cstr.length; ++i) { + var cc = cstr.charCodeAt(i); + if(cc >= 48 && cc <= 57) R = 10 * R + (cc - 48); + else if(cc >= 65 && cc <= 90) C = 26 * C + (cc - 64); + } + return { c: C - 1, r:R - 1 }; +} +function encode_cell(cell/*:CellAddress*/)/*:string*/ { + var col = cell.c + 1; + var s=""; + for(; col; col=((col-1)/26)|0) s = String.fromCharCode(((col-1)%26) + 65) + s; + return s + (cell.r + 1); +} +function decode_range(range/*:string*/)/*:Range*/ { + var idx = range.indexOf(":"); + if(idx == -1) return { s: decode_cell(range), e: decode_cell(range) }; + return { s: decode_cell(range.slice(0, idx)), e: decode_cell(range.slice(idx + 1)) }; +} +/*# if only one arg, it is assumed to be a Range. If 2 args, both are cell addresses */ +function encode_range(cs/*:CellAddrSpec|Range*/,ce/*:?CellAddrSpec*/)/*:string*/ { + if(typeof ce === 'undefined' || typeof ce === 'number') { +/*:: if(!(cs instanceof Range)) throw "unreachable"; */ + return encode_range(cs.s, cs.e); + } +/*:: if((cs instanceof Range)) throw "unreachable"; */ + if(typeof cs !== 'string') cs = encode_cell((cs/*:any*/)); + if(typeof ce !== 'string') ce = encode_cell((ce/*:any*/)); +/*:: if(typeof cs !== 'string') throw "unreachable"; */ +/*:: if(typeof ce !== 'string') throw "unreachable"; */ + return cs == ce ? cs : cs + ":" + ce; +} +function fix_range(a1/*:string*/)/*:string*/ { + var s = decode_range(a1); + return "$" + encode_col(s.s.c) + "$" + encode_row(s.s.r) + ":$" + encode_col(s.e.c) + "$" + encode_row(s.e.r); +} + +// List of invalid characters needs to be tested further +function formula_quote_sheet_name(sname/*:string*/, opts)/*:string*/ { + if(!sname && !(opts && opts.biff <= 5 && opts.biff >= 2)) throw new Error("empty sheet name"); + if (/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(sname)) return "'" + sname.replace(/'/g, "''") + "'"; + return sname; +} + +function safe_decode_range(range/*:string*/)/*:Range*/ { + var o = {s:{c:0,r:0},e:{c:0,r:0}}; + var idx = 0, i = 0, cc = 0; + var len = range.length; + for(idx = 0; i < len; ++i) { + if((cc=range.charCodeAt(i)-64) < 1 || cc > 26) break; + idx = 26*idx + cc; + } + o.s.c = --idx; + + for(idx = 0; i < len; ++i) { + if((cc=range.charCodeAt(i)-48) < 0 || cc > 9) break; + idx = 10*idx + cc; + } + o.s.r = --idx; + + if(i === len || cc != 10) { o.e.c=o.s.c; o.e.r=o.s.r; return o; } + ++i; + + for(idx = 0; i != len; ++i) { + if((cc=range.charCodeAt(i)-64) < 1 || cc > 26) break; + idx = 26*idx + cc; + } + o.e.c = --idx; + + for(idx = 0; i != len; ++i) { + if((cc=range.charCodeAt(i)-48) < 0 || cc > 9) break; + idx = 10*idx + cc; + } + o.e.r = --idx; + return o; +} + +function safe_format_cell(cell/*:Cell*/, v/*:any*/) { + var q = (cell.t == 'd' && v instanceof Date); + if(cell.z != null) try { return (cell.w = SSF_format(cell.z, q ? datenum(v) : v)); } catch(e) { } + try { return (cell.w = SSF_format((cell.XF||{}).numFmtId||(q ? 14 : 0), q ? datenum(v) : v)); } catch(e) { return ''+v; } +} + +function format_cell(cell/*:Cell*/, v/*:any*/, o/*:any*/) { + if(cell == null || cell.t == null || cell.t == 'z') return ""; + if(cell.w !== undefined) return cell.w; + if(cell.t == 'd' && !cell.z && o && o.dateNF) cell.z = o.dateNF; + if(cell.t == "e") return BErr[cell.v] || cell.v; + if(v == undefined) return safe_format_cell(cell, cell.v); + return safe_format_cell(cell, v); +} + +function sheet_to_workbook(sheet/*:Worksheet*/, opts)/*:Workbook*/ { + var n = opts && opts.sheet ? opts.sheet : "Sheet1"; + var sheets = {}; sheets[n] = sheet; + return { SheetNames: [n], Sheets: sheets }; +} + +function sheet_add_aoa(_ws/*:?Worksheet*/, data/*:AOA*/, opts/*:?any*/)/*:Worksheet*/ { + var o = opts || {}; + var dense = _ws ? (_ws["!data"] != null) : o.dense; + if(DENSE != null && dense == null) dense = DENSE; + var ws/*:Worksheet*/ = _ws || ({}/*:any*/); + if(dense && !ws["!data"]) ws["!data"] = []; + var _R = 0, _C = 0; + if(ws && o.origin != null) { + if(typeof o.origin == 'number') _R = o.origin; + else { + var _origin/*:CellAddress*/ = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin; + _R = _origin.r; _C = _origin.c; + } + if(!ws["!ref"]) ws["!ref"] = "A1:A1"; + } + var range/*:Range*/ = ({s: {c:10000000, r:10000000}, e: {c:0, r:0}}/*:any*/); + if(ws['!ref']) { + var _range = safe_decode_range(ws['!ref']); + range.s.c = _range.s.c; + range.s.r = _range.s.r; + range.e.c = Math.max(range.e.c, _range.e.c); + range.e.r = Math.max(range.e.r, _range.e.r); + if(_R == -1) range.e.r = _R = _range.e.r + 1; + } + var row = []; + for(var R = 0; R != data.length; ++R) { + if(!data[R]) continue; + if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays"); + var __R = _R + R, __Rstr = "" + (__R + 1); + if(dense) { + if(!ws["!data"][__R]) ws["!data"][__R] = []; + row = ws["!data"][__R]; + } + for(var C = 0; C != data[R].length; ++C) { + if(typeof data[R][C] === 'undefined') continue; + var cell/*:Cell*/ = ({v: data[R][C] }/*:any*/); + var __C = _C + C; + if(range.s.r > __R) range.s.r = __R; + if(range.s.c > __C) range.s.c = __C; + if(range.e.r < __R) range.e.r = __R; + if(range.e.c < __C) range.e.c = __C; + if(data[R][C] && typeof data[R][C] === 'object' && !Array.isArray(data[R][C]) && !(data[R][C] instanceof Date)) cell = data[R][C]; + else { + if(Array.isArray(cell.v)) { cell.f = data[R][C][1]; cell.v = cell.v[0]; } + if(cell.v === null) { + if(cell.f) cell.t = 'n'; + else if(o.nullError) { cell.t = 'e'; cell.v = 0; } + else if(!o.sheetStubs) continue; + else cell.t = 'z'; + } + else if(typeof cell.v === 'number') cell.t = 'n'; + else if(typeof cell.v === 'boolean') cell.t = 'b'; + else if(cell.v instanceof Date) { + cell.z = o.dateNF || table_fmt[14]; + if(!o.UTC) cell.v = local_to_utc(cell.v); + if(o.cellDates) { cell.t = 'd'; cell.w = SSF_format(cell.z, datenum(cell.v, o.date1904)); } + else { cell.t = 'n'; cell.v = datenum(cell.v, o.date1904); cell.w = SSF_format(cell.z, cell.v); } + } + else cell.t = 's'; + } + if(dense) { + if(row[__C] && row[__C].z) cell.z = row[__C].z; + row[__C] = cell; + } else { + var cell_ref = encode_col(__C) + __Rstr/*:any*/; + if(ws[cell_ref] && ws[cell_ref].z) cell.z = ws[cell_ref].z; + ws[cell_ref] = cell; + } + } + } + if(range.s.c < 10000000) ws['!ref'] = encode_range(range); + return ws; +} +function aoa_to_sheet(data/*:AOA*/, opts/*:?any*/)/*:Worksheet*/ { return sheet_add_aoa(null, data, opts); } + +function parse_Int32LE(data) { + return data.read_shift(4, 'i'); +} +function write_UInt32LE(x/*:number*/, o) { + if (!o) o = new_buf(4); + o.write_shift(4, x); + return o; +} + +/* [MS-XLSB] 2.5.168 */ +function parse_XLWideString(data/*::, length*/)/*:string*/ { + var cchCharacters = data.read_shift(4); + return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, 'dbcs'); +} +function write_XLWideString(data/*:string*/, o) { + var _null = false; if (o == null) { _null = true; o = new_buf(4 + 2 * data.length); } + o.write_shift(4, data.length); + if (data.length > 0) o.write_shift(0, data, 'dbcs'); + return _null ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.5.91 */ +//function parse_LPWideString(data/*::, length*/)/*:string*/ { +// var cchCharacters = data.read_shift(2); +// return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "utf16le"); +//} + +/* [MS-XLSB] 2.5.143 */ +function parse_StrRun(data) { + return { ich: data.read_shift(2), ifnt: data.read_shift(2) }; +} +function write_StrRun(run, o) { + if (!o) o = new_buf(4); + o.write_shift(2, run.ich || 0); + o.write_shift(2, run.ifnt || 0); + return o; +} + +/* [MS-XLSB] 2.5.121 */ +function parse_RichStr(data, length/*:number*/)/*:XLString*/ { + var start = data.l; + var flags = data.read_shift(1); + var str = parse_XLWideString(data); + var rgsStrRun = []; + var z = ({ t: str, h: str }/*:any*/); + if ((flags & 1) !== 0) { /* fRichStr */ + /* TODO: formatted string */ + var dwSizeStrRun = data.read_shift(4); + for (var i = 0; i != dwSizeStrRun; ++i) rgsStrRun.push(parse_StrRun(data)); + z.r = rgsStrRun; + } + else z.r = [{ ich: 0, ifnt: 0 }]; + //if((flags & 2) !== 0) { /* fExtStr */ + // /* TODO: phonetic string */ + //} + data.l = start + length; + return z; +} +function write_RichStr(str/*:XLString*/, o/*:?Block*/)/*:Block*/ { + /* TODO: formatted string */ + var _null = false; if (o == null) { _null = true; o = new_buf(15 + 4 * str.t.length); } + o.write_shift(1, 0); + write_XLWideString(str.t, o); + return _null ? o.slice(0, o.l) : o; +} +/* [MS-XLSB] 2.4.328 BrtCommentText (RichStr w/1 run) */ +var parse_BrtCommentText = parse_RichStr; +function write_BrtCommentText(str/*:XLString*/, o/*:?Block*/)/*:Block*/ { + /* TODO: formatted string */ + var _null = false; if (o == null) { _null = true; o = new_buf(23 + 4 * str.t.length); } + o.write_shift(1, 1); + write_XLWideString(str.t, o); + o.write_shift(4, 1); + write_StrRun({ ich: 0, ifnt: 0 }, o); + return _null ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.5.9 */ +function parse_XLSBCell(data)/*:any*/ { + var col = data.read_shift(4); + var iStyleRef = data.read_shift(2); + iStyleRef += data.read_shift(1) << 16; + data.l++; //var fPhShow = data.read_shift(1); + return { c: col, iStyleRef: iStyleRef }; +} +function write_XLSBCell(cell/*:any*/, o/*:?Block*/) { + if (o == null) o = new_buf(8); + o.write_shift(-4, cell.c); + o.write_shift(3, cell.iStyleRef || cell.s); + o.write_shift(1, 0); /* fPhShow */ + return o; +} + +/* Short XLSB Cell does not include column */ +function parse_XLSBShortCell(data)/*:any*/ { + var iStyleRef = data.read_shift(2); + iStyleRef += data.read_shift(1) <<16; + data.l++; //var fPhShow = data.read_shift(1); + return { c:-1, iStyleRef: iStyleRef }; +} +function write_XLSBShortCell(cell/*:any*/, o/*:?Block*/) { + if(o == null) o = new_buf(4); + o.write_shift(3, cell.iStyleRef || cell.s); + o.write_shift(1, 0); /* fPhShow */ + return o; +} + +/* [MS-XLSB] 2.5.21 */ +var parse_XLSBCodeName = parse_XLWideString; +var write_XLSBCodeName = write_XLWideString; + +/* [MS-XLSB] 2.5.166 */ +function parse_XLNullableWideString(data/*::, length*/)/*:string*/ { + var cchCharacters = data.read_shift(4); + return cchCharacters === 0 || cchCharacters === 0xFFFFFFFF ? "" : data.read_shift(cchCharacters, 'dbcs'); +} +function write_XLNullableWideString(data/*:string*/, o) { + var _null = false; if (o == null) { _null = true; o = new_buf(127); } + o.write_shift(4, data.length > 0 ? data.length : 0xFFFFFFFF); + if (data.length > 0) o.write_shift(0, data, 'dbcs'); + return _null ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.5.165 */ +var parse_XLNameWideString = parse_XLWideString; +//var write_XLNameWideString = write_XLWideString; + +/* [MS-XLSB] 2.5.114 */ +var parse_RelID = parse_XLNullableWideString; +var write_RelID = write_XLNullableWideString; + + +/* [MS-XLS] 2.5.217 ; [MS-XLSB] 2.5.122 */ +function parse_RkNumber(data)/*:number*/ { + var b = data.slice(data.l, data.l + 4); + var fX100 = (b[0] & 1), fInt = (b[0] & 2); + data.l += 4; + var RK = fInt === 0 ? __double([0, 0, 0, 0, (b[0] & 0xFC), b[1], b[2], b[3]], 0) : __readInt32LE(b, 0) >> 2; + return fX100 ? (RK / 100) : RK; +} +function write_RkNumber(data/*:number*/, o) { + if (o == null) o = new_buf(4); + var fX100 = 0, fInt = 0, d100 = data * 100; + if ((data == (data | 0)) && (data >= -(1 << 29)) && (data < (1 << 29))) { fInt = 1; } + else if ((d100 == (d100 | 0)) && (d100 >= -(1 << 29)) && (d100 < (1 << 29))) { fInt = 1; fX100 = 1; } + if (fInt) o.write_shift(-4, ((fX100 ? d100 : data) << 2) + (fX100 + 2)); + else throw new Error("unsupported RkNumber " + data); // TODO +} + + +/* [MS-XLSB] 2.5.117 RfX */ +function parse_RfX(data /*::, length*/)/*:Range*/ { + var cell/*:Range*/ = ({ s: {}, e: {} }/*:any*/); + cell.s.r = data.read_shift(4); + cell.e.r = data.read_shift(4); + cell.s.c = data.read_shift(4); + cell.e.c = data.read_shift(4); + return cell; +} +function write_RfX(r/*:Range*/, o) { + if (!o) o = new_buf(16); + o.write_shift(4, r.s.r); + o.write_shift(4, r.e.r); + o.write_shift(4, r.s.c); + o.write_shift(4, r.e.c); + return o; +} + +/* [MS-XLSB] 2.5.153 UncheckedRfX */ +var parse_UncheckedRfX = parse_RfX; +var write_UncheckedRfX = write_RfX; + +/* [MS-XLSB] 2.5.155 UncheckedSqRfX */ +//function parse_UncheckedSqRfX(data) { +// var cnt = data.read_shift(4); +// var out = []; +// for(var i = 0; i < cnt; ++i) { +// var rng = parse_UncheckedRfX(data); +// out.push(encode_range(rng)); +// } +// return out.join(","); +//} +//function write_UncheckedSqRfX(sqrfx/*:string*/) { +// var parts = sqrfx.split(/\s*,\s*/); +// var o = new_buf(4); o.write_shift(4, parts.length); +// var out = [o]; +// parts.forEach(function(rng) { +// out.push(write_UncheckedRfX(safe_decode_range(rng))); +// }); +// return bconcat(out); +//} + +/* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */ +/* TODO: error checking, NaN and Infinity values are not valid Xnum */ +function parse_Xnum(data/*::, length*/) { + if(data.length - data.l < 8) throw "XLS Xnum Buffer underflow"; + return data.read_shift(8, 'f'); +} +function write_Xnum(data, o) { return (o || new_buf(8)).write_shift(8, data, 'f'); } + +/* [MS-XLSB] 2.4.324 BrtColor */ +function parse_BrtColor(data/*::, length*/) { + var out = {}; + var d = data.read_shift(1); + + //var fValidRGB = d & 1; + var xColorType = d >>> 1; + + var index = data.read_shift(1); + var nTS = data.read_shift(2, 'i'); + var bR = data.read_shift(1); + var bG = data.read_shift(1); + var bB = data.read_shift(1); + data.l++; //var bAlpha = data.read_shift(1); + + switch (xColorType) { + case 0: out.auto = 1; break; + case 1: + out.index = index; + var icv = XLSIcv[index]; + /* automatic pseudo index 81 */ + if (icv) out.rgb = rgb2Hex(icv); + break; + case 2: + /* if(!fValidRGB) throw new Error("invalid"); */ + out.rgb = rgb2Hex([bR, bG, bB]); + break; + case 3: out.theme = index; break; + } + if (nTS != 0) out.tint = nTS > 0 ? nTS / 32767 : nTS / 32768; + + return out; +} +function write_BrtColor(color, o) { + if (!o) o = new_buf(8); + if (!color || color.auto) { o.write_shift(4, 0); o.write_shift(4, 0); return o; } + if (color.index != null) { + o.write_shift(1, 0x02); + o.write_shift(1, color.index); + } else if (color.theme != null) { + o.write_shift(1, 0x06); + o.write_shift(1, color.theme); + } else { + o.write_shift(1, 0x05); + o.write_shift(1, 0); + } + var nTS = color.tint || 0; + if (nTS > 0) nTS *= 32767; + else if (nTS < 0) nTS *= 32768; + o.write_shift(2, nTS); + if (!color.rgb || color.theme != null) { + o.write_shift(2, 0); + o.write_shift(1, 0); + o.write_shift(1, 0); + } else { + var rgb = (color.rgb || 'FFFFFF'); + if (typeof rgb == 'number') rgb = ("000000" + rgb.toString(16)).slice(-6); + o.write_shift(1, parseInt(rgb.slice(0, 2), 16)); + o.write_shift(1, parseInt(rgb.slice(2, 4), 16)); + o.write_shift(1, parseInt(rgb.slice(4, 6), 16)); + o.write_shift(1, 0xFF); + } + return o; +} + +/* [MS-XLSB] 2.5.52 */ +function parse_FontFlags(data/*::, length, opts*/) { + var d = data.read_shift(1); + data.l++; + var out = { + fBold: d & 0x01, + fItalic: d & 0x02, + fUnderline: d & 0x04, + fStrikeout: d & 0x08, + fOutline: d & 0x10, + fShadow: d & 0x20, + fCondense: d & 0x40, + fExtend: d & 0x80 + }; + return out; +} +function write_FontFlags(font, o) { + if (!o) o = new_buf(2); + var grbit = + (font.italic ? 0x02 : 0) | + (font.strike ? 0x08 : 0) | + (font.outline ? 0x10 : 0) | + (font.shadow ? 0x20 : 0) | + (font.condense ? 0x40 : 0) | + (font.extend ? 0x80 : 0); + o.write_shift(1, grbit); + o.write_shift(1, 0); + return o; +} + +/* [MS-OLEDS] 2.3.1 and 2.3.2 */ +function parse_ClipboardFormatOrString(o, w/*:number*/)/*:string*/ { + // $FlowIgnore + var ClipFmt = { 2: "BITMAP", 3: "METAFILEPICT", 8: "DIB", 14: "ENHMETAFILE" }; + var m/*:number*/ = o.read_shift(4); + switch (m) { + case 0x00000000: return ""; + case 0xffffffff: case 0xfffffffe: return ClipFmt[o.read_shift(4)] || ""; + } + if (m > 0x190) throw new Error("Unsupported Clipboard: " + m.toString(16)); + o.l -= 4; + return o.read_shift(0, w == 1 ? "lpstr" : "lpwstr"); +} +function parse_ClipboardFormatOrAnsiString(o) { return parse_ClipboardFormatOrString(o, 1); } +function parse_ClipboardFormatOrUnicodeString(o) { return parse_ClipboardFormatOrString(o, 2); } + +/* [MS-OLEPS] 2.2 PropertyType */ +// Note: some tree shakers cannot handle VT_VECTOR | $CONST, hence extra vars +//var VT_EMPTY = 0x0000; +//var VT_NULL = 0x0001; +var VT_I2 = 0x0002; +var VT_I4 = 0x0003; +//var VT_R4 = 0x0004; +//var VT_R8 = 0x0005; +//var VT_CY = 0x0006; +//var VT_DATE = 0x0007; +//var VT_BSTR = 0x0008; +//var VT_ERROR = 0x000A; +var VT_BOOL = 0x000B; +var VT_VARIANT = 0x000C; +//var VT_DECIMAL = 0x000E; +//var VT_I1 = 0x0010; +//var VT_UI1 = 0x0011; +//var VT_UI2 = 0x0012; +var VT_UI4 = 0x0013; +//var VT_I8 = 0x0014; +//var VT_UI8 = 0x0015; +//var VT_INT = 0x0016; +//var VT_UINT = 0x0017; +//var VT_LPSTR = 0x001E; +//var VT_LPWSTR = 0x001F; +var VT_FILETIME = 0x0040; +var VT_BLOB = 0x0041; +//var VT_STREAM = 0x0042; +//var VT_STORAGE = 0x0043; +//var VT_STREAMED_Object = 0x0044; +//var VT_STORED_Object = 0x0045; +//var VT_BLOB_Object = 0x0046; +var VT_CF = 0x0047; +//var VT_CLSID = 0x0048; +//var VT_VERSIONED_STREAM = 0x0049; +//var VT_VECTOR = 0x1000; +var VT_VECTOR_VARIANT = 0x100C; +var VT_VECTOR_LPSTR = 0x101E; +//var VT_ARRAY = 0x2000; + +var VT_STRING = 0x0050; // 2.3.3.1.11 VtString +var VT_USTR = 0x0051; // 2.3.3.1.12 VtUnalignedString +var VT_CUSTOM = [VT_STRING, VT_USTR]; + +/* [MS-OSHARED] 2.3.3.2.2.1 Document Summary Information PIDDSI */ +var DocSummaryPIDDSI = { + /*::[*/0x01/*::]*/: { n: 'CodePage', t: VT_I2 }, + /*::[*/0x02/*::]*/: { n: 'Category', t: VT_STRING }, + /*::[*/0x03/*::]*/: { n: 'PresentationFormat', t: VT_STRING }, + /*::[*/0x04/*::]*/: { n: 'ByteCount', t: VT_I4 }, + /*::[*/0x05/*::]*/: { n: 'LineCount', t: VT_I4 }, + /*::[*/0x06/*::]*/: { n: 'ParagraphCount', t: VT_I4 }, + /*::[*/0x07/*::]*/: { n: 'SlideCount', t: VT_I4 }, + /*::[*/0x08/*::]*/: { n: 'NoteCount', t: VT_I4 }, + /*::[*/0x09/*::]*/: { n: 'HiddenCount', t: VT_I4 }, + /*::[*/0x0a/*::]*/: { n: 'MultimediaClipCount', t: VT_I4 }, + /*::[*/0x0b/*::]*/: { n: 'ScaleCrop', t: VT_BOOL }, + /*::[*/0x0c/*::]*/: { n: 'HeadingPairs', t: VT_VECTOR_VARIANT /* VT_VECTOR | VT_VARIANT */ }, + /*::[*/0x0d/*::]*/: { n: 'TitlesOfParts', t: VT_VECTOR_LPSTR /* VT_VECTOR | VT_LPSTR */ }, + /*::[*/0x0e/*::]*/: { n: 'Manager', t: VT_STRING }, + /*::[*/0x0f/*::]*/: { n: 'Company', t: VT_STRING }, + /*::[*/0x10/*::]*/: { n: 'LinksUpToDate', t: VT_BOOL }, + /*::[*/0x11/*::]*/: { n: 'CharacterCount', t: VT_I4 }, + /*::[*/0x13/*::]*/: { n: 'SharedDoc', t: VT_BOOL }, + /*::[*/0x16/*::]*/: { n: 'HyperlinksChanged', t: VT_BOOL }, + /*::[*/0x17/*::]*/: { n: 'AppVersion', t: VT_I4, p: 'version' }, + /*::[*/0x18/*::]*/: { n: 'DigSig', t: VT_BLOB }, + /*::[*/0x1A/*::]*/: { n: 'ContentType', t: VT_STRING }, + /*::[*/0x1B/*::]*/: { n: 'ContentStatus', t: VT_STRING }, + /*::[*/0x1C/*::]*/: { n: 'Language', t: VT_STRING }, + /*::[*/0x1D/*::]*/: { n: 'Version', t: VT_STRING }, + /*::[*/0xFF/*::]*/: {}, + /* [MS-OLEPS] 2.18 */ + /*::[*/0x80000000/*::]*/: { n: 'Locale', t: VT_UI4 }, + /*::[*/0x80000003/*::]*/: { n: 'Behavior', t: VT_UI4 }, + /*::[*/0x72627262/*::]*/: {} +}; + +/* [MS-OSHARED] 2.3.3.2.1.1 Summary Information Property Set PIDSI */ +var SummaryPIDSI = { + /*::[*/0x01/*::]*/: { n: 'CodePage', t: VT_I2 }, + /*::[*/0x02/*::]*/: { n: 'Title', t: VT_STRING }, + /*::[*/0x03/*::]*/: { n: 'Subject', t: VT_STRING }, + /*::[*/0x04/*::]*/: { n: 'Author', t: VT_STRING }, + /*::[*/0x05/*::]*/: { n: 'Keywords', t: VT_STRING }, + /*::[*/0x06/*::]*/: { n: 'Comments', t: VT_STRING }, + /*::[*/0x07/*::]*/: { n: 'Template', t: VT_STRING }, + /*::[*/0x08/*::]*/: { n: 'LastAuthor', t: VT_STRING }, + /*::[*/0x09/*::]*/: { n: 'RevNumber', t: VT_STRING }, + /*::[*/0x0A/*::]*/: { n: 'EditTime', t: VT_FILETIME }, + /*::[*/0x0B/*::]*/: { n: 'LastPrinted', t: VT_FILETIME }, + /*::[*/0x0C/*::]*/: { n: 'CreatedDate', t: VT_FILETIME }, + /*::[*/0x0D/*::]*/: { n: 'ModifiedDate', t: VT_FILETIME }, + /*::[*/0x0E/*::]*/: { n: 'PageCount', t: VT_I4 }, + /*::[*/0x0F/*::]*/: { n: 'WordCount', t: VT_I4 }, + /*::[*/0x10/*::]*/: { n: 'CharCount', t: VT_I4 }, + /*::[*/0x11/*::]*/: { n: 'Thumbnail', t: VT_CF }, + /*::[*/0x12/*::]*/: { n: 'Application', t: VT_STRING }, + /*::[*/0x13/*::]*/: { n: 'DocSecurity', t: VT_I4 }, + /*::[*/0xFF/*::]*/: {}, + /* [MS-OLEPS] 2.18 */ + /*::[*/0x80000000/*::]*/: { n: 'Locale', t: VT_UI4 }, + /*::[*/0x80000003/*::]*/: { n: 'Behavior', t: VT_UI4 }, + /*::[*/0x72627262/*::]*/: {} +}; + +/* [MS-XLS] 2.4.63 Country/Region codes */ +var CountryEnum = { + /*::[*/0x0001/*::]*/: "US", // United States + /*::[*/0x0002/*::]*/: "CA", // Canada + /*::[*/0x0003/*::]*/: "", // Latin America (except Brazil) + /*::[*/0x0007/*::]*/: "RU", // Russia + /*::[*/0x0014/*::]*/: "EG", // Egypt + /*::[*/0x001E/*::]*/: "GR", // Greece + /*::[*/0x001F/*::]*/: "NL", // Netherlands + /*::[*/0x0020/*::]*/: "BE", // Belgium + /*::[*/0x0021/*::]*/: "FR", // France + /*::[*/0x0022/*::]*/: "ES", // Spain + /*::[*/0x0024/*::]*/: "HU", // Hungary + /*::[*/0x0027/*::]*/: "IT", // Italy + /*::[*/0x0029/*::]*/: "CH", // Switzerland + /*::[*/0x002B/*::]*/: "AT", // Austria + /*::[*/0x002C/*::]*/: "GB", // United Kingdom + /*::[*/0x002D/*::]*/: "DK", // Denmark + /*::[*/0x002E/*::]*/: "SE", // Sweden + /*::[*/0x002F/*::]*/: "NO", // Norway + /*::[*/0x0030/*::]*/: "PL", // Poland + /*::[*/0x0031/*::]*/: "DE", // Germany + /*::[*/0x0034/*::]*/: "MX", // Mexico + /*::[*/0x0037/*::]*/: "BR", // Brazil + /*::[*/0x003d/*::]*/: "AU", // Australia + /*::[*/0x0040/*::]*/: "NZ", // New Zealand + /*::[*/0x0042/*::]*/: "TH", // Thailand + /*::[*/0x0051/*::]*/: "JP", // Japan + /*::[*/0x0052/*::]*/: "KR", // Korea + /*::[*/0x0054/*::]*/: "VN", // Viet Nam + /*::[*/0x0056/*::]*/: "CN", // China + /*::[*/0x005A/*::]*/: "TR", // Turkey + /*::[*/0x0069/*::]*/: "JS", // Ramastan + /*::[*/0x00D5/*::]*/: "DZ", // Algeria + /*::[*/0x00D8/*::]*/: "MA", // Morocco + /*::[*/0x00DA/*::]*/: "LY", // Libya + /*::[*/0x015F/*::]*/: "PT", // Portugal + /*::[*/0x0162/*::]*/: "IS", // Iceland + /*::[*/0x0166/*::]*/: "FI", // Finland + /*::[*/0x01A4/*::]*/: "CZ", // Czech Republic + /*::[*/0x0376/*::]*/: "TW", // Taiwan + /*::[*/0x03C1/*::]*/: "LB", // Lebanon + /*::[*/0x03C2/*::]*/: "JO", // Jordan + /*::[*/0x03C3/*::]*/: "SY", // Syria + /*::[*/0x03C4/*::]*/: "IQ", // Iraq + /*::[*/0x03C5/*::]*/: "KW", // Kuwait + /*::[*/0x03C6/*::]*/: "SA", // Saudi Arabia + /*::[*/0x03CB/*::]*/: "AE", // United Arab Emirates + /*::[*/0x03CC/*::]*/: "IL", // Israel + /*::[*/0x03CE/*::]*/: "QA", // Qatar + /*::[*/0x03D5/*::]*/: "IR", // Iran + /*::[*/0xFFFF/*::]*/: "US" // United States +}; + +/* [MS-XLS] 2.5.127 */ +var XLSFillPattern = [ + null, + 'solid', + 'mediumGray', + 'darkGray', + 'lightGray', + 'darkHorizontal', + 'darkVertical', + 'darkDown', + 'darkUp', + 'darkGrid', + 'darkTrellis', + 'lightHorizontal', + 'lightVertical', + 'lightDown', + 'lightUp', + 'lightGrid', + 'lightTrellis', + 'gray125', + 'gray0625' +]; + +function rgbify(arr/*:Array*/)/*:Array<[number, number, number]>*/ { return arr.map(function(x) { return [(x>>16)&255,(x>>8)&255,x&255]; }); } + +/* [MS-XLS] 2.5.161 */ +/* [MS-XLSB] 2.5.75 Icv */ +var _XLSIcv = /*#__PURE__*/ rgbify([ + /* Color Constants */ + 0x000000, + 0xFFFFFF, + 0xFF0000, + 0x00FF00, + 0x0000FF, + 0xFFFF00, + 0xFF00FF, + 0x00FFFF, + + /* Overridable Defaults */ + 0x000000, + 0xFFFFFF, + 0xFF0000, + 0x00FF00, + 0x0000FF, + 0xFFFF00, + 0xFF00FF, + 0x00FFFF, + + 0x800000, + 0x008000, + 0x000080, + 0x808000, + 0x800080, + 0x008080, + 0xC0C0C0, + 0x808080, + 0x9999FF, + 0x993366, + 0xFFFFCC, + 0xCCFFFF, + 0x660066, + 0xFF8080, + 0x0066CC, + 0xCCCCFF, + + 0x000080, + 0xFF00FF, + 0xFFFF00, + 0x00FFFF, + 0x800080, + 0x800000, + 0x008080, + 0x0000FF, + 0x00CCFF, + 0xCCFFFF, + 0xCCFFCC, + 0xFFFF99, + 0x99CCFF, + 0xFF99CC, + 0xCC99FF, + 0xFFCC99, + + 0x3366FF, + 0x33CCCC, + 0x99CC00, + 0xFFCC00, + 0xFF9900, + 0xFF6600, + 0x666699, + 0x969696, + 0x003366, + 0x339966, + 0x003300, + 0x333300, + 0x993300, + 0x993366, + 0x333399, + 0x333333, + + /* Other entries to appease BIFF8/12 */ + 0x000000, /* 0x40 icvForeground ?? */ + 0xFFFFFF, /* 0x41 icvBackground ?? */ + 0x000000, /* 0x42 icvFrame ?? */ + 0x000000, /* 0x43 icv3D ?? */ + 0x000000, /* 0x44 icv3DText ?? */ + 0x000000, /* 0x45 icv3DHilite ?? */ + 0x000000, /* 0x46 icv3DShadow ?? */ + 0x000000, /* 0x47 icvHilite ?? */ + 0x000000, /* 0x48 icvCtlText ?? */ + 0x000000, /* 0x49 icvCtlScrl ?? */ + 0x000000, /* 0x4A icvCtlInv ?? */ + 0x000000, /* 0x4B icvCtlBody ?? */ + 0x000000, /* 0x4C icvCtlFrame ?? */ + 0x000000, /* 0x4D icvCtlFore ?? */ + 0x000000, /* 0x4E icvCtlBack ?? */ + 0x000000, /* 0x4F icvCtlNeutral */ + 0x000000, /* 0x50 icvInfoBk ?? */ + 0x000000 /* 0x51 icvInfoText ?? */ +]); +var XLSIcv = /*#__PURE__*/dup(_XLSIcv); + +/* [MS-XLSB] 2.5.97.2 */ +var BErr = { + /*::[*/0x00/*::]*/: "#NULL!", + /*::[*/0x07/*::]*/: "#DIV/0!", + /*::[*/0x0F/*::]*/: "#VALUE!", + /*::[*/0x17/*::]*/: "#REF!", + /*::[*/0x1D/*::]*/: "#NAME?", + /*::[*/0x24/*::]*/: "#NUM!", + /*::[*/0x2A/*::]*/: "#N/A", + /*::[*/0x2B/*::]*/: "#GETTING_DATA", + /*::[*/0xFF/*::]*/: "#WTF?" +}; +//var RBErr = evert_num(BErr); +var RBErr = { + "#NULL!": 0x00, + "#DIV/0!": 0x07, + "#VALUE!": 0x0F, + "#REF!": 0x17, + "#NAME?": 0x1D, + "#NUM!": 0x24, + "#N/A": 0x2A, + "#GETTING_DATA": 0x2B, + "#WTF?": 0xFF +}; + +var XLSLblBuiltIn = [ + "_xlnm.Consolidate_Area", + "_xlnm.Auto_Open", + "_xlnm.Auto_Close", + "_xlnm.Extract", + "_xlnm.Database", + "_xlnm.Criteria", + "_xlnm.Print_Area", + "_xlnm.Print_Titles", + "_xlnm.Recorder", + "_xlnm.Data_Form", + "_xlnm.Auto_Activate", + "_xlnm.Auto_Deactivate", + "_xlnm.Sheet_Title", + "_xlnm._FilterDatabase" +]; + +/* Parts enumerated in OPC spec, MS-XLSB and MS-XLSX */ +/* 12.3 Part Summary */ +/* 14.2 Part Summary */ +/* [MS-XLSX] 2.1 Part Enumerations ; [MS-XLSB] 2.1.7 Part Enumeration */ +var ct2type/*{[string]:string}*/ = ({ + /* Workbook */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks", + "application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks", + "application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks", + "application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks", + "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks", + + /* Worksheet */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets", + "application/vnd.ms-excel.worksheet": "sheets", + "application/vnd.ms-excel.binIndexWs": "TODO", /* Binary Index */ + + /* Chartsheet */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts", + "application/vnd.ms-excel.chartsheet": "charts", + + /* Macrosheet */ + "application/vnd.ms-excel.macrosheet+xml": "macros", + "application/vnd.ms-excel.macrosheet": "macros", + "application/vnd.ms-excel.intlmacrosheet": "TODO", + "application/vnd.ms-excel.binIndexMs": "TODO", /* Binary Index */ + + /* Dialogsheet */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs", + "application/vnd.ms-excel.dialogsheet": "dialogs", + + /* Shared Strings */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs", + "application/vnd.ms-excel.sharedStrings": "strs", + + /* Styles */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles", + "application/vnd.ms-excel.styles": "styles", + + /* File Properties */ + "application/vnd.openxmlformats-package.core-properties+xml": "coreprops", + "application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops", + "application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops", + + /* Custom Data Properties */ + "application/vnd.openxmlformats-officedocument.customXmlProperties+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty": "TODO", + + /* Comments */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments", + "application/vnd.ms-excel.comments": "comments", + "application/vnd.ms-excel.threadedcomments+xml": "threadedcomments", + "application/vnd.ms-excel.person+xml": "people", + + /* Metadata (Stock/Geography and Dynamic Array) */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata", + "application/vnd.ms-excel.sheetMetadata": "metadata", + + /* PivotTable */ + "application/vnd.ms-excel.pivotTable": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml": "TODO", + + /* Chart Objects */ + "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": "TODO", + + /* Chart Colors */ + "application/vnd.ms-office.chartcolorstyle+xml": "TODO", + + /* Chart Style */ + "application/vnd.ms-office.chartstyle+xml": "TODO", + + /* Chart Advanced */ + "application/vnd.ms-office.chartex+xml": "TODO", + + /* Calculation Chain */ + "application/vnd.ms-excel.calcChain": "calcchains", + "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml": "calcchains", + + /* Printer Settings */ + "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings": "TODO", + + /* ActiveX */ + "application/vnd.ms-office.activeX": "TODO", + "application/vnd.ms-office.activeX+xml": "TODO", + + /* Custom Toolbars */ + "application/vnd.ms-excel.attachedToolbars": "TODO", + + /* External Data Connections */ + "application/vnd.ms-excel.connections": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": "TODO", + + /* External Links */ + "application/vnd.ms-excel.externalLink": "links", + "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links", + + /* PivotCache */ + "application/vnd.ms-excel.pivotCacheDefinition": "TODO", + "application/vnd.ms-excel.pivotCacheRecords": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml": "TODO", + + /* Query Table */ + "application/vnd.ms-excel.queryTable": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml": "TODO", + + /* Shared Workbook */ + "application/vnd.ms-excel.userNames": "TODO", + "application/vnd.ms-excel.revisionHeaders": "TODO", + "application/vnd.ms-excel.revisionLog": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml": "TODO", + + /* Single Cell Table */ + "application/vnd.ms-excel.tableSingleCells": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml": "TODO", + + /* Slicer */ + "application/vnd.ms-excel.slicer": "TODO", + "application/vnd.ms-excel.slicerCache": "TODO", + "application/vnd.ms-excel.slicer+xml": "TODO", + "application/vnd.ms-excel.slicerCache+xml": "TODO", + + /* Sort Map */ + "application/vnd.ms-excel.wsSortMap": "TODO", + + /* Table */ + "application/vnd.ms-excel.table": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": "TODO", + + /* Themes */ + "application/vnd.openxmlformats-officedocument.theme+xml": "themes", + + /* Theme Override */ + "application/vnd.openxmlformats-officedocument.themeOverride+xml": "TODO", + + /* Timeline */ + "application/vnd.ms-excel.Timeline+xml": "TODO", /* verify */ + "application/vnd.ms-excel.TimelineCache+xml": "TODO", /* verify */ + + /* VBA */ + "application/vnd.ms-office.vbaProject": "vba", + "application/vnd.ms-office.vbaProjectSignature": "TODO", + + /* Volatile Dependencies */ + "application/vnd.ms-office.volatileDependencies": "TODO", + "application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml": "TODO", + + /* Control Properties */ + "application/vnd.ms-excel.controlproperties+xml": "TODO", + + /* Data Model */ + "application/vnd.openxmlformats-officedocument.model+data": "TODO", + + /* Survey */ + "application/vnd.ms-excel.Survey+xml": "TODO", + + /* Drawing */ + "application/vnd.openxmlformats-officedocument.drawing+xml": "drawings", + "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml": "TODO", + "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml": "TODO", + + /* VML */ + "application/vnd.openxmlformats-officedocument.vmlDrawing": "TODO", + + "application/vnd.openxmlformats-package.relationships+xml": "rels", + "application/vnd.openxmlformats-officedocument.oleObject": "TODO", + + /* Image */ + "image/png": "TODO", + + "sheet": "js" +}/*:any*/); + +var CT_LIST = { + workbooks: { + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", + xlsm: "application/vnd.ms-excel.sheet.macroEnabled.main+xml", + xlsb: "application/vnd.ms-excel.sheet.binary.macroEnabled.main", + xlam: "application/vnd.ms-excel.addin.macroEnabled.main+xml", + xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml" + }, + strs: { /* Shared Strings */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", + xlsb: "application/vnd.ms-excel.sharedStrings" + }, + comments: { /* Comments */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", + xlsb: "application/vnd.ms-excel.comments" + }, + sheets: { /* Worksheet */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", + xlsb: "application/vnd.ms-excel.worksheet" + }, + charts: { /* Chartsheet */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml", + xlsb: "application/vnd.ms-excel.chartsheet" + }, + dialogs: { /* Dialogsheet */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml", + xlsb: "application/vnd.ms-excel.dialogsheet" + }, + macros: { /* Macrosheet (Excel 4.0 Macros) */ + xlsx: "application/vnd.ms-excel.macrosheet+xml", + xlsb: "application/vnd.ms-excel.macrosheet" + }, + metadata: { /* Metadata (Stock/Geography and Dynamic Array) */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml", + xlsb: "application/vnd.ms-excel.sheetMetadata" + }, + styles: { /* Styles */ + xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", + xlsb: "application/vnd.ms-excel.styles" + } +}; + +function new_ct()/*:any*/ { + return ({ + workbooks:[], sheets:[], charts:[], dialogs:[], macros:[], + rels:[], strs:[], comments:[], threadedcomments:[], links:[], + coreprops:[], extprops:[], custprops:[], themes:[], styles:[], + calcchains:[], vba: [], drawings: [], metadata: [], people:[], + TODO:[], xmlns: "" }/*:any*/); +} + +function parse_ct(data/*:?string*/) { + var ct = new_ct(); + if(!data || !data.match) return ct; + var ctext = {}; + (data.match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(y[0].replace(nsregex,"<")) { + case ' 0 ? ct.calcchains[0] : ""; + ct.sst = ct.strs.length > 0 ? ct.strs[0] : ""; + ct.style = ct.styles.length > 0 ? ct.styles[0] : ""; + ct.defaults = ctext; + delete ct.calcchains; + return ct; +} + +function write_ct(ct, opts, raw)/*:string*/ { + var type2ct/*{[string]:Array}*/ = evert_arr(ct2type); + + var o/*:Array*/ = [], v; + + if(!raw) { + o[o.length] = (XML_HEADER); + o[o.length] = writextag('Types', null, { + 'xmlns': XMLNS.CT, + 'xmlns:xsd': XMLNS.xsd, + 'xmlns:xsi': XMLNS.xsi + }); + o = o.concat([ + ['xml', 'application/xml'], + ['bin', 'application/vnd.ms-excel.sheet.binary.macroEnabled.main'], + ['vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'], + ['data', 'application/vnd.openxmlformats-officedocument.model+data'], + /* from test files */ + ['bmp', 'image/bmp'], + ['png', 'image/png'], + ['gif', 'image/gif'], + ['emf', 'image/x-emf'], + ['wmf', 'image/x-wmf'], + ['jpg', 'image/jpeg'], ['jpeg', 'image/jpeg'], + ['tif', 'image/tiff'], ['tiff', 'image/tiff'], + ['pdf', 'application/pdf'], + ['rels', 'application/vnd.openxmlformats-package.relationships+xml'] + ].map(function(x) { + return writextag('Default', null, {'Extension':x[0], 'ContentType': x[1]}); + })); + } + + /* only write first instance */ + var f1 = function(w) { + if(ct[w] && ct[w].length > 0) { + v = ct[w][0]; + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "":"/") + v, + 'ContentType': CT_LIST[w][opts.bookType] || CT_LIST[w]['xlsx'] + })); + } + }; + + /* book type-specific */ + var f2 = function(w) { + (ct[w]||[]).forEach(function(v) { + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "":"/") + v, + 'ContentType': CT_LIST[w][opts.bookType] || CT_LIST[w]['xlsx'] + })); + }); + }; + + /* standard type */ + var f3 = function(t) { + (ct[t]||[]).forEach(function(v) { + o[o.length] = (writextag('Override', null, { + 'PartName': (v[0] == '/' ? "":"/") + v, + 'ContentType': type2ct[t][0] + })); + }); + }; + + f1('workbooks'); + f2('sheets'); + f2('charts'); + f3('themes'); + ['strs', 'styles'].forEach(f1); + ['coreprops', 'extprops', 'custprops'].forEach(f3); + f3('vba'); + f3('comments'); + f3('threadedcomments'); + f3('drawings'); + f2('metadata'); + f3('people'); + if(!raw && o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); +} +/* 9.3 Relationships */ +var RELS = ({ + WB: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", + SHEET: "http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument", + HLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", + VML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing", + XPATH: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath", + XMISS: "http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing", + XLINK: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink", + CXML: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", + CXMLP: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", + CMNT: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", + CORE_PROPS: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", + EXT_PROPS: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties', + CUST_PROPS: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties', + SST: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings", + STY: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", + THEME: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", + CHART: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", + CHARTEX: "http://schemas.microsoft.com/office/2014/relationships/chartEx", + CS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet", + WS: [ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", + "http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet" + ], + DS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet", + MS: "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet", + IMG: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", + DRAW: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing", + XLMETA: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata", + TCMNT: "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment", + PEOPLE: "http://schemas.microsoft.com/office/2017/10/relationships/person", + CONN: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", + VBA: "http://schemas.microsoft.com/office/2006/relationships/vbaProject" +}/*:any*/); + +/* 9.3.3 Representing Relationships */ +function get_rels_path(file/*:string*/)/*:string*/ { + var n = file.lastIndexOf("/"); + return file.slice(0,n+1) + '_rels/' + file.slice(n+1) + ".rels"; +} + +function parse_rels(data/*:?string*/, currentFilePath/*:string*/) { + var rels = {"!id":{}}; + if (!data) return rels; + if (currentFilePath.charAt(0) !== '/') { + currentFilePath = '/'+currentFilePath; + } + var hash = {}; + + (data.match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + /* 9.3.2.2 OPC_Relationships */ + if (y[0] === '2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); +} + +function add_rels(rels, rId/*:number*/, f, type, relobj, targetmode/*:?string*/)/*:number*/ { + if(!relobj) relobj = {}; + if(!rels['!id']) rels['!id'] = {}; + if(!rels['!idx']) rels['!idx'] = 1; + if(rId < 0) for(rId = rels['!idx']; rels['!id']['rId' + rId]; ++rId){/* empty */} + rels['!idx'] = rId + 1; + relobj.Id = 'rId' + rId; + relobj.Type = type; + relobj.Target = f; + if(targetmode) relobj.TargetMode = targetmode; + else if([RELS.HLINK, RELS.XPATH, RELS.XMISS].indexOf(relobj.Type) > -1) relobj.TargetMode = "External"; + if(rels['!id'][relobj.Id]) throw new Error("Cannot rewrite rId " + rId); + rels['!id'][relobj.Id] = relobj; + rels[('/' + relobj.Target).replace("//","/")] = relobj; + return rId; +} +var CT_ODS = "application/vnd.oasis.opendocument.spreadsheet"; +function parse_manifest(d, opts) { + var str = xlml_normalize(d); + var Rn; + var FEtag; + while (Rn = xlmlregex.exec(str)) + switch (Rn[3]) { + case "manifest": + break; + case "file-entry": + FEtag = parsexmltag(Rn[0], false); + if (FEtag.path == "/" && FEtag.type !== CT_ODS) + throw new Error("This OpenDocument is not a spreadsheet"); + break; + case "encryption-data": + case "algorithm": + case "start-key-generation": + case "key-derivation": + throw new Error("Unsupported ODS Encryption"); + default: + if (opts && opts.WTF) + throw Rn; + } +} +function write_manifest(manifest) { + var o = [XML_HEADER]; + o.push('\n'); + o.push(' \n'); + for (var i = 0; i < manifest.length; ++i) + o.push(' \n'); + o.push(""); + return o.join(""); +} +function write_rdf_type(file, res, tag) { + return [ + ' \n', + ' \n', + " \n" + ].join(""); +} +function write_rdf_has(base, file) { + return [ + ' \n', + ' \n', + " \n" + ].join(""); +} +function write_rdf(rdf) { + var o = [XML_HEADER]; + o.push('\n'); + for (var i = 0; i != rdf.length; ++i) { + o.push(write_rdf_type(rdf[i][0], rdf[i][1])); + o.push(write_rdf_has("", rdf[i][0])); + } + o.push(write_rdf_type("", "Document", "pkg")); + o.push(""); + return o.join(""); +} +function write_meta_ods(wb, opts) { + return 'SheetJS ' + XLSX.version + ""; +} +/* ECMA-376 Part II 11.1 Core Properties Part */ +/* [MS-OSHARED] 2.3.3.2.[1-2].1 (PIDSI/PIDDSI) */ +var CORE_PROPS/*:Array >*/ = [ + ["cp:category", "Category"], + ["cp:contentStatus", "ContentStatus"], + ["cp:keywords", "Keywords"], + ["cp:lastModifiedBy", "LastAuthor"], + ["cp:lastPrinted", "LastPrinted"], + ["cp:revision", "RevNumber"], + ["cp:version", "Version"], + ["dc:creator", "Author"], + ["dc:description", "Comments"], + ["dc:identifier", "Identifier"], + ["dc:language", "Language"], + ["dc:subject", "Subject"], + ["dc:title", "Title"], + ["dcterms:created", "CreatedDate", 'date'], + ["dcterms:modified", "ModifiedDate", 'date'] +]; + +var CORE_PROPS_REGEX/*:Array*/ = /*#__PURE__*/(function() { + var r = new Array(CORE_PROPS.length); + for(var i = 0; i < CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i]; + var g = "(?:"+ f[0].slice(0,f[0].indexOf(":")) +":)"+ f[0].slice(f[0].indexOf(":")+1); + r[i] = new RegExp("<" + g + "[^>]*>([\\s\\S]*?)<\/" + g + ">"); + } + return r; +})(); + +function parse_core_props(data) { + var p = {}; + data = utf8read(data); + + for(var i = 0; i < CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]); + if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]); + if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]); + } + + return p; +} + +function cp_doit(f, g, h, o, p) { + if(p[f] != null || g == null || g === "") return; + p[f] = g; + g = escapexml(g); + o[o.length] = (h ? writextag(f,g,h) : writetag(f,g)); +} + +function write_core_props(cp, _opts) { + var opts = _opts || {}; + var o = [XML_HEADER, writextag('cp:coreProperties', null, { + //'xmlns': XMLNS.CORE_PROPS, + 'xmlns:cp': XMLNS.CORE_PROPS, + 'xmlns:dc': XMLNS.dc, + 'xmlns:dcterms': XMLNS.dcterms, + 'xmlns:dcmitype': XMLNS.dcmitype, + 'xmlns:xsi': XMLNS.xsi + })], p = {}; + if(!cp && !opts.Props) return o.join(""); + + if(cp) { + if(cp.CreatedDate != null) cp_doit("dcterms:created", typeof cp.CreatedDate === "string" ? cp.CreatedDate : write_w3cdtf(cp.CreatedDate, opts.WTF), {"xsi:type":"dcterms:W3CDTF"}, o, p); + if(cp.ModifiedDate != null) cp_doit("dcterms:modified", typeof cp.ModifiedDate === "string" ? cp.ModifiedDate : write_w3cdtf(cp.ModifiedDate, opts.WTF), {"xsi:type":"dcterms:W3CDTF"}, o, p); + } + + for(var i = 0; i != CORE_PROPS.length; ++i) { + var f = CORE_PROPS[i]; + var v = opts.Props && opts.Props[f[1]] != null ? opts.Props[f[1]] : cp ? cp[f[1]] : null; + if(v === true) v = "1"; + else if(v === false) v = "0"; + else if(typeof v == "number") v = String(v); + if(v != null) cp_doit(f[0], v, null, o, p); + } + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); +} +/* 15.2.12.3 Extended File Properties Part */ +/* [MS-OSHARED] 2.3.3.2.[1-2].1 (PIDSI/PIDDSI) */ +var EXT_PROPS/*:Array >*/ = [ + ["Application", "Application", "string"], + ["AppVersion", "AppVersion", "string"], + ["Company", "Company", "string"], + ["DocSecurity", "DocSecurity", "string"], + ["Manager", "Manager", "string"], + ["HyperlinksChanged", "HyperlinksChanged", "bool"], + ["SharedDoc", "SharedDoc", "bool"], + ["LinksUpToDate", "LinksUpToDate", "bool"], + ["ScaleCrop", "ScaleCrop", "bool"], + ["HeadingPairs", "HeadingPairs", "raw"], + ["TitlesOfParts", "TitlesOfParts", "raw"] +]; + +var PseudoPropsPairs = [ + "Worksheets", "SheetNames", + "NamedRanges", "DefinedNames", + "Chartsheets", "ChartNames" +]; +function load_props_pairs(HP/*:string|Array>*/, TOP, props, opts) { + var v = []; + if(typeof HP == "string") v = parseVector(HP, opts); + else for(var j = 0; j < HP.length; ++j) v = v.concat(HP[j].map(function(hp) { return {v:hp}; })); + var parts = (typeof TOP == "string") ? parseVector(TOP, opts).map(function (x) { return x.v; }) : TOP; + var idx = 0, len = 0; + if(parts.length > 0) for(var i = 0; i !== v.length; i += 2) { + len = +(v[i+1].v); + switch(v[i].v) { + case "Worksheets": + case "工作表": + case "Листы": + case "أوراق العمل": + case "ワークシート": + case "×’×œ×™×•× ×•×ª עבודה": + case "Arbeitsblätter": + case "Çalışma Sayfaları": + case "Feuilles de calcul": + case "Fogli di lavoro": + case "Folhas de cálculo": + case "Planilhas": + case "Regneark": + case "Hojas de cálculo": + case "Werkbladen": + props.Worksheets = len; + props.SheetNames = parts.slice(idx, idx + len); + break; + + case "Named Ranges": + case "Rangos con nombre": + case "名前付き一覧": + case "Benannte Bereiche": + case "Navngivne omrÃ¥der": + props.NamedRanges = len; + props.DefinedNames = parts.slice(idx, idx + len); + break; + + case "Charts": + case "Diagramme": + props.Chartsheets = len; + props.ChartNames = parts.slice(idx, idx + len); + break; + } + idx += len; + } +} + +function parse_ext_props(data, p, opts) { + var q = {}; if(!p) p = {}; + data = utf8read(data); + + EXT_PROPS.forEach(function(f) { + var xml = (data.match(matchtag(f[0]))||[])[1]; + switch(f[2]) { + case "string": if(xml) p[f[1]] = unescapexml(xml); break; + case "bool": p[f[1]] = xml === "true"; break; + case "raw": + var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">")); + if(cur && cur.length > 0) q[f[1]] = cur[1]; + break; + } + }); + + if(q.HeadingPairs && q.TitlesOfParts) load_props_pairs(q.HeadingPairs, q.TitlesOfParts, p, opts); + + return p; +} + +function write_ext_props(cp/*::, opts*/)/*:string*/ { + var o/*:Array*/ = [], W = writextag; + if(!cp) cp = {}; + cp.Application = "SheetJS"; + o[o.length] = (XML_HEADER); + o[o.length] = (writextag('Properties', null, { + 'xmlns': XMLNS.EXT_PROPS, + 'xmlns:vt': XMLNS.vt + })); + + EXT_PROPS.forEach(function(f) { + if(cp[f[1]] === undefined) return; + var v; + switch(f[2]) { + case 'string': v = escapexml(String(cp[f[1]])); break; + case 'bool': v = cp[f[1]] ? 'true' : 'false'; break; + } + if(v !== undefined) o[o.length] = (W(f[0], v)); + }); + + /* TODO: HeadingPairs, TitlesOfParts */ + o[o.length] = (W('HeadingPairs', W('vt:vector', W('vt:variant', 'Worksheets')+W('vt:variant', W('vt:i4', String(cp.Worksheets))), {size:2, baseType:"variant"}))); + o[o.length] = (W('TitlesOfParts', W('vt:vector', cp.SheetNames.map(function(s) { return "" + escapexml(s) + ""; }).join(""), {size: cp.Worksheets, baseType:"lpstr"}))); + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); +} +/* 15.2.12.2 Custom File Properties Part */ +var custregex = /<[^>]+>[^<]*/g; +function parse_cust_props(data/*:string*/, opts) { + var p = {}, name = ""; + var m = data.match(custregex); + if(m) for(var i = 0; i != m.length; ++i) { + var x = m[i], y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': name = null; break; + default: if (x.indexOf(''); + var type = toks[0].slice(4), text = toks[1]; + /* 22.4.2.32 (CT_Variant). Omit the binary types from 22.4 (Variant Types) */ + switch(type) { + case 'lpstr': case 'bstr': case 'lpwstr': + p[name] = unescapexml(text); + break; + case 'bool': + p[name] = parsexmlbool(text); + break; + case 'i1': case 'i2': case 'i4': case 'i8': case 'int': case 'uint': + p[name] = parseInt(text, 10); + break; + case 'r4': case 'r8': case 'decimal': + p[name] = parseFloat(text); + break; + case 'filetime': case 'date': + p[name] = parseDate(text); + break; + case 'cy': case 'error': + p[name] = unescapexml(text); + break; + default: + if(type.slice(-1) == '/') break; + if(opts.WTF && typeof console !== 'undefined') console.warn('Unexpected', x, type, toks); + } + } else if(x.slice(0,2) === "2){ o[o.length] = ''; o[1]=o[1].replace("/>",">"); } + return o.join(""); +} +/* Common Name -> XLML Name */ +var XLMLDocPropsMap = { + Title: 'Title', + Subject: 'Subject', + Author: 'Author', + Keywords: 'Keywords', + Comments: 'Description', + LastAuthor: 'LastAuthor', + RevNumber: 'Revision', + Application: 'AppName', + /* TotalTime: 'TotalTime', */ + LastPrinted: 'LastPrinted', + CreatedDate: 'Created', + ModifiedDate: 'LastSaved', + /* Pages */ + /* Words */ + /* Characters */ + Category: 'Category', + /* PresentationFormat */ + Manager: 'Manager', + Company: 'Company', + /* Guid */ + /* HyperlinkBase */ + /* Bytes */ + /* Lines */ + /* Paragraphs */ + /* CharactersWithSpaces */ + AppVersion: 'Version', + + ContentStatus: 'ContentStatus', /* NOTE: missing from schema */ + Identifier: 'Identifier', /* NOTE: missing from schema */ + Language: 'Language' /* NOTE: missing from schema */ +}; +var evert_XLMLDPM; + +function xlml_set_prop(Props, tag/*:string*/, val) { + if(!evert_XLMLDPM) evert_XLMLDPM = evert(XLMLDocPropsMap); + tag = evert_XLMLDPM[tag] || tag; + Props[tag] = val; +} + +function xlml_write_docprops(Props, opts) { + var o/*:Array*/ = []; + keys(XLMLDocPropsMap).map(function(m) { + for(var i = 0; i < CORE_PROPS.length; ++i) if(CORE_PROPS[i][1] == m) return CORE_PROPS[i]; + for(i = 0; i < EXT_PROPS.length; ++i) if(EXT_PROPS[i][1] == m) return EXT_PROPS[i]; + throw m; + }).forEach(function(p) { + if(Props[p[1]] == null) return; + var m = opts && opts.Props && opts.Props[p[1]] != null ? opts.Props[p[1]] : Props[p[1]]; + switch(p[2]) { + case 'date': m = new Date(m).toISOString().replace(/\.\d*Z/,"Z"); break; + } + if(typeof m == 'number') m = String(m); + else if(m === true || m === false) { m = m ? "1" : "0"; } + else if(m instanceof Date) m = new Date(m).toISOString().replace(/\.\d*Z/,""); + o.push(writetag(XLMLDocPropsMap[p[1]] || p[1], m)); + }); + return writextag('DocumentProperties', o.join(""), {xmlns:XLMLNS.o }); +} +function xlml_write_custprops(Props, Custprops/*::, opts*/) { + var BLACKLIST = ["Worksheets","SheetNames"]; + var T = 'CustomDocumentProperties'; + var o/*:Array*/ = []; + if(Props) keys(Props).forEach(function(k) { + /*:: if(!Props) return; */ + if(!Object.prototype.hasOwnProperty.call(Props, k)) return; + for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return; + for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return; + for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return; + + var m = Props[k]; + var t = "string"; + if(typeof m == 'number') { t = "float"; m = String(m); } + else if(m === true || m === false) { t = "boolean"; m = m ? "1" : "0"; } + else m = String(m); + o.push(writextag(escapexmltag(k), m, {"dt:dt":t})); + }); + if(Custprops) keys(Custprops).forEach(function(k) { + /*:: if(!Custprops) return; */ + if(!Object.prototype.hasOwnProperty.call(Custprops, k)) return; + if(Props && Object.prototype.hasOwnProperty.call(Props, k)) return; + var m = Custprops[k]; + var t = "string"; + if(typeof m == 'number') { t = "float"; m = String(m); } + else if(m === true || m === false) { t = "boolean"; m = m ? "1" : "0"; } + else if(m instanceof Date) { t = "dateTime.tz"; m = m.toISOString(); } + else m = String(m); + o.push(writextag(escapexmltag(k), m, {"dt:dt":t})); + }); + return '<' + T + ' xmlns="' + XLMLNS.o + '">' + o.join("") + ''; +} +/* [MS-DTYP] 2.3.3 FILETIME */ +/* [MS-OLEDS] 2.1.3 FILETIME (Packet Version) */ +/* [MS-OLEPS] 2.8 FILETIME (Packet Version) */ +function parse_FILETIME(blob) { + var dwLowDateTime = blob.read_shift(4), dwHighDateTime = blob.read_shift(4); + return new Date(((dwHighDateTime/1e7*Math.pow(2,32) + dwLowDateTime/1e7) - 11644473600)*1000).toISOString().replace(/\.000/,""); +} +function write_FILETIME(time/*:string|Date*/) { + var date = (typeof time == "string") ? new Date(Date.parse(time)) : time; + var t = date.getTime() / 1000 + 11644473600; + var l = t % Math.pow(2,32), h = (t - l) / Math.pow(2,32); + l *= 1e7; h *= 1e7; + var w = (l / Math.pow(2,32)) | 0; + if(w > 0) { l = l % Math.pow(2,32); h += w; } + var o = new_buf(8); o.write_shift(4, l); o.write_shift(4, h); return o; +} + +/* [MS-OSHARED] 2.3.3.1.4 Lpstr */ +function parse_lpstr(blob, type, pad/*:?number*/) { + var start = blob.l; + var str = blob.read_shift(0, 'lpstr-cp'); + if(pad) while((blob.l - start) & 3) ++blob.l; + return str; +} + +/* [MS-OSHARED] 2.3.3.1.6 Lpwstr */ +function parse_lpwstr(blob, type, pad) { + var str = blob.read_shift(0, 'lpwstr'); + if(pad) blob.l += (4 - ((str.length+1) & 3)) & 3; + return str; +} + + +/* [MS-OSHARED] 2.3.3.1.11 VtString */ +/* [MS-OSHARED] 2.3.3.1.12 VtUnalignedString */ +function parse_VtStringBase(blob, stringType, pad) { + if(stringType === 0x1F /*VT_LPWSTR*/) return parse_lpwstr(blob); + return parse_lpstr(blob, stringType, pad); +} + +function parse_VtString(blob, t/*:number*/, pad/*:?boolean*/) { return parse_VtStringBase(blob, t, pad === false ? 0: 4); } +function parse_VtUnalignedString(blob, t/*:number*/) { if(!t) throw new Error("VtUnalignedString must have positive length"); return parse_VtStringBase(blob, t, 0); } + +/* [MS-OSHARED] 2.3.3.1.7 VtVecLpwstrValue */ +function parse_VtVecLpwstrValue(blob)/*:Array*/ { + var length = blob.read_shift(4); + var ret/*:Array*/ = []; + for(var i = 0; i != length; ++i) { + var start = blob.l; + ret[i] = blob.read_shift(0, 'lpwstr').replace(chr0,''); + if((blob.l - start) & 0x02) blob.l += 2; + } + return ret; +} + +/* [MS-OSHARED] 2.3.3.1.9 VtVecUnalignedLpstrValue */ +function parse_VtVecUnalignedLpstrValue(blob)/*:Array*/ { + var length = blob.read_shift(4); + var ret/*:Array*/ = []; + for(var i = 0; i != length; ++i) ret[i] = blob.read_shift(0, 'lpstr-cp').replace(chr0,''); + return ret; +} + + +/* [MS-OSHARED] 2.3.3.1.13 VtHeadingPair */ +function parse_VtHeadingPair(blob) { + var start = blob.l; + var headingString = parse_TypedPropertyValue(blob, VT_USTR); + if(blob[blob.l] == 0x00 && blob[blob.l+1] == 0x00 && ((blob.l - start) & 0x02)) blob.l += 2; + var headerParts = parse_TypedPropertyValue(blob, VT_I4); + return [headingString, headerParts]; +} + +/* [MS-OSHARED] 2.3.3.1.14 VtVecHeadingPairValue */ +function parse_VtVecHeadingPairValue(blob) { + var cElements = blob.read_shift(4); + var out = []; + for(var i = 0; i < cElements / 2; ++i) out.push(parse_VtHeadingPair(blob)); + return out; +} + +/* [MS-OLEPS] 2.18.1 Dictionary (uses 2.17, 2.16) */ +function parse_dictionary(blob,CodePage) { + var cnt = blob.read_shift(4); + var dict/*:{[number]:string}*/ = ({}/*:any*/); + for(var j = 0; j != cnt; ++j) { + var pid = blob.read_shift(4); + var len = blob.read_shift(4); + dict[pid] = blob.read_shift(len, (CodePage === 0x4B0 ?'utf16le':'utf8')).replace(chr0,'').replace(chr1,'!'); + if(CodePage === 0x4B0 && (len % 2)) blob.l += 2; + } + if(blob.l & 3) blob.l = (blob.l>>2+1)<<2; + return dict; +} + +/* [MS-OLEPS] 2.9 BLOB */ +function parse_BLOB(blob) { + var size = blob.read_shift(4); + var bytes = blob.slice(blob.l,blob.l+size); + blob.l += size; + if((size & 3) > 0) blob.l += (4 - (size & 3)) & 3; + return bytes; +} + +/* [MS-OLEPS] 2.11 ClipboardData */ +function parse_ClipboardData(blob) { + // TODO + var o = {}; + o.Size = blob.read_shift(4); + //o.Format = blob.read_shift(4); + blob.l += o.Size + 3 - (o.Size - 1) % 4; + return o; +} + +/* [MS-OLEPS] 2.15 TypedPropertyValue */ +function parse_TypedPropertyValue(blob, type/*:number*/, _opts)/*:any*/ { + var t = blob.read_shift(2), ret, opts = _opts||{}; + blob.l += 2; + if(type !== VT_VARIANT) + if(t !== type && VT_CUSTOM.indexOf(type)===-1 && !((type & 0xFFFE) == 0x101E && (t & 0xFFFE) == 0x101E)) throw new Error('Expected type ' + type + ' saw ' + t); + switch(type === VT_VARIANT ? t : type) { + case 0x02 /*VT_I2*/: ret = blob.read_shift(2, 'i'); if(!opts.raw) blob.l += 2; return ret; + case 0x03 /*VT_I4*/: ret = blob.read_shift(4, 'i'); return ret; + case 0x0B /*VT_BOOL*/: return blob.read_shift(4) !== 0x0; + case 0x13 /*VT_UI4*/: ret = blob.read_shift(4); return ret; + case 0x1E /*VT_LPSTR*/: return parse_lpstr(blob, t, 4).replace(chr0,''); + case 0x1F /*VT_LPWSTR*/: return parse_lpwstr(blob); + case 0x40 /*VT_FILETIME*/: return parse_FILETIME(blob); + case 0x41 /*VT_BLOB*/: return parse_BLOB(blob); + case 0x47 /*VT_CF*/: return parse_ClipboardData(blob); + case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw).replace(chr0,''); + case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t/*, 4*/).replace(chr0,''); + case 0x100C /*VT_VECTOR|VT_VARIANT*/: return parse_VtVecHeadingPairValue(blob); + case 0x101E /*VT_VECTOR|VT_LPSTR*/: + case 0x101F /*VT_VECTOR|VT_LPWSTR*/: + return t == 0x101F ? parse_VtVecLpwstrValue(blob) : parse_VtVecUnalignedLpstrValue(blob); + default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + t); + } +} +function write_TypedPropertyValue(type/*:number*/, value) { + var o = new_buf(4), p = new_buf(4); + o.write_shift(4, type == 0x50 ? 0x1F : type); + switch(type) { + case 0x03 /*VT_I4*/: p.write_shift(-4, value); break; + case 0x05 /*VT_I4*/: p = new_buf(8); p.write_shift(8, value, 'f'); break; + case 0x0B /*VT_BOOL*/: p.write_shift(4, value ? 0x01 : 0x00); break; + case 0x40 /*VT_FILETIME*/: /*:: if(typeof value !== "string" && !(value instanceof Date)) throw "unreachable"; */ p = write_FILETIME(value); break; + case 0x1F /*VT_LPWSTR*/: + case 0x50 /*VT_STRING*/: + /*:: if(typeof value !== "string") throw "unreachable"; */ + p = new_buf(4 + 2 * (value.length + 1) + (value.length % 2 ? 0 : 2)); + p.write_shift(4, value.length + 1); + p.write_shift(0, value, "dbcs"); + while(p.l != p.length) p.write_shift(1, 0); + break; + default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + value); + } + return bconcat([o, p]); +} + +/* [MS-OLEPS] 2.20 PropertySet */ +function parse_PropertySet(blob, PIDSI) { + var start_addr = blob.l; + var size = blob.read_shift(4); + var NumProps = blob.read_shift(4); + var Props = [], i = 0; + var CodePage = 0; + var Dictionary = -1, DictObj/*:{[number]:string}*/ = ({}/*:any*/); + for(i = 0; i != NumProps; ++i) { + var PropID = blob.read_shift(4); + var Offset = blob.read_shift(4); + Props[i] = [PropID, Offset + start_addr]; + } + Props.sort(function(x,y) { return x[1] - y[1]; }); + var PropH = {}; + for(i = 0; i != NumProps; ++i) { + if(blob.l !== Props[i][1]) { + var fail = true; + if(i>0 && PIDSI) switch(PIDSI[Props[i-1][0]].t) { + case 0x02 /*VT_I2*/: if(blob.l+2 === Props[i][1]) { blob.l+=2; fail = false; } break; + case 0x50 /*VT_STRING*/: if(blob.l <= Props[i][1]) { blob.l=Props[i][1]; fail = false; } break; + case 0x100C /*VT_VECTOR|VT_VARIANT*/: if(blob.l <= Props[i][1]) { blob.l=Props[i][1]; fail = false; } break; + } + if((!PIDSI||i==0) && blob.l <= Props[i][1]) { fail=false; blob.l = Props[i][1]; } + if(fail) throw new Error("Read Error: Expected address " + Props[i][1] + ' at ' + blob.l + ' :' + i); + } + if(PIDSI) { + if(Props[i][0] == 0 && Props.length > i+1 && Props[i][1] == Props[i+1][1]) continue; // R9 + var piddsi = PIDSI[Props[i][0]]; + PropH[piddsi.n] = parse_TypedPropertyValue(blob, piddsi.t, {raw:true}); + if(piddsi.p === 'version') PropH[piddsi.n] = String(PropH[piddsi.n] >> 16) + "." + ("0000" + String(PropH[piddsi.n] & 0xFFFF)).slice(-4); + if(piddsi.n == "CodePage") switch(PropH[piddsi.n]) { + case 0: PropH[piddsi.n] = 1252; + /* falls through */ + case 874: + case 932: + case 936: + case 949: + case 950: + case 1250: + case 1251: + case 1253: + case 1254: + case 1255: + case 1256: + case 1257: + case 1258: + case 10000: + case 1200: + case 1201: + case 1252: + case 65000: case -536: + case 65001: case -535: + set_cp(CodePage = (PropH[piddsi.n]>>>0) & 0xFFFF); break; + default: throw new Error("Unsupported CodePage: " + PropH[piddsi.n]); + } + } else { + if(Props[i][0] === 0x1) { + CodePage = PropH.CodePage = (parse_TypedPropertyValue(blob, VT_I2)/*:number*/); + set_cp(CodePage); + if(Dictionary !== -1) { + var oldpos = blob.l; + blob.l = Props[Dictionary][1]; + DictObj = parse_dictionary(blob,CodePage); + blob.l = oldpos; + } + } else if(Props[i][0] === 0) { + if(CodePage === 0) { Dictionary = i; blob.l = Props[i+1][1]; continue; } + DictObj = parse_dictionary(blob,CodePage); + } else { + var name = DictObj[Props[i][0]]; + var val; + /* [MS-OSHARED] 2.3.3.2.3.1.2 + PROPVARIANT */ + switch(blob[blob.l]) { + case 0x41 /*VT_BLOB*/: blob.l += 4; val = parse_BLOB(blob); break; + case 0x1E /*VT_LPSTR*/: blob.l += 4; val = parse_VtString(blob, blob[blob.l-4]).replace(/\u0000+$/,""); break; + case 0x1F /*VT_LPWSTR*/: blob.l += 4; val = parse_VtString(blob, blob[blob.l-4]).replace(/\u0000+$/,""); break; + case 0x03 /*VT_I4*/: blob.l += 4; val = blob.read_shift(4, 'i'); break; + case 0x13 /*VT_UI4*/: blob.l += 4; val = blob.read_shift(4); break; + case 0x05 /*VT_R8*/: blob.l += 4; val = blob.read_shift(8, 'f'); break; + case 0x0B /*VT_BOOL*/: blob.l += 4; val = parsebool(blob, 4); break; + case 0x40 /*VT_FILETIME*/: blob.l += 4; val = parseDate(parse_FILETIME(blob)); break; + default: throw new Error("unparsed value: " + blob[blob.l]); + } + PropH[name] = val; + } + } + } + blob.l = start_addr + size; /* step ahead to skip padding */ + return PropH; +} +var XLSPSSkip = [ "CodePage", "Thumbnail", "_PID_LINKBASE", "_PID_HLINKS", "SystemIdentifier", "FMTID" ]; +function guess_property_type(val/*:any*/)/*:number*/ { + switch(typeof val) { + case "boolean": return 0x0B; + case "number": return ((val|0)==val) ? 0x03 : 0x05; + case "string": return 0x1F; + case "object": if(val instanceof Date) return 0x40; break; + } + return -1; +} +function write_PropertySet(entries, RE, PIDSI) { + var hdr = new_buf(8), piao = [], prop = []; + var sz = 8, i = 0; + + var pr = new_buf(8), pio = new_buf(8); + pr.write_shift(4, 0x0002); + pr.write_shift(4, 0x04B0); + pio.write_shift(4, 0x0001); + prop.push(pr); piao.push(pio); + sz += 8 + pr.length; + + if(!RE) { + pio = new_buf(8); + pio.write_shift(4, 0); + piao.unshift(pio); + + var bufs = [new_buf(4)]; + bufs[0].write_shift(4, entries.length); + for(i = 0; i < entries.length; ++i) { + var value = entries[i][0]; + pr = new_buf(4 + 4 + 2 * (value.length + 1) + (value.length % 2 ? 0 : 2)); + pr.write_shift(4, i+2); + pr.write_shift(4, value.length + 1); + pr.write_shift(0, value, "dbcs"); + while(pr.l != pr.length) pr.write_shift(1, 0); + bufs.push(pr); + } + pr = bconcat(bufs); + prop.unshift(pr); + sz += 8 + pr.length; + } + + for(i = 0; i < entries.length; ++i) { + if(RE && !RE[entries[i][0]]) continue; + if(XLSPSSkip.indexOf(entries[i][0]) > -1 || PseudoPropsPairs.indexOf(entries[i][0]) > -1) continue; + if(entries[i][1] == null) continue; + + var val = entries[i][1], idx = 0; + if(RE) { + idx = +RE[entries[i][0]]; + var pinfo = (PIDSI/*:: || {}*/)[idx]/*:: || {} */; + if(pinfo.p == "version" && typeof val == "string") { + /*:: if(typeof val !== "string") throw "unreachable"; */ + var arr = val.split("."); + val = ((+arr[0])<<16) + ((+arr[1])||0); + } + pr = write_TypedPropertyValue(pinfo.t, val); + } else { + var T = guess_property_type(val); + if(T == -1) { T = 0x1F; val = String(val); } + pr = write_TypedPropertyValue(T, val); + } + prop.push(pr); + + pio = new_buf(8); + pio.write_shift(4, !RE ? 2+i : idx); + piao.push(pio); + + sz += 8 + pr.length; + } + + var w = 8 * (prop.length + 1); + for(i = 0; i < prop.length; ++i) { piao[i].write_shift(4, w); w += prop[i].length; } + hdr.write_shift(4, sz); + hdr.write_shift(4, prop.length); + return bconcat([hdr].concat(piao).concat(prop)); +} + +/* [MS-OLEPS] 2.21 PropertySetStream */ +function parse_PropertySetStream(file, PIDSI, clsid) { + var blob = file.content; + if(!blob) return ({}/*:any*/); + prep_blob(blob, 0); + + var NumSets, FMTID0, FMTID1, Offset0, Offset1 = 0; + blob.chk('feff', 'Byte Order: '); + + /*var vers = */blob.read_shift(2); // TODO: check version + var SystemIdentifier = blob.read_shift(4); + var CLSID = blob.read_shift(16); + if(CLSID !== CFB.utils.consts.HEADER_CLSID && CLSID !== clsid) throw new Error("Bad PropertySet CLSID " + CLSID); + NumSets = blob.read_shift(4); + if(NumSets !== 1 && NumSets !== 2) throw new Error("Unrecognized #Sets: " + NumSets); + FMTID0 = blob.read_shift(16); Offset0 = blob.read_shift(4); + + if(NumSets === 1 && Offset0 !== blob.l) throw new Error("Length mismatch: " + Offset0 + " !== " + blob.l); + else if(NumSets === 2) { FMTID1 = blob.read_shift(16); Offset1 = blob.read_shift(4); } + var PSet0 = parse_PropertySet(blob, PIDSI); + + var rval = ({ SystemIdentifier: SystemIdentifier }/*:any*/); + for(var y in PSet0) rval[y] = PSet0[y]; + //rval.blob = blob; + rval.FMTID = FMTID0; + //rval.PSet0 = PSet0; + if(NumSets === 1) return rval; + if(Offset1 - blob.l == 2) blob.l += 2; + if(blob.l !== Offset1) throw new Error("Length mismatch 2: " + blob.l + " !== " + Offset1); + var PSet1; + try { PSet1 = parse_PropertySet(blob, null); } catch(e) {/* empty */} + for(y in PSet1) rval[y] = PSet1[y]; + rval.FMTID = [FMTID0, FMTID1]; // TODO: verify FMTID0/1 + return rval; +} +function write_PropertySetStream(entries, clsid, RE, PIDSI/*:{[key:string|number]:any}*/, entries2/*:?any*/, clsid2/*:?any*/) { + var hdr = new_buf(entries2 ? 68 : 48); + var bufs = [hdr]; + hdr.write_shift(2, 0xFFFE); + hdr.write_shift(2, 0x0000); /* TODO: type 1 props */ + hdr.write_shift(4, 0x32363237); + hdr.write_shift(16, CFB.utils.consts.HEADER_CLSID, "hex"); + hdr.write_shift(4, (entries2 ? 2 : 1)); + hdr.write_shift(16, clsid, "hex"); + hdr.write_shift(4, (entries2 ? 68 : 48)); + var ps0 = write_PropertySet(entries, RE, PIDSI); + bufs.push(ps0); + + if(entries2) { + var ps1 = write_PropertySet(entries2, null, null); + hdr.write_shift(16, clsid2, "hex"); + hdr.write_shift(4, 68 + ps0.length); + bufs.push(ps1); + } + return bconcat(bufs); +} + +function parsenoop2(blob, length) { blob.read_shift(length); return null; } +function writezeroes(n, o) { if(!o) o=new_buf(n); for(var j=0; j= 12 ? 2 : 1); + var encoding = 'sbcs-cont'; + var cp = current_codepage; + if(opts && opts.biff >= 8) current_codepage = 1200; + if(!opts || opts.biff == 8 ) { + var fHighByte = blob.read_shift(1); + if(fHighByte) { encoding = 'dbcs-cont'; } + } else if(opts.biff == 12) { + encoding = 'wstr'; + } + if(opts.biff >= 2 && opts.biff <= 5) encoding = 'cpstr'; + var o = cch ? blob.read_shift(cch, encoding) : ""; + current_codepage = cp; + return o; +} + +/* 2.5.293 XLUnicodeRichExtendedString */ +function parse_XLUnicodeRichExtendedString(blob) { + var cp = current_codepage; + current_codepage = 1200; + var cch = blob.read_shift(2), flags = blob.read_shift(1); + var /*fHighByte = flags & 0x1,*/ fExtSt = flags & 0x4, fRichSt = flags & 0x8; + var width = 1 + (flags & 0x1); // 0x0 -> utf8, 0x1 -> dbcs + var cRun = 0, cbExtRst; + var z = {}; + if(fRichSt) cRun = blob.read_shift(2); + if(fExtSt) cbExtRst = blob.read_shift(4); + var encoding = width == 2 ? 'dbcs-cont' : 'sbcs-cont'; + var msg = cch === 0 ? "" : blob.read_shift(cch, encoding); + if(fRichSt) blob.l += 4 * cRun; //TODO: parse this + if(fExtSt) blob.l += cbExtRst; //TODO: parse this + z.t = msg; + if(!fRichSt) { z.raw = "" + z.t + ""; z.r = z.t; } + current_codepage = cp; + return z; +} +function write_XLUnicodeRichExtendedString(xlstr/*:: :XLString, opts*/) { + var str = (xlstr.t||""), nfmts = 1; + + var hdr = new_buf(3 + (nfmts > 1 ? 2 : 0)); + hdr.write_shift(2, str.length); + hdr.write_shift(1, (nfmts > 1 ? 0x08 : 0x00) | 0x01); + if(nfmts > 1) hdr.write_shift(2, nfmts); + + var otext = new_buf(2 * str.length); + otext.write_shift(2 * str.length, str, 'utf16le'); + + var out = [hdr, otext]; + + return bconcat(out); +} + +/* 2.5.296 XLUnicodeStringNoCch */ +function parse_XLUnicodeStringNoCch(blob, cch, opts) { + var retval; + if(opts) { + if(opts.biff >= 2 && opts.biff <= 5) return blob.read_shift(cch, 'cpstr'); + if(opts.biff >= 12) return blob.read_shift(cch, 'dbcs-cont'); + } + var fHighByte = blob.read_shift(1); + if(fHighByte===0) { retval = blob.read_shift(cch, 'sbcs-cont'); } + else { retval = blob.read_shift(cch, 'dbcs-cont'); } + return retval; +} + +/* 2.5.294 XLUnicodeString */ +function parse_XLUnicodeString(blob, length, opts) { + var cch = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + if(cch === 0) { blob.l++; return ""; } + return parse_XLUnicodeStringNoCch(blob, cch, opts); +} +/* BIFF5 override */ +function parse_XLUnicodeString2(blob, length, opts) { + if(opts.biff > 5) return parse_XLUnicodeString(blob, length, opts); + var cch = blob.read_shift(1); + if(cch === 0) { blob.l++; return ""; } + return blob.read_shift(cch, (opts.biff <= 4 || !blob.lens ) ? 'cpstr' : 'sbcs-cont'); +} +/* TODO: BIFF5 and lower, codepage awareness */ +function write_XLUnicodeString(str, opts, o) { + if(!o) o = new_buf(3 + 2 * str.length); + o.write_shift(2, str.length); + o.write_shift(1, 1); + o.write_shift(31, str, 'utf16le'); + return o; +} + +/* [MS-XLS] 2.5.61 ControlInfo */ +function parse_ControlInfo(blob/*::, length, opts*/) { + var flags = blob.read_shift(1); + blob.l++; + var accel = blob.read_shift(2); + blob.l += 2; + return [flags, accel]; +} + +/* [MS-OSHARED] 2.3.7.6 URLMoniker TODO: flags */ +function parse_URLMoniker(blob/*::, length, opts*/) { + var len = blob.read_shift(4), start = blob.l; + var extra = false; + if(len > 24) { + /* look ahead */ + blob.l += len - 24; + if(blob.read_shift(16) === "795881f43b1d7f48af2c825dc4852763") extra = true; + blob.l = start; + } + var url = blob.read_shift((extra?len-24:len)>>1, 'utf16le').replace(chr0,""); + if(extra) blob.l += 24; + return url; +} + +/* [MS-OSHARED] 2.3.7.8 FileMoniker TODO: all fields */ +function parse_FileMoniker(blob/*::, length*/) { + var cAnti = blob.read_shift(2); + var preamble = ""; while(cAnti-- > 0) preamble += "../"; + var ansiPath = blob.read_shift(0, 'lpstr-ansi'); + blob.l += 2; //var endServer = blob.read_shift(2); + if(blob.read_shift(2) != 0xDEAD) throw new Error("Bad FileMoniker"); + var sz = blob.read_shift(4); + if(sz === 0) return preamble + ansiPath.replace(/\\/g,"/"); + var bytes = blob.read_shift(4); + if(blob.read_shift(2) != 3) throw new Error("Bad FileMoniker"); + var unicodePath = blob.read_shift(bytes>>1, 'utf16le').replace(chr0,""); + return preamble + unicodePath; +} + +/* [MS-OSHARED] 2.3.7.2 HyperlinkMoniker TODO: all the monikers */ +function parse_HyperlinkMoniker(blob, length) { + var clsid = blob.read_shift(16); length -= 16; + switch(clsid) { + case "e0c9ea79f9bace118c8200aa004ba90b": return parse_URLMoniker(blob, length); + case "0303000000000000c000000000000046": return parse_FileMoniker(blob, length); + default: throw new Error("Unsupported Moniker " + clsid); + } +} + +/* [MS-OSHARED] 2.3.7.9 HyperlinkString */ +function parse_HyperlinkString(blob/*::, length*/) { + var len = blob.read_shift(4); + var o = len > 0 ? blob.read_shift(len, 'utf16le').replace(chr0, "") : ""; + return o; +} +function write_HyperlinkString(str/*:string*/, o) { + if(!o) o = new_buf(6 + str.length * 2); + o.write_shift(4, 1 + str.length); + for(var i = 0; i < str.length; ++i) o.write_shift(2, str.charCodeAt(i)); + o.write_shift(2, 0); + return o; +} + +/* [MS-OSHARED] 2.3.7.1 Hyperlink Object */ +function parse_Hyperlink(blob, length)/*:Hyperlink*/ { + var end = blob.l + length; + var sVer = blob.read_shift(4); + if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer); + var flags = blob.read_shift(2); + blob.l += 2; + var displayName, targetFrameName, moniker, oleMoniker, Loc="", guid, fileTime; + if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l); + if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l); + if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l); + if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l); + if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l); + if(flags & 0x0020) guid = blob.read_shift(16); + if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/); + blob.l = end; + var target = targetFrameName||moniker||oleMoniker||""; + if(target && Loc) target+="#"+Loc; + if(!target) target = "#" + Loc; + if((flags & 0x0002) && target.charAt(0) == "/" && target.charAt(1) != "/") target = "file://" + target; + var out = ({Target:target}/*:any*/); + if(guid) out.guid = guid; + if(fileTime) out.time = fileTime; + if(displayName) out.Tooltip = displayName; + return out; +} +function write_Hyperlink(hl) { + var out = new_buf(512), i = 0; + var Target = hl.Target; + if(Target.slice(0,7) == "file://") Target = Target.slice(7); + var hashidx = Target.indexOf("#"); + var F = hashidx > -1 ? 0x1f : 0x17; + switch(Target.charAt(0)) { case "#": F=0x1c; break; case ".": F&=~2; break; } + out.write_shift(4,2); out.write_shift(4, F); + var data = [8,6815827,6619237,4849780,83]; for(i = 0; i < data.length; ++i) out.write_shift(4, data[i]); + if(F == 0x1C) { + Target = Target.slice(1); + write_HyperlinkString(Target, out); + } else if(F & 0x02) { + data = "e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "); + for(i = 0; i < data.length; ++i) out.write_shift(1, parseInt(data[i], 16)); + var Pretarget = hashidx > -1 ? Target.slice(0, hashidx) : Target; + out.write_shift(4, 2*(Pretarget.length + 1)); + for(i = 0; i < Pretarget.length; ++i) out.write_shift(2, Pretarget.charCodeAt(i)); + out.write_shift(2, 0); + if(F & 0x08) write_HyperlinkString(hashidx > -1 ? Target.slice(hashidx+1): "", out); + } else { + data = "03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "); + for(i = 0; i < data.length; ++i) out.write_shift(1, parseInt(data[i], 16)); + var P = 0; + while(Target.slice(P*3,P*3+3)=="../"||Target.slice(P*3,P*3+3)=="..\\") ++P; + out.write_shift(2, P); + out.write_shift(4, Target.length - 3 * P + 1); + for(i = 0; i < Target.length - 3 * P; ++i) out.write_shift(1, Target.charCodeAt(i + 3 * P) & 0xFF); + out.write_shift(1, 0); + out.write_shift(2, 0xFFFF); + out.write_shift(2, 0xDEAD); + for(i = 0; i < 6; ++i) out.write_shift(4, 0); + } + return out.slice(0, out.l); +} + +/* 2.5.178 LongRGBA */ +function parse_LongRGBA(blob/*::, length*/) { var r = blob.read_shift(1), g = blob.read_shift(1), b = blob.read_shift(1), a = blob.read_shift(1); return [r,g,b,a]; } + +/* 2.5.177 LongRGB */ +function parse_LongRGB(blob, length) { var x = parse_LongRGBA(blob, length); x[3] = 0; return x; } + + +/* [MS-XLS] 2.5.19 */ +function parse_XLSCell(blob, length, opts)/*:Cell*/ { + var rw = blob.read_shift(2); // 0-indexed + var col = blob.read_shift(2); + var ret = ({r:rw, c:col, ixfe:0}/*:any*/); + if(opts && opts.biff == 2 || length == 7) { + /* TODO: pass back flags */ + var flags = blob.read_shift(1); + ret.ixfe = flags & 0x3F; + blob.l += 2; + /* + var ifntifmt = blob.read_shift(1); + var ifmt = ifntifmt & 0x3f, ifnt = ifntifmt >> 6; + var flags3 = blob.read_shift(1); + */ + } else ret.ixfe = blob.read_shift(2); + return ret; +} +function write_XLSCell(R/*:number*/, C/*:number*/, ixfe/*:?number*/, o) { + if(!o) o = new_buf(6); + o.write_shift(2, R); + o.write_shift(2, C); + o.write_shift(2, ixfe||0); + return o; +} + +/* [MS-XLS] 2.5.134 */ +function parse_frtHeader(blob) { + var rt = blob.read_shift(2); + var flags = blob.read_shift(2); // TODO: parse these flags + blob.l += 8; + return {type: rt, flags: flags}; +} + + + +function parse_OptXLUnicodeString(blob, length, opts) { return length === 0 ? "" : parse_XLUnicodeString2(blob, length, opts); } + +/* [MS-XLS] 2.5.344 */ +function parse_XTI(blob, length, opts) { + var w = opts.biff > 8 ? 4 : 2; + var iSupBook = blob.read_shift(w), itabFirst = blob.read_shift(w,'i'), itabLast = blob.read_shift(w,'i'); + return [iSupBook, itabFirst, itabLast]; +} + +/* [MS-XLS] 2.5.218 */ +function parse_RkRec(blob) { + var ixfe = blob.read_shift(2); + var RK = parse_RkNumber(blob); + return [ixfe, RK]; +} + +/* [MS-XLS] 2.5.1 */ +function parse_AddinUdf(blob, length, opts) { + blob.l += 4; length -= 4; + var l = blob.l + length; + var udfName = parse_ShortXLUnicodeString(blob, length, opts); + var cb = blob.read_shift(2); + l -= blob.l; + if(cb !== l) throw new Error("Malformed AddinUdf: padding = " + l + " != " + cb); + blob.l += cb; + return udfName; +} + +/* [MS-XLS] 2.5.209 TODO: Check sizes */ +function parse_Ref8U(blob/*::, length*/) { + var rwFirst = blob.read_shift(2); + var rwLast = blob.read_shift(2); + var colFirst = blob.read_shift(2); + var colLast = blob.read_shift(2); + return {s:{c:colFirst, r:rwFirst}, e:{c:colLast,r:rwLast}}; +} +function write_Ref8U(r/*:Range*/, o) { + if(!o) o = new_buf(8); + o.write_shift(2, r.s.r); + o.write_shift(2, r.e.r); + o.write_shift(2, r.s.c); + o.write_shift(2, r.e.c); + return o; +} + +/* [MS-XLS] 2.5.211 */ +function parse_RefU(blob/*::, length*/) { + var rwFirst = blob.read_shift(2); + var rwLast = blob.read_shift(2); + var colFirst = blob.read_shift(1); + var colLast = blob.read_shift(1); + return {s:{c:colFirst, r:rwFirst}, e:{c:colLast,r:rwLast}}; +} + +/* [MS-XLS] 2.5.207 */ +var parse_Ref = parse_RefU; + +/* [MS-XLS] 2.5.143 */ +function parse_FtCmo(blob/*::, length*/) { + blob.l += 4; + var ot = blob.read_shift(2); + var id = blob.read_shift(2); + var flags = blob.read_shift(2); + blob.l+=12; + return [id, ot, flags]; +} + +/* [MS-XLS] 2.5.149 */ +function parse_FtNts(blob) { + var out = {}; + blob.l += 4; + blob.l += 16; // GUID TODO + out.fSharedNote = blob.read_shift(2); + blob.l += 4; + return out; +} + +/* [MS-XLS] 2.5.142 */ +function parse_FtCf(blob) { + var out = {}; + blob.l += 4; + blob.cf = blob.read_shift(2); + return out; +} + +/* [MS-XLS] 2.5.140 - 2.5.154 and friends */ +function parse_FtSkip(blob) { blob.l += 2; blob.l += blob.read_shift(2); } +var FtTab = { + /*::[*/0x00/*::]*/: parse_FtSkip, /* FtEnd */ + /*::[*/0x04/*::]*/: parse_FtSkip, /* FtMacro */ + /*::[*/0x05/*::]*/: parse_FtSkip, /* FtButton */ + /*::[*/0x06/*::]*/: parse_FtSkip, /* FtGmo */ + /*::[*/0x07/*::]*/: parse_FtCf, /* FtCf */ + /*::[*/0x08/*::]*/: parse_FtSkip, /* FtPioGrbit */ + /*::[*/0x09/*::]*/: parse_FtSkip, /* FtPictFmla */ + /*::[*/0x0A/*::]*/: parse_FtSkip, /* FtCbls */ + /*::[*/0x0B/*::]*/: parse_FtSkip, /* FtRbo */ + /*::[*/0x0C/*::]*/: parse_FtSkip, /* FtSbs */ + /*::[*/0x0D/*::]*/: parse_FtNts, /* FtNts */ + /*::[*/0x0E/*::]*/: parse_FtSkip, /* FtSbsFmla */ + /*::[*/0x0F/*::]*/: parse_FtSkip, /* FtGboData */ + /*::[*/0x10/*::]*/: parse_FtSkip, /* FtEdoData */ + /*::[*/0x11/*::]*/: parse_FtSkip, /* FtRboData */ + /*::[*/0x12/*::]*/: parse_FtSkip, /* FtCblsData */ + /*::[*/0x13/*::]*/: parse_FtSkip, /* FtLbsData */ + /*::[*/0x14/*::]*/: parse_FtSkip, /* FtCblsFmla */ + /*::[*/0x15/*::]*/: parse_FtCmo +}; +function parse_FtArray(blob, length/*::, ot*/) { + var tgt = blob.l + length; + var fts = []; + while(blob.l < tgt) { + var ft = blob.read_shift(2); + blob.l-=2; + try { + fts[ft] = FtTab[ft](blob, tgt - blob.l); + } catch(e) { blob.l = tgt; return fts; } + } + if(blob.l != tgt) blob.l = tgt; //throw new Error("bad Object Ft-sequence"); + return fts; +} + +/* --- 2.4 Records --- */ + +/* [MS-XLS] 2.4.21 */ +function parse_BOF(blob, length) { + var o = {BIFFVer:0, dt:0}; + o.BIFFVer = blob.read_shift(2); length -= 2; + if(length >= 2) { o.dt = blob.read_shift(2); blob.l -= 2; } + switch(o.BIFFVer) { + case 0x0600: /* BIFF8 */ + case 0x0500: /* BIFF5 */ + case 0x0400: /* BIFF4 */ + case 0x0300: /* BIFF3 */ + case 0x0200: /* BIFF2 */ + case 0x0002: case 0x0007: /* BIFF2 */ + break; + default: if(length > 6) throw new Error("Unexpected BIFF Ver " + o.BIFFVer); + } + + blob.read_shift(length); + return o; +} +function write_BOF(wb/*:Workbook*/, t/*:number*/, o) { + var h = 0x0600, w = 16; + switch(o.bookType) { + case 'biff8': break; + case 'biff5': h = 0x0500; w = 8; break; + case 'biff4': h = 0x0004; w = 6; break; + case 'biff3': h = 0x0003; w = 6; break; + case 'biff2': h = 0x0002; w = 4; break; + case 'xla': break; + default: throw new Error("unsupported BIFF version"); + } + var out = new_buf(w); + out.write_shift(2, h); + out.write_shift(2, t); + if(w > 4) out.write_shift(2, 0x7262); + if(w > 6) out.write_shift(2, 0x07CD); + if(w > 8) { + out.write_shift(2, 0xC009); + out.write_shift(2, 0x0001); + out.write_shift(2, 0x0706); + out.write_shift(2, 0x0000); + } + return out; +} + + +/* [MS-XLS] 2.4.146 */ +function parse_InterfaceHdr(blob, length) { + if(length === 0) return 0x04b0; + if((blob.read_shift(2))!==0x04b0){/* empty */} + return 0x04b0; +} + + +/* [MS-XLS] 2.4.349 */ +function parse_WriteAccess(blob, length, opts) { + if(opts.enc) { blob.l += length; return ""; } + var l = blob.l; + // TODO: make sure XLUnicodeString doesnt overrun + var UserName = parse_XLUnicodeString2(blob, 0, opts); + blob.read_shift(length + l - blob.l); + return UserName; +} +function write_WriteAccess(s/*:string*/, opts) { + var b8 = !opts || opts.biff == 8; + var o = new_buf(b8 ? 112 : 54); + o.write_shift(opts.biff == 8 ? 2 : 1, 7); + if(b8) o.write_shift(1, 0); + o.write_shift(4, 0x33336853); + o.write_shift(4, (0x00534A74 | (b8 ? 0 : 0x20000000))); + while(o.l < o.length) o.write_shift(1, (b8 ? 0 : 32)); + return o; +} + +/* [MS-XLS] 2.4.351 */ +function parse_WsBool(blob, length, opts) { + var flags = opts && opts.biff == 8 || length == 2 ? blob.read_shift(2) : (blob.l += length, 0); + return { fDialog: flags & 0x10, fBelow: flags & 0x40, fRight: flags & 0x80 }; +} + +/* [MS-XLS] 2.4.28 */ +function parse_BoundSheet8(blob, length, opts) { + var name = ""; + if(opts.biff == 4) { + name = parse_ShortXLUnicodeString(blob, 0, opts); + if(name.length === 0) name = "Sheet1"; + return { name:name }; + } + var pos = blob.read_shift(4); + var hidden = blob.read_shift(1) & 0x03; + var dt = blob.read_shift(1); + switch(dt) { + case 0: dt = 'Worksheet'; break; + case 1: dt = 'Macrosheet'; break; + case 2: dt = 'Chartsheet'; break; + case 6: dt = 'VBAModule'; break; + } + name = parse_ShortXLUnicodeString(blob, 0, opts); + if(name.length === 0) name = "Sheet1"; + return { pos:pos, hs:hidden, dt:dt, name:name }; +} +function write_BoundSheet8(data, opts) { + var w = (!opts || opts.biff >= 8 ? 2 : 1); + var o = new_buf(8 + w * data.name.length); + o.write_shift(4, data.pos); + o.write_shift(1, data.hs || 0); + o.write_shift(1, data.dt); + o.write_shift(1, data.name.length); + if(opts.biff >= 8) o.write_shift(1, 1); + o.write_shift(w * data.name.length, data.name, opts.biff < 8 ? 'sbcs' : 'utf16le'); + var out = o.slice(0, o.l); + out.l = o.l; return out; +} + +/* [MS-XLS] 2.4.265 TODO */ +function parse_SST(blob, length)/*:SST*/ { + var end = blob.l + length; + var cnt = blob.read_shift(4); + var ucnt = blob.read_shift(4); + var strs/*:SST*/ = ([]/*:any*/); + for(var i = 0; i != ucnt && blob.l < end; ++i) { + strs.push(parse_XLUnicodeRichExtendedString(blob)); + } + strs.Count = cnt; strs.Unique = ucnt; + return strs; +} +function write_SST(sst, opts) { + var header = new_buf(8); + header.write_shift(4, sst.Count); + header.write_shift(4, sst.Unique); + var strs = []; + for(var j = 0; j < sst.length; ++j) strs[j] = write_XLUnicodeRichExtendedString(sst[j], opts); + var o = bconcat([header].concat(strs)); + /*::(*/o/*:: :any)*/.parts = [header.length].concat(strs.map(function(str) { return str.length; })); + return o; +} + +/* [MS-XLS] 2.4.107 */ +function parse_ExtSST(blob, length) { + var extsst = {}; + extsst.dsst = blob.read_shift(2); + blob.l += length-2; + return extsst; +} + + +/* [MS-XLS] 2.4.221 TODO: check BIFF2-4 */ +function parse_Row(blob) { + var z = ({}/*:any*/); + z.r = blob.read_shift(2); + z.c = blob.read_shift(2); + z.cnt = blob.read_shift(2) - z.c; + var miyRw = blob.read_shift(2); + blob.l += 4; // reserved(2), unused(2) + var flags = blob.read_shift(1); // various flags + blob.l += 3; // reserved(8), ixfe(12), flags(4) + if(flags & 0x07) z.level = flags & 0x07; + // collapsed: flags & 0x10 + if(flags & 0x20) z.hidden = true; + if(flags & 0x40) z.hpt = miyRw / 20; + return z; +} + + +/* [MS-XLS] 2.4.125 */ +function parse_ForceFullCalculation(blob) { + var header = parse_frtHeader(blob); + if(header.type != 0x08A3) throw new Error("Invalid Future Record " + header.type); + var fullcalc = blob.read_shift(4); + return fullcalc !== 0x0; +} + + + + + +/* [MS-XLS] 2.4.215 rt */ +function parse_RecalcId(blob) { + blob.read_shift(2); + return blob.read_shift(4); +} + +/* [MS-XLS] 2.4.87 */ +function parse_DefaultRowHeight(blob, length, opts) { + var f = 0; + if(!(opts && opts.biff == 2)) { + f = blob.read_shift(2); + } + var miyRw = blob.read_shift(2); + if((opts && opts.biff == 2)) { + f = 1 - (miyRw >> 15); miyRw &= 0x7fff; + } + var fl = {Unsynced:f&1,DyZero:(f&2)>>1,ExAsc:(f&4)>>2,ExDsc:(f&8)>>3}; + return [fl, miyRw]; +} + +/* [MS-XLS] 2.4.345 TODO */ +function parse_Window1(blob) { + var xWn = blob.read_shift(2), yWn = blob.read_shift(2), dxWn = blob.read_shift(2), dyWn = blob.read_shift(2); + var flags = blob.read_shift(2), iTabCur = blob.read_shift(2), iTabFirst = blob.read_shift(2); + var ctabSel = blob.read_shift(2), wTabRatio = blob.read_shift(2); + return { Pos: [xWn, yWn], Dim: [dxWn, dyWn], Flags: flags, CurTab: iTabCur, + FirstTab: iTabFirst, Selected: ctabSel, TabRatio: wTabRatio }; +} +function write_Window1(/*::opts*/) { + var o = new_buf(18); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0x7260); + o.write_shift(2, 0x44c0); + o.write_shift(2, 0x38); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 1); + o.write_shift(2, 0x01f4); + return o; +} +/* [MS-XLS] 2.4.346 TODO */ +function parse_Window2(blob, length, opts) { + if(opts && opts.biff >= 2 && opts.biff < 5) return {}; + var f = blob.read_shift(2); + return { RTL: f & 0x40 }; +} +function write_Window2(view) { + var o = new_buf(18), f = 0x6b6; + if(view && view.RTL) f |= 0x40; + o.write_shift(2, f); + o.write_shift(4, 0); + o.write_shift(4, 64); + o.write_shift(4, 0); + o.write_shift(4, 0); + return o; +} + +/* [MS-XLS] 2.4.189 TODO */ +function parse_Pane(/*blob, length, opts*/) { +} + +/* [MS-XLS] 2.4.122 TODO */ +function parse_Font(blob, length, opts) { + var o/*:any*/ = { + dyHeight: blob.read_shift(2), + fl: blob.read_shift(2) + }; + switch((opts && opts.biff) || 8) { + case 2: break; + case 3: case 4: blob.l += 2; break; + default: blob.l += 10; break; + } + o.name = parse_ShortXLUnicodeString(blob, 0, opts); + return o; +} +function write_Font(data, opts) { + var name = data.name || "Arial"; + var b5 = (opts && (opts.biff == 5)), w = (b5 ? (15 + name.length) : (16 + 2 * name.length)); + var o = new_buf(w); + o.write_shift(2, (data.sz || 12) * 20); + o.write_shift(4, 0); + o.write_shift(2, 400); + o.write_shift(4, 0); + o.write_shift(2, 0); + o.write_shift(1, name.length); + if(!b5) o.write_shift(1, 1); + o.write_shift((b5 ? 1 : 2) * name.length, name, (b5 ? "sbcs" : "utf16le")); + return o; +} + +/* [MS-XLS] 2.4.149 */ +function parse_LabelSst(blob, length, opts) { + var cell = parse_XLSCell(blob, length, opts); + cell.isst = blob.read_shift(4); + return cell; +} +function write_LabelSst(R/*:number*/, C/*:number*/, v/*:number*/, os/*:number*/ /*::, opts*/) { + var o = new_buf(10); + write_XLSCell(R, C, os, o); + o.write_shift(4, v); + return o; +} + +/* [MS-XLS] 2.4.148 */ +function parse_Label(blob, length, opts) { + if(opts.biffguess && opts.biff == 2) opts.biff = 5; + var target = blob.l + length; + var cell = parse_XLSCell(blob, length, opts); + var str = parse_XLUnicodeString(blob, target - blob.l, opts); + cell.val = str; + return cell; +} +function write_Label(R/*:number*/, C/*:number*/, v/*:string*/, os/*:number*/, opts) { + var b8 = !opts || opts.biff == 8; + var o = new_buf(6 + 2 + (+b8) + (1 + b8) * v.length); + write_XLSCell(R, C, os, o); + o.write_shift(2, v.length); + if(b8) o.write_shift(1, 1); + o.write_shift((1 + b8) * v.length, v, b8 ? 'utf16le' : 'sbcs'); + return o; +} + + +/* [MS-XLS] 2.4.126 Number Formats */ +function parse_Format(blob, length, opts) { + var numFmtId = blob.read_shift(2); + var fmtstr = parse_XLUnicodeString2(blob, 0, opts); + return [numFmtId, fmtstr]; +} +function write_Format(i/*:number*/, f/*:string*/, opts, o) { + var b5 = (opts && (opts.biff == 5)); + if(!o) o = new_buf(b5 ? (3 + f.length) : (5 + 2 * f.length)); + o.write_shift(2, i); + o.write_shift((b5 ? 1 : 2), f.length); + if(!b5) o.write_shift(1, 1); + o.write_shift((b5 ? 1 : 2) * f.length, f, (b5 ? 'sbcs' : 'utf16le')); + var out = (o.length > o.l) ? o.slice(0, o.l) : o; + if(out.l == null) out.l = out.length; + return out; +} +var parse_BIFF2Format = parse_XLUnicodeString2; +function write_BIFF2Format(f/*:string*/) { + var o = new_buf(1 + f.length); + o.write_shift(1, f.length); + o.write_shift(f.length, f, "sbcs"); + return o; +} +function write_BIFF4Format(f/*:string*/) { + var o = new_buf(3 + f.length); + o.l += 2; + o.write_shift(1, f.length); + o.write_shift(f.length, f, "sbcs"); + return o; +} + +/* [MS-XLS] 2.4.90 */ +function parse_Dimensions(blob, length, opts) { + var end = blob.l + length; + var w = opts.biff == 8 || !opts.biff ? 4 : 2; + var r = blob.read_shift(w), R = blob.read_shift(w); + var c = blob.read_shift(2), C = blob.read_shift(2); + blob.l = end; + return {s: {r:r, c:c}, e: {r:R, c:C}}; +} +function write_Dimensions(range, opts) { + var w = opts.biff == 8 || !opts.biff ? 4 : 2; + var o = new_buf(2*w + 6); + o.write_shift(w, range.s.r); + o.write_shift(w, range.e.r + 1); + o.write_shift(2, range.s.c); + o.write_shift(2, range.e.c + 1); + o.write_shift(2, 0); + return o; +} + +/* [MS-XLS] 2.4.220 */ +function parse_RK(blob) { + var rw = blob.read_shift(2), col = blob.read_shift(2); + var rkrec = parse_RkRec(blob); + return {r:rw, c:col, ixfe:rkrec[0], rknum:rkrec[1]}; +} + +/* [MS-XLS] 2.4.175 */ +function parse_MulRk(blob, length) { + var target = blob.l + length - 2; + var rw = blob.read_shift(2), col = blob.read_shift(2); + var rkrecs = []; + while(blob.l < target) rkrecs.push(parse_RkRec(blob)); + if(blob.l !== target) throw new Error("MulRK read error"); + var lastcol = blob.read_shift(2); + if(rkrecs.length != lastcol - col + 1) throw new Error("MulRK length mismatch"); + return {r:rw, c:col, C:lastcol, rkrec:rkrecs}; +} +/* [MS-XLS] 2.4.174 */ +function parse_MulBlank(blob, length) { + var target = blob.l + length - 2; + var rw = blob.read_shift(2), col = blob.read_shift(2); + var ixfes = []; + while(blob.l < target) ixfes.push(blob.read_shift(2)); + if(blob.l !== target) throw new Error("MulBlank read error"); + var lastcol = blob.read_shift(2); + if(ixfes.length != lastcol - col + 1) throw new Error("MulBlank length mismatch"); + return {r:rw, c:col, C:lastcol, ixfe:ixfes}; +} + +/* [MS-XLS] 2.5.20 2.5.249 TODO: interpret values here */ +function parse_CellStyleXF(blob, length, style, opts) { + var o = {}; + var a = blob.read_shift(4), b = blob.read_shift(4); + var c = blob.read_shift(4), d = blob.read_shift(2); + o.patternType = XLSFillPattern[c >> 26]; + + if(!opts.cellStyles) return o; + o.alc = a & 0x07; + o.fWrap = (a >> 3) & 0x01; + o.alcV = (a >> 4) & 0x07; + o.fJustLast = (a >> 7) & 0x01; + o.trot = (a >> 8) & 0xFF; + o.cIndent = (a >> 16) & 0x0F; + o.fShrinkToFit = (a >> 20) & 0x01; + o.iReadOrder = (a >> 22) & 0x02; + o.fAtrNum = (a >> 26) & 0x01; + o.fAtrFnt = (a >> 27) & 0x01; + o.fAtrAlc = (a >> 28) & 0x01; + o.fAtrBdr = (a >> 29) & 0x01; + o.fAtrPat = (a >> 30) & 0x01; + o.fAtrProt = (a >> 31) & 0x01; + + o.dgLeft = b & 0x0F; + o.dgRight = (b >> 4) & 0x0F; + o.dgTop = (b >> 8) & 0x0F; + o.dgBottom = (b >> 12) & 0x0F; + o.icvLeft = (b >> 16) & 0x7F; + o.icvRight = (b >> 23) & 0x7F; + o.grbitDiag = (b >> 30) & 0x03; + + o.icvTop = c & 0x7F; + o.icvBottom = (c >> 7) & 0x7F; + o.icvDiag = (c >> 14) & 0x7F; + o.dgDiag = (c >> 21) & 0x0F; + + o.icvFore = d & 0x7F; + o.icvBack = (d >> 7) & 0x7F; + o.fsxButton = (d >> 14) & 0x01; + return o; +} +//function parse_CellXF(blob, length, opts) {return parse_CellStyleXF(blob,length,0, opts);} +//function parse_StyleXF(blob, length, opts) {return parse_CellStyleXF(blob,length,1, opts);} + +/* [MS-XLS] 2.4.353 TODO: actually do this right */ +function parse_XF(blob, length, opts) { + var o = {}; + o.ifnt = blob.read_shift(2); o.numFmtId = blob.read_shift(2); o.flags = blob.read_shift(2); + o.fStyle = (o.flags >> 2) & 0x01; + length -= 6; + o.data = parse_CellStyleXF(blob, length, o.fStyle, opts); + return o; +} +function write_XF(data, ixfeP, opts, o) { + var b5 = (opts && (opts.biff == 5)); + if(!o) o = new_buf(b5 ? 16 : 20); + o.write_shift(2, 0); + if(data.style) { + o.write_shift(2, (data.numFmtId||0)); + o.write_shift(2, 0xFFF4); + } else { + o.write_shift(2, (data.numFmtId||0)); + o.write_shift(2, (ixfeP<<4)); + } + var f = 0; + if(data.numFmtId > 0 && b5) f |= 0x0400; + o.write_shift(4, f); + o.write_shift(4, 0); + if(!b5) o.write_shift(4, 0); + o.write_shift(2, 0); + return o; +} +function parse_BIFF2XF(blob/*::, length, opts*/) { + var o = {}; + o.ifnt = blob.read_shift(1); blob.l++; o.flags = blob.read_shift(1); + o.numFmtId = o.flags & 0x3F; o.flags>>=6; + o.fStyle = 0; + o.data = {}; // TODO + return o; +} +function write_BIFF2XF(xf) { + var o = new_buf(4); + o.l+=2; + o.write_shift(1, xf.numFmtId); + o.l++; + return o; +} +function write_BIFF3XF(xf) { + var o = new_buf(12); + o.l++; + o.write_shift(1, xf.numFmtId); + o.l += 10; + return o; +} +/* TODO: check other fields */ +var write_BIFF4XF = write_BIFF3XF; +function parse_BIFF3XF(blob/*::, length, opts*/) { + var o = {}; + o.ifnt = blob.read_shift(1); o.numFmtId = blob.read_shift(1); o.flags = blob.read_shift(2); + o.fStyle = (o.flags >> 2) & 0x01; + o.data = {}; // TODO + return o; +} +function parse_BIFF4XF(blob/*::, length, opts*/) { + var o = {}; + o.ifnt = blob.read_shift(1); o.numFmtId = blob.read_shift(1); o.flags = blob.read_shift(2); + o.fStyle = (o.flags >> 2) & 0x01; + o.data = {}; // TODO + return o; +} + +/* [MS-XLS] 2.4.134 */ +function parse_Guts(blob) { + blob.l += 4; + var out = [blob.read_shift(2), blob.read_shift(2)]; + if(out[0] !== 0) out[0]--; + if(out[1] !== 0) out[1]--; + if(out[0] > 7 || out[1] > 7) throw new Error("Bad Gutters: " + out.join("|")); + return out; +} +function write_Guts(guts/*:Array*/) { + var o = new_buf(8); + o.write_shift(4, 0); + o.write_shift(2, guts[0] ? guts[0] + 1 : 0); + o.write_shift(2, guts[1] ? guts[1] + 1 : 0); + return o; +} + +/* [MS-XLS] 2.4.24 */ +function parse_BoolErr(blob, length, opts) { + var cell = parse_XLSCell(blob, 6, opts); + var val = parse_Bes(blob, 2); + cell.val = val; + cell.t = (val === true || val === false) ? 'b' : 'e'; + return cell; +} +function write_BoolErr(R/*:number*/, C/*:number*/, v, os/*:number*/, opts, t/*:string*/) { + var o = new_buf(8); + write_XLSCell(R, C, os, o); + write_Bes(v, t, o); + return o; +} + +/* [MS-XLS] 2.4.180 Number */ +function parse_Number(blob, length, opts) { + if(opts.biffguess && opts.biff == 2) opts.biff = 5; + var cell = parse_XLSCell(blob, 6, opts); + var xnum = parse_Xnum(blob, 8); + cell.val = xnum; + return cell; +} +function write_Number(R/*:number*/, C/*:number*/, v, os/*:: :number, opts*/) { + var o = new_buf(14); + write_XLSCell(R, C, os, o); + write_Xnum(v, o); + return o; +} + +var parse_XLHeaderFooter = parse_OptXLUnicodeString; // TODO: parse 2.4.136 + +/* [MS-XLS] 2.4.271 */ +function parse_SupBook(blob, length, opts) { + var end = blob.l + length; + var ctab = blob.read_shift(2); + var cch = blob.read_shift(2); + opts.sbcch = cch; + if(cch == 0x0401 || cch == 0x3A01) return [cch, ctab]; + if(cch < 0x01 || cch >0xff) throw new Error("Unexpected SupBook type: "+cch); + var virtPath = parse_XLUnicodeStringNoCch(blob, cch); + /* TODO: 2.5.277 Virtual Path */ + var rgst = []; + while(end > blob.l) rgst.push(parse_XLUnicodeString(blob)); + return [cch, ctab, virtPath, rgst]; +} + +/* [MS-XLS] 2.4.105 TODO */ +function parse_ExternName(blob, length, opts) { + var flags = blob.read_shift(2); + var body; + var o = ({ + fBuiltIn: flags & 0x01, + fWantAdvise: (flags >>> 1) & 0x01, + fWantPict: (flags >>> 2) & 0x01, + fOle: (flags >>> 3) & 0x01, + fOleLink: (flags >>> 4) & 0x01, + cf: (flags >>> 5) & 0x3FF, + fIcon: flags >>> 15 & 0x01 + }/*:any*/); + if(opts.sbcch === 0x3A01) body = parse_AddinUdf(blob, length-2, opts); + //else throw new Error("unsupported SupBook cch: " + opts.sbcch); + o.body = body || blob.read_shift(length-2); + if(typeof body === "string") o.Name = body; + return o; +} + +/* [MS-XLS] 2.4.150 TODO */ +function parse_Lbl(blob, length, opts) { + var target = blob.l + length; + var flags = blob.read_shift(2); + var chKey = blob.read_shift(1); + var cch = blob.read_shift(1); + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + var itab = 0; + if(!opts || opts.biff >= 5) { + if(opts.biff != 5) blob.l += 2; + itab = blob.read_shift(2); + if(opts.biff == 5) blob.l += 2; + blob.l += 4; + } + var name = parse_XLUnicodeStringNoCch(blob, cch, opts); + if(flags & 0x20) name = XLSLblBuiltIn[name.charCodeAt(0)]; + var npflen = target - blob.l; if(opts && opts.biff == 2) --npflen; + /*jshint -W018 */ + var rgce = (target == blob.l || cce === 0 || !(npflen > 0)) ? [] : parse_NameParsedFormula(blob, npflen, opts, cce); + /*jshint +W018 */ + return { + chKey: chKey, + Name: name, + itab: itab, + rgce: rgce + }; +} + +/* [MS-XLS] 2.4.106 TODO: legacy record filename encoding */ +function parse_ExternSheet(blob, length, opts) { + if(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts); + /* see issue 2907 */ + if(!(opts.biff > 8) && (length == blob[blob.l] + (blob[blob.l+1] == 0x03 ? 1 : 0) + 1)) return parse_BIFF5ExternSheet(blob, length, opts); + var o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2); + while(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts)); + // [iSupBook, itabFirst, itabLast]; + if(blob.l != target) throw new Error("Bad ExternSheet: " + blob.l + " != " + target); + return o; +} +function parse_BIFF5ExternSheet(blob, length, opts) { + if(blob[blob.l + 1] == 0x03) blob[blob.l]++; + var o = parse_ShortXLUnicodeString(blob, length, opts); + return o.charCodeAt(0) == 0x03 ? o.slice(1) : o; +} + +/* [MS-XLS] 2.4.176 TODO: check older biff */ +function parse_NameCmt(blob, length, opts) { + if(opts.biff < 8) { blob.l += length; return; } + var cchName = blob.read_shift(2); + var cchComment = blob.read_shift(2); + var name = parse_XLUnicodeStringNoCch(blob, cchName, opts); + var comment = parse_XLUnicodeStringNoCch(blob, cchComment, opts); + return [name, comment]; +} + +/* [MS-XLS] 2.4.260 */ +function parse_ShrFmla(blob, length, opts) { + var ref = parse_RefU(blob, 6); + blob.l++; + var cUse = blob.read_shift(1); + length -= 8; + return [parse_SharedParsedFormula(blob, length, opts), cUse, ref]; +} + +/* [MS-XLS] 2.4.4 TODO */ +function parse_Array(blob, length, opts) { + var ref = parse_Ref(blob, 6); + /* TODO: fAlwaysCalc */ + switch(opts.biff) { + case 2: blob.l ++; length -= 7; break; + case 3: case 4: blob.l += 2; length -= 8; break; + default: blob.l += 6; length -= 12; + } + return [ref, parse_ArrayParsedFormula(blob, length, opts, ref)]; +} + +/* [MS-XLS] 2.4.173 */ +function parse_MTRSettings(blob) { + var fMTREnabled = blob.read_shift(4) !== 0x00; + var fUserSetThreadCount = blob.read_shift(4) !== 0x00; + var cUserThreadCount = blob.read_shift(4); + return [fMTREnabled, fUserSetThreadCount, cUserThreadCount]; +} + +/* [MS-XLS] 2.5.186 */ +function parse_NoteSh(blob, length, opts) { + var row = blob.read_shift(2), col = blob.read_shift(2); + var flags = blob.read_shift(2), idObj = blob.read_shift(2); + var stAuthor = parse_XLUnicodeString2(blob, 0, opts); + return [{r:row,c:col}, stAuthor, idObj, flags]; +} + +/* [MS-XLS] 2.4.179 */ +function parse_Note(blob, length, opts) { + if(opts && (opts.biff < 8)) { + var row = blob.read_shift(2), col = blob.read_shift(2); + if(row == 0xFFFF || row == -1) return; // TODO: test continuation + var cch = blob.read_shift(2); + var cmnt = blob.read_shift(Math.min(cch,2048), 'cpstr'); + return [{r:row, c:col}, cmnt]; + } + /* TODO: Support revisions */ + return parse_NoteSh(blob, length, opts); +} +function write_NOTE_BIFF2(text/*:string*/, R/*:number*/, C/*:number*/, len/*?:number*/) { + var o = new_buf(6 + (len || text.length)); + o.write_shift(2, R); + o.write_shift(2, C); + o.write_shift(2, len || text.length); + o.write_shift(text.length, text, "sbcs"); + return o; +} + +/* [MS-XLS] 2.4.168 */ +function parse_MergeCells(blob, length)/*:Array*/ { + var merges/*:Array*/ = []; + var cmcs = blob.read_shift(2); + while (cmcs--) merges.push(parse_Ref8U(blob,length)); + return merges; +} +function write_MergeCells(merges/*:Array*/) { + var o = new_buf(2 + merges.length * 8); + o.write_shift(2, merges.length); + for(var i = 0; i < merges.length; ++i) write_Ref8U(merges[i], o); + return o; +} + +/* [MS-XLS] 2.4.181 TODO: parse all the things! */ +function parse_Obj(blob, length, opts) { + if(opts && opts.biff < 8) return parse_BIFF5Obj(blob, length, opts); + var cmo = parse_FtCmo(blob, 22); // id, ot, flags + var fts = parse_FtArray(blob, length-22, cmo[1]); + return { cmo: cmo, ft:fts }; +} +/* from older spec */ +var parse_BIFF5OT = { +0x08: function(blob, length) { + var tgt = blob.l + length; + blob.l += 10; // todo + var cf = blob.read_shift(2); + blob.l += 4; + blob.l += 2; //var cbPictFmla = blob.read_shift(2); + blob.l += 2; + blob.l += 2; //var grbit = blob.read_shift(2); + blob.l += 4; + var cchName = blob.read_shift(1); + blob.l += cchName; // TODO: stName + blob.l = tgt; // TODO: fmla + return { fmt:cf }; +} +}; + +function parse_BIFF5Obj(blob, length, opts) { + blob.l += 4; //var cnt = blob.read_shift(4); + var ot = blob.read_shift(2); + var id = blob.read_shift(2); + var grbit = blob.read_shift(2); + blob.l += 2; //var colL = blob.read_shift(2); + blob.l += 2; //var dxL = blob.read_shift(2); + blob.l += 2; //var rwT = blob.read_shift(2); + blob.l += 2; //var dyT = blob.read_shift(2); + blob.l += 2; //var colR = blob.read_shift(2); + blob.l += 2; //var dxR = blob.read_shift(2); + blob.l += 2; //var rwB = blob.read_shift(2); + blob.l += 2; //var dyB = blob.read_shift(2); + blob.l += 2; //var cbMacro = blob.read_shift(2); + blob.l += 6; + length -= 36; + var fts = []; + fts.push((parse_BIFF5OT[ot]||parsenoop)(blob, length, opts)); + return { cmo: [id, ot, grbit], ft:fts }; +} + +/* [MS-XLS] 2.4.329 TODO: parse properly */ +function parse_TxO(blob, length, opts) { + var s = blob.l; + var texts = ""; +try { + blob.l += 4; + var ot = (opts.lastobj||{cmo:[0,0]}).cmo[1]; + var controlInfo; // eslint-disable-line no-unused-vars + if([0,5,7,11,12,14].indexOf(ot) == -1) blob.l += 6; + else controlInfo = parse_ControlInfo(blob, 6, opts); // eslint-disable-line no-unused-vars + var cchText = blob.read_shift(2); + /*var cbRuns = */blob.read_shift(2); + /*var ifntEmpty = */parseuint16(blob, 2); + var len = blob.read_shift(2); + blob.l += len; + //var fmla = parse_ObjFmla(blob, s + length - blob.l); + + for(var i = 1; i < blob.lens.length-1; ++i) { + if(blob.l-s != blob.lens[i]) throw new Error("TxO: bad continue record"); + var hdr = blob[blob.l]; + var t = parse_XLUnicodeStringNoCch(blob, blob.lens[i+1]-blob.lens[i]-1); + texts += t; + if(texts.length >= (hdr ? cchText : 2*cchText)) break; + } + if(texts.length !== cchText && texts.length !== cchText*2) { + throw new Error("cchText: " + cchText + " != " + texts.length); + } + + blob.l = s + length; + /* [MS-XLS] 2.5.272 TxORuns */ +// var rgTxoRuns = []; +// for(var j = 0; j != cbRuns/8-1; ++j) blob.l += 8; +// var cchText2 = blob.read_shift(2); +// if(cchText2 !== cchText) throw new Error("TxOLastRun mismatch: " + cchText2 + " " + cchText); +// blob.l += 6; +// if(s + length != blob.l) throw new Error("TxO " + (s + length) + ", at " + blob.l); + return { t: texts }; +} catch(e) { blob.l = s + length; return { t: texts }; } +} + +/* [MS-XLS] 2.4.140 */ +function parse_HLink(blob, length) { + var ref = parse_Ref8U(blob, 8); + blob.l += 16; /* CLSID */ + var hlink = parse_Hyperlink(blob, length-24); + return [ref, hlink]; +} +function write_HLink(hl) { + var O = new_buf(24); + var ref = decode_cell(hl[0]); + O.write_shift(2, ref.r); O.write_shift(2, ref.r); + O.write_shift(2, ref.c); O.write_shift(2, ref.c); + var clsid = "d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "); + for(var i = 0; i < 16; ++i) O.write_shift(1, parseInt(clsid[i], 16)); + return bconcat([O, write_Hyperlink(hl[1])]); +} + + +/* [MS-XLS] 2.4.141 */ +function parse_HLinkTooltip(blob, length) { + blob.read_shift(2); + var ref = parse_Ref8U(blob, 8); + var wzTooltip = blob.read_shift((length-10)/2, 'dbcs-cont'); + wzTooltip = wzTooltip.replace(chr0,""); + return [ref, wzTooltip]; +} +function write_HLinkTooltip(hl) { + var TT = hl[1].Tooltip; + var O = new_buf(10 + 2 * (TT.length + 1)); + O.write_shift(2, 0x0800); + var ref = decode_cell(hl[0]); + O.write_shift(2, ref.r); O.write_shift(2, ref.r); + O.write_shift(2, ref.c); O.write_shift(2, ref.c); + for(var i = 0; i < TT.length; ++i) O.write_shift(2, TT.charCodeAt(i)); + O.write_shift(2, 0); + return O; +} + +/* [MS-XLS] 2.4.63 */ +function parse_Country(blob)/*:[string|number, string|number]*/ { + var o = [0,0], d; + d = blob.read_shift(2); o[0] = CountryEnum[d] || d; + d = blob.read_shift(2); o[1] = CountryEnum[d] || d; + return o; +} +function write_Country(o) { + if(!o) o = new_buf(4); + o.write_shift(2, 0x01); + o.write_shift(2, 0x01); + return o; +} + +/* [MS-XLS] 2.4.50 ClrtClient */ +function parse_ClrtClient(blob) { + var ccv = blob.read_shift(2); + var o = []; + while(ccv-->0) o.push(parse_LongRGB(blob, 8)); + return o; +} + +/* [MS-XLS] 2.4.188 */ +function parse_Palette(blob) { + var ccv = blob.read_shift(2); + var o = []; + while(ccv-->0) o.push(parse_LongRGB(blob, 8)); + return o; +} + +/* [MS-XLS] 2.4.354 */ +function parse_XFCRC(blob) { + blob.l += 2; + var o = {cxfs:0, crc:0}; + o.cxfs = blob.read_shift(2); + o.crc = blob.read_shift(4); + return o; +} + +/* [MS-XLS] 2.4.53 TODO: parse flags */ +/* [MS-XLSB] 2.4.323 TODO: parse flags */ +function parse_ColInfo(blob, length, opts) { + if(!opts.cellStyles) return parsenoop(blob, length); + var w = opts && opts.biff >= 12 ? 4 : 2; + var colFirst = blob.read_shift(w); + var colLast = blob.read_shift(w); + var coldx = blob.read_shift(w); + var ixfe = blob.read_shift(w); + var flags = blob.read_shift(2); + if(w == 2) blob.l += 2; + var o = ({s:colFirst, e:colLast, w:coldx, ixfe:ixfe, flags:flags}/*:any*/); + if(opts.biff >= 5 || !opts.biff) o.level = (flags >> 8) & 0x7; + return o; +} +function write_ColInfo(col, idx) { + var o = new_buf(12); + o.write_shift(2, idx); + o.write_shift(2, idx); + o.write_shift(2, col.width * 256); + o.write_shift(2, 0); + var f = 0; + if(col.hidden) f |= 1; + o.write_shift(1, f); + f = col.level || 0; + o.write_shift(1, f); + o.write_shift(2, 0); + return o; +} + +/* [MS-XLS] 2.4.257 */ +function parse_Setup(blob, length) { + var o = {}; + if(length < 32) return o; + blob.l += 16; + o.header = parse_Xnum(blob, 8); + o.footer = parse_Xnum(blob, 8); + blob.l += 2; + return o; +} + +/* [MS-XLS] 2.4.261 */ +function parse_ShtProps(blob, length, opts) { + var def = {area:false}; + if(opts.biff != 5) { blob.l += length; return def; } + var d = blob.read_shift(1); blob.l += 3; + if((d & 0x10)) def.area = true; + return def; +} + +/* [MS-XLS] 2.4.241 */ +function write_RRTabId(n/*:number*/) { + var out = new_buf(2 * n); + for(var i = 0; i < n; ++i) out.write_shift(2, i+1); + return out; +} + +var parse_Blank = parse_XLSCell; /* [MS-XLS] 2.4.20 Just the cell */ +var parse_Scl = parseuint16a; /* [MS-XLS] 2.4.247 num, den */ +var parse_String = parse_XLUnicodeString; /* [MS-XLS] 2.4.268 */ + +/* --- Specific to versions before BIFF8 --- */ +function parse_ImData(blob) { + var cf = blob.read_shift(2); + var env = blob.read_shift(2); + var lcb = blob.read_shift(4); + var o = {fmt:cf, env:env, len:lcb, data:blob.slice(blob.l,blob.l+lcb)}; + blob.l += lcb; + return o; +} + +function write_BIFF2Cell(out, r/*:number*/, c/*:number*/, ixfe/*:number*/, ifmt/*:number*/) { + if(!out) out = new_buf(7); + out.write_shift(2, r); + out.write_shift(2, c); + out.write_shift(1, ixfe||0/* & 0x3F */); + out.write_shift(1, ifmt||0/* & 0x3F */); + out.write_shift(1, 0); + return out; +} + +/* BIFF2_??? where ??? is the name from [XLS] */ +function parse_BIFF2STR(blob, length, opts) { + if(opts.biffguess && opts.biff == 5) opts.biff = 2; + var cell = parse_XLSCell(blob, 7, opts); + var str = parse_XLUnicodeString2(blob, length-7, opts); + cell.t = 'str'; + cell.val = str; + return cell; +} + +function parse_BIFF2NUM(blob, length, opts) { + var cell = parse_XLSCell(blob, 7, opts); + var num = parse_Xnum(blob, 8); + cell.t = 'n'; + cell.val = num; + return cell; +} +function write_BIFF2NUM(r/*:number*/, c/*:number*/, val/*:number*/, ixfe, ifmt) { + var out = new_buf(15); + write_BIFF2Cell(out, r, c, ixfe||0, ifmt||0); + out.write_shift(8, val, 'f'); + return out; +} + +function parse_BIFF2INT(blob, length, opts) { + var cell = parse_XLSCell(blob, 7, opts); + var num = blob.read_shift(2); + cell.t = 'n'; + cell.val = num; + return cell; +} +function write_BIFF2INT(r/*:number*/, c/*:number*/, val/*:number*/, ixfe/*:number*/, ifmt/*:number*/) { + var out = new_buf(9); + write_BIFF2Cell(out, r, c, ixfe||0, ifmt||0); + out.write_shift(2, val); + return out; +} + +function parse_BIFF2STRING(blob) { + var cch = blob.read_shift(1); + if(cch === 0) { blob.l++; return ""; } + return blob.read_shift(cch, 'sbcs-cont'); +} + +function parse_BIFF2BOOLERR(blob, length, opts) { + var bestart = blob.l + 7; + var cell = parse_XLSCell(blob, 6, opts); + blob.l = bestart; + var val = parse_Bes(blob, 2); + cell.val = val; + cell.t = (val === true || val === false) ? 'b' : 'e'; + return cell; +} + +/* TODO: convert to BIFF8 font struct */ +function parse_BIFF2FONTXTRA(blob, length) { + blob.l += 6; // unknown + blob.l += 2; // font weight "bls" + blob.l += 1; // charset + blob.l += 3; // unknown + blob.l += 1; // font family + blob.l += length - 13; +} + +/* TODO: parse rich text runs */ +function parse_RString(blob, length, opts) { + var end = blob.l + length; + var cell = parse_XLSCell(blob, 6, opts); + var cch = blob.read_shift(2); + var str = parse_XLUnicodeStringNoCch(blob, cch, opts); + blob.l = end; + cell.t = 'str'; + cell.val = str; + return cell; +} + +function parse_BIFF4SheetInfo(blob/*::, length, opts*/) { + var flags = blob.read_shift(4); + var cch = blob.read_shift(1), name = blob.read_shift(cch, "sbcs"); + if(name.length === 0) name = "Sheet1"; + return { flags: flags, name:name }; +}var DBF_SUPPORTED_VERSIONS = [0x02, 0x03, 0x30, 0x31, 0x83, 0x8B, 0x8C, 0xF5]; +var DBF = /*#__PURE__*/(function() { +var dbf_codepage_map = { + /* Code Pages Supported by Visual FoxPro */ + /*::[*/0x01/*::]*/: 437, /*::[*/0x02/*::]*/: 850, + /*::[*/0x03/*::]*/: 1252, /*::[*/0x04/*::]*/: 10000, + /*::[*/0x64/*::]*/: 852, /*::[*/0x65/*::]*/: 866, + /*::[*/0x66/*::]*/: 865, /*::[*/0x67/*::]*/: 861, + /*::[*/0x68/*::]*/: 895, /*::[*/0x69/*::]*/: 620, + /*::[*/0x6A/*::]*/: 737, /*::[*/0x6B/*::]*/: 857, + /*::[*/0x78/*::]*/: 950, /*::[*/0x79/*::]*/: 949, + /*::[*/0x7A/*::]*/: 936, /*::[*/0x7B/*::]*/: 932, + /*::[*/0x7C/*::]*/: 874, /*::[*/0x7D/*::]*/: 1255, + /*::[*/0x7E/*::]*/: 1256, /*::[*/0x96/*::]*/: 10007, + /*::[*/0x97/*::]*/: 10029, /*::[*/0x98/*::]*/: 10006, + /*::[*/0xC8/*::]*/: 1250, /*::[*/0xC9/*::]*/: 1251, + /*::[*/0xCA/*::]*/: 1254, /*::[*/0xCB/*::]*/: 1253, + + /* shapefile DBF extension */ + /*::[*/0x00/*::]*/: 20127, /*::[*/0x08/*::]*/: 865, + /*::[*/0x09/*::]*/: 437, /*::[*/0x0A/*::]*/: 850, + /*::[*/0x0B/*::]*/: 437, /*::[*/0x0D/*::]*/: 437, + /*::[*/0x0E/*::]*/: 850, /*::[*/0x0F/*::]*/: 437, + /*::[*/0x10/*::]*/: 850, /*::[*/0x11/*::]*/: 437, + /*::[*/0x12/*::]*/: 850, /*::[*/0x13/*::]*/: 932, + /*::[*/0x14/*::]*/: 850, /*::[*/0x15/*::]*/: 437, + /*::[*/0x16/*::]*/: 850, /*::[*/0x17/*::]*/: 865, + /*::[*/0x18/*::]*/: 437, /*::[*/0x19/*::]*/: 437, + /*::[*/0x1A/*::]*/: 850, /*::[*/0x1B/*::]*/: 437, + /*::[*/0x1C/*::]*/: 863, /*::[*/0x1D/*::]*/: 850, + /*::[*/0x1F/*::]*/: 852, /*::[*/0x22/*::]*/: 852, + /*::[*/0x23/*::]*/: 852, /*::[*/0x24/*::]*/: 860, + /*::[*/0x25/*::]*/: 850, /*::[*/0x26/*::]*/: 866, + /*::[*/0x37/*::]*/: 850, /*::[*/0x40/*::]*/: 852, + /*::[*/0x4D/*::]*/: 936, /*::[*/0x4E/*::]*/: 949, + /*::[*/0x4F/*::]*/: 950, /*::[*/0x50/*::]*/: 874, + /*::[*/0x57/*::]*/: 1252, /*::[*/0x58/*::]*/: 1252, + /*::[*/0x59/*::]*/: 1252, /*::[*/0x6C/*::]*/: 863, + /*::[*/0x86/*::]*/: 737, /*::[*/0x87/*::]*/: 852, + /*::[*/0x88/*::]*/: 857, /*::[*/0xCC/*::]*/: 1257, + + /*::[*/0xFF/*::]*/: 16969 +}; +var dbf_reverse_map = evert({ + /*::[*/0x01/*::]*/: 437, /*::[*/0x02/*::]*/: 850, + /*::[*/0x03/*::]*/: 1252, /*::[*/0x04/*::]*/: 10000, + /*::[*/0x64/*::]*/: 852, /*::[*/0x65/*::]*/: 866, + /*::[*/0x66/*::]*/: 865, /*::[*/0x67/*::]*/: 861, + /*::[*/0x68/*::]*/: 895, /*::[*/0x69/*::]*/: 620, + /*::[*/0x6A/*::]*/: 737, /*::[*/0x6B/*::]*/: 857, + /*::[*/0x78/*::]*/: 950, /*::[*/0x79/*::]*/: 949, + /*::[*/0x7A/*::]*/: 936, /*::[*/0x7B/*::]*/: 932, + /*::[*/0x7C/*::]*/: 874, /*::[*/0x7D/*::]*/: 1255, + /*::[*/0x7E/*::]*/: 1256, /*::[*/0x96/*::]*/: 10007, + /*::[*/0x97/*::]*/: 10029, /*::[*/0x98/*::]*/: 10006, + /*::[*/0xC8/*::]*/: 1250, /*::[*/0xC9/*::]*/: 1251, + /*::[*/0xCA/*::]*/: 1254, /*::[*/0xCB/*::]*/: 1253, + /*::[*/0x00/*::]*/: 20127 +}); +/* TODO: find an actual specification */ +function dbf_to_aoa(buf, opts)/*:AOA*/ { + var out/*:AOA*/ = []; + var d/*:Block*/ = (new_raw_buf(1)/*:any*/); + switch(opts.type) { + case 'base64': d = s2a(Base64_decode(buf)); break; + case 'binary': d = s2a(buf); break; + case 'buffer': + case 'array': d = buf; break; + } + prep_blob(d, 0); + + /* header */ + var ft = d.read_shift(1); + var memo = !!(ft & 0x88); + var vfp = false, l7 = false; + switch(ft) { + case 0x02: break; // dBASE II + case 0x03: break; // dBASE III + case 0x30: vfp = true; memo = true; break; // VFP + case 0x31: vfp = true; memo = true; break; // VFP with autoincrement + // 0x43 dBASE IV SQL table files + // 0x63 dBASE IV SQL system files + case 0x83: break; // dBASE III with memo + case 0x8B: break; // dBASE IV with memo + case 0x8C: l7 = true; break; // dBASE Level 7 with memo + // case 0xCB dBASE IV SQL table files with memo + case 0xF5: break; // FoxPro 2.x with memo + // case 0xFB FoxBASE + default: throw new Error("DBF Unsupported Version: " + ft.toString(16)); + } + + var nrow = 0, fpos = 0x0209; + if(ft == 0x02) nrow = d.read_shift(2); + d.l += 3; // dBASE II stores DDMMYY date, others use YYMMDD + if(ft != 0x02) nrow = d.read_shift(4); + if(nrow > 1048576) nrow = 1e6; + + if(ft != 0x02) fpos = d.read_shift(2); // header length + var rlen = d.read_shift(2); // record length + + var /*flags = 0,*/ current_cp = opts.codepage || 1252; + if(ft != 0x02) { // 20 reserved bytes + d.l+=16; + /*flags = */d.read_shift(1); + //if(memo && ((flags & 0x02) === 0)) throw new Error("DBF Flags " + flags.toString(16) + " ft " + ft.toString(16)); + + /* codepage present in FoxPro and dBASE Level 7 */ + if(d[d.l] !== 0) current_cp = dbf_codepage_map[d[d.l]]; + d.l+=1; + + d.l+=2; + } + if(l7) d.l += 36; // Level 7: 32 byte "Language driver name", 4 byte reserved + +/*:: type DBFField = { name:string; len:number; type:string; } */ + var fields/*:Array*/ = [], field/*:DBFField*/ = ({}/*:any*/); + var hend = Math.min(d.length, (ft == 0x02 ? 0x209 : (fpos - 10 - (vfp ? 264 : 0)))); + var ww = l7 ? 32 : 11; + while(d.l < hend && d[d.l] != 0x0d) { + field = ({}/*:any*/); + field.name = (typeof $cptable !== "undefined" ? $cptable.utils.decode(current_cp, d.slice(d.l, d.l+ww)) : a2s(d.slice(d.l, d.l + ww))).replace(/[\u0000\r\n].*$/g,""); + d.l += ww; + field.type = String.fromCharCode(d.read_shift(1)); + if(ft != 0x02 && !l7) field.offset = d.read_shift(4); + field.len = d.read_shift(1); + if(ft == 0x02) field.offset = d.read_shift(2); + field.dec = d.read_shift(1); + if(field.name.length) fields.push(field); + if(ft != 0x02) d.l += l7 ? 13 : 14; + switch(field.type) { + case 'B': // Double (VFP) / Binary (dBASE L7) + if((!vfp || field.len != 8) && opts.WTF) console.log('Skipping ' + field.name + ':' + field.type); + break; + case 'G': // General (FoxPro and dBASE L7) + case 'P': // Picture (FoxPro and dBASE L7) + if(opts.WTF) console.log('Skipping ' + field.name + ':' + field.type); + break; + case '+': // Autoincrement (dBASE L7 only) + case '0': // _NullFlags (VFP only) + case '@': // Timestamp (dBASE L7 only) + case 'C': // Character (dBASE II) + case 'D': // Date (dBASE III) + case 'F': // Float (dBASE IV) + case 'I': // Long (VFP and dBASE L7) + case 'L': // Logical (dBASE II) + case 'M': // Memo (dBASE III) + case 'N': // Number (dBASE II) + case 'O': // Double (dBASE L7 only) + case 'T': // Datetime (VFP only) + case 'Y': // Currency (VFP only) + break; + default: throw new Error('Unknown Field Type: ' + field.type); + } + } + + if(d[d.l] !== 0x0D) d.l = fpos-1; + if(d.read_shift(1) !== 0x0D) throw new Error("DBF Terminator not found " + d.l + " " + d[d.l]); + d.l = fpos; + + /* data */ + var R = 0, C = 0; + out[0] = []; + for(C = 0; C != fields.length; ++C) out[0][C] = fields[C].name; + while(nrow-- > 0) { + if(d[d.l] === 0x2A) { + // TODO: record marked as deleted -- create a hidden row? + d.l+=rlen; + continue; + } + ++d.l; + out[++R] = []; C = 0; + for(C = 0; C != fields.length; ++C) { + var dd = d.slice(d.l, d.l+fields[C].len); d.l+=fields[C].len; + prep_blob(dd, 0); + var s = typeof $cptable !== "undefined" ? $cptable.utils.decode(current_cp, dd) : a2s(dd); + switch(fields[C].type) { + case 'C': + // NOTE: it is conventional to write ' / / ' for empty dates + if(s.trim().length) out[R][C] = s.replace(/\s+$/,""); + break; + case 'D': + if(s.length === 8) { + out[R][C] = new Date(Date.UTC(+s.slice(0,4), +s.slice(4,6)-1, +s.slice(6,8), 0, 0, 0, 0)); + if(!(opts && opts.UTC)) { out[R][C] = utc_to_local(out[R][C]); } + } + else out[R][C] = s; + break; + case 'F': out[R][C] = parseFloat(s.trim()); break; + case '+': case 'I': out[R][C] = l7 ? dd.read_shift(-4, 'i') ^ 0x80000000 : dd.read_shift(4, 'i'); break; + case 'L': switch(s.trim().toUpperCase()) { + case 'Y': case 'T': out[R][C] = true; break; + case 'N': case 'F': out[R][C] = false; break; + case '': case '?': break; + default: throw new Error("DBF Unrecognized L:|" + s + "|"); + } break; + case 'M': /* TODO: handle memo files */ + if(!memo) throw new Error("DBF Unexpected MEMO for type " + ft.toString(16)); + out[R][C] = "##MEMO##" + (l7 ? parseInt(s.trim(), 10): dd.read_shift(4)); + break; + case 'N': + s = s.replace(/\u0000/g,"").trim(); + // NOTE: dBASE II interprets " . " as 0 + if(s && s != ".") out[R][C] = +s || 0; break; + case '@': + // NOTE: dBASE specs appear to be incorrect + out[R][C] = new Date(dd.read_shift(-8, 'f') - 0x388317533400); + break; + case 'T': { + var hi = dd.read_shift(4), lo = dd.read_shift(4); + if(hi == 0 && lo == 0) break; + out[R][C] = new Date((hi - 0x253D8C) * 0x5265C00 + lo); + if(!(opts && opts.UTC)) out[R][C] = utc_to_local(out[R][C]); + } break; + case 'Y': out[R][C] = dd.read_shift(4,'i')/1e4 + (dd.read_shift(4, 'i')/1e4)*Math.pow(2,32); break; + case 'O': out[R][C] = -dd.read_shift(-8, 'f'); break; + case 'B': if(vfp && fields[C].len == 8) { out[R][C] = dd.read_shift(8,'f'); break; } + /* falls through */ + case 'G': case 'P': dd.l += fields[C].len; break; + case '0': + if(fields[C].name === '_NullFlags') break; + /* falls through */ + default: throw new Error("DBF Unsupported data type " + fields[C].type); + } + } + } + if(ft != 0x02) if(d.l < d.length && d[d.l++] != 0x1A) throw new Error("DBF EOF Marker missing " + (d.l-1) + " of " + d.length + " " + d[d.l-1].toString(16)); + if(opts && opts.sheetRows) out = out.slice(0, opts.sheetRows); + opts.DBF = fields; + return out; +} + +function dbf_to_sheet(buf, opts)/*:Worksheet*/ { + var o = opts || {}; + if(!o.dateNF) o.dateNF = "yyyymmdd"; + var ws = aoa_to_sheet(dbf_to_aoa(buf, o), o); + ws["!cols"] = o.DBF.map(function(field) { return { + wch: field.len, + DBF: field + };}); + delete o.DBF; + return ws; +} + +function dbf_to_workbook(buf, opts)/*:Workbook*/ { + try { + var o = sheet_to_workbook(dbf_to_sheet(buf, opts), opts); + o.bookType = "dbf"; + return o; + } catch(e) { if(opts && opts.WTF) throw e; } + return ({SheetNames:[],Sheets:{}}); +} + +var _RLEN = { 'B': 8, 'C': 250, 'L': 1, 'D': 8, '?': 0, '': 0 }; +function sheet_to_dbf(ws/*:Worksheet*/, opts/*:WriteOpts*/) { + var o = opts || {}; + var old_cp = current_codepage; + if(+o.codepage >= 0) set_cp(+o.codepage); + if(o.type == "string") throw new Error("Cannot write DBF to JS string"); + var ba = buf_array(); + var aoa/*:AOA*/ = sheet_to_json(ws, {header:1, raw:true, cellDates:true}); + var headers = aoa[0], data = aoa.slice(1), cols = ws["!cols"] || []; + var i = 0, j = 0, hcnt = 0, rlen = 1; + for(i = 0; i < headers.length; ++i) { + if(((cols[i]||{}).DBF||{}).name) { headers[i] = cols[i].DBF.name; ++hcnt; continue; } + if(headers[i] == null) continue; + ++hcnt; + if(typeof headers[i] === 'number') headers[i] = headers[i].toString(10); + if(typeof headers[i] !== 'string') throw new Error("DBF Invalid column name " + headers[i] + " |" + (typeof headers[i]) + "|"); + if(headers.indexOf(headers[i]) !== i) for(j=0; j<1024;++j) + if(headers.indexOf(headers[i] + "_" + j) == -1) { headers[i] += "_" + j; break; } + } + var range = safe_decode_range(ws['!ref']); + var coltypes/*:Array*/ = []; + var colwidths/*:Array*/ = []; + var coldecimals/*:Array*/ = []; + for(i = 0; i <= range.e.c - range.s.c; ++i) { + var guess = '', _guess = '', maxlen = 0; + var col/*:Array*/ = []; + for(j=0; j < data.length; ++j) { + if(data[j][i] != null) col.push(data[j][i]); + } + if(col.length == 0 || headers[i] == null) { coltypes[i] = '?'; continue; } + for(j = 0; j < col.length; ++j) { + switch(typeof col[j]) { + /* TODO: check if L2 compat is desired */ + case 'number': _guess = 'B'; break; + case 'string': _guess = 'C'; break; + case 'boolean': _guess = 'L'; break; + case 'object': _guess = col[j] instanceof Date ? 'D' : 'C'; break; + default: _guess = 'C'; + } + /* TODO: cache the values instead of encoding twice */ + maxlen = Math.max(maxlen, (typeof $cptable !== "undefined" && typeof col[j] == "string" ? $cptable.utils.encode(current_ansi, col[j]): String(col[j])).length); + guess = guess && guess != _guess ? 'C' : _guess; + //if(guess == 'C') break; + } + if(maxlen > 250) maxlen = 250; + _guess = ((cols[i]||{}).DBF||{}).type; + /* TODO: more fine grained control over DBF type resolution */ + if(_guess == 'C') { + if(cols[i].DBF.len > maxlen) maxlen = cols[i].DBF.len; + } + if(guess == 'B' && _guess == 'N') { + guess = 'N'; + coldecimals[i] = cols[i].DBF.dec; + maxlen = cols[i].DBF.len; + } + colwidths[i] = guess == 'C' || _guess == 'N' ? maxlen : (_RLEN[guess] || 0); + rlen += colwidths[i]; + coltypes[i] = guess; + } + + var h = ba.next(32); + h.write_shift(4, 0x13021130); + h.write_shift(4, data.length); + h.write_shift(2, 296 + 32 * hcnt); + h.write_shift(2, rlen); + for(i=0; i < 4; ++i) h.write_shift(4, 0); + var cp = +dbf_reverse_map[/*::String(*/current_codepage/*::)*/] || 0x03; + h.write_shift(4, 0x00000000 | (cp<<8)); + if(dbf_codepage_map[cp] != +o.codepage) { + if(o.codepage) console.error("DBF Unsupported codepage " + current_codepage + ", using 1252"); + current_codepage = 1252; + } + + for(i = 0, j = 0; i < headers.length; ++i) { + if(headers[i] == null) continue; + var hf = ba.next(32); + /* TODO: test how applications handle non-ASCII field names */ + var _f = (headers[i].slice(-10) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00").slice(0, 11); + hf.write_shift(1, _f, "sbcs"); + hf.write_shift(1, coltypes[i] == '?' ? 'C' : coltypes[i], "sbcs"); + hf.write_shift(4, j); + hf.write_shift(1, colwidths[i] || _RLEN[coltypes[i]] || 0); + hf.write_shift(1, coldecimals[i] || 0); + hf.write_shift(1, 0x02); + hf.write_shift(4, 0); + hf.write_shift(1, 0); + hf.write_shift(4, 0); + hf.write_shift(4, 0); + j += (colwidths[i] || _RLEN[coltypes[i]] || 0); + } + + var hb = ba.next(264); + hb.write_shift(4, 0x0000000D); + for(i=0; i < 65;++i) hb.write_shift(4, 0x00000000); + for(i=0; i < data.length; ++i) { + var rout = ba.next(rlen); + rout.write_shift(1, 0); + for(j=0; j colwidths[j]) _n = _n.slice(0, colwidths[j]); // addresses decimal > width + for(hcnt=0; hcnt < colwidths[j]-_n.length; ++hcnt) rout.write_shift(1, 0x20); + rout.write_shift(1, _n, "sbcs"); + break; + case 'D': + if(!data[i][j]) rout.write_shift(8, "00000000", "sbcs"); + else { + rout.write_shift(4, ("0000"+data[i][j].getFullYear()).slice(-4), "sbcs"); + rout.write_shift(2, ("00"+(data[i][j].getMonth()+1)).slice(-2), "sbcs"); + rout.write_shift(2, ("00"+data[i][j].getDate()).slice(-2), "sbcs"); + } break; + case 'C': + var _l = rout.l; + var _s = String(data[i][j] != null ? data[i][j] : "").slice(0, colwidths[j]); + rout.write_shift(1, _s, "cpstr"); + _l += colwidths[j] - rout.l; + for(hcnt=0; hcnt < _l; ++hcnt) rout.write_shift(1, 0x20); break; + } + } + // data + } + current_codepage = old_cp; + ba.next(1).write_shift(1, 0x1A); + return ba.end(); +} + return { + to_workbook: dbf_to_workbook, + to_sheet: dbf_to_sheet, + from_sheet: sheet_to_dbf + }; +})(); + +var SYLK = /*#__PURE__*/(function() { + /* TODO: stress test sequences */ + var sylk_escapes = ({ + AA:'À', BA:'Á', CA:'Â', DA:195, HA:'Ä', JA:197, + AE:'È', BE:'É', CE:'Ê', HE:'Ë', + AI:'ÃŒ', BI:'Í', CI:'ÃŽ', HI:'Ï', + AO:'Ã’', BO:'Ó', CO:'Ô', DO:213, HO:'Ö', + AU:'Ù', BU:'Ú', CU:'Û', HU:'Ãœ', + Aa:'à ', Ba:'á', Ca:'â', Da:227, Ha:'ä', Ja:229, + Ae:'è', Be:'é', Ce:'ê', He:'ë', + Ai:'ì', Bi:'í', Ci:'î', Hi:'ï', + Ao:'ò', Bo:'ó', Co:'ô', Do:245, Ho:'ö', + Au:'ù', Bu:'ú', Cu:'û', Hu:'ü', + KC:'Ç', Kc:'ç', q:'æ', z:'Å“', a:'Æ', j:'Å’', + DN:209, Dn:241, Hy:255, + S:169, c:170, R:174, "B ":180, + /*::[*/0/*::]*/:176, /*::[*/1/*::]*/:177, /*::[*/2/*::]*/:178, + /*::[*/3/*::]*/:179, /*::[*/5/*::]*/:181, /*::[*/6/*::]*/:182, + /*::[*/7/*::]*/:183, Q:185, k:186, b:208, i:216, l:222, s:240, y:248, + "!":161, '"':162, "#":163, "(":164, "%":165, "'":167, "H ":168, + "+":171, ";":187, "<":188, "=":189, ">":190, "?":191, "{":223 + }/*:any*/); + var sylk_char_regex = new RegExp("\u001BN(" + keys(sylk_escapes).join("|").replace(/\|\|\|/, "|\\||").replace(/([?()+])/g,"\\$1") + "|\\|)", "gm"); + var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; }; + var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); }; + sylk_escapes["|"] = 254; + /* TODO: evert the escape map */ + var encode_sylk_str = function($$) { return $$.replace(/\n/g, "\x1b :").replace(/\r/g, "\x1b ="); }; + /* https://oss.sheetjs.com/notes/sylk/ for more details */ + function sylk_to_aoa(d/*:RawData*/, opts)/*:[AOA, Worksheet]*/ { + switch(opts.type) { + case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts); + case 'binary': return sylk_to_aoa_str(d, opts); + case 'buffer': return sylk_to_aoa_str(has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d), opts); + case 'array': return sylk_to_aoa_str(cc2str(d), opts); + } + throw new Error("Unrecognized type " + opts.type); + } + function sylk_to_aoa_str(str/*:string*/, opts)/*:[AOA, Worksheet]*/ { + var records = str.split(/[\n\r]+/), R = -1, C = -1, ri = 0, rj = 0, arr/*:AOA*/ = []; + var formats/*:Array*/ = []; + var next_cell_format/*:string|null*/ = null; + var sht = {}, rowinfo/*:Array*/ = [], colinfo/*:Array*/ = [], cw/*:Array*/ = []; + var Mval = 0, j; + var wb = { Workbook: { WBProps: {}, Names: [] } }; + if(+opts.codepage >= 0) set_cp(+opts.codepage); + for (; ri !== records.length; ++ri) { + Mval = 0; + var rstr=records[ri].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g, decode_sylk_char).replace(sylk_char_regex, sylk_char_fn); + var record=rstr.replace(/;;/g, "\u0000").split(";").map(function(x) { return x.replace(/\u0000/g, ";"); }); + var RT=record[0], val; + if(rstr.length > 0) switch(RT) { + case 'ID': break; /* header */ + case 'E': break; /* EOF */ + case 'B': break; /* dimensions */ + case 'O': /* workbook options */ + for(rj=1; rj= 5 or < 0 + if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true; + } break; + } break; + case 'W': break; /* window */ + case 'P': + switch(record[1].charAt(0)){ + case 'P': formats.push(rstr.slice(3).replace(/;;/g, ";")); break; + } break; + case 'NN': { /* defined name */ + var nn = {Sheet: 0}; + for(rj=1; rj -1 && arr[_R][_C]; + if(!shrbase || !shrbase[1]) throw new Error("SYLK shared formula cannot find base"); + formula = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C}); + } + if(formula) { + if(!arr[R][C]) arr[R][C] = { t: 'n', f: formula }; + else arr[R][C].f = formula; + } + if(cmnt) { + if(!arr[R][C]) arr[R][C] = { t: 'z' }; + arr[R][C].c = [{a:"SheetJSYLK", t: cmnt}]; + } + break; + case 'F': /* Format */ + var F_seen = 0; + for(rj=1; rj 0) { rowinfo[R].hpt = Mval; rowinfo[R].hpx = pt2px(Mval); } + else if(Mval === 0) rowinfo[R].hidden = true; + break; + // case 'K': // ?? + // case 'E': // ?? + default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr); + } + if(F_seen < 1) next_cell_format = null; break; + default: if(opts && opts.WTF) throw new Error("SYLK bad record " + rstr); + } + } + if(rowinfo.length > 0) sht['!rows'] = rowinfo; + if(colinfo.length > 0) sht['!cols'] = colinfo; + colinfo.forEach(function(col) { process_col(col); }); + if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); + return [arr, sht, wb]; + } + + function sylk_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { + var aoasht = sylk_to_aoa(d, opts); + var aoa = aoasht[0], ws = aoasht[1], wb = aoasht[2]; + var _opts = dup(opts); _opts.date1904 = (((wb||{}).Workbook || {}).WBProps || {}).date1904; + var o = aoa_to_sheet(aoa, _opts); + keys(ws).forEach(function(k) { o[k] = ws[k]; }); + var outwb = sheet_to_workbook(o, opts); + keys(wb).forEach(function(k) { outwb[k] = wb[k]; }); + outwb.bookType = "sylk"; + return outwb; + } + + function write_ws_cell_sylk(cell/*:Cell*/, ws/*:Worksheet*/, R/*:number*/, C/*:number*/, opts, date1904/*:boolean*/)/*:string*/ { + var o = "C;Y" + (R+1) + ";X" + (C+1) + ";K"; + switch(cell.t) { + case 'n': + o += (cell.v||0); + if(cell.f && !cell.F) o += ";E" + a1_to_rc(cell.f, {r:R, c:C}); break; + case 'b': o += cell.v ? "TRUE" : "FALSE"; break; + case 'e': o += cell.w || cell.v; break; + case 'd': o += datenum(parseDate(cell.v, date1904), date1904); break; + case 's': o += '"' + (cell.v == null ? "" : String(cell.v)).replace(/"/g,"").replace(/;/g, ";;") + '"'; break; + } + return o; + } + + function write_ws_cmnt_sylk(cmnt/*:Comment*/, R/*:number*/, C/*:number*/)/*:string*/ { + var o = "C;Y" + (R+1) + ";X" + (C+1) + ";A"; + /* TODO: max length? */ + o += encode_sylk_str(cmnt.map(function(c) { return c.t; }).join("")); + return o; + } + + function write_ws_cols_sylk(out, cols) { + cols.forEach(function(col, i) { + var rec = "F;W" + (i+1) + " " + (i+1) + " "; + if(col.hidden) rec += "0"; + else { + if(typeof col.width == 'number' && !col.wpx) col.wpx = width2px(col.width); + if(typeof col.wpx == 'number' && !col.wch) col.wch = px2char(col.wpx); + if(typeof col.wch == 'number') rec += Math.round(col.wch); + } + if(rec.charAt(rec.length - 1) != " ") out.push(rec); + }); + } + + function write_ws_rows_sylk(out/*:Array*/, rows/*:Array*/) { + rows.forEach(function(row, i) { + var rec = "F;"; + if(row.hidden) rec += "M0;"; + else if(row.hpt) rec += "M" + 20 * row.hpt + ";"; + else if(row.hpx) rec += "M" + 20 * px2pt(row.hpx) + ";"; + if(rec.length > 2) out.push(rec + "R" + (i+1)); + }); + } + + function sheet_to_sylk(ws/*:Worksheet*/, opts/*:?any*/, wb/*:?WorkBook*/)/*:string*/ { + if(!opts) opts = {}; opts._formats = ["General"]; + /* TODO: codepage */ + var preamble/*:Array*/ = ["ID;PSheetJS;N;E"], o/*:Array*/ = []; + var r = safe_decode_range(ws['!ref']), cell/*:Cell*/; + var dense = ws["!data"] != null; + var RS = "\r\n"; + var d1904 = (((wb||{}).Workbook||{}).WBProps||{}).date1904; + + var _lastfmt = "General"; + preamble.push("P;PGeneral"); + /* Excel has been inconsistent in comment placement */ + var R = r.s.r, C = r.s.c, p = []; + for(R = r.s.r; R <= r.e.r; ++R) { + if(dense && !ws["!data"][R]) continue; + p = []; + for(C = r.s.c; C <= r.e.c; ++C) { + cell = dense ? ws["!data"][R][C] : ws[encode_col(C) + encode_row(R)]; + if(!cell || !cell.c) continue; + p.push(write_ws_cmnt_sylk(cell.c, R, C)); + } + if(p.length) o.push(p.join(RS)); + } + for(R = r.s.r; R <= r.e.r; ++R) { + if(dense && !ws["!data"][R]) continue; + p = []; + for(C = r.s.c; C <= r.e.c; ++C) { + cell = dense ? ws["!data"][R][C] : ws[encode_col(C) + encode_row(R)]; + if(!cell || (cell.v == null && (!cell.f || cell.F))) continue; + if((cell.z||(cell.t == "d" ? table_fmt[14] : "General")) != _lastfmt) { + var ifmt = opts._formats.indexOf(cell.z); + if(ifmt == -1) { opts._formats.push(cell.z); ifmt = opts._formats.length - 1; preamble.push("P;P" + cell.z.replace(/;/g, ";;")); } + p.push("F;P" + ifmt + ";Y" + (R+1) + ";X" + (C+1)); + } + p.push(write_ws_cell_sylk(cell, ws, R, C, opts, d1904)); + } + o.push(p.join(RS)); + } + + preamble.push("F;P0;DG0G8;M255"); + if(ws['!cols']) write_ws_cols_sylk(preamble, ws['!cols']); + if(ws['!rows']) write_ws_rows_sylk(preamble, ws['!rows']); + + preamble.push("B;Y" + (r.e.r - r.s.r + 1) + ";X" + (r.e.c - r.s.c + 1) + ";D" + [r.s.c,r.s.r,r.e.c,r.e.r].join(" ")); + preamble.push("O;L;D;B" + (d1904 ? ";V4" : "") + ";K47;G100 0.001"); + + delete opts._formats; + return preamble.join(RS) + RS + o.join(RS) + RS + "E" + RS; + } + + return { + to_workbook: sylk_to_workbook, + from_sheet: sheet_to_sylk + }; +})(); + +var DIF = /*#__PURE__*/(function() { + function dif_to_aoa(d/*:RawData*/, opts)/*:AOA*/ { + switch(opts.type) { + case 'base64': return dif_to_aoa_str(Base64_decode(d), opts); + case 'binary': return dif_to_aoa_str(d, opts); + case 'buffer': return dif_to_aoa_str(has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d), opts); + case 'array': return dif_to_aoa_str(cc2str(d), opts); + } + throw new Error("Unrecognized type " + opts.type); + } + function dif_to_aoa_str(str/*:string*/, opts)/*:AOA*/ { + var records = str.split('\n'), R = -1, C = -1, ri = 0, arr/*:AOA*/ = []; + for (; ri !== records.length; ++ri) { + if (records[ri].trim() === 'BOT') { arr[++R] = []; C = 0; continue; } + if (R < 0) continue; + var metadata = records[ri].trim().split(","); + var type = metadata[0], value = metadata[1]; + ++ri; + var data = records[ri] || ""; + while(((data.match(/["]/g)||[]).length & 1) && ri < records.length - 1) data += "\n" + records[++ri]; + data = data.trim(); + switch (+type) { + case -1: + if (data === 'BOT') { arr[++R] = []; C = 0; continue; } + else if (data !== 'EOD') throw new Error("Unrecognized DIF special command " + data); + break; + case 0: + if(data === 'TRUE') arr[R][C] = true; + else if(data === 'FALSE') arr[R][C] = false; + else if(!isNaN(fuzzynum(value))) arr[R][C] = fuzzynum(value); + else if(!isNaN(fuzzydate(value).getDate())) { + arr[R][C] = parseDate(value); + if(!(opts && opts.UTC)) { arr[R][C] = utc_to_local(arr[R][C]); } + } + else arr[R][C] = value; + ++C; break; + case 1: + data = data.slice(1,data.length-1); + data = data.replace(/""/g, '"'); + if(DIF_XL && data && data.match(/^=".*"$/)) data = data.slice(2, -1); + arr[R][C++] = data !== '' ? data : null; + break; + } + if (data === 'EOD') break; + } + if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); + return arr; + } + + function dif_to_sheet(str/*:string*/, opts)/*:Worksheet*/ { return aoa_to_sheet(dif_to_aoa(str, opts), opts); } + function dif_to_workbook(str/*:string*/, opts)/*:Workbook*/ { + var o = sheet_to_workbook(dif_to_sheet(str, opts), opts); + o.bookType = "dif"; + return o; + } + + function make_value(v/*:number*/, s/*:string*/)/*:string*/ { return "0," + String(v) + "\r\n" + s; } + function make_value_str(s/*:string*/)/*:string*/ { return "1,0\r\n\"" + s.replace(/"/g,'""') + '"'; } + function sheet_to_dif(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ { + var _DIF_XL = DIF_XL; + var r = safe_decode_range(ws['!ref']); + var dense = ws["!data"] != null; + var o/*:Array*/ = [ + "TABLE\r\n0,1\r\n\"sheetjs\"\r\n", + "VECTORS\r\n0," + (r.e.r - r.s.r + 1) + "\r\n\"\"\r\n", + "TUPLES\r\n0," + (r.e.c - r.s.c + 1) + "\r\n\"\"\r\n", + "DATA\r\n0,0\r\n\"\"\r\n" + ]; + for(var R = r.s.r; R <= r.e.r; ++R) { + var row = dense ? ws["!data"][R] : []; + var p = "-1,0\r\nBOT\r\n"; + for(var C = r.s.c; C <= r.e.c; ++C) { + var cell/*:Cell*/ = dense ? (row && row[C]) : ws[encode_cell({r:R,c:C})]; + if(cell == null) { p +=("1,0\r\n\"\"\r\n"); continue;} + switch(cell.t) { + case 'n': + if(_DIF_XL) { + if(cell.w != null) p +=("0," + cell.w + "\r\nV"); + else if(cell.v != null) p +=(make_value(cell.v, "V")); // TODO: should this call SSF_format? + else if(cell.f != null && !cell.F) p +=(make_value_str("=" + cell.f)); + else p +=("1,0\r\n\"\""); + } else { + if(cell.v == null) p +=("1,0\r\n\"\""); + else p +=(make_value(cell.v, "V")); + } + break; + case 'b': + p +=(cell.v ? make_value(1, "TRUE") : make_value(0, "FALSE")); + break; + case 's': + p +=(make_value_str((!_DIF_XL || isNaN(+cell.v)) ? cell.v : '="' + cell.v + '"')); + break; + case 'd': + if(!cell.w) cell.w = SSF_format(cell.z || table_fmt[14], datenum(parseDate(cell.v))); + if(_DIF_XL) p +=(make_value(cell.w, "V")); + else p +=(make_value_str(cell.w)); + break; + default: p +=("1,0\r\n\"\""); + } + p += "\r\n"; + } + o.push(p); + } + return o.join("") + "-1,0\r\nEOD"; + } + return { + to_workbook: dif_to_workbook, + to_sheet: dif_to_sheet, + from_sheet: sheet_to_dif + }; +})(); + +var ETH = /*#__PURE__*/(function() { + function decode(s/*:string*/)/*:string*/ { return s.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,"\n"); } + function encode(s/*:string*/)/*:string*/ { return s.replace(/\\/g, "\\b").replace(/:/g, "\\c").replace(/\n/g,"\\n"); } + + function eth_to_aoa(str/*:string*/, opts)/*:AOA*/ { + var records = str.split('\n'), R = -1, C = -1, ri = 0, arr/*:AOA*/ = []; + for (; ri !== records.length; ++ri) { + var record = records[ri].trim().split(":"); + if(record[0] !== 'cell') continue; + var addr = decode_cell(record[1]); + if(arr.length <= addr.r) for(R = arr.length; R <= addr.r; ++R) if(!arr[R]) arr[R] = []; + R = addr.r; C = addr.c; + switch(record[2]) { + case 't': arr[R][C] = decode(record[3]); break; + case 'v': arr[R][C] = +record[3]; break; + case 'vtf': var _f = record[record.length - 1]; + /* falls through */ + case 'vtc': + switch(record[3]) { + case 'nl': arr[R][C] = +record[4] ? true : false; break; + default: arr[R][C] = +record[4]; break; + } + if(record[2] == 'vtf') arr[R][C] = [arr[R][C], _f]; + } + } + if(opts && opts.sheetRows) arr = arr.slice(0, opts.sheetRows); + return arr; + } + + function eth_to_sheet(d/*:string*/, opts)/*:Worksheet*/ { return aoa_to_sheet(eth_to_aoa(d, opts), opts); } + function eth_to_workbook(d/*:string*/, opts)/*:Workbook*/ { return sheet_to_workbook(eth_to_sheet(d, opts), opts); } + + var header = [ + "socialcalc:version:1.5", + "MIME-Version: 1.0", + "Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave" + ].join("\n"); + + var sep = [ + "--SocialCalcSpreadsheetControlSave", + "Content-type: text/plain; charset=UTF-8" + ].join("\n") + "\n"; + + /* TODO: the other parts */ + var meta = [ + "# SocialCalc Spreadsheet Control Save", + "part:sheet" + ].join("\n"); + + var end = "--SocialCalcSpreadsheetControlSave--"; + + function sheet_to_eth_data(ws/*:Worksheet*/)/*:string*/ { + if(!ws || !ws['!ref']) return ""; + var o/*:Array*/ = [], oo/*:Array*/ = [], cell, coord = ""; + var r = decode_range(ws['!ref']); + var dense = ws["!data"] != null; + for(var R = r.s.r; R <= r.e.r; ++R) { + for(var C = r.s.c; C <= r.e.c; ++C) { + coord = encode_cell({r:R,c:C}); + cell = dense ? (ws["!data"][R]||[])[C] : ws[coord]; + if(!cell || cell.v == null || cell.t === 'z') continue; + oo = ["cell", coord, 't']; + switch(cell.t) { + case 's': case 'str': oo.push(encode(cell.v)); break; + case 'n': + if(!cell.f) { oo[2]='v'; oo[3]=cell.v; } + else { oo[2]='vtf'; oo[3]='n'; oo[4]=cell.v; oo[5]=encode(cell.f); } + break; + case 'b': + oo[2] = 'vt'+(cell.f?'f':'c'); oo[3]='nl'; oo[4]=cell.v?"1":"0"; + oo[5] = encode(cell.f||(cell.v?'TRUE':'FALSE')); + break; + case 'd': + var t = datenum(parseDate(cell.v)); + oo[2] = 'vtc'; oo[3] = 'nd'; oo[4] = ""+t; + oo[5] = cell.w || SSF_format(cell.z || table_fmt[14], t); + break; + case 'e': continue; + } + o.push(oo.join(":")); + } + } + o.push("sheet:c:" + (r.e.c-r.s.c+1) + ":r:" + (r.e.r-r.s.r+1) + ":tvf:1"); + o.push("valueformat:1:text-wiki"); + //o.push("copiedfrom:" + ws['!ref']); // clipboard only + return o.join("\n"); + } + + function sheet_to_eth(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ { + return [header, sep, meta, sep, sheet_to_eth_data(ws), end].join("\n"); + // return ["version:1.5", sheet_to_eth_data(ws)].join("\n"); // clipboard form + } + + return { + to_workbook: eth_to_workbook, + to_sheet: eth_to_sheet, + from_sheet: sheet_to_eth + }; +})(); + +var PRN = /*#__PURE__*/(function() { + function set_text_arr(data/*:string*/, arr/*:AOA*/, R/*:number*/, C/*:number*/, o/*:any*/) { + if(o.raw) arr[R][C] = data; + else if(data === ""){/* empty */} + else if(data === 'TRUE') arr[R][C] = true; + else if(data === 'FALSE') arr[R][C] = false; + else if(!isNaN(fuzzynum(data))) arr[R][C] = fuzzynum(data); + else if(!isNaN(fuzzydate(data).getDate())) arr[R][C] = parseDate(data); + else arr[R][C] = data; + } + + function prn_to_aoa_str(f/*:string*/, opts)/*:AOA*/ { + var o = opts || {}; + var arr/*:AOA*/ = ([]/*:any*/); + if(!f || f.length === 0) return arr; + var lines = f.split(/[\r\n]/); + var L = lines.length - 1; + while(L >= 0 && lines[L].length === 0) --L; + var start = 10, idx = 0; + var R = 0; + for(; R <= L; ++R) { + idx = lines[R].indexOf(" "); + if(idx == -1) idx = lines[R].length; else idx++; + start = Math.max(start, idx); + } + for(R = 0; R <= L; ++R) { + arr[R] = []; + /* TODO: confirm that widths are always 10 */ + var C = 0; + set_text_arr(lines[R].slice(0, start).trim(), arr, R, C, o); + for(C = 1; C <= (lines[R].length - start)/10 + 1; ++C) + set_text_arr(lines[R].slice(start+(C-1)*10,start+C*10).trim(),arr,R,C,o); + } + if(o.sheetRows) arr = arr.slice(0, o.sheetRows); + return arr; + } + + // List of accepted CSV separators + var guess_seps = { + /*::[*/0x2C/*::]*/: ',', + /*::[*/0x09/*::]*/: "\t", + /*::[*/0x3B/*::]*/: ';', + /*::[*/0x7C/*::]*/: '|' + }; + + // CSV separator weights to be used in case of equal numbers + var guess_sep_weights = { + /*::[*/0x2C/*::]*/: 3, + /*::[*/0x09/*::]*/: 2, + /*::[*/0x3B/*::]*/: 1, + /*::[*/0x7C/*::]*/: 0 + }; + + function guess_sep(str) { + var cnt = {}, instr = false, end = 0, cc = 0; + for(;end < str.length;++end) { + if((cc=str.charCodeAt(end)) == 0x22) instr = !instr; + else if(!instr && cc in guess_seps) cnt[cc] = (cnt[cc]||0)+1; + } + + cc = []; + for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) { + cc.push([ cnt[end], end ]); + } + + if ( !cc.length ) { + cnt = guess_sep_weights; + for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) { + cc.push([ cnt[end], end ]); + } + } + + cc.sort(function(a, b) { return a[0] - b[0] || guess_sep_weights[a[1]] - guess_sep_weights[b[1]]; }); + + return guess_seps[cc.pop()[1]] || 0x2C; + } + + function dsv_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ { + var o = opts || {}; + var sep = ""; + if(DENSE != null && o.dense == null) o.dense = DENSE; + var ws/*:Worksheet*/ = ({}/*:any*/); + if(o.dense) ws["!data"] = []; + var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:0, r:0}}/*:any*/); + + if(str.slice(0,4) == "sep=") { + // If the line ends in \r\n + if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) { + sep = str.charAt(4); str = str.slice(7); + } + // If line ends in \r OR \n + else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) { + sep = str.charAt(4); str = str.slice(6); + } + else sep = guess_sep(str.slice(0,1024)); + } + else if(o && o.FS) sep = o.FS; + else sep = guess_sep(str.slice(0,1024)); + var R = 0, C = 0, v = 0; + var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0, startcc=str.charCodeAt(0); + var _re/*:?RegExp*/ = o.dateNF != null ? dateNF_regex(o.dateNF) : null; + function finish_cell() { + /* TODO: fuzzy parsers should pass back assumed number format */ + var s = str.slice(start, end); if(s.slice(-1) == "\r") s = s.slice(0, -1); + var cell = ({}/*:any*/); + if(s.charAt(0) == '"' && s.charAt(s.length - 1) == '"') s = s.slice(1,-1).replace(/""/g,'"'); + if(o.cellText !== false) cell.w = s; + if(s.length === 0) cell.t = 'z'; + else if(o.raw) { cell.t = 's'; cell.v = s; } + else if(s.trim().length === 0) { cell.t = 's'; cell.v = s; } + else if(s.charCodeAt(0) == 0x3D) { + if(s.charCodeAt(1) == 0x22 && s.charCodeAt(s.length - 1) == 0x22) { cell.t = 's'; cell.v = s.slice(2,-1).replace(/""/g,'"'); } + else if(fuzzyfmla(s)) { cell.t = 'n'; cell.f = s.slice(1); } + else { cell.t = 's'; cell.v = s; } } + else if(s == "TRUE") { cell.t = 'b'; cell.v = true; } + else if(s == "FALSE") { cell.t = 'b'; cell.v = false; } + else if(!isNaN(v = fuzzynum(s))) { cell.t = 'n'; cell.v = v; } + else if(!isNaN((v = fuzzydate(s)).getDate()) || _re && s.match(_re)) { + cell.z = o.dateNF || table_fmt[14]; + if(_re && s.match(_re)){ var news=dateNF_fix(s, o.dateNF, (s.match(_re)||[])); v = parseDate(news); if(o && o.UTC === false) v = utc_to_local(v); } + else if(o && o.UTC === false) v = utc_to_local(v); + else if(o.cellText !== false && o.dateNF) cell.w = SSF_format(cell.z, v); + if(o.cellDates) { cell.t = 'd'; cell.v = v; } + else { cell.t = 'n'; cell.v = datenum(v); } + if(!o.cellNF) delete cell.z; + } else { + cell.t = 's'; + cell.v = s; + } + if(cell.t == 'z'){} + else if(o.dense) { if(!ws["!data"][R]) ws["!data"][R] = []; ws["!data"][R][C] = cell; } + else ws[encode_cell({c:C,r:R})] = cell; + start = end+1; startcc = str.charCodeAt(start); + if(range.e.c < C) range.e.c = C; + if(range.e.r < R) range.e.r = R; + if(cc == sepcc) ++C; else { C = 0; ++R; if(o.sheetRows && o.sheetRows <= R) return true; } + } + outer: for(;end < str.length;++end) switch((cc=str.charCodeAt(end))) { + case 0x22: if(startcc === 0x22) instr = !instr; break; + case 0x0d: + if(instr) break; + if(str.charCodeAt(end+1) == 0x0a) ++end; + /* falls through */ + case sepcc: case 0x0a: if(!instr && finish_cell()) break outer; break; + default: break; + } + if(end - start > 0) finish_cell(); + + ws['!ref'] = encode_range(range); + return ws; + } + + function prn_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ { + if(!(opts && opts.PRN)) return dsv_to_sheet_str(str, opts); + if(opts.FS) return dsv_to_sheet_str(str, opts); + if(str.slice(0,4) == "sep=") return dsv_to_sheet_str(str, opts); + if(str.indexOf("\t") >= 0 || str.indexOf(",") >= 0 || str.indexOf(";") >= 0) return dsv_to_sheet_str(str, opts); + return aoa_to_sheet(prn_to_aoa_str(str, opts), opts); + } + + function prn_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ { + var str = "", bytes = opts.type == 'string' ? [0,0,0,0] : firstbyte(d, opts); + switch(opts.type) { + case 'base64': str = Base64_decode(d); break; + case 'binary': str = d; break; + case 'buffer': + if(opts.codepage == 65001) str = d.toString('utf8'); // TODO: test if buf + else if(opts.codepage && typeof $cptable !== 'undefined') str = $cptable.utils.decode(opts.codepage, d); + else str = has_buf && Buffer.isBuffer(d) ? d.toString('binary') : a2s(d); + break; + case 'array': str = cc2str(d); break; + case 'string': str = d; break; + default: throw new Error("Unrecognized type " + opts.type); + } + if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3)); + else if(opts.type != 'string' && opts.type != 'buffer' && opts.codepage == 65001) str = utf8read(str); + else if((opts.type == 'binary') && typeof $cptable !== 'undefined' && opts.codepage) str = $cptable.utils.decode(opts.codepage, $cptable.utils.encode(28591,str)); + if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts); + return prn_to_sheet_str(str, opts); + } + + function prn_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(prn_to_sheet(d, opts), opts); } + + function sheet_to_prn(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ { + var o/*:Array*/ = []; + var r = safe_decode_range(ws['!ref']), cell/*:Cell*/; + var dense = ws["!data"] != null; + for(var R = r.s.r; R <= r.e.r; ++R) { + var oo/*:Array*/ = []; + for(var C = r.s.c; C <= r.e.c; ++C) { + var coord = encode_cell({r:R,c:C}); + cell = dense ? (ws["!data"][R]||[])[C] : ws[coord]; + if(!cell || cell.v == null) { oo.push(" "); continue; } + var w = (cell.w || (format_cell(cell), cell.w) || "").slice(0,10); + while(w.length < 10) w += " "; + oo.push(w + (C === 0 ? " " : "")); + } + o.push(oo.join("")); + } + return o.join("\n"); + } + + return { + to_workbook: prn_to_workbook, + to_sheet: prn_to_sheet, + from_sheet: sheet_to_prn + }; +})(); + +/* Excel defaults to SYLK but warns if data is not valid */ +function read_wb_ID(d, opts) { + var o = opts || {}, OLD_WTF = !!o.WTF; o.WTF = true; + try { + var out = SYLK.to_workbook(d, o); + o.WTF = OLD_WTF; + return out; + } catch(e) { + o.WTF = OLD_WTF; + if(!e.message.match(/SYLK bad record ID/) && OLD_WTF) throw e; + return PRN.to_workbook(d, opts); + } +} + +var WK_ = /*#__PURE__*/(function() { + function lotushopper(data, cb/*:RecordHopperCB*/, opts/*:any*/) { + if(!data) return; + prep_blob(data, data.l || 0); + var Enum = opts.Enum || WK1Enum; + while(data.l < data.length) { + var RT = data.read_shift(2); + var R = Enum[RT] || Enum[0xFFFF]; + var length = data.read_shift(2); + var tgt = data.l + length; + var d = R.f && R.f(data, length, opts); + data.l = tgt; + if(cb(d, R, RT)) return; + } + } + + function lotus_to_workbook(d/*:RawData*/, opts) { + switch(opts.type) { + case 'base64': return lotus_to_workbook_buf(s2a(Base64_decode(d)), opts); + case 'binary': return lotus_to_workbook_buf(s2a(d), opts); + case 'buffer': + case 'array': return lotus_to_workbook_buf(d, opts); + } + throw "Unsupported type " + opts.type; + } + + /* NOTE: this list intentionally starts at 1 */ + var LOTUS_DATE_FMTS = [ + "mmmm", + "dd-mmm-yyyy", + "dd-mmm", + "mmm-yyyy", + "@", // "text"? + "mm/dd", + "hh:mm:ss AM/PM", // 7 + "hh:mm AM/PM", + "mm/dd/yyyy", + "mm/dd", + "hh:mm:ss", + "hh:mm" // 12 + ]; + + function lotus_to_workbook_buf(d, opts)/*:Workbook*/ { + if(!d) return d; + var o = opts || {}; + if(DENSE != null && o.dense == null) o.dense = DENSE; + var s/*:Worksheet*/ = ({}/*:any*/), n = "Sheet1", next_n = "", sidx = 0; + var sheets = {}, snames = [], realnames = [], sdata = []; + if(o.dense) sdata = s["!data"] = []; + + var refguess = {s: {r:0, c:0}, e: {r:0, c:0} }; + var sheetRows = o.sheetRows || 0; + var lastcell = {}; + + if(d[4] == 0x51 && d[5] == 0x50 && d[6] == 0x57) return qpw_to_workbook_buf(d, opts); + if(d[2] == 0x00) { + if(d[3] == 0x08 || d[3] == 0x09) { + if(d.length >= 16 && d[14] == 0x05 && d[15] === 0x6c) throw new Error("Unsupported Works 3 for Mac file"); + } + } + + if(d[2] == 0x02) { + o.Enum = WK1Enum; + lotushopper(d, function(val, R, RT) { switch(RT) { + case 0x00: /* BOF */ + o.vers = val; + if(val >= 0x1000) o.qpro = true; + break; + case 0xFF: /* BOF (works 3+) */ + o.vers = val; + o.works = true; + break; + case 0x06: refguess = val; break; /* RANGE */ + case 0xCC: if(val) next_n = val; break; /* SHEETNAMECS */ + case 0xDE: next_n = val; break; /* SHEETNAMELP */ + case 0x0F: /* LABEL */ + case 0x33: /* STRING */ + if((!o.qpro && !o.works || RT == 0x33) && val[1].v.charCodeAt(0) < 0x30) val[1].v = val[1].v.slice(1); + if(o.works || o.works2) val[1].v = val[1].v.replace(/\r\n/g, "\n"); + /* falls through */ + case 0x0D: /* INTEGER */ + case 0x0E: /* NUMBER */ + case 0x10: /* FORMULA */ + /* TODO: actual translation of the format code */ + if((val[2] & 0x70) == 0x70 && (val[2] & 0x0F) > 1 && (val[2] & 0x0F) < 15) { + val[1].z = o.dateNF || LOTUS_DATE_FMTS[(val[2] & 0x0F)-1] || table_fmt[14]; + if(o.cellDates) { val[1].v = numdate(val[1].v); val[1].t = typeof val[1].v == "number" ? 'n' : 'd'; } + } + + if(o.qpro) { + if(val[3] > sidx) { + s["!ref"] = encode_range(refguess); + sheets[n] = s; + snames.push(n); + s = ({}/*:any*/); if(o.dense) sdata = s["!data"] = []; + refguess = {s: {r:0, c:0}, e: {r:0, c:0} }; + sidx = val[3]; n = next_n || "Sheet" + (sidx + 1); next_n = ""; + } + } + + var tmpcell = o.dense ? (sdata[val[0].r]||[])[val[0].c] : s[encode_cell(val[0])]; + if(tmpcell) { + tmpcell.t = val[1].t; tmpcell.v = val[1].v; + if(val[1].z != null) tmpcell.z = val[1].z; + if(val[1].f != null) tmpcell.f = val[1].f; + lastcell = tmpcell; + break; + } + if(o.dense) { + if(!sdata[val[0].r]) sdata[val[0].r] = []; + sdata[val[0].r][val[0].c] = val[1]; + } else s[encode_cell(val[0])] = val[1]; + lastcell = val[1]; + break; + case 0x5405: o.works2 = true; break; + case 0x5402: { + /* TODO: enumerate all extended number formats */ + if(val == 0x14a1) { + lastcell.z = "hh:mm:ss"; + if(o.cellDates && lastcell.t == "n") { + lastcell.v = numdate(lastcell.v); lastcell.t = typeof lastcell.v == "number" ? 'n' : 'd'; + } + } + } break; + }}, o); + } else if(d[2] == 0x1A || d[2] == 0x0E) { + o.Enum = WK3Enum; + if(d[2] == 0x0E) { o.qpro = true; d.l = 0; } + lotushopper(d, function(val, R, RT) { switch(RT) { + case 0xCC: n = val; break; /* SHEETNAMECS */ + case 0x16: /* LABEL16 */ + if(val[1].v.charCodeAt(0) < 0x30) val[1].v = val[1].v.slice(1); + // TODO: R9 appears to encode control codes this way -- verify against other versions + val[1].v = val[1].v.replace(/\x0F./g, function($$) { return String.fromCharCode($$.charCodeAt(1) - 0x20); }).replace(/\r\n/g, "\n"); + /* falls through */ + case 0x17: /* NUMBER17 */ + case 0x18: /* NUMBER18 */ + case 0x19: /* FORMULA19 */ + case 0x25: /* NUMBER25 */ + case 0x27: /* NUMBER27 */ + case 0x28: /* FORMULA28 */ + if(val[3] > sidx) { + s["!ref"] = encode_range(refguess); + sheets[n] = s; + snames.push(n); + s = ({}/*:any*/); if(o.dense) sdata = s["!data"] = []; + refguess = {s: {r:0, c:0}, e: {r:0, c:0} }; + sidx = val[3]; n = "Sheet" + (sidx + 1); + } + if(sheetRows > 0 && val[0].r >= sheetRows) break; + if(o.dense) { + if(!sdata[val[0].r]) sdata[val[0].r] = []; + sdata[val[0].r][val[0].c] = val[1]; + } else s[encode_cell(val[0])] = val[1]; + if(refguess.e.c < val[0].c) refguess.e.c = val[0].c; + if(refguess.e.r < val[0].r) refguess.e.r = val[0].r; + break; + case 0x1B: /* XFORMAT */ + if(val[0x36b0]) realnames[val[0x36b0][0]] = val[0x36b0][1]; + break; + case 0x0601: /* SHEETINFOQP */ + realnames[val[0]] = val[1]; if(val[0] == sidx) n = val[1]; break; + default: break; + }}, o); + } else throw new Error("Unrecognized LOTUS BOF " + d[2]); + s["!ref"] = encode_range(refguess); + sheets[next_n || n] = s; + snames.push(next_n || n); + if(!realnames.length) return { SheetNames: snames, Sheets: sheets }; + var osheets = {}, rnames = []; + /* TODO: verify no collisions */ + for(var i = 0; i < realnames.length; ++i) if(sheets[snames[i]]) { + rnames.push(realnames[i] || snames[i]); + osheets[realnames[i]] = sheets[realnames[i]] || sheets[snames[i]]; + } else { + rnames.push(realnames[i]); + osheets[realnames[i]] = ({ "!ref": "A1" }); + } + return { SheetNames: rnames, Sheets: osheets }; + } + + function sheet_to_wk1(ws/*:Worksheet*/, opts/*:WriteOpts*/) { + var o = opts || {}; + if(+o.codepage >= 0) set_cp(+o.codepage); + if(o.type == "string") throw new Error("Cannot write WK1 to JS string"); + var ba = buf_array(); + var range = safe_decode_range(ws["!ref"]); + var dense = ws["!data"] != null; + var cols = []; + + write_biff_rec(ba, 0x00, write_BOF_WK1(0x0406)); + write_biff_rec(ba, 0x06, write_RANGE(range)); + var max_R = Math.min(range.e.r, 8191); + for(var C = range.s.c; C <= range.e.c; ++C) cols[C] = encode_col(C); + for(var R = range.s.r; R <= max_R; ++R) { + var rr = encode_row(R); + for(C = range.s.c; C <= range.e.c; ++C) { + var cell = dense ? (ws["!data"][R]||[])[C] : ws[cols[C] + rr]; + if(!cell || cell.t == "z") continue; + /* TODO: formula records */ + switch(cell.t) { + case "n": + if((cell.v|0)==cell.v && cell.v >= -32768 && cell.v <= 32767) write_biff_rec(ba, 0x0d, write_INTEGER(R, C, cell)); + else write_biff_rec(ba, 0x0e, write_NUMBER(R, C, cell)); + break; + case "d": + var dc = datenum(cell.v); + if((dc|0)==dc && dc >= -32768 && dc <= 32767) write_biff_rec(ba, 0x0d, write_INTEGER(R, C, {t:"n", v:dc, z:cell.z || table_fmt[14]})); + else write_biff_rec(ba, 0x0e, write_NUMBER(R, C, {t:"n", v:dc, z:cell.z || table_fmt[14]})); + break; + default: + var str = format_cell(cell); + write_biff_rec(ba, 0x0F, write_LABEL(R, C, str.slice(0, 239))); + } + } + } + + write_biff_rec(ba, 0x01); + return ba.end(); + } + + function book_to_wk3(wb/*:Workbook*/, opts/*:WriteOpts*/) { + var o = opts || {}; + if(+o.codepage >= 0) set_cp(+o.codepage); + if(o.type == "string") throw new Error("Cannot write WK3 to JS string"); + var ba = buf_array(); + + write_biff_rec(ba, 0x00, write_BOF_WK3(wb)); + + for(var i = 0, cnt = 0; i < wb.SheetNames.length; ++i) if((wb.Sheets[wb.SheetNames[i]] || {})["!ref"]) write_biff_rec(ba, 0x1b, write_XFORMAT_SHEETNAME(wb.SheetNames[i], cnt++)); + + var wsidx = 0; + for(i = 0; i < wb.SheetNames.length; ++i) { + var ws = wb.Sheets[wb.SheetNames[i]]; + if(!ws || !ws["!ref"]) continue; + var range = safe_decode_range(ws["!ref"]); + var dense = ws["!data"] != null; + var cols = []; + var max_R = Math.min(range.e.r, 8191); + for(var R = range.s.r; R <= max_R; ++R) { + var rr = encode_row(R); + for(var C = range.s.c; C <= range.e.c; ++C) { + if(R === range.s.r) cols[C] = encode_col(C); + var ref = cols[C] + rr; + var cell = dense ? (ws["!data"][R]||[])[C] : ws[ref]; + if(!cell || cell.t == "z") continue; + /* TODO: FORMULA19 NUMBER18 records */ + if(cell.t == "n") { + write_biff_rec(ba, 0x17, write_NUMBER_17(R, C, wsidx, cell.v)); + } else { + var str = format_cell(cell); + /* TODO: max len? */ + write_biff_rec(ba, 0x16, write_LABEL_16(R, C, wsidx, str.slice(0, 239))); + } + } + } + ++wsidx; + } + + write_biff_rec(ba, 0x01); + return ba.end(); + } + + + function write_BOF_WK1(v/*:number*/) { + var out = new_buf(2); + out.write_shift(2, v); + return out; + } + + function write_BOF_WK3(wb/*:Workbook*/) { + var out = new_buf(26); + out.write_shift(2, 0x1000); + out.write_shift(2, 0x0004); + out.write_shift(4, 0x0000); + var rows = 0, cols = 0, wscnt = 0; + for(var i = 0; i < wb.SheetNames.length; ++i) { + var name = wb.SheetNames[i]; + var ws = wb.Sheets[name]; + if(!ws || !ws["!ref"]) continue; + ++wscnt; + var range = decode_range(ws["!ref"]); + if(rows < range.e.r) rows = range.e.r; + if(cols < range.e.c) cols = range.e.c; + } + if(rows > 8191) rows = 8191; + out.write_shift(2, rows); + out.write_shift(1, wscnt); + out.write_shift(1, cols); + out.write_shift(2, 0x00); + out.write_shift(2, 0x00); + out.write_shift(1, 0x01); + out.write_shift(1, 0x02); + out.write_shift(4, 0); + out.write_shift(4, 0); + return out; + } + + function parse_RANGE(blob, length, opts) { + var o = {s:{c:0,r:0},e:{c:0,r:0}}; + if(length == 8 && opts.qpro) { + o.s.c = blob.read_shift(1); + blob.l++; + o.s.r = blob.read_shift(2); + o.e.c = blob.read_shift(1); + blob.l++; + o.e.r = blob.read_shift(2); + return o; + } + o.s.c = blob.read_shift(2); + o.s.r = blob.read_shift(2); + if(length == 12 && opts.qpro) blob.l += 2; + o.e.c = blob.read_shift(2); + o.e.r = blob.read_shift(2); + if(length == 12 && opts.qpro) blob.l += 2; + if(o.s.c == 0xFFFF) o.s.c = o.e.c = o.s.r = o.e.r = 0; + return o; + } + function write_RANGE(range) { + var out = new_buf(8); + out.write_shift(2, range.s.c); + out.write_shift(2, range.s.r); + out.write_shift(2, range.e.c); + out.write_shift(2, range.e.r); + return out; + } + + function parse_cell(blob, length, opts) { + var o = [{c:0,r:0}, {t:'n',v:0}, 0, 0]; + if(opts.qpro && opts.vers != 0x5120) { + o[0].c = blob.read_shift(1); + o[3] = blob.read_shift(1); + o[0].r = blob.read_shift(2); + blob.l+=2; + } else if(opts.works) { // TODO: verify with more complex works3-4 examples + o[0].c = blob.read_shift(2); o[0].r = blob.read_shift(2); + o[2] = blob.read_shift(2); + } else { + o[2] = blob.read_shift(1); + o[0].c = blob.read_shift(2); o[0].r = blob.read_shift(2); + } + return o; + } + + function get_wk1_fmt(cell)/*:number*/ { + /* TODO: some fuzzy matching on the number format */ + if(cell.z && fmt_is_date(cell.z)) { + return 0xf0 | (LOTUS_DATE_FMTS.indexOf(cell.z) + 1 || 2); + } + return 0xFF; + } + function parse_LABEL(blob, length, opts) { + var tgt = blob.l + length; + var o = parse_cell(blob, length, opts); + o[1].t = 's'; + if((opts.vers & 0xFFFE) == 0x5120) { // WQ1 / WQ2 + blob.l++; + var len = blob.read_shift(1); + o[1].v = blob.read_shift(len, 'utf8'); + return o; + } + if(opts.qpro) blob.l++; + o[1].v = blob.read_shift(tgt - blob.l, 'cstr'); + return o; + } + function write_LABEL(R, C, s) { + /* TODO: encoding */ + var o = new_buf(7 + s.length); + o.write_shift(1, 0xFF); + o.write_shift(2, C); + o.write_shift(2, R); + o.write_shift(1, 0x27); // ?? + for(var i = 0; i < o.length; ++i) { + var cc = s.charCodeAt(i); + o.write_shift(1, cc >= 0x80 ? 0x5F : cc); + } + o.write_shift(1, 0); + return o; + } + function parse_STRING(blob, length, opts) { + var tgt = blob.l + length; + var o = parse_cell(blob, length, opts); + o[1].t = 's'; + if(opts.vers == 0x5120) { + var len = blob.read_shift(1); + o[1].v = blob.read_shift(len, 'utf8'); + return o; + } + o[1].v = blob.read_shift(tgt - blob.l, 'cstr'); + return o; + } + + function parse_INTEGER(blob, length, opts) { + var o = parse_cell(blob, length, opts); + o[1].v = blob.read_shift(2, 'i'); + return o; + } + function write_INTEGER(R, C, cell) { + var o = new_buf(7); + o.write_shift(1, get_wk1_fmt(cell)); + o.write_shift(2, C); + o.write_shift(2, R); + o.write_shift(2, cell.v, 'i'); + return o; + } + + function parse_NUMBER(blob, length, opts) { + var o = parse_cell(blob, length, opts); + o[1].v = blob.read_shift(8, 'f'); + return o; + } + function write_NUMBER(R, C, cell) { + var o = new_buf(13); + o.write_shift(1, get_wk1_fmt(cell)); + o.write_shift(2, C); + o.write_shift(2, R); + o.write_shift(8, cell.v, 'f'); + return o; + } + + function parse_FORMULA(blob, length, opts) { + var tgt = blob.l + length; + var o = parse_cell(blob, length, opts); + /* TODO: formula */ + o[1].v = blob.read_shift(8, 'f'); + if(opts.qpro) blob.l = tgt; + else { + var flen = blob.read_shift(2); + wk1_fmla_to_csf(blob.slice(blob.l, blob.l + flen), o); + blob.l += flen; + } + return o; + } + + function wk1_parse_rc(B, V, col) { + var rel = V & 0x8000; + V &= ~0x8000; + V = (rel ? B : 0) + ((V >= 0x2000) ? V - 0x4000 : V); + return (rel ? "" : "$") + (col ? encode_col(V) : encode_row(V)); + } + /* var oprec = [ + 8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 4, 5, 5, 7, 3, 3, + 3, 3, 3, 3, 1, 1, 2, 6, 8, 8, 8, 8, 8, 8, 8, 8 + ]; */ + /* TODO: flesh out */ + var FuncTab = { + 0x1F: ["NA", 0], + // 0x20: ["ERR", 0], + 0x21: ["ABS", 1], + 0x22: ["TRUNC", 1], + 0x23: ["SQRT", 1], + 0x24: ["LOG", 1], + 0x25: ["LN", 1], + 0x26: ["PI", 0], + 0x27: ["SIN", 1], + 0x28: ["COS", 1], + 0x29: ["TAN", 1], + 0x2A: ["ATAN2", 2], + 0x2B: ["ATAN", 1], + 0x2C: ["ASIN", 1], + 0x2D: ["ACOS", 1], + 0x2E: ["EXP", 1], + 0x2F: ["MOD", 2], + // 0x30 + 0x31: ["ISNA", 1], + 0x32: ["ISERR", 1], + 0x33: ["FALSE", 0], + 0x34: ["TRUE", 0], + 0x35: ["RAND", 0], + 0x36: ["DATE", 3], + // 0x37 NOW + // 0x38 PMT + // 0x39 PV + // 0x3A FV + // 0x3B IF + // 0x3C DAY + // 0x3D MONTH + // 0x3E YEAR + 0x3F: ["ROUND", 2], + 0x40: ["TIME", 3], + // 0x41 HOUR + // 0x42 MINUTE + // 0x43 SECOND + 0x44: ["ISNUMBER", 1], + 0x45: ["ISTEXT", 1], + 0x46: ["LEN", 1], + 0x47: ["VALUE", 1], + // 0x48: ["FIXED", ?? 1], + 0x49: ["MID", 3], + 0x4A: ["CHAR", 1], + // 0x4B + // 0x4C FIND + // 0x4D DATEVALUE + // 0x4E TIMEVALUE + // 0x4F CELL + 0x50: ["SUM", 69], + 0x51: ["AVERAGEA", 69], + 0x52: ["COUNTA", 69], + 0x53: ["MINA", 69], + 0x54: ["MAXA", 69], + // 0x55 VLOOKUP + // 0x56 NPV + // 0x57 VAR + // 0x58 STD + // 0x59 IRR + // 0x5A HLOOKUP + // 0x5B DSUM + // 0x5C DAVERAGE + // 0x5D DCOUNTA + // 0x5E DMIN + // 0x5F DMAX + // 0x60 DVARP + // 0x61 DSTDEVP + // 0x62 INDEX + // 0x63 COLS + // 0x64 ROWS + // 0x65 REPEAT + 0x66: ["UPPER", 1], + 0x67: ["LOWER", 1], + // 0x68 LEFT + // 0x69 RIGHT + // 0x6A REPLACE + 0x6B: ["PROPER", 1], + // 0x6C CELL + 0x6D: ["TRIM", 1], + // 0x6E CLEAN + 0x6F: ["T", 1] + // 0x70 V + }; + var BinOpTab = [ + "", "", "", "", "", "", "", "", // eslint-disable-line no-mixed-spaces-and-tabs + "", "+", "-", "*", "/", "^", "=", "<>", // eslint-disable-line no-mixed-spaces-and-tabs + "<=", ">=", "<", ">", "", "", "", "", // eslint-disable-line no-mixed-spaces-and-tabs + "&", "", "", "", "", "", "", "" // eslint-disable-line no-mixed-spaces-and-tabs + ]; + + function wk1_fmla_to_csf(blob, o) { + prep_blob(blob, 0); + var out = [], argc = 0, R = "", C = "", argL = "", argR = ""; + while(blob.l < blob.length) { + var cc = blob[blob.l++]; + switch(cc) { + case 0x00: out.push(blob.read_shift(8, 'f')); break; + case 0x01: { + C = wk1_parse_rc(o[0].c, blob.read_shift(2), true); + R = wk1_parse_rc(o[0].r, blob.read_shift(2), false); + out.push(C + R); + } break; + case 0x02: { + var c = wk1_parse_rc(o[0].c, blob.read_shift(2), true); + var r = wk1_parse_rc(o[0].r, blob.read_shift(2), false); + C = wk1_parse_rc(o[0].c, blob.read_shift(2), true); + R = wk1_parse_rc(o[0].r, blob.read_shift(2), false); + out.push(c + r + ":" + C + R); + } break; + case 0x03: + if(blob.l < blob.length) { console.error("WK1 premature formula end"); return; } + break; + case 0x04: out.push("(" + out.pop() + ")"); break; + case 0x05: out.push(blob.read_shift(2)); break; + case 0x06: { + /* TODO: text encoding */ + var Z = ""; while((cc = blob[blob.l++])) Z += String.fromCharCode(cc); + out.push('"' + Z.replace(/"/g, '""') + '"'); + } break; + + case 0x08: out.push("-" + out.pop()); break; + case 0x17: out.push("+" + out.pop()); break; + case 0x16: out.push("NOT(" + out.pop() + ")"); break; + + case 0x14: case 0x15: { + argR = out.pop(); argL = out.pop(); + out.push(["AND", "OR"][cc - 0x14] + "(" + argL + "," + argR + ")"); + } break; + + default: + if(cc < 0x20 && BinOpTab[cc]) { + argR = out.pop(); argL = out.pop(); + out.push(argL + BinOpTab[cc] + argR); + } else if(FuncTab[cc]) { + argc = FuncTab[cc][1]; + if(argc == 69) argc = blob[blob.l++]; + if(argc > out.length) { console.error("WK1 bad formula parse 0x" + cc.toString(16) + ":|" + out.join("|") + "|"); return; } + var args = out.slice(-argc); + out.length -= argc; + out.push(FuncTab[cc][0] + "(" + args.join(",") + ")"); + } + else if(cc <= 0x07) return console.error("WK1 invalid opcode " + cc.toString(16)); + else if(cc <= 0x18) return console.error("WK1 unsupported op " + cc.toString(16)); + else if(cc <= 0x1E) return console.error("WK1 invalid opcode " + cc.toString(16)); + else if(cc <= 0x73) return console.error("WK1 unsupported function opcode " + cc.toString(16)); + // possible future functions ?? + else return console.error("WK1 unrecognized opcode " + cc.toString(16)); + } + } + if(out.length == 1) o[1].f = "" + out[0]; + else console.error("WK1 bad formula parse |" + out.join("|") + "|"); + } + + + function parse_cell_3(blob/*::, length*/) { + var o = [{c:0,r:0}, {t:'n',v:0}, 0]; + o[0].r = blob.read_shift(2); o[3] = blob[blob.l++]; o[0].c = blob[blob.l++]; + return o; + } + + function parse_LABEL_16(blob, length) { + var o = parse_cell_3(blob, length); + o[1].t = 's'; + o[1].v = blob.read_shift(length - 4, 'cstr'); + return o; + } + function write_LABEL_16(R, C, wsidx, s) { + /* TODO: encoding */ + var o = new_buf(6 + s.length); + o.write_shift(2, R); + o.write_shift(1, wsidx); + o.write_shift(1, C); + o.write_shift(1, 0x27); + for(var i = 0; i < s.length; ++i) { + var cc = s.charCodeAt(i); + o.write_shift(1, cc >= 0x80 ? 0x5F : cc); + } + o.write_shift(1, 0); + return o; + } + + function parse_NUMBER_18(blob, length) { + var o = parse_cell_3(blob, length); + o[1].v = blob.read_shift(2); + var v = o[1].v >> 1; + if(o[1].v & 0x1) { + switch(v & 0x07) { + case 0: v = (v >> 3) * 5000; break; + case 1: v = (v >> 3) * 500; break; + case 2: v = (v >> 3) / 20; break; + case 3: v = (v >> 3) / 200; break; + case 4: v = (v >> 3) / 2000; break; + case 5: v = (v >> 3) / 20000; break; + case 6: v = (v >> 3) / 16; break; + case 7: v = (v >> 3) / 64; break; + } + } + o[1].v = v; + return o; + } + + function parse_NUMBER_17(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(4); + var v2 = blob.read_shift(4); + var e = blob.read_shift(2); + if(e == 0xFFFF) { + if(v1 === 0 && v2 === 0xC0000000) { o[1].t = "e"; o[1].v = 0x0F; } // ERR -> #VALUE! + else if(v1 === 0 && v2 === 0xD0000000) { o[1].t = "e"; o[1].v = 0x2A; } // NA -> #N/A + else o[1].v = 0; + return o; + } + var s = e & 0x8000; e = (e&0x7FFF) - 16446; + o[1].v = (1 - s*2) * (v2 * Math.pow(2, e+32) + v1 * Math.pow(2, e)); + return o; + } + function write_NUMBER_17(R, C, wsidx, v) { + var o = new_buf(14); + o.write_shift(2, R); + o.write_shift(1, wsidx); + o.write_shift(1, C); + if(v == 0) { + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(2, 0xFFFF); + return o; + } + var s = 0, e = 0, v1 = 0, v2 = 0; + if(v < 0) { s = 1; v = -v; } + e = Math.log2(v) | 0; + v /= Math.pow(2, e-31); + v2 = (v)>>>0; + if((v2&0x80000000) == 0) { v/=2; ++e; v2 = v >>> 0; } + v -= v2; + v2 |= 0x80000000; + v2 >>>= 0; + v *= Math.pow(2, 32); + v1 = v>>>0; + o.write_shift(4, v1); + o.write_shift(4, v2); + e += 0x3FFF + (s ? 0x8000 : 0); + o.write_shift(2, e); + return o; + } + + function parse_FORMULA_19(blob, length) { + var o = parse_NUMBER_17(blob, 14); + blob.l += length - 14; /* TODO: WK3 formula */ + return o; + } + + function parse_NUMBER_25(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(4); + o[1].v = v1 >> 6; + return o; + } + + function parse_NUMBER_27(blob, length) { + var o = parse_cell_3(blob, length); + var v1 = blob.read_shift(8,'f'); + o[1].v = v1; + return o; + } + + function parse_FORMULA_28(blob, length) { + var o = parse_NUMBER_27(blob, 12); + blob.l += length - 12; /* TODO: formula */ + return o; + } + + function parse_SHEETNAMECS(blob, length) { + return blob[blob.l + length - 1] == 0 ? blob.read_shift(length, 'cstr') : ""; + } + + function parse_SHEETNAMELP(blob, length) { + var len = blob[blob.l++]; + if(len > length - 1) len = length - 1; + var o = ""; while(o.length < len) o += String.fromCharCode(blob[blob.l++]); + return o; + } + + function parse_SHEETINFOQP(blob, length, opts) { + if(!opts.qpro || length < 21) return; + var id = blob.read_shift(1); + blob.l += 17; + blob.l += 1; //var len = blob.read_shift(1); + blob.l += 2; + var nm = blob.read_shift(length - 21, 'cstr'); + return [id, nm]; + } + + function parse_XFORMAT(blob, length) { + var o = {}, tgt = blob.l + length; + while(blob.l < tgt) { + var dt = blob.read_shift(2); + if(dt == 0x36b0) { + o[dt] = [0, ""]; + o[dt][0] = blob.read_shift(2); + while(blob[blob.l]) { o[dt][1] += String.fromCharCode(blob[blob.l]); blob.l++; } blob.l++; + } + // TODO: 0x3a99 ?? + } + return o; + } + function write_XFORMAT_SHEETNAME(name, wsidx) { + var out = new_buf(5 + name.length); + out.write_shift(2, 0x36b0); + out.write_shift(2, wsidx); + for(var i = 0; i < name.length; ++i) { + var cc = name.charCodeAt(i); + out[out.l++] = cc > 0x7F ? 0x5F : cc; + } + out[out.l++] = 0; + return out; + } + + var WK1Enum = { + /*::[*/0x0000/*::]*/: { n:"BOF", f:parseuint16 }, + /*::[*/0x0001/*::]*/: { n:"EOF" }, + /*::[*/0x0002/*::]*/: { n:"CALCMODE" }, + /*::[*/0x0003/*::]*/: { n:"CALCORDER" }, + /*::[*/0x0004/*::]*/: { n:"SPLIT" }, + /*::[*/0x0005/*::]*/: { n:"SYNC" }, + /*::[*/0x0006/*::]*/: { n:"RANGE", f:parse_RANGE }, + /*::[*/0x0007/*::]*/: { n:"WINDOW1" }, + /*::[*/0x0008/*::]*/: { n:"COLW1" }, + /*::[*/0x0009/*::]*/: { n:"WINTWO" }, + /*::[*/0x000A/*::]*/: { n:"COLW2" }, + /*::[*/0x000B/*::]*/: { n:"NAME" }, + /*::[*/0x000C/*::]*/: { n:"BLANK" }, + /*::[*/0x000D/*::]*/: { n:"INTEGER", f:parse_INTEGER }, + /*::[*/0x000E/*::]*/: { n:"NUMBER", f:parse_NUMBER }, + /*::[*/0x000F/*::]*/: { n:"LABEL", f:parse_LABEL }, + /*::[*/0x0010/*::]*/: { n:"FORMULA", f:parse_FORMULA }, + /*::[*/0x0018/*::]*/: { n:"TABLE" }, + /*::[*/0x0019/*::]*/: { n:"ORANGE" }, + /*::[*/0x001A/*::]*/: { n:"PRANGE" }, + /*::[*/0x001B/*::]*/: { n:"SRANGE" }, + /*::[*/0x001C/*::]*/: { n:"FRANGE" }, + /*::[*/0x001D/*::]*/: { n:"KRANGE1" }, + /*::[*/0x0020/*::]*/: { n:"HRANGE" }, + /*::[*/0x0023/*::]*/: { n:"KRANGE2" }, + /*::[*/0x0024/*::]*/: { n:"PROTEC" }, + /*::[*/0x0025/*::]*/: { n:"FOOTER" }, + /*::[*/0x0026/*::]*/: { n:"HEADER" }, + /*::[*/0x0027/*::]*/: { n:"SETUP" }, + /*::[*/0x0028/*::]*/: { n:"MARGINS" }, + /*::[*/0x0029/*::]*/: { n:"LABELFMT" }, + /*::[*/0x002A/*::]*/: { n:"TITLES" }, + /*::[*/0x002B/*::]*/: { n:"SHEETJS" }, + /*::[*/0x002D/*::]*/: { n:"GRAPH" }, + /*::[*/0x002E/*::]*/: { n:"NGRAPH" }, + /*::[*/0x002F/*::]*/: { n:"CALCCOUNT" }, + /*::[*/0x0030/*::]*/: { n:"UNFORMATTED" }, + /*::[*/0x0031/*::]*/: { n:"CURSORW12" }, + /*::[*/0x0032/*::]*/: { n:"WINDOW" }, + /*::[*/0x0033/*::]*/: { n:"STRING", f:parse_STRING }, + /*::[*/0x0037/*::]*/: { n:"PASSWORD" }, + /*::[*/0x0038/*::]*/: { n:"LOCKED" }, + /*::[*/0x003C/*::]*/: { n:"QUERY" }, + /*::[*/0x003D/*::]*/: { n:"QUERYNAME" }, + /*::[*/0x003E/*::]*/: { n:"PRINT" }, + /*::[*/0x003F/*::]*/: { n:"PRINTNAME" }, + /*::[*/0x0040/*::]*/: { n:"GRAPH2" }, + /*::[*/0x0041/*::]*/: { n:"GRAPHNAME" }, + /*::[*/0x0042/*::]*/: { n:"ZOOM" }, + /*::[*/0x0043/*::]*/: { n:"SYMSPLIT" }, + /*::[*/0x0044/*::]*/: { n:"NSROWS" }, + /*::[*/0x0045/*::]*/: { n:"NSCOLS" }, + /*::[*/0x0046/*::]*/: { n:"RULER" }, + /*::[*/0x0047/*::]*/: { n:"NNAME" }, + /*::[*/0x0048/*::]*/: { n:"ACOMM" }, + /*::[*/0x0049/*::]*/: { n:"AMACRO" }, + /*::[*/0x004A/*::]*/: { n:"PARSE" }, + // 0x0064 + /*::[*/0x0066/*::]*/: { n:"PRANGES??" }, + /*::[*/0x0067/*::]*/: { n:"RRANGES??" }, + /*::[*/0x0068/*::]*/: { n:"FNAME??" }, + /*::[*/0x0069/*::]*/: { n:"MRANGES??" }, + // 0x0096 + // 0x0099 + // 0x009A + // 0x009B + // 0x009C + // 0x00C0 + // 0x00C7 + // 0x00C9 + /*::[*/0x00CC/*::]*/: { n:"SHEETNAMECS", f:parse_SHEETNAMECS }, + // 0x00CD + /*::[*/0x00DE/*::]*/: { n:"SHEETNAMELP", f:parse_SHEETNAMELP }, + /*::[*/0x00FF/*::]*/: { n:"BOF", f:parseuint16 }, + /*::[*/0x5402/*::]*/: { n:"WKSNF", f:parseuint16 }, + /*::[*/0xFFFF/*::]*/: { n:"" } + }; + + var WK3Enum = { + /*::[*/0x0000/*::]*/: { n:"BOF" }, + /*::[*/0x0001/*::]*/: { n:"EOF" }, + /*::[*/0x0002/*::]*/: { n:"PASSWORD" }, + /*::[*/0x0003/*::]*/: { n:"CALCSET" }, + /*::[*/0x0004/*::]*/: { n:"WINDOWSET" }, + /*::[*/0x0005/*::]*/: { n:"SHEETCELLPTR" }, + /*::[*/0x0006/*::]*/: { n:"SHEETLAYOUT" }, + /*::[*/0x0007/*::]*/: { n:"COLUMNWIDTH" }, + /*::[*/0x0008/*::]*/: { n:"HIDDENCOLUMN" }, + /*::[*/0x0009/*::]*/: { n:"USERRANGE" }, + /*::[*/0x000A/*::]*/: { n:"SYSTEMRANGE" }, + /*::[*/0x000B/*::]*/: { n:"ZEROFORCE" }, + /*::[*/0x000C/*::]*/: { n:"SORTKEYDIR" }, + /*::[*/0x000D/*::]*/: { n:"FILESEAL" }, + /*::[*/0x000E/*::]*/: { n:"DATAFILLNUMS" }, + /*::[*/0x000F/*::]*/: { n:"PRINTMAIN" }, + /*::[*/0x0010/*::]*/: { n:"PRINTSTRING" }, + /*::[*/0x0011/*::]*/: { n:"GRAPHMAIN" }, + /*::[*/0x0012/*::]*/: { n:"GRAPHSTRING" }, + /*::[*/0x0013/*::]*/: { n:"??" }, + /*::[*/0x0014/*::]*/: { n:"ERRCELL" }, + /*::[*/0x0015/*::]*/: { n:"NACELL" }, + /*::[*/0x0016/*::]*/: { n:"LABEL16", f:parse_LABEL_16}, + /*::[*/0x0017/*::]*/: { n:"NUMBER17", f:parse_NUMBER_17 }, + /*::[*/0x0018/*::]*/: { n:"NUMBER18", f:parse_NUMBER_18 }, + /*::[*/0x0019/*::]*/: { n:"FORMULA19", f:parse_FORMULA_19}, + /*::[*/0x001A/*::]*/: { n:"FORMULA1A" }, + /*::[*/0x001B/*::]*/: { n:"XFORMAT", f:parse_XFORMAT }, + /*::[*/0x001C/*::]*/: { n:"DTLABELMISC" }, + /*::[*/0x001D/*::]*/: { n:"DTLABELCELL" }, + /*::[*/0x001E/*::]*/: { n:"GRAPHWINDOW" }, + /*::[*/0x001F/*::]*/: { n:"CPA" }, + /*::[*/0x0020/*::]*/: { n:"LPLAUTO" }, + /*::[*/0x0021/*::]*/: { n:"QUERY" }, + /*::[*/0x0022/*::]*/: { n:"HIDDENSHEET" }, + /*::[*/0x0023/*::]*/: { n:"??" }, + /*::[*/0x0025/*::]*/: { n:"NUMBER25", f:parse_NUMBER_25 }, + /*::[*/0x0026/*::]*/: { n:"??" }, + /*::[*/0x0027/*::]*/: { n:"NUMBER27", f:parse_NUMBER_27 }, + /*::[*/0x0028/*::]*/: { n:"FORMULA28", f:parse_FORMULA_28 }, + /*::[*/0x008E/*::]*/: { n:"??" }, + /*::[*/0x0093/*::]*/: { n:"??" }, + /*::[*/0x0096/*::]*/: { n:"??" }, + /*::[*/0x0097/*::]*/: { n:"??" }, + /*::[*/0x0098/*::]*/: { n:"??" }, + /*::[*/0x0099/*::]*/: { n:"??" }, + /*::[*/0x009A/*::]*/: { n:"??" }, + /*::[*/0x009B/*::]*/: { n:"??" }, + /*::[*/0x009C/*::]*/: { n:"??" }, + /*::[*/0x00A3/*::]*/: { n:"??" }, + /*::[*/0x00AE/*::]*/: { n:"??" }, + /*::[*/0x00AF/*::]*/: { n:"??" }, + /*::[*/0x00B0/*::]*/: { n:"??" }, + /*::[*/0x00B1/*::]*/: { n:"??" }, + /*::[*/0x00B8/*::]*/: { n:"??" }, + /*::[*/0x00B9/*::]*/: { n:"??" }, + /*::[*/0x00BA/*::]*/: { n:"??" }, + /*::[*/0x00BB/*::]*/: { n:"??" }, + /*::[*/0x00BC/*::]*/: { n:"??" }, + /*::[*/0x00C3/*::]*/: { n:"??" }, + /*::[*/0x00C9/*::]*/: { n:"??" }, + /*::[*/0x00CC/*::]*/: { n:"SHEETNAMECS", f:parse_SHEETNAMECS }, + /*::[*/0x00CD/*::]*/: { n:"??" }, + /*::[*/0x00CE/*::]*/: { n:"??" }, + /*::[*/0x00CF/*::]*/: { n:"??" }, + /*::[*/0x00D0/*::]*/: { n:"??" }, + /*::[*/0x0100/*::]*/: { n:"??" }, + /*::[*/0x0103/*::]*/: { n:"??" }, + /*::[*/0x0104/*::]*/: { n:"??" }, + /*::[*/0x0105/*::]*/: { n:"??" }, + /*::[*/0x0106/*::]*/: { n:"??" }, + /*::[*/0x0107/*::]*/: { n:"??" }, + /*::[*/0x0109/*::]*/: { n:"??" }, + /*::[*/0x010A/*::]*/: { n:"??" }, + /*::[*/0x010B/*::]*/: { n:"??" }, + /*::[*/0x010C/*::]*/: { n:"??" }, + /*::[*/0x010E/*::]*/: { n:"??" }, + /*::[*/0x010F/*::]*/: { n:"??" }, + /*::[*/0x0180/*::]*/: { n:"??" }, + /*::[*/0x0185/*::]*/: { n:"??" }, + /*::[*/0x0186/*::]*/: { n:"??" }, + /*::[*/0x0189/*::]*/: { n:"??" }, + /*::[*/0x018C/*::]*/: { n:"??" }, + /*::[*/0x0200/*::]*/: { n:"??" }, + /*::[*/0x0202/*::]*/: { n:"??" }, + /*::[*/0x0201/*::]*/: { n:"??" }, + /*::[*/0x0204/*::]*/: { n:"??" }, + /*::[*/0x0205/*::]*/: { n:"??" }, + /*::[*/0x0280/*::]*/: { n:"??" }, + /*::[*/0x0281/*::]*/: { n:"??" }, + /*::[*/0x0282/*::]*/: { n:"??" }, + /*::[*/0x0283/*::]*/: { n:"??" }, + /*::[*/0x0284/*::]*/: { n:"??" }, + /*::[*/0x0285/*::]*/: { n:"??" }, + /*::[*/0x0286/*::]*/: { n:"??" }, + /*::[*/0x0287/*::]*/: { n:"??" }, + /*::[*/0x0288/*::]*/: { n:"??" }, + /*::[*/0x0292/*::]*/: { n:"??" }, + /*::[*/0x0293/*::]*/: { n:"??" }, + /*::[*/0x0294/*::]*/: { n:"??" }, + /*::[*/0x0295/*::]*/: { n:"??" }, + /*::[*/0x0296/*::]*/: { n:"??" }, + /*::[*/0x0299/*::]*/: { n:"??" }, + /*::[*/0x029A/*::]*/: { n:"??" }, + /*::[*/0x0300/*::]*/: { n:"??" }, + /*::[*/0x0304/*::]*/: { n:"??" }, + /*::[*/0x0601/*::]*/: { n:"SHEETINFOQP", f:parse_SHEETINFOQP }, + /*::[*/0x0640/*::]*/: { n:"??" }, + /*::[*/0x0642/*::]*/: { n:"??" }, + /*::[*/0x0701/*::]*/: { n:"??" }, + /*::[*/0x0702/*::]*/: { n:"??" }, + /*::[*/0x0703/*::]*/: { n:"??" }, + /*::[*/0x0704/*::]*/: { n:"??" }, + /*::[*/0x0780/*::]*/: { n:"??" }, + /*::[*/0x0800/*::]*/: { n:"??" }, + /*::[*/0x0801/*::]*/: { n:"??" }, + /*::[*/0x0804/*::]*/: { n:"??" }, + /*::[*/0x0A80/*::]*/: { n:"??" }, + /*::[*/0x2AF6/*::]*/: { n:"??" }, + /*::[*/0x3231/*::]*/: { n:"??" }, + /*::[*/0x6E49/*::]*/: { n:"??" }, + /*::[*/0x6F44/*::]*/: { n:"??" }, + /*::[*/0xFFFF/*::]*/: { n:"" } + }; + + /* TODO: fill out and verify this table across QP versions */ + var QPWNFTable = { + /*::[*/0x05/*::*/: "dd-mmm-yy", + /*::[*/0x06/*::*/: "dd-mmm", + /*::[*/0x07/*::*/: "mmm-yy", + /*::[*/0x08/*::*/: "mm/dd/yy", // Long Date Intl + /*::[*/0x0A/*::*/: "hh:mm:ss AM/PM", + /*::[*/0x0B/*::*/: "hh:mm AM/PM", + /*::[*/0x0E/*::*/: "dd-mmm-yyyy", + /*::[*/0x0F/*::*/: "mmm-yyyy", + + /*::[*/0x22/*::*/: "0.00", + /*::[*/0x32/*::*/: "0.00;[Red]0.00", + /*::[*/0x42/*::*/: "0.00;\(0.00\)", + /*::[*/0x52/*::*/: "0.00;[Red]\(0.00\)", + + /*::[*/162/*::*/: '"$"#,##0;\\("$"#,##0\\)' // slightly different from SSF 5 + }; + /* QPW uses a different set of record types */ + function qpw_to_workbook_buf(d, opts)/*:Workbook*/ { + prep_blob(d, 0); + var o = opts || {}; + if(DENSE != null && o.dense == null) o.dense = DENSE; + var s/*:Worksheet*/ = ({}/*:any*/); if(o.dense) s["!data"] = []; + var SST = [], sname = "", formulae = []; + var range = {s:{r:-1,c:-1}, e:{r:-1,c:-1}}; + var cnt = 0, type = 0, C = 0, R = 0; + var wb = { SheetNames: [], Sheets: {} }; + var FMTS = []; + outer: while(d.l < d.length) { + var RT = d.read_shift(2), length = d.read_shift(2); + var p = d.slice(d.l, d.l + length); + prep_blob(p, 0); + switch(RT) { + case 0x01: /* BOF */ + if(p.read_shift(4) != 0x39575051) throw "Bad QPW9 BOF!"; + break; + case 0x02: /* EOF */ break outer; + + case 0x08: /* NF */ break; // TODO: this is tied to custom number formats + + case 0x0A: /* FORMATS */ { + var fcnt = p.read_shift(4); + var step = ((p.length - p.l)/ fcnt)|0; + for(var ifmt = 0; ifmt < fcnt; ++ifmt) { + var end = p.l + step; + var fmt = {}; + p.l += 2; + fmt.numFmtId = p.read_shift(2); + if(QPWNFTable[fmt.numFmtId]) fmt.z = QPWNFTable[fmt.numFmtId]; + p.l = end; + FMTS.push(fmt); + } + } break; + + /* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TableModelArchive */ + case 0x0401: /* BON */ break; + case 0x0402: /* EON */ /* TODO: backfill missing sheets based on BON cnt */ break; + + case 0x0407: { /* SST */ + p.l += 12; + while(p.l < p.length) { + cnt = p.read_shift(2); + type = p.read_shift(1); + SST.push(p.read_shift(cnt, 'cstr')); + } + } break; + case 0x0408: { /* FORMULAE */ + //p.l += 12; + //while(p.l < p.length) { + // cnt = p.read_shift(2); + // formulae.push(p.slice(p.l, p.l + cnt + 1)); p.l += cnt + 1; + //} + } break; + + case 0x0601: { /* BOS */ + var sidx = p.read_shift(2); + s = ({}/*:any*/); if(o.dense) s["!data"] = []; + range.s.c = p.read_shift(2); + range.e.c = p.read_shift(2); + range.s.r = p.read_shift(4); + range.e.r = p.read_shift(4); + p.l += 4; + if(p.l + 2 < p.length) { + cnt = p.read_shift(2); + type = p.read_shift(1); + sname = cnt == 0 ? "" : p.read_shift(cnt, 'cstr'); + } + if(!sname) sname = encode_col(sidx); + /* TODO: backfill empty sheets */ + } break; + case 0x0602: { /* EOS */ + /* NOTE: QP valid range A1:IV1000000 */ + if(range.s.c > 0xFF || range.s.r > 999999) break; + if(range.e.c < range.s.c) range.e.c = range.s.c; + if(range.e.r < range.s.r) range.e.r = range.s.r; + s["!ref"] = encode_range(range); + book_append_sheet(wb, s, sname); // TODO: a barrel roll + } break; + + case 0x0A01: { /* COL (like XLS Row, modulo the layout transposition) */ + C = p.read_shift(2); + if(range.e.c < C) range.e.c = C; + if(range.s.c > C) range.s.c = C; + R = p.read_shift(4); + if(range.s.r > R) range.s.r = R; + R = p.read_shift(4); + if(range.e.r < R) range.e.r = R; + } break; + + case 0x0C01: { /* MulCells (like XLS MulRK, but takes advantage of common column data patterns) */ + R = p.read_shift(4), cnt = p.read_shift(4); + if(range.s.r > R) range.s.r = R; + if(range.e.r < R + cnt - 1) range.e.r = R + cnt - 1; + var CC = encode_col(C); + while(p.l < p.length) { + var cell = { t: "z" }; + var flags = p.read_shift(1), fmtidx = -1; + if(flags & 0x80) fmtidx = p.read_shift(2); + var mul = (flags & 0x40) ? p.read_shift(2) - 1: 0; + switch(flags & 0x1F) { + case 0: break; + case 1: break; + case 2: cell = { t: "n", v: p.read_shift(2) }; break; + case 3: cell = { t: "n", v: p.read_shift(2, 'i') }; break; + case 4: cell = { t: "n", v: parse_RkNumber(p) }; break; + case 5: cell = { t: "n", v: p.read_shift(8, 'f') }; break; + case 7: cell = { t: "s", v: SST[type = p.read_shift(4) - 1] }; break; + case 8: cell = { t: "n", v: p.read_shift(8, 'f') }; p.l += 2; /* cell.f = formulae[p.read_shift(4)]; */ p.l += 4; break; + default: throw "Unrecognized QPW cell type " + (flags & 0x1F); + } + if(fmtidx != -1 && (FMTS[fmtidx - 1]||{}).z) cell.z = FMTS[fmtidx-1].z; + var delta = 0; + if(flags & 0x20) switch(flags & 0x1F) { + case 2: delta = p.read_shift(2); break; + case 3: delta = p.read_shift(2, 'i'); break; + case 7: delta = p.read_shift(2); break; + default: throw "Unsupported delta for QPW cell type " + (flags & 0x1F); + } + if(!(!o.sheetStubs && cell.t == "z")) { + var newcell = dup(cell); + if(cell.t == "n" && cell.z && fmt_is_date(cell.z) && o.cellDates) { + newcell.v = numdate(cell.v); newcell.t = typeof newcell.v == "number" ? 'n' : 'd'; + } + if(s["!data"] != null) { + if(!s["!data"][R]) s["!data"][R] = []; + s["!data"][R][C] = newcell; + } else s[CC + encode_row(R)] = newcell; + } + ++R; --cnt; + while(mul-- > 0 && cnt >= 0) { + if(flags & 0x20) switch(flags & 0x1F) { + case 2: cell = { t: "n", v: (cell.v + delta) & 0xFFFF }; break; + case 3: cell = { t: "n", v: (cell.v + delta) & 0xFFFF }; if(cell.v > 0x7FFF) cell.v -= 0x10000; break; + case 7: cell = { t: "s", v: SST[type = (type + delta) >>> 0] }; break; + default: throw "Cannot apply delta for QPW cell type " + (flags & 0x1F); + } else switch(flags & 0x1F) { + case 1: cell = { t: "z" }; break; + case 2: cell = { t: "n", v: p.read_shift(2) }; break; + case 7: cell = { t: "s", v: SST[type = p.read_shift(4) - 1] }; break; + default: throw "Cannot apply repeat for QPW cell type " + (flags & 0x1F); + } + if(fmtidx != -1); + if(!(!o.sheetStubs && cell.t == "z")) { + if(s["!data"] != null) { + if(!s["!data"][R]) s["!data"][R] = []; + s["!data"][R][C] = cell; + } else s[CC + encode_row(R)] = cell; + } + ++R; --cnt; + } + } + } break; + + default: break; + } + d.l += length; + } + return wb; + } + + return { + sheet_to_wk1: sheet_to_wk1, + book_to_wk3: book_to_wk3, + to_workbook: lotus_to_workbook + }; +})(); +/* 18.4.7 rPr CT_RPrElt */ +function parse_rpr(rpr) { + var font = {}, m = rpr.match(tagregex), i = 0; + var pass = false; + if(m) for(;i!=m.length; ++i) { + var y = parsexmltag(m[i]); + switch(y[0].replace(/\w*:/g,"")) { + /* 18.8.12 condense CT_BooleanProperty */ + /* ** not required . */ + case '': + case '': font.shadow = 1; break; + case '': break; + + /* 18.4.1 charset CT_IntProperty TODO */ + case '': + case '': font.outline = 1; break; + case '': break; + + /* 18.4.5 rFont CT_FontName */ + case '': + case '': font.strike = 1; break; + case '': break; + + /* 18.4.13 u CT_UnderlineProperty */ + case '': + case '': font.u = 1; break; + case '': break; + + /* 18.8.2 b */ + case '': + case '': font.b = 1; break; + case '': break; + + /* 18.8.26 i */ + case '': + case '': font.i = 1; break; + case '': break; + + /* 18.3.1.15 color CT_Color TODO: tint, theme, auto, indexed */ + case '': case '': case '': break; + + /* 18.8.18 family ST_FontFamily */ + case '': case '': case '': break; + + /* 18.4.14 vertAlign CT_VerticalAlignFontProperty TODO */ + case '': case '': case '': break; + + /* 18.8.35 scheme CT_FontScheme TODO */ + case '': case '': case '': break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: + if(y[0].charCodeAt(1) !== 47 && !pass) throw new Error('Unrecognized rich format ' + y[0]); + } + } + return font; +} + +var parse_rs = /*#__PURE__*/(function() { + var tregex = matchtag("t"), rpregex = matchtag("rPr"); + /* 18.4.4 r CT_RElt */ + function parse_r(r) { + /* 18.4.12 t ST_Xstring */ + var t = r.match(tregex)/*, cp = 65001*/; + if(!t) return {t:"s", v:""}; + + var o/*:Cell*/ = ({t:'s', v:unescapexml(t[1])}/*:any*/); + var rpr = r.match(rpregex); + if(rpr) o.s = parse_rpr(rpr[1]); + return o; + } + var rregex = /<(?:\w+:)?r>/g, rend = /<\/(?:\w+:)?r>/; + return function parse_rs(rs) { + return rs.replace(rregex,"").split(rend).map(parse_r).filter(function(r) { return r.v; }); + }; +})(); + + +/* Parse a list of tags */ +var rs_to_html = /*#__PURE__*/(function parse_rs_factory() { + var nlregex = /(\r\n|\n)/g; + function parse_rpr2(font, intro, outro) { + var style/*:Array*/ = []; + + if(font.u) style.push("text-decoration: underline;"); + if(font.uval) style.push("text-underline-style:" + font.uval + ";"); + if(font.sz) style.push("font-size:" + font.sz + "pt;"); + if(font.outline) style.push("text-effect: outline;"); + if(font.shadow) style.push("text-shadow: auto;"); + intro.push(''); + + if(font.b) { intro.push(""); outro.push(""); } + if(font.i) { intro.push(""); outro.push(""); } + if(font.strike) { intro.push(""); outro.push(""); } + + var align = font.valign || ""; + if(align == "superscript" || align == "super") align = "sup"; + else if(align == "subscript") align = "sub"; + if(align != "") { intro.push("<" + align + ">"); outro.push(""); } + + outro.push(""); + return font; + } + + /* 18.4.4 r CT_RElt */ + function r_to_html(r) { + var terms/*:[Array, string, Array]*/ = [[],r.v,[]]; + if(!r.v) return ""; + + if(r.s) parse_rpr2(r.s, terms[0], terms[2]); + + return terms[0].join("") + terms[1].replace(nlregex,'
') + terms[2].join(""); + } + + return function parse_rs(rs) { + return rs.map(r_to_html).join(""); + }; +})(); + +/* 18.4.8 si CT_Rst */ +var sitregex = /<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g, sirregex = /<(?:\w+:)?r\b[^>]*>/; +var sirphregex = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g; +function parse_si(x, opts) { + var html = opts ? opts.cellHTML : true; + var z = {}; + if(!x) return { t: "" }; + //var y; + /* 18.4.12 t ST_Xstring (Plaintext String) */ + // TODO: is whitespace actually valid here? + if(x.match(/^\s*<(?:\w+:)?t[^>]*>/)) { + z.t = unescapexml(utf8read(x.slice(x.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||""), true); + z.r = utf8read(x); + if(html) z.h = escapehtml(z.t); + } + /* 18.4.4 r CT_RElt (Rich Text Run) */ + else if((/*y = */x.match(sirregex))) { + z.r = utf8read(x); + z.t = unescapexml(utf8read((x.replace(sirphregex, '').match(sitregex)||[]).join("").replace(tagregex,"")), true); + if(html) z.h = rs_to_html(parse_rs(z.r)); + } + /* 18.4.3 phoneticPr CT_PhoneticPr (TODO: needed for Asian support) */ + /* 18.4.6 rPh CT_PhoneticRun (TODO: needed for Asian support) */ + return z; +} + +/* 18.4 Shared String Table */ +var sstr0 = /<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/; +var sstr1 = /<(?:\w+:)?(?:si|sstItem)>/g; +var sstr2 = /<\/(?:\w+:)?(?:si|sstItem)>/; +function parse_sst_xml(data/*:string*/, opts)/*:SST*/ { + var s/*:SST*/ = ([]/*:any*/), ss = ""; + if(!data) return s; + /* 18.4.9 sst CT_Sst */ + var sst = data.match(sstr0); + if(sst) { + ss = sst[2].replace(sstr1,"").split(sstr2); + for(var i = 0; i != ss.length; ++i) { + var o = parse_si(ss[i].trim(), opts); + if(o != null) s[s.length] = o; + } + sst = parsexmltag(sst[1]); s.Count = sst.count; s.Unique = sst.uniqueCount; + } + return s; +} + +var straywsregex = /^\s|\s$|[\t\n\r]/; +function write_sst_xml(sst/*:SST*/, opts)/*:string*/ { + if(!opts.bookSST) return ""; + var o = [XML_HEADER]; + o[o.length] = (writextag('sst', null, { + xmlns: XMLNS_main[0], + count: sst.Count, + uniqueCount: sst.Unique + })); + for(var i = 0; i != sst.length; ++i) { if(sst[i] == null) continue; + var s/*:XLString*/ = sst[i]; + var sitag = ""; + if(s.r) sitag += s.r; + else { + sitag += ""; + } + sitag += ""; + o[o.length] = (sitag); + } + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); +} +/* [MS-XLSB] 2.4.221 BrtBeginSst */ +function parse_BrtBeginSst(data) { + return [data.read_shift(4), data.read_shift(4)]; +} + +/* [MS-XLSB] 2.1.7.45 Shared Strings */ +function parse_sst_bin(data, opts)/*:SST*/ { + var s/*:SST*/ = ([]/*:any*/); + var pass = false; + recordhopper(data, function hopper_sst(val, R, RT) { + switch(RT) { + case 0x009F: /* BrtBeginSst */ + s.Count = val[0]; s.Unique = val[1]; break; + case 0x0013: /* BrtSSTItem */ + s.push(val); break; + case 0x00A0: /* BrtEndSst */ + return true; + + case 0x0023: /* BrtFRTBegin */ + pass = true; break; + case 0x0024: /* BrtFRTEnd */ + pass = false; break; + + default: + if(R.T){} + if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }); + return s; +} + +function write_BrtBeginSst(sst, o) { + if(!o) o = new_buf(8); + o.write_shift(4, sst.Count); + o.write_shift(4, sst.Unique); + return o; +} + +var write_BrtSSTItem = write_RichStr; + +function write_sst_bin(sst/*::, opts*/) { + var ba = buf_array(); + write_record(ba, 0x009F /* BrtBeginSst */, write_BrtBeginSst(sst)); + for(var i = 0; i < sst.length; ++i) write_record(ba, 0x0013 /* BrtSSTItem */, write_BrtSSTItem(sst[i])); + /* FRTSST */ + write_record(ba, 0x00A0 /* BrtEndSst */); + return ba.end(); +} +function _JS2ANSI(str/*:string*/)/*:Array*/ { + if(typeof $cptable !== 'undefined') return $cptable.utils.encode(current_ansi, str); + var o/*:Array*/ = [], oo = str.split(""); + for(var i = 0; i < oo.length; ++i) o[i] = oo[i].charCodeAt(0); + return o; +} + +/* [MS-OFFCRYPTO] 2.1.4 Version */ +function parse_CRYPTOVersion(blob, length/*:?number*/) { + var o/*:any*/ = {}; + o.Major = blob.read_shift(2); + o.Minor = blob.read_shift(2); + /*:: if(length == null) return o; */ + if(length >= 4) blob.l += length - 4; + return o; +} + +/* [MS-OFFCRYPTO] 2.1.5 DataSpaceVersionInfo */ +function parse_DataSpaceVersionInfo(blob) { + var o = {}; + o.id = blob.read_shift(0, 'lpp4'); + o.R = parse_CRYPTOVersion(blob, 4); + o.U = parse_CRYPTOVersion(blob, 4); + o.W = parse_CRYPTOVersion(blob, 4); + return o; +} + +/* [MS-OFFCRYPTO] 2.1.6.1 DataSpaceMapEntry Structure */ +function parse_DataSpaceMapEntry(blob) { + var len = blob.read_shift(4); + var end = blob.l + len - 4; + var o = {}; + var cnt = blob.read_shift(4); + var comps/*:Array<{t:number, v:string}>*/ = []; + /* [MS-OFFCRYPTO] 2.1.6.2 DataSpaceReferenceComponent Structure */ + while(cnt-- > 0) comps.push({ t: blob.read_shift(4), v: blob.read_shift(0, 'lpp4') }); + o.name = blob.read_shift(0, 'lpp4'); + o.comps = comps; + if(blob.l != end) throw new Error("Bad DataSpaceMapEntry: " + blob.l + " != " + end); + return o; +} + +/* [MS-OFFCRYPTO] 2.1.6 DataSpaceMap */ +function parse_DataSpaceMap(blob) { + var o = []; + blob.l += 4; // must be 0x8 + var cnt = blob.read_shift(4); + while(cnt-- > 0) o.push(parse_DataSpaceMapEntry(blob)); + return o; +} + +/* [MS-OFFCRYPTO] 2.1.7 DataSpaceDefinition */ +function parse_DataSpaceDefinition(blob)/*:Array*/ { + var o/*:Array*/ = []; + blob.l += 4; // must be 0x8 + var cnt = blob.read_shift(4); + while(cnt-- > 0) o.push(blob.read_shift(0, 'lpp4')); + return o; +} + +/* [MS-OFFCRYPTO] 2.1.8 DataSpaceDefinition */ +function parse_TransformInfoHeader(blob) { + var o = {}; + /*var len = */blob.read_shift(4); + blob.l += 4; // must be 0x1 + o.id = blob.read_shift(0, 'lpp4'); + o.name = blob.read_shift(0, 'lpp4'); + o.R = parse_CRYPTOVersion(blob, 4); + o.U = parse_CRYPTOVersion(blob, 4); + o.W = parse_CRYPTOVersion(blob, 4); + return o; +} + +function parse_Primary(blob) { + /* [MS-OFFCRYPTO] 2.2.6 IRMDSTransformInfo */ + var hdr = parse_TransformInfoHeader(blob); + /* [MS-OFFCRYPTO] 2.1.9 EncryptionTransformInfo */ + hdr.ename = blob.read_shift(0, '8lpp4'); + hdr.blksz = blob.read_shift(4); + hdr.cmode = blob.read_shift(4); + if(blob.read_shift(4) != 0x04) throw new Error("Bad !Primary record"); + return hdr; +} + +/* [MS-OFFCRYPTO] 2.3.2 Encryption Header */ +function parse_EncryptionHeader(blob, length/*:number*/) { + var tgt = blob.l + length; + var o = {}; + o.Flags = (blob.read_shift(4) & 0x3F); + blob.l += 4; + o.AlgID = blob.read_shift(4); + var valid = false; + switch(o.AlgID) { + case 0x660E: case 0x660F: case 0x6610: valid = (o.Flags == 0x24); break; + case 0x6801: valid = (o.Flags == 0x04); break; + case 0: valid = (o.Flags == 0x10 || o.Flags == 0x04 || o.Flags == 0x24); break; + default: throw 'Unrecognized encryption algorithm: ' + o.AlgID; + } + if(!valid) throw new Error("Encryption Flags/AlgID mismatch"); + o.AlgIDHash = blob.read_shift(4); + o.KeySize = blob.read_shift(4); + o.ProviderType = blob.read_shift(4); + blob.l += 8; + o.CSPName = blob.read_shift((tgt-blob.l)>>1, 'utf16le'); + blob.l = tgt; + return o; +} + +/* [MS-OFFCRYPTO] 2.3.3 Encryption Verifier */ +function parse_EncryptionVerifier(blob, length/*:number*/) { + var o = {}, tgt = blob.l + length; + blob.l += 4; // SaltSize must be 0x10 + o.Salt = blob.slice(blob.l, blob.l+16); blob.l += 16; + o.Verifier = blob.slice(blob.l, blob.l+16); blob.l += 16; + /*var sz = */blob.read_shift(4); + o.VerifierHash = blob.slice(blob.l, tgt); blob.l = tgt; + return o; +} + +/* [MS-OFFCRYPTO] 2.3.4.* EncryptionInfo Stream */ +function parse_EncryptionInfo(blob) { + var vers = parse_CRYPTOVersion(blob); + switch(vers.Minor) { + case 0x02: return [vers.Minor, parse_EncInfoStd(blob, vers)]; + case 0x03: return [vers.Minor, parse_EncInfoExt(blob, vers)]; + case 0x04: return [vers.Minor, parse_EncInfoAgl(blob, vers)]; + } + throw new Error("ECMA-376 Encrypted file unrecognized Version: " + vers.Minor); +} + +/* [MS-OFFCRYPTO] 2.3.4.5 EncryptionInfo Stream (Standard Encryption) */ +function parse_EncInfoStd(blob/*::, vers*/) { + var flags = blob.read_shift(4); + if((flags & 0x3F) != 0x24) throw new Error("EncryptionInfo mismatch"); + var sz = blob.read_shift(4); + //var tgt = blob.l + sz; + var hdr = parse_EncryptionHeader(blob, sz); + var verifier = parse_EncryptionVerifier(blob, blob.length - blob.l); + return { t:"Std", h:hdr, v:verifier }; +} +/* [MS-OFFCRYPTO] 2.3.4.6 EncryptionInfo Stream (Extensible Encryption) */ +function parse_EncInfoExt(/*::blob, vers*/) { throw new Error("File is password-protected: ECMA-376 Extensible"); } +/* [MS-OFFCRYPTO] 2.3.4.10 EncryptionInfo Stream (Agile Encryption) */ +function parse_EncInfoAgl(blob/*::, vers*/) { + var KeyData = ["saltSize","blockSize","keyBits","hashSize","cipherAlgorithm","cipherChaining","hashAlgorithm","saltValue"]; + blob.l+=4; + var xml = blob.read_shift(blob.length - blob.l, 'utf8'); + var o = {}; + xml.replace(tagregex, function xml_agile(x) { + var y/*:any*/ = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': break; + case '': case '': break; + + case '': break; + case ' 4 || vers.Major < 2) throw new Error('unrecognized major version code: ' + vers.Major); + o.Flags = blob.read_shift(4); length -= 4; + var sz = blob.read_shift(4); length -= 4; + o.EncryptionHeader = parse_EncryptionHeader(blob, sz); length -= sz; + o.EncryptionVerifier = parse_EncryptionVerifier(blob, length); + return o; +} +/* [MS-OFFCRYPTO] 2.3.6.1 RC4 Encryption Header */ +function parse_RC4Header(blob/*::, length*/) { + var o = {}; + var vers = o.EncryptionVersionInfo = parse_CRYPTOVersion(blob, 4); + if(vers.Major != 1 || vers.Minor != 1) throw 'unrecognized version code ' + vers.Major + ' : ' + vers.Minor; + o.Salt = blob.read_shift(16); + o.EncryptedVerifier = blob.read_shift(16); + o.EncryptedVerifierHash = blob.read_shift(16); + return o; +} + +/* [MS-OFFCRYPTO] 2.3.7.1 Binary Document Password Verifier Derivation */ +function crypto_CreatePasswordVerifier_Method1(Password/*:string*/) { + var Verifier = 0x0000, PasswordArray; + var PasswordDecoded = _JS2ANSI(Password); + var len = PasswordDecoded.length + 1, i, PasswordByte; + var Intermediate1, Intermediate2, Intermediate3; + PasswordArray = new_raw_buf(len); + PasswordArray[0] = PasswordDecoded.length; + for(i = 1; i != len; ++i) PasswordArray[i] = PasswordDecoded[i-1]; + for(i = len-1; i >= 0; --i) { + PasswordByte = PasswordArray[i]; + Intermediate1 = ((Verifier & 0x4000) === 0x0000) ? 0 : 1; + Intermediate2 = (Verifier << 1) & 0x7FFF; + Intermediate3 = Intermediate1 | Intermediate2; + Verifier = Intermediate3 ^ PasswordByte; + } + return Verifier ^ 0xCE4B; +} + +/* [MS-OFFCRYPTO] 2.3.7.2 Binary Document XOR Array Initialization */ +var crypto_CreateXorArray_Method1 = /*#__PURE__*/(function() { + var PadArray = [0xBB, 0xFF, 0xFF, 0xBA, 0xFF, 0xFF, 0xB9, 0x80, 0x00, 0xBE, 0x0F, 0x00, 0xBF, 0x0F, 0x00]; + var InitialCode = [0xE1F0, 0x1D0F, 0xCC9C, 0x84C0, 0x110C, 0x0E10, 0xF1CE, 0x313E, 0x1872, 0xE139, 0xD40F, 0x84F9, 0x280C, 0xA96A, 0x4EC3]; + var XorMatrix = [0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09, 0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF, 0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0, 0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40, 0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5, 0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A, 0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9, 0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0, 0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC, 0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10, 0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168, 0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C, 0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD, 0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC, 0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4]; + var Ror = function(Byte) { return ((Byte/2) | (Byte*128)) & 0xFF; }; + var XorRor = function(byte1, byte2) { return Ror(byte1 ^ byte2); }; + var CreateXorKey_Method1 = function(Password) { + var XorKey = InitialCode[Password.length - 1]; + var CurrentElement = 0x68; + for(var i = Password.length-1; i >= 0; --i) { + var Char = Password[i]; + for(var j = 0; j != 7; ++j) { + if(Char & 0x40) XorKey ^= XorMatrix[CurrentElement]; + Char *= 2; --CurrentElement; + } + } + return XorKey; + }; + return function(password/*:string*/) { + var Password = _JS2ANSI(password); + var XorKey = CreateXorKey_Method1(Password); + var Index = Password.length; + var ObfuscationArray = new_raw_buf(16); + for(var i = 0; i != 16; ++i) ObfuscationArray[i] = 0x00; + var Temp, PasswordLastChar, PadIndex; + if((Index & 1) === 1) { + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(PadArray[0], Temp); + --Index; + Temp = XorKey & 0xFF; + PasswordLastChar = Password[Password.length - 1]; + ObfuscationArray[Index] = XorRor(PasswordLastChar, Temp); + } + while(Index > 0) { + --Index; + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + --Index; + Temp = XorKey & 0xFF; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + } + Index = 15; + PadIndex = 15 - Password.length; + while(PadIndex > 0) { + Temp = XorKey >> 8; + ObfuscationArray[Index] = XorRor(PadArray[PadIndex], Temp); + --Index; + --PadIndex; + Temp = XorKey & 0xFF; + ObfuscationArray[Index] = XorRor(Password[Index], Temp); + --Index; + --PadIndex; + } + return ObfuscationArray; + }; +})(); + +/* [MS-OFFCRYPTO] 2.3.7.3 Binary Document XOR Data Transformation Method 1 */ +var crypto_DecryptData_Method1 = function(password/*:string*/, Data, XorArrayIndex, XorArray, O) { + /* If XorArray is set, use it; if O is not set, make changes in-place */ + if(!O) O = Data; + if(!XorArray) XorArray = crypto_CreateXorArray_Method1(password); + var Index, Value; + for(Index = 0; Index != Data.length; ++Index) { + Value = Data[Index]; + Value ^= XorArray[XorArrayIndex]; + Value = ((Value>>5) | (Value<<3)) & 0xFF; + O[Index] = Value; + ++XorArrayIndex; + } + return [O, XorArrayIndex, XorArray]; +}; + +var crypto_MakeXorDecryptor = function(password/*:string*/) { + var XorArrayIndex = 0, XorArray = crypto_CreateXorArray_Method1(password); + return function(Data) { + var O = crypto_DecryptData_Method1("", Data, XorArrayIndex, XorArray); + XorArrayIndex = O[1]; + return O[0]; + }; +}; + +/* 2.5.343 */ +function parse_XORObfuscation(blob, length, opts, out) { + var o = ({ key: parseuint16(blob), verificationBytes: parseuint16(blob) }/*:any*/); + if(opts.password) o.verifier = crypto_CreatePasswordVerifier_Method1(opts.password); + out.valid = o.verificationBytes === o.verifier; + if(out.valid) out.insitu = crypto_MakeXorDecryptor(opts.password); + return o; +} + +/* 2.4.117 */ +function parse_FilePassHeader(blob, length/*:number*/, oo) { + var o = oo || {}; o.Info = blob.read_shift(2); blob.l -= 2; + if(o.Info === 1) o.Data = parse_RC4Header(blob, length); + else o.Data = parse_RC4CryptoHeader(blob, length); + return o; +} +function parse_FilePass(blob, length/*:number*/, opts) { + var o = ({ Type: opts.biff >= 8 ? blob.read_shift(2) : 0 }/*:any*/); /* wEncryptionType */ + if(o.Type) parse_FilePassHeader(blob, length-2, o); + else parse_XORObfuscation(blob, opts.biff >= 8 ? length : length - 2, opts, o); + return o; +} + + +function rtf_to_sheet(d, opts) { + switch (opts.type) { + case "base64": + return rtf_to_sheet_str(Base64_decode(d), opts); + case "binary": + return rtf_to_sheet_str(d, opts); + case "buffer": + return rtf_to_sheet_str(has_buf && Buffer.isBuffer(d) ? d.toString("binary") : a2s(d), opts); + case "array": + return rtf_to_sheet_str(cc2str(d), opts); + } + throw new Error("Unrecognized type " + opts.type); +} +function rtf_to_sheet_str(str, opts) { + var o = opts || {}; + var ws = {}; + var dense = o.dense; + if (dense) + ws["!data"] = []; + var rows = str.match(/\\trowd[\s\S]*?\\row\b/g); + if (!rows) + throw new Error("RTF missing table"); + var range = { s: { c: 0, r: 0 }, e: { c: 0, r: rows.length - 1 } }; + var row = []; + rows.forEach(function(rowtf, R) { + if (dense) + row = ws["!data"][R] = []; + var rtfre = /\\[\w\-]+\b/g; + var last_index = 0; + var res; + var C = -1; + var payload = []; + while ((res = rtfre.exec(rowtf)) != null) { + var data = rowtf.slice(last_index, rtfre.lastIndex - res[0].length); + if (data.charCodeAt(0) == 32) + data = data.slice(1); + if (data.length) + payload.push(data); + switch (res[0]) { + case "\\cell": + ++C; + if (payload.length) { + var cell = { v: payload.join(""), t: "s" }; + if (cell.v == "TRUE" || cell.v == "FALSE") { + cell.v = cell.v == "TRUE"; + cell.t = "b"; + } else if (!isNaN(fuzzynum(cell.v))) { + cell.t = "n"; + if (o.cellText !== false) + cell.w = cell.v; + cell.v = fuzzynum(cell.v); + } + if (dense) + row[C] = cell; + else + ws[encode_cell({ r: R, c: C })] = cell; + } + payload = []; + break; + case "\\par": + payload.push("\n"); + break; + } + last_index = rtfre.lastIndex; + } + if (C > range.e.c) + range.e.c = C; + }); + ws["!ref"] = encode_range(range); + return ws; +} +function rtf_to_workbook(d, opts) { + var wb = sheet_to_workbook(rtf_to_sheet(d, opts), opts); + wb.bookType = "rtf"; + return wb; +} +function sheet_to_rtf(ws, opts) { + var o = ["{\\rtf1\\ansi"]; + if (!ws["!ref"]) + return o[0] + "}"; + var r = safe_decode_range(ws["!ref"]), cell; + var dense = ws["!data"] != null, row = []; + for (var R = r.s.r; R <= r.e.r; ++R) { + o.push("\\trowd\\trautofit1"); + for (var C = r.s.c; C <= r.e.c; ++C) + o.push("\\cellx" + (C + 1)); + o.push("\\pard\\intbl"); + if (dense) + row = ws["!data"][R] || []; + for (C = r.s.c; C <= r.e.c; ++C) { + var coord = encode_cell({ r: R, c: C }); + cell = dense ? row[C] : ws[coord]; + if (!cell || cell.v == null && (!cell.f || cell.F)) { + o.push(" \\cell"); + continue; + } + o.push(" " + (cell.w || (format_cell(cell), cell.w) || "").replace(/[\r\n]/g, "\\par ")); + o.push("\\cell"); + } + o.push("\\pard\\intbl\\row"); + } + return o.join("") + "}"; +} +function hex2RGB(h) { + var o = h.slice(h[0]==="#"?1:0).slice(0,6); + return [parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16)]; +} +function rgb2Hex(rgb) { + for(var i=0,o=1; i!=3; ++i) o = o*256 + (rgb[i]>255?255:rgb[i]<0?0:rgb[i]); + return o.toString(16).toUpperCase().slice(1); +} + +function rgb2HSL(rgb) { + var R = rgb[0]/255, G = rgb[1]/255, B=rgb[2]/255; + var M = Math.max(R, G, B), m = Math.min(R, G, B), C = M - m; + if(C === 0) return [0, 0, R]; + + var H6 = 0, S = 0, L2 = (M + m); + S = C / (L2 > 1 ? 2 - L2 : L2); + switch(M){ + case R: H6 = ((G - B) / C + 6)%6; break; + case G: H6 = ((B - R) / C + 2); break; + case B: H6 = ((R - G) / C + 4); break; + } + return [H6 / 6, S, L2 / 2]; +} + +function hsl2RGB(hsl){ + var H = hsl[0], S = hsl[1], L = hsl[2]; + var C = S * 2 * (L < 0.5 ? L : 1 - L), m = L - C/2; + var rgb = [m,m,m], h6 = 6*H; + + var X; + if(S !== 0) switch(h6|0) { + case 0: case 6: X = C * h6; rgb[0] += C; rgb[1] += X; break; + case 1: X = C * (2 - h6); rgb[0] += X; rgb[1] += C; break; + case 2: X = C * (h6 - 2); rgb[1] += C; rgb[2] += X; break; + case 3: X = C * (4 - h6); rgb[1] += X; rgb[2] += C; break; + case 4: X = C * (h6 - 4); rgb[2] += C; rgb[0] += X; break; + case 5: X = C * (6 - h6); rgb[2] += X; rgb[0] += C; break; + } + for(var i = 0; i != 3; ++i) rgb[i] = Math.round(rgb[i]*255); + return rgb; +} + +/* 18.8.3 bgColor tint algorithm */ +function rgb_tint(hex, tint) { + if(tint === 0) return hex; + var hsl = rgb2HSL(hex2RGB(hex)); + if (tint < 0) hsl[2] = hsl[2] * (1 + tint); + else hsl[2] = 1 - (1 - hsl[2]) * (1 - tint); + return rgb2Hex(hsl2RGB(hsl)); +} + +/* 18.3.1.13 width calculations */ +/* [MS-OI29500] 2.1.595 Column Width & Formatting */ +var DEF_MDW = 6, MAX_MDW = 15, MIN_MDW = 1, MDW = DEF_MDW; +function width2px(width) { return Math.floor(( width + (Math.round(128/MDW))/256 )* MDW ); } +function px2char(px) { return (Math.floor((px - 5)/MDW * 100 + 0.5))/100; } +function char2width(chr) { return (Math.round((chr * MDW + 5)/MDW*256))/256; } +//function px2char_(px) { return (((px - 5)/MDW * 100 + 0.5))/100; } +//function char2width_(chr) { return (((chr * MDW + 5)/MDW*256))/256; } +function cycle_width(collw) { return char2width(px2char(width2px(collw))); } +/* XLSX/XLSB/XLS specify width in units of MDW */ +function find_mdw_colw(collw) { + var delta = Math.abs(collw - cycle_width(collw)), _MDW = MDW; + if(delta > 0.005) for(MDW=MIN_MDW; MDW 0.5) guess--; + if(Math.abs(guess) < delta) { delta = Math.abs(guess); _MDW = MDW; } + } + MDW = _MDW; +}*/ + +function process_col(coll/*:ColInfo*/) { + if(coll.width) { + coll.wpx = width2px(coll.width); + coll.wch = px2char(coll.wpx); + coll.MDW = MDW; + } else if(coll.wpx) { + coll.wch = px2char(coll.wpx); + coll.width = char2width(coll.wch); + coll.MDW = MDW; + } else if(typeof coll.wch == 'number') { + coll.width = char2width(coll.wch); + coll.wpx = width2px(coll.width); + coll.MDW = MDW; + } + if(coll.customWidth) delete coll.customWidth; +} + +var DEF_PPI = 96, PPI = DEF_PPI; +function px2pt(px) { return px * 96 / PPI; } +function pt2px(pt) { return pt * PPI / 96; } + +/* [MS-EXSPXML3] 2.4.54 ST_enmPattern */ +var XLMLPatternTypeMap = { + "None": "none", + "Solid": "solid", + "Gray50": "mediumGray", + "Gray75": "darkGray", + "Gray25": "lightGray", + "HorzStripe": "darkHorizontal", + "VertStripe": "darkVertical", + "ReverseDiagStripe": "darkDown", + "DiagStripe": "darkUp", + "DiagCross": "darkGrid", + "ThickDiagCross": "darkTrellis", + "ThinHorzStripe": "lightHorizontal", + "ThinVertStripe": "lightVertical", + "ThinReverseDiagStripe": "lightDown", + "ThinHorzCross": "lightGrid" +}; + +/* 18.8.5 borders CT_Borders */ +function parse_borders(t, styles, themes, opts) { + styles.Borders = []; + var border = {}; + var pass = false; + (t[0].match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': case '': break; + + /* 18.8.4 border CT_Border */ + case '': case '': + border = /*::(*/{}/*:: :any)*/; + if(y.diagonalUp) border.diagonalUp = parsexmlbool(y.diagonalUp); + if(y.diagonalDown) border.diagonalDown = parsexmlbool(y.diagonalDown); + styles.Borders.push(border); + break; + case '': break; + + /* note: not in spec, appears to be CT_BorderPr */ + case '': break; + case '': break; + case '': break; + + /* note: not in spec, appears to be CT_BorderPr */ + case '': break; + case '': break; + case '': break; + + /* 18.8.43 top CT_BorderPr */ + case '': break; + case '': break; + case '': break; + + /* 18.8.6 bottom CT_BorderPr */ + case '': break; + case '': break; + case '': break; + + /* 18.8.13 diagonal CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.25 horizontal CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.44 vertical CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.37 start CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.16 end CT_BorderPr */ + case '': case '': break; + case '': break; + + /* 18.8.? color CT_Color */ + case '': + break; + case '': case '': break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: if(opts && opts.WTF) { + if(!pass) throw new Error('unrecognized ' + y[0] + ' in borders'); + } + } + }); +} + +/* 18.8.21 fills CT_Fills */ +function parse_fills(t, styles, themes, opts) { + styles.Fills = []; + var fill = {}; + var pass = false; + (t[0].match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': case '': break; + + /* 18.8.20 fill CT_Fill */ + case '': case '': + fill = {}; styles.Fills.push(fill); break; + case '': break; + + /* 18.8.24 gradientFill CT_GradientFill */ + case '': break; + case '': styles.Fills.push(fill); fill = {}; break; + + /* 18.8.32 patternFill CT_PatternFill */ + case '': + if(y.patternType) fill.patternType = y.patternType; + break; + case '': case '': break; + + /* 18.8.3 bgColor CT_Color */ + case '': case '': break; + + /* 18.8.19 fgColor CT_Color */ + case '': case '': break; + + /* 18.8.38 stop CT_GradientStop */ + case '': break; + case '': break; + + /* 18.8.? color CT_Color */ + case '': break; + case '': break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: if(opts && opts.WTF) { + if(!pass) throw new Error('unrecognized ' + y[0] + ' in fills'); + } + } + }); +} + +/* 18.8.23 fonts CT_Fonts */ +function parse_fonts(t, styles, themes, opts) { + styles.Fonts = []; + var font = {}; + var pass = false; + (t[0].match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': case '': break; + + /* 18.8.22 font CT_Font */ + case '': break; + case '': case '': + styles.Fonts.push(font); + font = {}; + break; + + /* 18.8.29 name CT_FontName */ + case '': case '': break; + + /* 18.8.2 b CT_BooleanProperty */ + case '': font.bold = 1; break; + + /* 18.8.26 i CT_BooleanProperty */ + case '': font.italic = 1; break; + + /* 18.4.13 u CT_UnderlineProperty */ + case '': font.underline = 1; break; + + /* 18.4.10 strike CT_BooleanProperty */ + case '': font.strike = 1; break; + + /* 18.4.2 outline CT_BooleanProperty */ + case '': font.outline = 1; break; + + /* 18.8.36 shadow CT_BooleanProperty */ + case '': font.shadow = 1; break; + + /* 18.8.12 condense CT_BooleanProperty */ + case '': font.condense = 1; break; + + /* 18.8.17 extend CT_BooleanProperty */ + case '': font.extend = 1; break; + + /* 18.4.11 sz CT_FontSize */ + case '': case '': break; + + /* 18.4.14 vertAlign CT_VerticalAlignFontProperty */ + case '': case '': break; + + /* 18.8.18 family CT_FontFamily */ + case '': case '': break; + + /* 18.8.35 scheme CT_FontScheme */ + case '': case '': break; + + /* 18.4.1 charset CT_IntProperty */ + case '': case '': break; + + /* note: sometimes mc:AlternateContent appears bare */ + case '': pass = false; break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: if(opts && opts.WTF) { + if(!pass) throw new Error('unrecognized ' + y[0] + ' in fonts'); + } + } + }); +} + +/* 18.8.31 numFmts CT_NumFmts */ +function parse_numFmts(t, styles, opts) { + styles.NumberFmt = []; + var k/*Array*/ = (keys(table_fmt)/*:any*/); + for(var i=0; i < k.length; ++i) styles.NumberFmt[k[i]] = table_fmt[k[i]]; + var m = t[0].match(tagregex); + if(!m) return; + for(i=0; i < m.length; ++i) { + var y = parsexmltag(m[i]); + switch(strip_ns(y[0])) { + case '': case '': case '': break; + case '0) { + if(j > 0x188) { + for(j = 0x188; j > 0x3c; --j) if(styles.NumberFmt[j] == null) break; + styles.NumberFmt[j] = f; + } + SSF__load(f,j); + } + } break; + case '': break; + default: if(opts.WTF) throw new Error('unrecognized ' + y[0] + ' in numFmts'); + } + } +} + +function write_numFmts(NF/*:{[n:number|string]:string}*//*::, opts*/) { + var o = [""]; + [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { + for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) o[o.length] = (writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])})); + }); + if(o.length === 1) return ""; + o[o.length] = (""); + o[0] = writextag('numFmts', null, { count:o.length-2 }).replace("/>", ">"); + return o.join(""); +} + +/* 18.8.10 cellXfs CT_CellXfs */ +var cellXF_uint = [ "numFmtId", "fillId", "fontId", "borderId", "xfId" ]; +var cellXF_bool = [ "applyAlignment", "applyBorder", "applyFill", "applyFont", "applyNumberFormat", "applyProtection", "pivotButton", "quotePrefix" ]; +function parse_cellXfs(t, styles, opts) { + styles.CellXf = []; + var xf; + var pass = false; + (t[0].match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x), i = 0; + switch(strip_ns(y[0])) { + case '': case '': case '': break; + + /* 18.8.45 xf CT_Xf */ + case '': + xf = y; + delete xf[0]; + for(i = 0; i < cellXF_uint.length; ++i) if(xf[cellXF_uint[i]]) + xf[cellXF_uint[i]] = parseInt(xf[cellXF_uint[i]], 10); + for(i = 0; i < cellXF_bool.length; ++i) if(xf[cellXF_bool[i]]) + xf[cellXF_bool[i]] = parsexmlbool(xf[cellXF_bool[i]]); + if(styles.NumberFmt && xf.numFmtId > 0x188) { + for(i = 0x188; i > 0x3c; --i) if(styles.NumberFmt[xf.numFmtId] == styles.NumberFmt[i]) { xf.numFmtId = i; break; } + } + styles.CellXf.push(xf); break; + case '': break; + + /* 18.8.1 alignment CT_CellAlignment */ + case '': + var alignment = {}; + if(y.vertical) alignment.vertical = y.vertical; + if(y.horizontal) alignment.horizontal = y.horizontal; + if(y.textRotation != null) alignment.textRotation = y.textRotation; + if(y.indent) alignment.indent = y.indent; + if(y.wrapText) alignment.wrapText = parsexmlbool(y.wrapText); + xf.alignment = alignment; + break; + case '': break; + + /* 18.8.33 protection CT_CellProtection */ + case '': case '': break; + + /* note: sometimes mc:AlternateContent appears bare */ + case '': pass = false; break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': break; + case '': pass = false; break; + default: if(opts && opts.WTF) { + if(!pass) throw new Error('unrecognized ' + y[0] + ' in cellXfs'); + } + } + }); +} + +function write_cellXfs(cellXfs)/*:string*/ { + var o/*:Array*/ = []; + o[o.length] = (writextag('cellXfs',null)); + cellXfs.forEach(function(c) { + o[o.length] = (writextag('xf', null, c)); + }); + o[o.length] = (""); + if(o.length === 2) return ""; + o[0] = writextag('cellXfs',null, {count:o.length-2}).replace("/>",">"); + return o.join(""); +} + +/* 18.8 Styles CT_Stylesheet*/ +var parse_sty_xml= /*#__PURE__*/(function make_pstyx() { +var numFmtRegex = /<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/; +var cellXfRegex = /<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/; +var fillsRegex = /<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/; +var fontsRegex = /<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/; +var bordersRegex = /<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/; + +return function parse_sty_xml(data, themes, opts) { + var styles = {}; + if(!data) return styles; + data = data.replace(//mg,"").replace(//gm,""); + /* 18.8.39 styleSheet CT_Stylesheet */ + var t; + + /* 18.8.31 numFmts CT_NumFmts ? */ + if((t=data.match(numFmtRegex))) parse_numFmts(t, styles, opts); + + /* 18.8.23 fonts CT_Fonts ? */ + if((t=data.match(fontsRegex))) parse_fonts(t, styles, themes, opts); + + /* 18.8.21 fills CT_Fills ? */ + if((t=data.match(fillsRegex))) parse_fills(t, styles, themes, opts); + + /* 18.8.5 borders CT_Borders ? */ + if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts); + + /* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */ + /* 18.8.8 cellStyles CT_CellStyles ? */ + + /* 18.8.10 cellXfs CT_CellXfs ? */ + if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts); + + /* 18.8.15 dxfs CT_Dxfs ? */ + /* 18.8.42 tableStyles CT_TableStyles ? */ + /* 18.8.11 colors CT_Colors ? */ + /* 18.2.10 extLst CT_ExtensionList ? */ + + return styles; +}; +})(); + +function write_sty_xml(wb/*:Workbook*/, opts)/*:string*/ { + var o = [XML_HEADER, writextag('styleSheet', null, { + 'xmlns': XMLNS_main[0], + 'xmlns:vt': XMLNS.vt + })], w; + if(wb.SSF && (w = write_numFmts(wb.SSF)) != null) o[o.length] = w; + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + if((w = write_cellXfs(opts.cellXfs))) o[o.length] = (w); + o[o.length] = (''); + o[o.length] = (''); + o[o.length] = (''); + + if(o.length>2){ o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); +} +/* [MS-XLSB] 2.4.657 BrtFmt */ +function parse_BrtFmt(data, length/*:number*/) { + var numFmtId = data.read_shift(2); + var stFmtCode = parse_XLWideString(data,length-2); + return [numFmtId, stFmtCode]; +} +function write_BrtFmt(i/*:number*/, f/*:string*/, o) { + if(!o) o = new_buf(6 + 4 * f.length); + o.write_shift(2, i); + write_XLWideString(f, o); + var out = (o.length > o.l) ? o.slice(0, o.l) : o; + if(o.l == null) o.l = o.length; + return out; +} + +/* [MS-XLSB] 2.4.659 BrtFont TODO */ +function parse_BrtFont(data, length/*:number*/, opts) { + var out = ({}/*:any*/); + + out.sz = data.read_shift(2) / 20; + + var grbit = parse_FontFlags(data, 2, opts); + if(grbit.fItalic) out.italic = 1; + if(grbit.fCondense) out.condense = 1; + if(grbit.fExtend) out.extend = 1; + if(grbit.fShadow) out.shadow = 1; + if(grbit.fOutline) out.outline = 1; + if(grbit.fStrikeout) out.strike = 1; + + var bls = data.read_shift(2); + if(bls === 0x02BC) out.bold = 1; + + switch(data.read_shift(2)) { + /* case 0: out.vertAlign = "baseline"; break; */ + case 1: out.vertAlign = "superscript"; break; + case 2: out.vertAlign = "subscript"; break; + } + + var underline = data.read_shift(1); + if(underline != 0) out.underline = underline; + + var family = data.read_shift(1); + if(family > 0) out.family = family; + + var bCharSet = data.read_shift(1); + if(bCharSet > 0) out.charset = bCharSet; + + data.l++; + out.color = parse_BrtColor(data, 8); + + switch(data.read_shift(1)) { + /* case 0: out.scheme = "none": break; */ + case 1: out.scheme = "major"; break; + case 2: out.scheme = "minor"; break; + } + + out.name = parse_XLWideString(data, length - 21); + + return out; +} +function write_BrtFont(font/*:any*/, o) { + if(!o) o = new_buf(25+4*32); + o.write_shift(2, font.sz * 20); + write_FontFlags(font, o); + o.write_shift(2, font.bold ? 0x02BC : 0x0190); + var sss = 0; + if(font.vertAlign == "superscript") sss = 1; + else if(font.vertAlign == "subscript") sss = 2; + o.write_shift(2, sss); + o.write_shift(1, font.underline || 0); + o.write_shift(1, font.family || 0); + o.write_shift(1, font.charset || 0); + o.write_shift(1, 0); + write_BrtColor(font.color, o); + var scheme = 0; + if(font.scheme == "major") scheme = 1; + if(font.scheme == "minor") scheme = 2; + o.write_shift(1, scheme); + write_XLWideString(font.name, o); + return o.length > o.l ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.4.650 BrtFill */ +var XLSBFillPTNames = [ + "none", + "solid", + "mediumGray", + "darkGray", + "lightGray", + "darkHorizontal", + "darkVertical", + "darkDown", + "darkUp", + "darkGrid", + "darkTrellis", + "lightHorizontal", + "lightVertical", + "lightDown", + "lightUp", + "lightGrid", + "lightTrellis", + "gray125", + "gray0625" +]; +var rev_XLSBFillPTNames/*:EvertNumType*/; +/* TODO: gradient fill representation */ +var parse_BrtFill = parsenoop; +function write_BrtFill(fill, o) { + if(!o) o = new_buf(4*3 + 8*7 + 16*1); + if(!rev_XLSBFillPTNames) rev_XLSBFillPTNames = (evert(XLSBFillPTNames)/*:any*/); + var fls/*:number*/ = rev_XLSBFillPTNames[fill.patternType]; + if(fls == null) fls = 0x28; + o.write_shift(4, fls); + var j = 0; + if(fls != 0x28) { + /* TODO: custom FG Color */ + write_BrtColor({auto:1}, o); + /* TODO: custom BG Color */ + write_BrtColor({auto:1}, o); + + for(; j < 12; ++j) o.write_shift(4, 0); + } else { + for(; j < 4; ++j) o.write_shift(4, 0); + + for(; j < 12; ++j) o.write_shift(4, 0); /* TODO */ + /* iGradientType */ + /* xnumDegree */ + /* xnumFillToLeft */ + /* xnumFillToRight */ + /* xnumFillToTop */ + /* xnumFillToBottom */ + /* cNumStop */ + /* xfillGradientStop */ + } + return o.length > o.l ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.4.824 BrtXF */ +function parse_BrtXF(data, length/*:number*/) { + var tgt = data.l + length; + var ixfeParent = data.read_shift(2); + var ifmt = data.read_shift(2); + data.l = tgt; + return {ixfe:ixfeParent, numFmtId:ifmt }; +} +function write_BrtXF(data, ixfeP, o) { + if(!o) o = new_buf(16); + o.write_shift(2, ixfeP||0); + o.write_shift(2, data.numFmtId||0); + o.write_shift(2, 0); /* iFont */ + o.write_shift(2, 0); /* iFill */ + o.write_shift(2, 0); /* ixBorder */ + o.write_shift(1, 0); /* trot */ + o.write_shift(1, 0); /* indent */ + var flow = 0; + o.write_shift(1, flow); /* flags */ + o.write_shift(1, 0); /* flags */ + o.write_shift(1, 0); /* xfGrbitAtr */ + o.write_shift(1, 0); + return o; +} + +/* [MS-XLSB] 2.5.4 Blxf TODO */ +function write_Blxf(data, o) { + if(!o) o = new_buf(10); + o.write_shift(1, 0); /* dg */ + o.write_shift(1, 0); + o.write_shift(4, 0); /* color */ + o.write_shift(4, 0); /* color */ + return o; +} +/* [MS-XLSB] 2.4.302 BrtBorder TODO */ +var parse_BrtBorder = parsenoop; +function write_BrtBorder(border, o) { + if(!o) o = new_buf(51); + o.write_shift(1, 0); /* diagonal */ + write_Blxf(null, o); /* top */ + write_Blxf(null, o); /* bottom */ + write_Blxf(null, o); /* left */ + write_Blxf(null, o); /* right */ + write_Blxf(null, o); /* diag */ + return o.length > o.l ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.4.763 BrtStyle TODO */ +function write_BrtStyle(style, o) { + if(!o) o = new_buf(12+4*10); + o.write_shift(4, style.xfId); + o.write_shift(2, 1); + o.write_shift(1, +style.builtinId); + o.write_shift(1, 0); /* iLevel */ + write_XLNullableWideString(style.name || "", o); + return o.length > o.l ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.4.272 BrtBeginTableStyles */ +function write_BrtBeginTableStyles(cnt, defTableStyle, defPivotStyle) { + var o = new_buf(4+256*2*4); + o.write_shift(4, cnt); + write_XLNullableWideString(defTableStyle, o); + write_XLNullableWideString(defPivotStyle, o); + return o.length > o.l ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.1.7.50 Styles */ +function parse_sty_bin(data, themes, opts) { + var styles = {}; + styles.NumberFmt = ([]/*:any*/); + for(var y in table_fmt) styles.NumberFmt[y] = table_fmt[y]; + + styles.CellXf = []; + styles.Fonts = []; + var state/*:Array*/ = []; + var pass = false; + recordhopper(data, function hopper_sty(val, R, RT) { + switch(RT) { + case 0x002C: /* BrtFmt */ + styles.NumberFmt[val[0]] = val[1]; SSF__load(val[1], val[0]); + break; + case 0x002B: /* BrtFont */ + styles.Fonts.push(val); + if(val.color.theme != null && themes && themes.themeElements && themes.themeElements.clrScheme) { + val.color.rgb = rgb_tint(themes.themeElements.clrScheme[val.color.theme].rgb, val.color.tint || 0); + } + break; + case 0x0401: /* BrtKnownFonts */ break; + case 0x002D: /* BrtFill */ + break; + case 0x002E: /* BrtBorder */ + break; + case 0x002F: /* BrtXF */ + if(state[state.length - 1] == 0x0269 /* BrtBeginCellXFs */) { + styles.CellXf.push(val); + } + break; + case 0x0030: /* BrtStyle */ + case 0x01FB: /* BrtDXF */ + case 0x023C: /* BrtMRUColor */ + case 0x01DB: /* BrtIndexedColor */ + break; + + case 0x0493: /* BrtDXF14 */ + case 0x0836: /* BrtDXF15 */ + case 0x046A: /* BrtSlicerStyleElement */ + case 0x0200: /* BrtTableStyleElement */ + case 0x082F: /* BrtTimelineStyleElement */ + case 0x0C00: /* BrtUid */ + break; + + case 0x0023: /* BrtFRTBegin */ + pass = true; break; + case 0x0024: /* BrtFRTEnd */ + pass = false; break; + case 0x0025: /* BrtACBegin */ + state.push(RT); pass = true; break; + case 0x0026: /* BrtACEnd */ + state.pop(); pass = false; break; + + default: + if(R.T > 0) state.push(RT); + else if(R.T < 0) state.pop(); + else if(!pass || (opts.WTF && state[state.length-1] != 0x0025 /* BrtACBegin */)) throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }); + return styles; +} + +function write_FMTS_bin(ba, NF/*:?SSFTable*/) { + if(!NF) return; + var cnt = 0; + [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { + /*:: if(!NF) return; */ + for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) ++cnt; + }); + + if(cnt == 0) return; + write_record(ba, 0x0267 /* BrtBeginFmts */, write_UInt32LE(cnt)); + [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { + /*:: if(!NF) return; */ + for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_record(ba, 0x002C /* BrtFmt */, write_BrtFmt(i, NF[i])); + }); + write_record(ba, 0x0268 /* BrtEndFmts */); +} + +function write_FONTS_bin(ba/*::, data*/) { + var cnt = 1; + + if(cnt == 0) return; + write_record(ba, 0x0263 /* BrtBeginFonts */, write_UInt32LE(cnt)); + write_record(ba, 0x002B /* BrtFont */, write_BrtFont({ + sz:12, + color: {theme:1}, + name: "Calibri", + family: 2, + scheme: "minor" + })); + /* 1*65491BrtFont [ACFONTS] */ + write_record(ba, 0x0264 /* BrtEndFonts */); +} + +function write_FILLS_bin(ba/*::, data*/) { + var cnt = 2; + + if(cnt == 0) return; + write_record(ba, 0x025B /* BrtBeginFills */, write_UInt32LE(cnt)); + write_record(ba, 0x002D /* BrtFill */, write_BrtFill({patternType:"none"})); + write_record(ba, 0x002D /* BrtFill */, write_BrtFill({patternType:"gray125"})); + /* 1*65431BrtFill */ + write_record(ba, 0x025C /* BrtEndFills */); +} + +function write_BORDERS_bin(ba/*::, data*/) { + var cnt = 1; + + if(cnt == 0) return; + write_record(ba, 0x0265 /* BrtBeginBorders */, write_UInt32LE(cnt)); + write_record(ba, 0x002E /* BrtBorder */, write_BrtBorder({})); + /* 1*65430BrtBorder */ + write_record(ba, 0x0266 /* BrtEndBorders */); +} + +function write_CELLSTYLEXFS_bin(ba/*::, data*/) { + var cnt = 1; + write_record(ba, 0x0272 /* BrtBeginCellStyleXFs */, write_UInt32LE(cnt)); + write_record(ba, 0x002F /* BrtXF */, write_BrtXF({ + numFmtId: 0, + fontId: 0, + fillId: 0, + borderId: 0 + }, 0xFFFF)); + /* 1*65430(BrtXF *FRT) */ + write_record(ba, 0x0273 /* BrtEndCellStyleXFs */); +} + +function write_CELLXFS_bin(ba, data) { + write_record(ba, 0x0269 /* BrtBeginCellXFs */, write_UInt32LE(data.length)); + data.forEach(function(c) { write_record(ba, 0x002F /* BrtXF */, write_BrtXF(c,0)); }); + /* 1*65430(BrtXF *FRT) */ + write_record(ba, 0x026A /* BrtEndCellXFs */); +} + +function write_STYLES_bin(ba/*::, data*/) { + var cnt = 1; + + write_record(ba, 0x026B /* BrtBeginStyles */, write_UInt32LE(cnt)); + write_record(ba, 0x0030 /* BrtStyle */, write_BrtStyle({ + xfId:0, + builtinId:0, + name:"Normal" + })); + /* 1*65430(BrtStyle *FRT) */ + write_record(ba, 0x026C /* BrtEndStyles */); +} + +function write_DXFS_bin(ba/*::, data*/) { + var cnt = 0; + + write_record(ba, 0x01F9 /* BrtBeginDXFs */, write_UInt32LE(cnt)); + /* *2147483647(BrtDXF *FRT) */ + write_record(ba, 0x01FA /* BrtEndDXFs */); +} + +function write_TABLESTYLES_bin(ba/*::, data*/) { + var cnt = 0; + + write_record(ba, 0x01FC /* BrtBeginTableStyles */, write_BrtBeginTableStyles(cnt, "TableStyleMedium9", "PivotStyleMedium4")); + /* *TABLESTYLE */ + write_record(ba, 0x01FD /* BrtEndTableStyles */); +} + +function write_COLORPALETTE_bin(/*::ba, data*/) { + return; + /* BrtBeginColorPalette [INDEXEDCOLORS] [MRUCOLORS] BrtEndColorPalette */ +} + +/* [MS-XLSB] 2.1.7.50 Styles */ +function write_sty_bin(wb, opts) { + var ba = buf_array(); + write_record(ba, 0x0116 /* BrtBeginStyleSheet */); + write_FMTS_bin(ba, wb.SSF); + write_FONTS_bin(ba, wb); + write_FILLS_bin(ba, wb); + write_BORDERS_bin(ba, wb); + write_CELLSTYLEXFS_bin(ba, wb); + write_CELLXFS_bin(ba, opts.cellXfs); + write_STYLES_bin(ba, wb); + write_DXFS_bin(ba, wb); + write_TABLESTYLES_bin(ba, wb); + write_COLORPALETTE_bin(ba, wb); + /* FRTSTYLESHEET*/ + write_record(ba, 0x0117 /* BrtEndStyleSheet */); + return ba.end(); +} +/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */ +var XLSXThemeClrScheme = [ + '', '', '', '', + '', '', '', + '', '', '', + '', '' +]; +/* 20.1.6.2 clrScheme CT_ColorScheme */ +function parse_clrScheme(t, themes, opts) { + themes.themeElements.clrScheme = []; + var color = {}; + (t[0].match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(y[0]) { + /* 20.1.6.2 clrScheme (Color Scheme) CT_ColorScheme */ + case '': break; + + /* 20.1.2.3.32 srgbClr CT_SRgbColor */ + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + case '': case '': + if (y[0].charAt(1) === '/') { + themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color; + color = {}; + } else { + color.name = y[0].slice(3, y[0].length - 1); + } + break; + + default: if(opts && opts.WTF) throw new Error('Unrecognized ' + y[0] + ' in clrScheme'); + } + }); +} + +/* 20.1.4.1.18 fontScheme CT_FontScheme */ +function parse_fontScheme(/*::t, themes, opts*/) { } + +/* 20.1.4.1.15 fmtScheme CT_StyleMatrix */ +function parse_fmtScheme(/*::t, themes, opts*/) { } + +var clrsregex = /]*)>[\s\S]*<\/a:clrScheme>/; +var fntsregex = /]*)>[\s\S]*<\/a:fontScheme>/; +var fmtsregex = /]*)>[\s\S]*<\/a:fmtScheme>/; + +/* 20.1.6.10 themeElements CT_BaseStyles */ +function parse_themeElements(data, themes, opts) { + themes.themeElements = {}; + + var t; + + [ + /* clrScheme CT_ColorScheme */ + ['clrScheme', clrsregex, parse_clrScheme], + /* fontScheme CT_FontScheme */ + ['fontScheme', fntsregex, parse_fontScheme], + /* fmtScheme CT_StyleMatrix */ + ['fmtScheme', fmtsregex, parse_fmtScheme] + ].forEach(function(m) { + if(!(t=data.match(m[1]))) throw new Error(m[0] + ' not found in themeElements'); + m[2](t, themes, opts); + }); +} + +var themeltregex = /]*)>[\s\S]*<\/a:themeElements>/; + +/* 14.2.7 Theme Part */ +function parse_theme_xml(data/*:string*/, opts) { + /* 20.1.6.9 theme CT_OfficeStyleSheet */ + if(!data || data.length === 0) data = write_theme(); + + var t; + var themes = {}; + + /* themeElements CT_BaseStyles */ + if(!(t=data.match(themeltregex))) throw new Error('themeElements not found in theme'); + parse_themeElements(t[0], themes, opts); + themes.raw = data; + return themes; +} + +function write_theme(Themes, opts)/*:string*/ { + if(opts && opts.themeXLSX) return opts.themeXLSX; + if(Themes && typeof Themes.raw == "string") return Themes.raw; + var o = [XML_HEADER]; + o[o.length] = ''; + o[o.length] = ''; + + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + o[o.length] = ''; + return o.join(""); +} +/* [MS-XLS] 2.4.326 TODO: payload is a zip file */ +function parse_Theme(blob, length, opts) { + var end = blob.l + length; + var dwThemeVersion = blob.read_shift(4); + if(dwThemeVersion === 124226) return; + if(!opts.cellStyles) { blob.l = end; return; } + var data = blob.slice(blob.l); + blob.l = end; + var zip; try { zip = zip_read(data, {type: "array"}); } catch(e) { return; } + var themeXML = getzipstr(zip, "theme/theme/theme1.xml", true); + if(!themeXML) return; + return parse_theme_xml(themeXML, opts); +} + +/* 2.5.49 */ +function parse_ColorTheme(blob/*::, length*/) { return blob.read_shift(4); } + +/* 2.5.155 */ +function parse_FullColorExt(blob/*::, length*/) { + var o = {}; + o.xclrType = blob.read_shift(2); + o.nTintShade = blob.read_shift(2); + switch(o.xclrType) { + case 0: blob.l += 4; break; + case 1: o.xclrValue = parse_IcvXF(blob, 4); break; + case 2: o.xclrValue = parse_LongRGBA(blob, 4); break; + case 3: o.xclrValue = parse_ColorTheme(blob, 4); break; + case 4: blob.l += 4; break; + } + blob.l += 8; + return o; +} + +/* 2.5.164 TODO: read 7 bits*/ +function parse_IcvXF(blob, length) { + return parsenoop(blob, length); +} + +/* 2.5.280 */ +function parse_XFExtGradient(blob, length) { + return parsenoop(blob, length); +} + +/* [MS-XLS] 2.5.108 */ +function parse_ExtProp(blob/*::, length*/)/*:Array*/ { + var extType = blob.read_shift(2); + var cb = blob.read_shift(2) - 4; + var o = [extType]; + switch(extType) { + case 0x04: case 0x05: case 0x07: case 0x08: + case 0x09: case 0x0A: case 0x0B: case 0x0D: + o[1] = parse_FullColorExt(blob, cb); break; + case 0x06: o[1] = parse_XFExtGradient(blob, cb); break; + case 0x0E: case 0x0F: o[1] = blob.read_shift(cb === 1 ? 1 : 2); break; + default: throw new Error("Unrecognized ExtProp type: " + extType + " " + cb); + } + return o; +} + +/* 2.4.355 */ +function parse_XFExt(blob, length) { + var end = blob.l + length; + blob.l += 2; + var ixfe = blob.read_shift(2); + blob.l += 2; + var cexts = blob.read_shift(2); + var ext/*:AOA*/ = []; + while(cexts-- > 0) ext.push(parse_ExtProp(blob, end-blob.l)); + return {ixfe:ixfe, ext:ext}; +} + +/* xf is an XF, see parse_XFExt for xfext */ +function update_xfext(xf, xfext) { + xfext.forEach(function(xfe) { + switch(xfe[0]) { /* 2.5.108 extPropData */ + case 0x04: break; /* foreground color */ + case 0x05: break; /* background color */ + case 0x06: break; /* gradient fill */ + case 0x07: break; /* top cell border color */ + case 0x08: break; /* bottom cell border color */ + case 0x09: break; /* left cell border color */ + case 0x0a: break; /* right cell border color */ + case 0x0b: break; /* diagonal cell border color */ + case 0x0d: /* text color */ + break; + case 0x0e: break; /* font scheme */ + case 0x0f: break; /* indentation level */ + } + }); +} + +function parse_BrtMdtinfo(data, length) { + return { + flags: data.read_shift(4), + version: data.read_shift(4), + name: parse_XLWideString(data, length - 8) + }; +} +function write_BrtMdtinfo(data) { + var o = new_buf(12 + 2 * data.name.length); + o.write_shift(4, data.flags); + o.write_shift(4, data.version); + write_XLWideString(data.name, o); + return o.slice(0, o.l); +} +function parse_BrtMdb(data) { + var out = []; + var cnt = data.read_shift(4); + while (cnt-- > 0) + out.push([data.read_shift(4), data.read_shift(4)]); + return out; +} +function write_BrtMdb(mdb) { + var o = new_buf(4 + 8 * mdb.length); + o.write_shift(4, mdb.length); + for (var i = 0; i < mdb.length; ++i) { + o.write_shift(4, mdb[i][0]); + o.write_shift(4, mdb[i][1]); + } + return o; +} +function write_BrtBeginEsfmd(cnt, name) { + var o = new_buf(8 + 2 * name.length); + o.write_shift(4, cnt); + write_XLWideString(name, o); + return o.slice(0, o.l); +} +function parse_BrtBeginEsmdb(data) { + data.l += 4; + return data.read_shift(4) != 0; +} +function write_BrtBeginEsmdb(cnt, cm) { + var o = new_buf(8); + o.write_shift(4, cnt); + o.write_shift(4, cm ? 1 : 0); + return o; +} +function parse_xlmeta_bin(data, name, _opts) { + var out = { Types: [], Cell: [], Value: [] }; + var opts = _opts || {}; + var state = []; + var pass = false; + var metatype = 2; + recordhopper(data, function(val, R, RT) { + switch (RT) { + case 335: + out.Types.push({ name: val.name }); + break; + case 51: + val.forEach(function(r) { + if (metatype == 1) + out.Cell.push({ type: out.Types[r[0] - 1].name, index: r[1] }); + else if (metatype == 0) + out.Value.push({ type: out.Types[r[0] - 1].name, index: r[1] }); + }); + break; + case 337: + metatype = val ? 1 : 0; + break; + case 338: + metatype = 2; + break; + case 35: + state.push(RT); + pass = true; + break; + case 36: + state.pop(); + pass = false; + break; + default: + if (R.T) { + } else if (!pass || opts.WTF && state[state.length - 1] != 35) + throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }); + return out; +} +function write_xlmeta_bin() { + var ba = buf_array(); + write_record(ba, 332); + write_record(ba, 334, write_UInt32LE(1)); + write_record(ba, 335, write_BrtMdtinfo({ + name: "XLDAPR", + version: 12e4, + flags: 3496657072 + })); + write_record(ba, 336); + write_record(ba, 339, write_BrtBeginEsfmd(1, "XLDAPR")); + write_record(ba, 52); + write_record(ba, 35, write_UInt32LE(514)); + write_record(ba, 4096, write_UInt32LE(0)); + write_record(ba, 4097, writeuint16(1)); + write_record(ba, 36); + write_record(ba, 53); + write_record(ba, 340); + write_record(ba, 337, write_BrtBeginEsmdb(1, true)); + write_record(ba, 51, write_BrtMdb([[1, 0]])); + write_record(ba, 338); + write_record(ba, 333); + return ba.end(); +} +function parse_xlmeta_xml(data, name, opts) { + var out = { Types: [], Cell: [], Value: [] }; + if (!data) + return out; + var pass = false; + var metatype = 2; + var lastmeta; + data.replace(tagregex, function(x) { + var y = parsexmltag(x); + switch (strip_ns(y[0])) { + case "": + break; + case "": + break; + case "": + break; + case "": + break; + case "": + break; + case "": + break; + case "": + break; + case "": + metatype = 2; + break; + case "": + metatype = 2; + break; + case "": + case "": + case "": + break; + case "": + pass = false; + break; + case "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n'); + return o.join(""); +} +/* 18.6 Calculation Chain */ +function parse_cc_xml(data/*::, name, opts*/)/*:Array*/ { + var d = []; + if(!data) return d; + var i = 1; + (data.match(tagregex)||[]).forEach(function(x) { + var y = parsexmltag(x); + switch(y[0]) { + case '': case '': break; + /* 18.6.1 c CT_CalcCell 1 */ + case ']*r:id="([^"]*)"/)||["",""])[1]; + + return rels['!id'][id].Target; +} + +/* L.5.5.2 SpreadsheetML Comments + VML Schema */ +var shapevmlregex = /<(?:\w+:)?shape(?:[^\w][^>]*)?>([\s\S]*?)<\/(?:\w+:)?shape>/g; +function parse_vml(data/*:string*/, sheet, comments) { + var cidx = 0; + (data.match(shapevmlregex)||[]).forEach(function(m) { + var type = ""; + var hidden = true; + var aidx = -1; + var R = -1, C = -1; + m.replace(tagregex, function(x/*:string*/, idx/*:number*/) { + var y = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': hidden = false; break; + + case '': aidx = idx + x.length; break; + case '': R = +m.slice(aidx, idx).trim(); break; + + case '': aidx = idx + x.length; break; + case '': C = +m.slice(aidx, idx).trim(); break; + } + return ""; + }); + switch(type) { + case 'Note': + var cell = ws_get_cell_stub(sheet, ((R>=0 && C>=0) ? encode_cell({r:R,c:C}) : comments[cidx].ref)); + if(cell.c) { + cell.c.hidden = hidden; + } + ++cidx; + break; + } + + }); +} + + +/* comment boxes */ +function write_vml(rId/*:number*/, comments, ws) { + var csize = [21600, 21600]; + /* L.5.2.1.2 Path Attribute */ + var bbox = ["m0,0l0",csize[1],csize[0],csize[1],csize[0],"0xe"].join(","); + var o = [ + writextag("xml", null, { 'xmlns:v': XLMLNS.v, 'xmlns:o': XLMLNS.o, 'xmlns:x': XLMLNS.x, 'xmlns:mv': XLMLNS.mv }).replace(/\/>/,">"), + writextag("o:shapelayout", writextag("o:idmap", null, {'v:ext':"edit", 'data':rId}), {'v:ext':"edit"}) + ]; + + var _shapeid = 65536 * rId; + + var _comments = comments || []; + if(_comments.length > 0) o.push(writextag("v:shapetype", [ + writextag("v:stroke", null, {joinstyle:"miter"}), + writextag("v:path", null, {gradientshapeok:"t", 'o:connecttype':"rect"}) + ].join(""), {id:"_x0000_t202", coordsize:csize.join(","), 'o:spt':202, path:bbox})); + + _comments.forEach(function(x) { ++_shapeid; o.push(write_vml_comment(x, _shapeid)); }); + o.push(''); + return o.join(""); +} + +function write_vml_comment(x, _shapeid, ws)/*:string*/ { + var c = decode_cell(x[0]); + var fillopts = /*::(*/{'color2':"#BEFF82", 'type':"gradient"}/*:: :any)*/; + if(fillopts.type == "gradient") fillopts.angle = "-180"; + var fillparm = fillopts.type == "gradient" ? writextag("o:fill", null, {type:"gradientUnscaled", 'v:ext':"view"}) : null; + var fillxml = writextag('v:fill', fillparm, fillopts); + + var shadata = ({on:"t", 'obscured':"t"}/*:any*/); + + return [ + '', + fillxml, + writextag("v:shadow", null, shadata), + writextag("v:path", null, {'o:connecttype':"none"}), + '
', + '', + '', + '', + /* Part 4 19.4.2.3 Anchor (Anchor) */ + writetag('x:Anchor', [c.c+1, 0, c.r+1, 0, c.c+3, 20, c.r+5, 20].join(",")), + writetag('x:AutoFill', "False"), + writetag('x:Row', String(c.r)), + writetag('x:Column', String(c.c)), + x[1].hidden ? '' : '', + '', + '' + ].join(""); +} +function sheet_insert_comments(sheet/*:WorkSheet*/, comments/*:Array*/, threaded/*:boolean*/, people/*:?Array*/) { + var dense = sheet["!data"] != null; + var cell/*:Cell*/; + comments.forEach(function(comment) { + var r = decode_cell(comment.ref); + if(r.r < 0 || r.c < 0) return; + if(dense) { + if(!sheet["!data"][r.r]) sheet["!data"][r.r] = []; + cell = sheet["!data"][r.r][r.c]; + } else cell = sheet[comment.ref]; + if (!cell) { + cell = ({t:"z"}/*:any*/); + if(dense) sheet["!data"][r.r][r.c] = cell; + else sheet[comment.ref] = cell; + var range = safe_decode_range(sheet["!ref"]||"BDWGO1000001:A1"); + if(range.s.r > r.r) range.s.r = r.r; + if(range.e.r < r.r) range.e.r = r.r; + if(range.s.c > r.c) range.s.c = r.c; + if(range.e.c < r.c) range.e.c = r.c; + var encoded = encode_range(range); + sheet["!ref"] = encoded; + } + + if (!cell.c) cell.c = []; + var o/*:Comment*/ = ({a: comment.author, t: comment.t, r: comment.r, T: threaded}); + if(comment.h) o.h = comment.h; + + /* threaded comments always override */ + for(var i = cell.c.length - 1; i >= 0; --i) { + if(!threaded && cell.c[i].T) return; + if(threaded && !cell.c[i].T) cell.c.splice(i, 1); + } + if(threaded && people) for(i = 0; i < people.length; ++i) { + if(o.a == people[i].id) { o.a = people[i].name || o.a; break; } + } + cell.c.push(o); + }); +} +/* 18.7 Comments */ +function parse_comments_xml(data/*:string*/, opts)/*:Array*/ { + /* 18.7.6 CT_Comments */ + if(data.match(/<(?:\w+:)?comments *\/>/)) return []; + var authors/*:Array*/ = []; + var commentList/*:Array*/ = []; + var authtag = data.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/); + if(authtag && authtag[1]) authtag[1].split(/<\/\w*:?author>/).forEach(function(x) { + if(x === "" || x.trim() === "") return; + var a = x.match(/<(?:\w+:)?author[^>]*>(.*)/); + if(a) authors.push(a[1]); + }); + var cmnttag = data.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/); + if(cmnttag && cmnttag[1]) cmnttag[1].split(/<\/\w*:?comment>/).forEach(function(x) { + if(x === "" || x.trim() === "") return; + var cm = x.match(/<(?:\w+:)?comment[^>]*>/); + if(!cm) return; + var y = parsexmltag(cm[0]); + var comment/*:RawComment*/ = ({ author: y.authorId && authors[y.authorId] || "sheetjsghost", ref: y.ref, guid: y.guid }/*:any*/); + var cell = decode_cell(y.ref); + if(opts.sheetRows && opts.sheetRows <= cell.r) return; + var textMatch = x.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/); + var rt = !!textMatch && !!textMatch[1] && parse_si(textMatch[1]) || {r:"",t:"",h:""}; + comment.r = rt.r; + if(rt.r == "") rt.t = rt.h = ""; + comment.t = (rt.t||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"); + if(opts.cellHTML) comment.h = rt.h; + commentList.push(comment); + }); + return commentList; +} + +function write_comments_xml(data/*::, opts*/) { + var o = [XML_HEADER, writextag('comments', null, { 'xmlns': XMLNS_main[0] })]; + + var iauthor/*:Array*/ = []; + o.push(""); + data.forEach(function(x) { x[1].forEach(function(w) { var a = escapexml(w.a); + if(iauthor.indexOf(a) == -1) { + iauthor.push(a); + o.push("" + a + ""); + } + if(w.T && w.ID && iauthor.indexOf("tc=" + w.ID) == -1) { + iauthor.push("tc=" + w.ID); + o.push("" + "tc=" + w.ID + ""); + } + }); }); + if(iauthor.length == 0) { iauthor.push("SheetJ5"); o.push("SheetJ5"); } + o.push(""); + o.push(""); + data.forEach(function(d) { + /* 18.7.3 CT_Comment */ + var lastauthor = 0, ts = [], tcnt = 0; + if(d[1][0] && d[1][0].T && d[1][0].ID) lastauthor = iauthor.indexOf("tc=" + d[1][0].ID); + d[1].forEach(function(c) { + if(c.a) lastauthor = iauthor.indexOf(escapexml(c.a)); + if(c.T) ++tcnt; + ts.push(c.t == null ? "" : escapexml(c.t)); + }); + if(tcnt === 0) { + d[1].forEach(function(c) { + o.push(''); + o.push(writetag("t", c.t == null ? "" : escapexml(c.t))); + o.push(''); + }); + } else { + if(d[1][0] && d[1][0].T && d[1][0].ID) lastauthor = iauthor.indexOf("tc=" + d[1][0].ID); + /* based on Threaded Comments -> Comments projection */ + o.push(''); + var t = "Comment:\n " + (ts[0]) + "\n"; + for(var i = 1; i < ts.length; ++i) t += "Reply:\n " + ts[i] + "\n"; + o.push(writetag("t", escapexml(t))); + o.push(''); + } + }); + o.push(""); + if(o.length>2) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); +} + +/* [MS-XLSX] 2.1.17 */ +function parse_tcmnt_xml(data/*:string*/, opts)/*:Array*/ { + var out = []; + var pass = false, comment = {}, tidx = 0; + data.replace(tagregex, function xml_tcmnt(x, idx) { + var y/*:any*/ = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': break; + + /* 2.6.205 threadedComment CT_ThreadedComment */ + case '': if(comment.t != null) out.push(comment); break; + + case '': case '': comment.t = data.slice(tidx, idx).replace(/\r\n/g, "\n").replace(/\r/g, "\n"); break; + + /* 2.6.206 mentions CT_ThreadedCommentMentions TODO */ + case '': pass = true; break; + case '': pass = false; break; + + /* 2.6.202 mention CT_Mention TODO */ + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '
': case '': break; + /* 18.2.7 ext CT_Extension + */ + case '': pass=false; break; + + default: if(!pass && opts.WTF) throw new Error('unrecognized ' + y[0] + ' in threaded comments'); + } + return x; + }); + return out; +} + +function write_tcmnt_xml(comments, people, opts) { + var o = [XML_HEADER, writextag('ThreadedComments', null, { 'xmlns': XMLNS.TCMNT }).replace(/[\/]>/, ">")]; + comments.forEach(function(carr) { + var rootid = ""; + (carr[1] || []).forEach(function(c, idx) { + if(!c.T) { delete c.ID; return; } + if(c.a && people.indexOf(c.a) == -1) people.push(c.a); + var tcopts = { + ref: carr[0], + id: "{54EE7951-7262-4200-6969-" + ("000000000000" + opts.tcid++).slice(-12) + "}" + }; + if(idx == 0) rootid = tcopts.id; + else tcopts.parentId = rootid; + c.ID = tcopts.id; + if(c.a) tcopts.personId = "{54EE7950-7262-4200-6969-" + ("000000000000" + people.indexOf(c.a)).slice(-12) + "}"; + o.push(writextag('threadedComment', writetag('text', c.t||""), tcopts)); + }); + }); + o.push(''); + return o.join(""); +} + +/* [MS-XLSX] 2.1.18 */ +function parse_people_xml(data/*:string*/, opts) { + var out = []; + var pass = false; + data.replace(tagregex, function xml_tcmnt(x) { + var y/*:any*/ = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': break; + + /* 2.6.203 person CT_Person TODO: providers */ + case '': break; + + /* 18.2.10 extLst CT_ExtensionList ? */ + case '': case '': case '': break; + /* 18.2.7 ext CT_Extension + */ + case '': pass=false; break; + + default: if(!pass && opts.WTF) throw new Error('unrecognized ' + y[0] + ' in threaded comments'); + } + return x; + }); + return out; +} +function write_people_xml(people/*, opts*/) { + var o = [XML_HEADER, writextag('personList', null, { + 'xmlns': XMLNS.TCMNT, + 'xmlns:x': XMLNS_main[0] + }).replace(/[\/]>/, ">")]; + people.forEach(function(person, idx) { + o.push(writextag('person', null, { + displayName: person, + id: "{54EE7950-7262-4200-6969-" + ("000000000000" + idx).slice(-12) + "}", + userId: person, + providerId: "None" + })); + }); + o.push(""); + return o.join(""); +} +/* [MS-XLSB] 2.4.28 BrtBeginComment */ +function parse_BrtBeginComment(data) { + var out = {}; + out.iauthor = data.read_shift(4); + var rfx = parse_UncheckedRfX(data, 16); + out.rfx = rfx.s; + out.ref = encode_cell(rfx.s); + data.l += 16; /*var guid = parse_GUID(data); */ + return out; +} +function write_BrtBeginComment(data, o) { + if(o == null) o = new_buf(36); + o.write_shift(4, data[1].iauthor); + write_UncheckedRfX((data[0]/*:any*/), o); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + o.write_shift(4, 0); + return o; +} + +/* [MS-XLSB] 2.4.327 BrtCommentAuthor */ +var parse_BrtCommentAuthor = parse_XLWideString; +function write_BrtCommentAuthor(data) { return write_XLWideString(data.slice(0, 54)); } + +/* [MS-XLSB] 2.1.7.8 Comments */ +function parse_comments_bin(data, opts)/*:Array*/ { + var out/*:Array*/ = []; + var authors/*:Array*/ = []; + var c = {}; + var pass = false; + recordhopper(data, function hopper_cmnt(val, R, RT) { + switch(RT) { + case 0x0278: /* 'BrtCommentAuthor' */ + authors.push(val); break; + case 0x027B: /* 'BrtBeginComment' */ + c = val; break; + case 0x027D: /* 'BrtCommentText' */ + c.t = val.t; c.h = val.h; c.r = val.r; break; + case 0x027C: /* 'BrtEndComment' */ + c.author = authors[c.iauthor]; + delete (c/*:any*/).iauthor; + if(opts.sheetRows && c.rfx && opts.sheetRows <= c.rfx.r) break; + if(!c.t) c.t = ""; + delete c.rfx; out.push(c); break; + + case 0x0C00: /* 'BrtUid' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + case 0x0025: /* 'BrtACBegin' */ break; + case 0x0026: /* 'BrtACEnd' */ break; + + + default: + if(R.T){/* empty */} + else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }); + return out; +} + +function write_comments_bin(data/*::, opts*/) { + var ba = buf_array(); + var iauthor/*:Array*/ = []; + write_record(ba, 0x0274 /* BrtBeginComments */); + + write_record(ba, 0x0276 /* BrtBeginCommentAuthors */); + data.forEach(function(comment) { + comment[1].forEach(function(c) { + if(iauthor.indexOf(c.a) > -1) return; + iauthor.push(c.a.slice(0,54)); + write_record(ba, 0x0278 /* BrtCommentAuthor */, write_BrtCommentAuthor(c.a)); + if(c.T && c.ID && iauthor.indexOf("tc=" + c.ID) == -1) { + iauthor.push("tc=" + c.ID); + write_record(ba, 0x0278 /* BrtCommentAuthor */, write_BrtCommentAuthor("tc=" + c.ID)); + } + }); + }); + write_record(ba, 0x0277 /* BrtEndCommentAuthors */); + + write_record(ba, 0x0279 /* BrtBeginCommentList */); + data.forEach(function(comment) { + comment[1].forEach(function(c) { + var _ia = -1; + if(c.ID) _ia = iauthor.indexOf("tc=" + c.ID); + if(_ia == -1 && comment[1][0].T && comment[1][0].ID) _ia = iauthor.indexOf("tc=" + comment[1][0].ID); + if(_ia == -1) _ia = iauthor.indexOf(c.a); + c.iauthor = _ia; + var range = {s:decode_cell(comment[0]),e:decode_cell(comment[0])}; + write_record(ba, 0x027B /* BrtBeginComment */, write_BrtBeginComment([range, c])); + if(c.t && c.t.length > 0) write_record(ba, 0x027D /* BrtCommentText */, write_BrtCommentText(c)); + write_record(ba, 0x027C /* BrtEndComment */); + delete c.iauthor; + }); + }); + write_record(ba, 0x027A /* BrtEndCommentList */); + + write_record(ba, 0x0275 /* BrtEndComments */); + return ba.end(); +} +var CT_VBA = "application/vnd.ms-office.vbaProject"; +function make_vba_xls(cfb) { + var newcfb = CFB.utils.cfb_new({ root: "R" }); + cfb.FullPaths.forEach(function(p, i) { + if (p.slice(-1) === "/" || !p.match(/_VBA_PROJECT_CUR/)) + return; + var newpath = p.replace(/^[^\/]*/, "R").replace(/\/_VBA_PROJECT_CUR\u0000*/, ""); + CFB.utils.cfb_add(newcfb, newpath, cfb.FileIndex[i].content); + }); + return CFB.write(newcfb); +} +function fill_vba_xls(cfb, vba) { + vba.FullPaths.forEach(function(p, i) { + if (i == 0) + return; + var newpath = p.replace(/[^\/]*[\/]/, "/_VBA_PROJECT_CUR/"); + if (newpath.slice(-1) !== "/") + CFB.utils.cfb_add(cfb, newpath, vba.FileIndex[i].content); + }); +} +var VBAFMTS = ["xlsb", "xlsm", "xlam", "biff8", "xla"]; +/* macro and dialog sheet stubs */ +function parse_ds_bin(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { return {'!type':'dialog'}; } +function parse_ds_xml(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { return {'!type':'dialog'}; } +function parse_ms_bin(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { return {'!type':'macro'}; } +function parse_ms_xml(/*::data:any, opts, idx:number, rels, wb, themes, styles*/)/*:Worksheet*/ { return {'!type':'macro'}; } +/* TODO: it will be useful to parse the function str */ +var rc_to_a1 = /*#__PURE__*/(function(){ + var rcregex = /(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g; + var rcbase/*:Cell*/ = ({r:0,c:0}/*:any*/); + function rcfunc($$,$1,$2,$3) { + var cRel = false, rRel = false; + + if($2.length == 0) rRel = true; + else if($2.charAt(0) == "[") { rRel = true; $2 = $2.slice(1, -1); } + + if($3.length == 0) cRel = true; + else if($3.charAt(0) == "[") { cRel = true; $3 = $3.slice(1, -1); } + + var R = $2.length>0?parseInt($2,10)|0:0, C = $3.length>0?parseInt($3,10)|0:0; + + if(cRel) C += rcbase.c; else --C; + if(rRel) R += rcbase.r; else --R; + return $1 + (cRel ? "" : "$") + encode_col(C) + (rRel ? "" : "$") + encode_row(R); + } + return function rc_to_a1(fstr/*:string*/, base/*:Cell*/)/*:string*/ { + rcbase = base; + return fstr.replace(rcregex, rcfunc); + }; +})(); + +var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g; +var a1_to_rc = /*#__PURE__*/(function(){ + return function a1_to_rc(fstr/*:string*/, base/*:CellAddress*/) { + return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) { + var c = decode_col($3) - ($2 ? 0 : base.c); + var r = decode_row($5) - ($4 ? 0 : base.r); + var R = $4 == "$" ? (r+1) : (r == 0 ? "" : "[" + r + "]"); + var C = $2 == "$" ? (c+1) : (c == 0 ? "" : "[" + c + "]"); + return $1 + "R" + R + "C" + C; + }); + }; +})(); + +/* no defined name can collide with a valid cell address A1:XFD1048576 ... except LOG10! */ +function shift_formula_str(f/*:string*/, delta/*:Cell*/)/*:string*/ { + return f.replace(crefregex, function($0, $1, $2, $3, $4, $5) { + return $1+($2=="$" ? $2+$3 : encode_col(decode_col($3)+delta.c))+($4=="$" ? $4+$5 : encode_row(decode_row($5) + delta.r)); + }); +} + +function shift_formula_xlsx(f/*:string*/, range/*:string*/, cell/*:string*/)/*:string*/ { + var r = decode_range(range), s = r.s, c = decode_cell(cell); + var delta = {r:c.r - s.r, c:c.c - s.c}; + return shift_formula_str(f, delta); +} + +/* TODO: parse formula */ +function fuzzyfmla(f/*:string*/)/*:boolean*/ { + if(f.length == 1) return false; + return true; +} + +function _xlfn(f/*:string*/)/*:string*/ { + return f.replace(/_xlfn\./g,""); +} +function parseread1(blob) { blob.l+=1; return; } + +/* [MS-XLS] 2.5.51 */ +function parse_ColRelU(blob, length) { + var c = blob.read_shift(length == 1 ? 1 : 2); + return [c & 0x3FFF, (c >> 14) & 1, (c >> 15) & 1]; +} + +/* [MS-XLS] 2.5.198.105 ; [MS-XLSB] 2.5.97.89 */ +function parse_RgceArea(blob, length, opts) { + var w = 2; + if(opts) { + if(opts.biff >= 2 && opts.biff <= 5) return parse_RgceArea_BIFF2(blob, length, opts); + else if(opts.biff == 12) w = 4; + } + var r=blob.read_shift(w), R=blob.read_shift(w); + var c=parse_ColRelU(blob, 2); + var C=parse_ColRelU(blob, 2); + return { s:{r:r, c:c[0], cRel:c[1], rRel:c[2]}, e:{r:R, c:C[0], cRel:C[1], rRel:C[2]} }; +} +/* BIFF 2-5 encodes flags in the row field */ +function parse_RgceArea_BIFF2(blob/*::, length, opts*/) { + var r=parse_ColRelU(blob, 2), R=parse_ColRelU(blob, 2); + var c=blob.read_shift(1); + var C=blob.read_shift(1); + return { s:{r:r[0], c:c, cRel:r[1], rRel:r[2]}, e:{r:R[0], c:C, cRel:R[1], rRel:R[2]} }; +} + +/* [MS-XLS] 2.5.198.105 ; [MS-XLSB] 2.5.97.90 */ +function parse_RgceAreaRel(blob, length, opts) { + if(opts.biff < 8) return parse_RgceArea_BIFF2(blob, length, opts); + var r=blob.read_shift(opts.biff == 12 ? 4 : 2), R=blob.read_shift(opts.biff == 12 ? 4 : 2); + var c=parse_ColRelU(blob, 2); + var C=parse_ColRelU(blob, 2); + return { s:{r:r, c:c[0], cRel:c[1], rRel:c[2]}, e:{r:R, c:C[0], cRel:C[1], rRel:C[2]} }; +} + +/* [MS-XLS] 2.5.198.109 ; [MS-XLSB] 2.5.97.91 */ +function parse_RgceLoc(blob, length, opts) { + if(opts && opts.biff >= 2 && opts.biff <= 5) return parse_RgceLoc_BIFF2(blob, length, opts); + var r = blob.read_shift(opts && opts.biff == 12 ? 4 : 2); + var c = parse_ColRelU(blob, 2); + return {r:r, c:c[0], cRel:c[1], rRel:c[2]}; +} +function parse_RgceLoc_BIFF2(blob/*::, length, opts*/) { + var r = parse_ColRelU(blob, 2); + var c = blob.read_shift(1); + return {r:r[0], c:c, cRel:r[1], rRel:r[2]}; +} + +/* [MS-XLS] 2.5.198.107, 2.5.47 */ +function parse_RgceElfLoc(blob/*::, length, opts*/) { + var r = blob.read_shift(2); + var c = blob.read_shift(2); + return {r:r, c:c & 0xFF, fQuoted:!!(c & 0x4000), cRel:c>>15, rRel:c>>15 }; +} + +/* [MS-XLS] 2.5.198.111 ; [MS-XLSB] 2.5.97.92 TODO */ +function parse_RgceLocRel(blob, length, opts) { + var biff = opts && opts.biff ? opts.biff : 8; + if(biff >= 2 && biff <= 5) return parse_RgceLocRel_BIFF2(blob, length, opts); + var r = blob.read_shift(biff >= 12 ? 4 : 2); + var cl = blob.read_shift(2); + var cRel = (cl & 0x4000) >> 14, rRel = (cl & 0x8000) >> 15; + cl &= 0x3FFF; + if(rRel == 1) while(r > 0x7FFFF) r -= 0x100000; + if(cRel == 1) while(cl > 0x1FFF) cl = cl - 0x4000; + return {r:r,c:cl,cRel:cRel,rRel:rRel}; +} +function parse_RgceLocRel_BIFF2(blob/*::, length:number, opts*/) { + var rl = blob.read_shift(2); + var c = blob.read_shift(1); + var rRel = (rl & 0x8000) >> 15, cRel = (rl & 0x4000) >> 14; + rl &= 0x3FFF; + if(rRel == 1 && rl >= 0x2000) rl = rl - 0x4000; + if(cRel == 1 && c >= 0x80) c = c - 0x100; + return {r:rl,c:c,cRel:cRel,rRel:rRel}; +} + +/* [MS-XLS] 2.5.198.27 ; [MS-XLSB] 2.5.97.18 */ +function parse_PtgArea(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts); + return [type, area]; +} + +/* [MS-XLS] 2.5.198.28 ; [MS-XLSB] 2.5.97.19 */ +function parse_PtgArea3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2, 'i'); + var w = 8; + if(opts) switch(opts.biff) { + case 5: blob.l += 12; w = 6; break; + case 12: w = 12; break; + } + var area = parse_RgceArea(blob, w, opts); + return [type, ixti, area]; +} + +/* [MS-XLS] 2.5.198.29 ; [MS-XLSB] 2.5.97.20 */ +function parse_PtgAreaErr(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + blob.l += opts && (opts.biff > 8) ? 12 : (opts.biff < 8 ? 6 : 8); + return [type]; +} +/* [MS-XLS] 2.5.198.30 ; [MS-XLSB] 2.5.97.21 */ +function parse_PtgAreaErr3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2); + var w = 8; + if(opts) switch(opts.biff) { + case 5: blob.l += 12; w = 6; break; + case 12: w = 12; break; + } + blob.l += w; + return [type, ixti]; +} + +/* [MS-XLS] 2.5.198.31 ; [MS-XLSB] 2.5.97.22 */ +function parse_PtgAreaN(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var area = parse_RgceAreaRel(blob, length - 1, opts); + return [type, area]; +} + +/* [MS-XLS] 2.5.198.32 ; [MS-XLSB] 2.5.97.23 */ +function parse_PtgArray(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + blob.l += opts.biff == 2 ? 6 : opts.biff == 12 ? 14 : 7; + return [type]; +} + +/* [MS-XLS] 2.5.198.33 ; [MS-XLSB] 2.5.97.24 */ +function parse_PtgAttrBaxcel(blob) { + var bitSemi = blob[blob.l+1] & 0x01; /* 1 = volatile */ + var bitBaxcel = 1; + blob.l += 4; + return [bitSemi, bitBaxcel]; +} + +/* [MS-XLS] 2.5.198.34 ; [MS-XLSB] 2.5.97.25 */ +function parse_PtgAttrChoose(blob, length, opts)/*:Array*/ { + blob.l +=2; + var offset = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + var o/*:Array*/ = []; + /* offset is 1 less than the number of elements */ + for(var i = 0; i <= offset; ++i) o.push(blob.read_shift(opts && opts.biff == 2 ? 1 : 2)); + return o; +} + +/* [MS-XLS] 2.5.198.35 ; [MS-XLSB] 2.5.97.26 */ +function parse_PtgAttrGoto(blob, length, opts) { + var bitGoto = (blob[blob.l+1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitGoto, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)]; +} + +/* [MS-XLS] 2.5.198.36 ; [MS-XLSB] 2.5.97.27 */ +function parse_PtgAttrIf(blob, length, opts) { + var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitIf, blob.read_shift(opts && opts.biff == 2 ? 1 : 2)]; +} + +/* [MS-XLSB] 2.5.97.28 */ +function parse_PtgAttrIfError(blob) { + var bitIf = (blob[blob.l+1] & 0xFF) ? 1 : 0; + blob.l += 2; + return [bitIf, blob.read_shift(2)]; +} + +/* [MS-XLS] 2.5.198.37 ; [MS-XLSB] 2.5.97.29 */ +function parse_PtgAttrSemi(blob, length, opts) { + var bitSemi = (blob[blob.l+1] & 0xFF) ? 1 : 0; + blob.l += opts && opts.biff == 2 ? 3 : 4; + return [bitSemi]; +} + +/* [MS-XLS] 2.5.198.40 ; [MS-XLSB] 2.5.97.32 */ +function parse_PtgAttrSpaceType(blob/*::, length*/) { + var type = blob.read_shift(1), cch = blob.read_shift(1); + return [type, cch]; +} + +/* [MS-XLS] 2.5.198.38 ; [MS-XLSB] 2.5.97.30 */ +function parse_PtgAttrSpace(blob) { + blob.read_shift(2); + return parse_PtgAttrSpaceType(blob, 2); +} + +/* [MS-XLS] 2.5.198.39 ; [MS-XLSB] 2.5.97.31 */ +function parse_PtgAttrSpaceSemi(blob) { + blob.read_shift(2); + return parse_PtgAttrSpaceType(blob, 2); +} + +/* [MS-XLS] 2.5.198.84 ; [MS-XLSB] 2.5.97.68 TODO */ +function parse_PtgRef(blob, length, opts) { + //var ptg = blob[blob.l] & 0x1F; + var type = (blob[blob.l] & 0x60)>>5; + blob.l += 1; + var loc = parse_RgceLoc(blob, 0, opts); + return [type, loc]; +} + +/* [MS-XLS] 2.5.198.88 ; [MS-XLSB] 2.5.97.72 TODO */ +function parse_PtgRefN(blob, length, opts) { + var type = (blob[blob.l] & 0x60)>>5; + blob.l += 1; + var loc = parse_RgceLocRel(blob, 0, opts); + return [type, loc]; +} + +/* [MS-XLS] 2.5.198.85 ; [MS-XLSB] 2.5.97.69 TODO */ +function parse_PtgRef3d(blob, length, opts) { + var type = (blob[blob.l] & 0x60)>>5; + blob.l += 1; + var ixti = blob.read_shift(2); // XtiIndex + if(opts && opts.biff == 5) blob.l += 12; + var loc = parse_RgceLoc(blob, 0, opts); // TODO: or RgceLocRel + return [type, ixti, loc]; +} + + +/* [MS-XLS] 2.5.198.62 ; [MS-XLSB] 2.5.97.45 TODO */ +function parse_PtgFunc(blob, length, opts) { + //var ptg = blob[blob.l] & 0x1F; + var type = (blob[blob.l] & 0x60)>>5; + blob.l += 1; + var iftab = blob.read_shift(opts && opts.biff <= 3 ? 1 : 2); + return [FtabArgc[iftab], Ftab[iftab], type]; +} +/* [MS-XLS] 2.5.198.63 ; [MS-XLSB] 2.5.97.46 TODO */ +function parse_PtgFuncVar(blob, length, opts) { + var type = blob[blob.l++]; + var cparams = blob.read_shift(1), tab = opts && opts.biff <= 3 ? [(type == 0x58 ? -1 : 0), blob.read_shift(1)]: parsetab(blob); + return [cparams, (tab[0] === 0 ? Ftab : Cetab)[tab[1]]]; +} + +function parsetab(blob) { + return [blob[blob.l+1]>>7, blob.read_shift(2) & 0x7FFF]; +} + +/* [MS-XLS] 2.5.198.41 ; [MS-XLSB] 2.5.97.33 */ +function parse_PtgAttrSum(blob, length, opts) { + blob.l += opts && opts.biff == 2 ? 3 : 4; return; +} + +/* [MS-XLS] 2.5.198.58 ; [MS-XLSB] 2.5.97.40 */ +function parse_PtgExp(blob, length, opts) { + blob.l++; + if(opts && opts.biff == 12) return [blob.read_shift(4, 'i'), 0]; + var row = blob.read_shift(2); + var col = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [row, col]; +} + +/* [MS-XLS] 2.5.198.57 ; [MS-XLSB] 2.5.97.39 */ +function parse_PtgErr(blob) { blob.l++; return BErr[blob.read_shift(1)]; } + +/* [MS-XLS] 2.5.198.66 ; [MS-XLSB] 2.5.97.49 */ +function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); } + +/* [MS-XLS] 2.5.198.42 ; [MS-XLSB] 2.5.97.34 */ +function parse_PtgBool(blob) { blob.l++; return blob.read_shift(1)!==0;} + +/* [MS-XLS] 2.5.198.79 ; [MS-XLSB] 2.5.97.63 */ +function parse_PtgNum(blob) { blob.l++; return parse_Xnum(blob, 8); } + +/* [MS-XLS] 2.5.198.89 ; [MS-XLSB] 2.5.97.74 */ +function parse_PtgStr(blob, length, opts) { blob.l++; return parse_ShortXLUnicodeString(blob, length-1, opts); } + +/* [MS-XLS] 2.5.192.112 + 2.5.192.11{3,4,5,6,7} */ +/* [MS-XLSB] 2.5.97.93 + 2.5.97.9{4,5,6,7} */ +function parse_SerAr(blob, biff/*:number*/) { + var val = [blob.read_shift(1)]; + if(biff == 12) switch(val[0]) { + case 0x02: val[0] = 0x04; break; /* SerBool */ + case 0x04: val[0] = 0x10; break; /* SerErr */ + case 0x00: val[0] = 0x01; break; /* SerNum */ + case 0x01: val[0] = 0x02; break; /* SerStr */ + } + switch(val[0]) { + case 0x04: /* SerBool -- boolean */ + val[1] = parsebool(blob, 1) ? 'TRUE' : 'FALSE'; + if(biff != 12) blob.l += 7; break; + case 0x25: /* appears to be an alias */ + case 0x10: /* SerErr -- error */ + val[1] = BErr[blob[blob.l]]; + blob.l += ((biff == 12) ? 4 : 8); break; + case 0x00: /* SerNil -- honestly, I'm not sure how to reproduce this */ + blob.l += 8; break; + case 0x01: /* SerNum -- Xnum */ + val[1] = parse_Xnum(blob, 8); break; + case 0x02: /* SerStr -- XLUnicodeString (<256 chars) */ + val[1] = parse_XLUnicodeString2(blob, 0, {biff:biff > 0 && biff < 8 ? 2 : biff}); break; + default: throw new Error("Bad SerAr: " + val[0]); /* Unreachable */ + } + return val; +} + +/* [MS-XLS] 2.5.198.61 ; [MS-XLSB] 2.5.97.44 */ +function parse_PtgExtraMem(blob, cce, opts) { + var count = blob.read_shift((opts.biff == 12) ? 4 : 2); + var out/*:Array*/ = []; + for(var i = 0; i != count; ++i) out.push(((opts.biff == 12) ? parse_UncheckedRfX : parse_Ref8U)(blob, 8)); + return out; +} + +/* [MS-XLS] 2.5.198.59 ; [MS-XLSB] 2.5.97.41 */ +function parse_PtgExtraArray(blob, length, opts) { + var rows = 0, cols = 0; + if(opts.biff == 12) { + rows = blob.read_shift(4); // DRw + cols = blob.read_shift(4); // DCol + } else { + cols = 1 + blob.read_shift(1); //DColByteU + rows = 1 + blob.read_shift(2); //DRw + } + if(opts.biff >= 2 && opts.biff < 8) { --rows; if(--cols == 0) cols = 0x100; } + // $FlowIgnore + for(var i = 0, o/*:Array>*/ = []; i != rows && (o[i] = []); ++i) + for(var j = 0; j != cols; ++j) o[i][j] = parse_SerAr(blob, opts.biff); + return o; +} + +/* [MS-XLS] 2.5.198.76 ; [MS-XLSB] 2.5.97.60 */ +function parse_PtgName(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var w = (!opts || (opts.biff >= 8)) ? 4 : 2; + var nameindex = blob.read_shift(w); + switch(opts.biff) { + case 2: blob.l += 5; break; + case 3: case 4: blob.l += 8; break; + case 5: blob.l += 12; break; + } + return [type, 0, nameindex]; +} + +/* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 */ +function parse_PtgNameX(blob, length, opts) { + if(opts.biff == 5) return parse_PtgNameX_BIFF5(blob, length, opts); + var type = (blob.read_shift(1) >>> 5) & 0x03; + var ixti = blob.read_shift(2); // XtiIndex + var nameindex = blob.read_shift(4); + return [type, ixti, nameindex]; +} +function parse_PtgNameX_BIFF5(blob/*::, length, opts*/) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var ixti = blob.read_shift(2, 'i'); // XtiIndex + blob.l += 8; + var nameindex = blob.read_shift(2); + blob.l += 12; + return [type, ixti, nameindex]; +} + +/* [MS-XLS] 2.5.198.70 ; [MS-XLSB] 2.5.97.54 */ +function parse_PtgMemArea(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + blob.l += (opts && opts.biff == 2 ? 3 : 4); + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [type, cce]; +} + +/* [MS-XLS] 2.5.198.72 ; [MS-XLSB] 2.5.97.56 */ +function parse_PtgMemFunc(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(opts && opts.biff == 2 ? 1 : 2); + return [type, cce]; +} + + +/* [MS-XLS] 2.5.198.86 ; [MS-XLSB] 2.5.97.69 */ +function parse_PtgRefErr(blob, length, opts) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + blob.l += 4; + if(opts.biff < 8) blob.l--; + if(opts.biff == 12) blob.l += 2; + return [type]; +} + +/* [MS-XLS] 2.5.198.87 ; [MS-XLSB] 2.5.97.71 */ +function parse_PtgRefErr3d(blob, length, opts) { + var type = (blob[blob.l++] & 0x60) >> 5; + var ixti = blob.read_shift(2); + var w = 4; + if(opts) switch(opts.biff) { + case 5: w = 15; break; + case 12: w = 6; break; + } + blob.l += w; + return [type, ixti]; +} + +/* [MS-XLS] 2.5.198.71 ; [MS-XLSB] 2.5.97.55 */ +var parse_PtgMemErr = parsenoop; +/* [MS-XLS] 2.5.198.73 ; [MS-XLSB] 2.5.97.57 */ +var parse_PtgMemNoMem = parsenoop; +/* [MS-XLS] 2.5.198.92 */ +var parse_PtgTbl = parsenoop; + +function parse_PtgElfLoc(blob, length, opts) { + blob.l += 2; + return [parse_RgceElfLoc(blob, 4, opts)]; +} +function parse_PtgElfNoop(blob/*::, length, opts*/) { + blob.l += 6; + return []; +} +/* [MS-XLS] 2.5.198.46 */ +var parse_PtgElfCol = parse_PtgElfLoc; +/* [MS-XLS] 2.5.198.47 */ +var parse_PtgElfColS = parse_PtgElfNoop; +/* [MS-XLS] 2.5.198.48 */ +var parse_PtgElfColSV = parse_PtgElfNoop; +/* [MS-XLS] 2.5.198.49 */ +var parse_PtgElfColV = parse_PtgElfLoc; +/* [MS-XLS] 2.5.198.50 */ +function parse_PtgElfLel(blob/*::, length, opts*/) { + blob.l += 2; + return [parseuint16(blob), blob.read_shift(2) & 0x01]; +} +/* [MS-XLS] 2.5.198.51 */ +var parse_PtgElfRadical = parse_PtgElfLoc; +/* [MS-XLS] 2.5.198.52 */ +var parse_PtgElfRadicalLel = parse_PtgElfLel; +/* [MS-XLS] 2.5.198.53 */ +var parse_PtgElfRadicalS = parse_PtgElfNoop; +/* [MS-XLS] 2.5.198.54 */ +var parse_PtgElfRw = parse_PtgElfLoc; +/* [MS-XLS] 2.5.198.55 */ +var parse_PtgElfRwV = parse_PtgElfLoc; + +/* [MS-XLSB] 2.5.97.52 TODO */ +var PtgListRT = [ + "Data", + "All", + "Headers", + "??", + "?Data2", + "??", + "?DataHeaders", + "??", + "Totals", + "??", + "??", + "??", + "?DataTotals", + "??", + "??", + "??", + "?Current" +]; +function parse_PtgList(blob/*::, length, opts*/) { + blob.l += 2; + var ixti = blob.read_shift(2); + var flags = blob.read_shift(2); + var idx = blob.read_shift(4); + var c = blob.read_shift(2); + var C = blob.read_shift(2); + var rt = PtgListRT[(flags >> 2) & 0x1F]; + return {ixti: ixti, coltype:(flags&0x3), rt:rt, idx:idx, c:c, C:C}; +} +/* [MS-XLS] 2.5.198.91 ; [MS-XLSB] 2.5.97.76 */ +function parse_PtgSxName(blob/*::, length, opts*/) { + blob.l += 2; + return [blob.read_shift(4)]; +} + +/* [XLS] old spec */ +function parse_PtgSheet(blob, length, opts) { + blob.l += 5; + blob.l += 2; + blob.l += (opts.biff == 2 ? 1 : 4); + return ["PTGSHEET"]; +} +function parse_PtgEndSheet(blob, length, opts) { + blob.l += (opts.biff == 2 ? 4 : 5); + return ["PTGENDSHEET"]; +} +function parse_PtgMemAreaN(blob/*::, length, opts*/) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(2); + return [type, cce]; +} +function parse_PtgMemNoMemN(blob/*::, length, opts*/) { + var type = (blob.read_shift(1) >>> 5) & 0x03; + var cce = blob.read_shift(2); + return [type, cce]; +} +function parse_PtgAttrNoop(blob/*::, length, opts*/) { + blob.l += 4; + return [0, 0]; +} + +/* [MS-XLS] 2.5.198.25 ; [MS-XLSB] 2.5.97.16 */ +var PtgTypes = { + /*::[*/0x01/*::]*/: { n:'PtgExp', f:parse_PtgExp }, + /*::[*/0x02/*::]*/: { n:'PtgTbl', f:parse_PtgTbl }, + /*::[*/0x03/*::]*/: { n:'PtgAdd', f:parseread1 }, + /*::[*/0x04/*::]*/: { n:'PtgSub', f:parseread1 }, + /*::[*/0x05/*::]*/: { n:'PtgMul', f:parseread1 }, + /*::[*/0x06/*::]*/: { n:'PtgDiv', f:parseread1 }, + /*::[*/0x07/*::]*/: { n:'PtgPower', f:parseread1 }, + /*::[*/0x08/*::]*/: { n:'PtgConcat', f:parseread1 }, + /*::[*/0x09/*::]*/: { n:'PtgLt', f:parseread1 }, + /*::[*/0x0A/*::]*/: { n:'PtgLe', f:parseread1 }, + /*::[*/0x0B/*::]*/: { n:'PtgEq', f:parseread1 }, + /*::[*/0x0C/*::]*/: { n:'PtgGe', f:parseread1 }, + /*::[*/0x0D/*::]*/: { n:'PtgGt', f:parseread1 }, + /*::[*/0x0E/*::]*/: { n:'PtgNe', f:parseread1 }, + /*::[*/0x0F/*::]*/: { n:'PtgIsect', f:parseread1 }, + /*::[*/0x10/*::]*/: { n:'PtgUnion', f:parseread1 }, + /*::[*/0x11/*::]*/: { n:'PtgRange', f:parseread1 }, + /*::[*/0x12/*::]*/: { n:'PtgUplus', f:parseread1 }, + /*::[*/0x13/*::]*/: { n:'PtgUminus', f:parseread1 }, + /*::[*/0x14/*::]*/: { n:'PtgPercent', f:parseread1 }, + /*::[*/0x15/*::]*/: { n:'PtgParen', f:parseread1 }, + /*::[*/0x16/*::]*/: { n:'PtgMissArg', f:parseread1 }, + /*::[*/0x17/*::]*/: { n:'PtgStr', f:parse_PtgStr }, + /*::[*/0x1A/*::]*/: { n:'PtgSheet', f:parse_PtgSheet }, + /*::[*/0x1B/*::]*/: { n:'PtgEndSheet', f:parse_PtgEndSheet }, + /*::[*/0x1C/*::]*/: { n:'PtgErr', f:parse_PtgErr }, + /*::[*/0x1D/*::]*/: { n:'PtgBool', f:parse_PtgBool }, + /*::[*/0x1E/*::]*/: { n:'PtgInt', f:parse_PtgInt }, + /*::[*/0x1F/*::]*/: { n:'PtgNum', f:parse_PtgNum }, + /*::[*/0x20/*::]*/: { n:'PtgArray', f:parse_PtgArray }, + /*::[*/0x21/*::]*/: { n:'PtgFunc', f:parse_PtgFunc }, + /*::[*/0x22/*::]*/: { n:'PtgFuncVar', f:parse_PtgFuncVar }, + /*::[*/0x23/*::]*/: { n:'PtgName', f:parse_PtgName }, + /*::[*/0x24/*::]*/: { n:'PtgRef', f:parse_PtgRef }, + /*::[*/0x25/*::]*/: { n:'PtgArea', f:parse_PtgArea }, + /*::[*/0x26/*::]*/: { n:'PtgMemArea', f:parse_PtgMemArea }, + /*::[*/0x27/*::]*/: { n:'PtgMemErr', f:parse_PtgMemErr }, + /*::[*/0x28/*::]*/: { n:'PtgMemNoMem', f:parse_PtgMemNoMem }, + /*::[*/0x29/*::]*/: { n:'PtgMemFunc', f:parse_PtgMemFunc }, + /*::[*/0x2A/*::]*/: { n:'PtgRefErr', f:parse_PtgRefErr }, + /*::[*/0x2B/*::]*/: { n:'PtgAreaErr', f:parse_PtgAreaErr }, + /*::[*/0x2C/*::]*/: { n:'PtgRefN', f:parse_PtgRefN }, + /*::[*/0x2D/*::]*/: { n:'PtgAreaN', f:parse_PtgAreaN }, + /*::[*/0x2E/*::]*/: { n:'PtgMemAreaN', f:parse_PtgMemAreaN }, + /*::[*/0x2F/*::]*/: { n:'PtgMemNoMemN', f:parse_PtgMemNoMemN }, + /*::[*/0x39/*::]*/: { n:'PtgNameX', f:parse_PtgNameX }, + /*::[*/0x3A/*::]*/: { n:'PtgRef3d', f:parse_PtgRef3d }, + /*::[*/0x3B/*::]*/: { n:'PtgArea3d', f:parse_PtgArea3d }, + /*::[*/0x3C/*::]*/: { n:'PtgRefErr3d', f:parse_PtgRefErr3d }, + /*::[*/0x3D/*::]*/: { n:'PtgAreaErr3d', f:parse_PtgAreaErr3d }, + /*::[*/0xFF/*::]*/: {} +}; +/* These are duplicated in the PtgTypes table */ +var PtgDupes = { + /*::[*/0x40/*::]*/: 0x20, /*::[*/0x60/*::]*/: 0x20, + /*::[*/0x41/*::]*/: 0x21, /*::[*/0x61/*::]*/: 0x21, + /*::[*/0x42/*::]*/: 0x22, /*::[*/0x62/*::]*/: 0x22, + /*::[*/0x43/*::]*/: 0x23, /*::[*/0x63/*::]*/: 0x23, + /*::[*/0x44/*::]*/: 0x24, /*::[*/0x64/*::]*/: 0x24, + /*::[*/0x45/*::]*/: 0x25, /*::[*/0x65/*::]*/: 0x25, + /*::[*/0x46/*::]*/: 0x26, /*::[*/0x66/*::]*/: 0x26, + /*::[*/0x47/*::]*/: 0x27, /*::[*/0x67/*::]*/: 0x27, + /*::[*/0x48/*::]*/: 0x28, /*::[*/0x68/*::]*/: 0x28, + /*::[*/0x49/*::]*/: 0x29, /*::[*/0x69/*::]*/: 0x29, + /*::[*/0x4A/*::]*/: 0x2A, /*::[*/0x6A/*::]*/: 0x2A, + /*::[*/0x4B/*::]*/: 0x2B, /*::[*/0x6B/*::]*/: 0x2B, + /*::[*/0x4C/*::]*/: 0x2C, /*::[*/0x6C/*::]*/: 0x2C, + /*::[*/0x4D/*::]*/: 0x2D, /*::[*/0x6D/*::]*/: 0x2D, + /*::[*/0x4E/*::]*/: 0x2E, /*::[*/0x6E/*::]*/: 0x2E, + /*::[*/0x4F/*::]*/: 0x2F, /*::[*/0x6F/*::]*/: 0x2F, + /*::[*/0x58/*::]*/: 0x22, /*::[*/0x78/*::]*/: 0x22, + /*::[*/0x59/*::]*/: 0x39, /*::[*/0x79/*::]*/: 0x39, + /*::[*/0x5A/*::]*/: 0x3A, /*::[*/0x7A/*::]*/: 0x3A, + /*::[*/0x5B/*::]*/: 0x3B, /*::[*/0x7B/*::]*/: 0x3B, + /*::[*/0x5C/*::]*/: 0x3C, /*::[*/0x7C/*::]*/: 0x3C, + /*::[*/0x5D/*::]*/: 0x3D, /*::[*/0x7D/*::]*/: 0x3D +}; + +var Ptg18 = { + /*::[*/0x01/*::]*/: { n:'PtgElfLel', f:parse_PtgElfLel }, + /*::[*/0x02/*::]*/: { n:'PtgElfRw', f:parse_PtgElfRw }, + /*::[*/0x03/*::]*/: { n:'PtgElfCol', f:parse_PtgElfCol }, + /*::[*/0x06/*::]*/: { n:'PtgElfRwV', f:parse_PtgElfRwV }, + /*::[*/0x07/*::]*/: { n:'PtgElfColV', f:parse_PtgElfColV }, + /*::[*/0x0A/*::]*/: { n:'PtgElfRadical', f:parse_PtgElfRadical }, + /*::[*/0x0B/*::]*/: { n:'PtgElfRadicalS', f:parse_PtgElfRadicalS }, + /*::[*/0x0D/*::]*/: { n:'PtgElfColS', f:parse_PtgElfColS }, + /*::[*/0x0F/*::]*/: { n:'PtgElfColSV', f:parse_PtgElfColSV }, + /*::[*/0x10/*::]*/: { n:'PtgElfRadicalLel', f:parse_PtgElfRadicalLel }, + /*::[*/0x19/*::]*/: { n:'PtgList', f:parse_PtgList }, + /*::[*/0x1D/*::]*/: { n:'PtgSxName', f:parse_PtgSxName }, + /*::[*/0xFF/*::]*/: {} +}; +var Ptg19 = { + /*::[*/0x00/*::]*/: { n:'PtgAttrNoop', f:parse_PtgAttrNoop }, + /*::[*/0x01/*::]*/: { n:'PtgAttrSemi', f:parse_PtgAttrSemi }, + /*::[*/0x02/*::]*/: { n:'PtgAttrIf', f:parse_PtgAttrIf }, + /*::[*/0x04/*::]*/: { n:'PtgAttrChoose', f:parse_PtgAttrChoose }, + /*::[*/0x08/*::]*/: { n:'PtgAttrGoto', f:parse_PtgAttrGoto }, + /*::[*/0x10/*::]*/: { n:'PtgAttrSum', f:parse_PtgAttrSum }, + /*::[*/0x20/*::]*/: { n:'PtgAttrBaxcel', f:parse_PtgAttrBaxcel }, + /*::[*/0x21/*::]*/: { n:'PtgAttrBaxcel', f:parse_PtgAttrBaxcel }, + /*::[*/0x40/*::]*/: { n:'PtgAttrSpace', f:parse_PtgAttrSpace }, + /*::[*/0x41/*::]*/: { n:'PtgAttrSpaceSemi', f:parse_PtgAttrSpaceSemi }, + /*::[*/0x80/*::]*/: { n:'PtgAttrIfError', f:parse_PtgAttrIfError }, + /*::[*/0xFF/*::]*/: {} +}; + +/* [MS-XLS] 2.5.198.103 ; [MS-XLSB] 2.5.97.87 */ +function parse_RgbExtra(blob, length, rgce, opts) { + if(opts.biff < 8) return parsenoop(blob, length); + var target = blob.l + length; + var o = []; + for(var i = 0; i !== rgce.length; ++i) { + switch(rgce[i][0]) { + case 'PtgArray': /* PtgArray -> PtgExtraArray */ + rgce[i][1] = parse_PtgExtraArray(blob, 0, opts); + o.push(rgce[i][1]); + break; + case 'PtgMemArea': /* PtgMemArea -> PtgExtraMem */ + rgce[i][2] = parse_PtgExtraMem(blob, rgce[i][1], opts); + o.push(rgce[i][2]); + break; + case 'PtgExp': /* PtgExp -> PtgExtraCol */ + if(opts && opts.biff == 12) { + rgce[i][1][1] = blob.read_shift(4); + o.push(rgce[i][1]); + } break; + case 'PtgList': /* TODO: PtgList -> PtgExtraList */ + case 'PtgElfRadicalS': /* TODO: PtgElfRadicalS -> PtgExtraElf */ + case 'PtgElfColS': /* TODO: PtgElfColS -> PtgExtraElf */ + case 'PtgElfColSV': /* TODO: PtgElfColSV -> PtgExtraElf */ + throw "Unsupported " + rgce[i][0]; + default: break; + } + } + length = target - blob.l; + /* note: this is technically an error but Excel disregards */ + //if(target !== blob.l && blob.l !== target - length) throw new Error(target + " != " + blob.l); + if(length !== 0) o.push(parsenoop(blob, length)); + return o; +} + +/* [MS-XLS] 2.5.198.104 ; [MS-XLSB] 2.5.97.88 */ +function parse_Rgce(blob, length, opts) { + var target = blob.l + length; + var R, id, ptgs = []; + while(target != blob.l) { + length = target - blob.l; + id = blob[blob.l]; + R = PtgTypes[id] || PtgTypes[PtgDupes[id]]; + if(id === 0x18 || id === 0x19) R = (id === 0x18 ? Ptg18 : Ptg19)[blob[blob.l + 1]]; + if(!R || !R.f) { /*ptgs.push*/(parsenoop(blob, length)); } + else { ptgs.push([R.n, R.f(blob, length, opts)]); } + } + return ptgs; +} + +function stringify_array(f/*:Array>*/)/*:string*/ { + var o/*:Array*/ = []; + for(var i = 0; i < f.length; ++i) { + var x = f[i], r/*:Array*/ = []; + for(var j = 0; j < x.length; ++j) { + var y = x[j]; + if(y) switch(y[0]) { + // TODO: handle embedded quotes + case 0x02: + /*:: if(typeof y[1] != 'string') throw "unreachable"; */ + r.push('"' + y[1].replace(/"/g,'""') + '"'); break; + default: r.push(y[1]); + } else r.push(""); + } + o.push(r.join(",")); + } + return o.join(";"); +} + +/* [MS-XLS] 2.2.2 ; [MS-XLSB] 2.2.2 TODO */ +var PtgBinOp = { + PtgAdd: "+", + PtgConcat: "&", + PtgDiv: "/", + PtgEq: "=", + PtgGe: ">=", + PtgGt: ">", + PtgLe: "<=", + PtgLt: "<", + PtgMul: "*", + PtgNe: "<>", + PtgPower: "^", + PtgSub: "-" +}; + +// TODO: explore space +function make_3d_range(start, end) { + var s = start.lastIndexOf("!"), e = end.lastIndexOf("!"); + if(s == -1 && e == -1) return start + ":" + end; + if(s > 0 && e > 0 && start.slice(0, s).toLowerCase() == end.slice(0, e).toLowerCase()) return start + ":" + end.slice(e+1); + console.error("Cannot hydrate range", start, end); + return start + ":" + end; +} + +function get_ixti_raw(supbooks, ixti/*:number*/, opts)/*:string*/ { + if(!supbooks) return "SH33TJSERR0"; + if(opts.biff > 8 && (!supbooks.XTI || !supbooks.XTI[ixti])) return supbooks.SheetNames[ixti]; + if(!supbooks.XTI) return "SH33TJSERR6"; + var XTI = supbooks.XTI[ixti]; + if(opts.biff < 8) { + if(ixti > 10000) ixti-= 65536; + if(ixti < 0) ixti = -ixti; + return ixti == 0 ? "" : supbooks.XTI[ixti - 1]; + } + if(!XTI) return "SH33TJSERR1"; + var o = ""; + if(opts.biff > 8) switch(supbooks[XTI[0]][0]) { + case 0x0165: /* 'BrtSupSelf' */ + o = XTI[1] == -1 ? "#REF" : supbooks.SheetNames[XTI[1]]; + return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]]; + case 0x0166: /* 'BrtSupSame' */ + if(opts.SID != null) return supbooks.SheetNames[opts.SID]; + return "SH33TJSSAME" + supbooks[XTI[0]][0]; + case 0x0163: /* 'BrtSupBookSrc' */ + /* falls through */ + default: return "SH33TJSSRC" + supbooks[XTI[0]][0]; + } + switch(supbooks[XTI[0]][0][0]) { + case 0x0401: + o = XTI[1] == -1 ? "#REF" : (supbooks.SheetNames[XTI[1]] || "SH33TJSERR3"); + return XTI[1] == XTI[2] ? o : o + ":" + supbooks.SheetNames[XTI[2]]; + case 0x3A01: return supbooks[XTI[0]].slice(1).map(function(name) { return name.Name; }).join(";;"); //return "SH33TJSERR8"; + default: + if(!supbooks[XTI[0]][0][3]) return "SH33TJSERR2"; + o = XTI[1] == -1 ? "#REF" : (supbooks[XTI[0]][0][3][XTI[1]] || "SH33TJSERR4"); + return XTI[1] == XTI[2] ? o : o + ":" + supbooks[XTI[0]][0][3][XTI[2]]; + } +} +function get_ixti(supbooks, ixti/*:number*/, opts)/*:string*/ { + var ixtiraw = get_ixti_raw(supbooks, ixti, opts); + return ixtiraw == "#REF" ? ixtiraw : formula_quote_sheet_name(ixtiraw, opts); +} +function stringify_formula(formula/*Array*/, range, cell/*:any*/, supbooks, opts)/*:string*/ { + var biff = (opts && opts.biff) || 8; + var _range = /*range != null ? range :*/ {s:{c:0, r:0},e:{c:0, r:0}}; + var stack/*:Array*/ = [], e1, e2, /*::type,*/ c/*:CellAddress*/, ixti=0, nameidx=0, r, sname=""; + if(!formula[0] || !formula[0][0]) return ""; + var last_sp = -1, sp = ""; + for(var ff = 0, fflen = formula[0].length; ff < fflen; ++ff) { + var f = formula[0][ff]; + switch(f[0]) { + case 'PtgUminus': /* [MS-XLS] 2.5.198.93 */ + stack.push("-" + stack.pop()); break; + case 'PtgUplus': /* [MS-XLS] 2.5.198.95 */ + stack.push("+" + stack.pop()); break; + case 'PtgPercent': /* [MS-XLS] 2.5.198.81 */ + stack.push(stack.pop() + "%"); break; + + case 'PtgAdd': /* [MS-XLS] 2.5.198.26 */ + case 'PtgConcat': /* [MS-XLS] 2.5.198.43 */ + case 'PtgDiv': /* [MS-XLS] 2.5.198.45 */ + case 'PtgEq': /* [MS-XLS] 2.5.198.56 */ + case 'PtgGe': /* [MS-XLS] 2.5.198.64 */ + case 'PtgGt': /* [MS-XLS] 2.5.198.65 */ + case 'PtgLe': /* [MS-XLS] 2.5.198.68 */ + case 'PtgLt': /* [MS-XLS] 2.5.198.69 */ + case 'PtgMul': /* [MS-XLS] 2.5.198.75 */ + case 'PtgNe': /* [MS-XLS] 2.5.198.78 */ + case 'PtgPower': /* [MS-XLS] 2.5.198.82 */ + case 'PtgSub': /* [MS-XLS] 2.5.198.90 */ + e1 = stack.pop(); e2 = stack.pop(); + if(last_sp >= 0) { + switch(formula[0][last_sp][1][0]) { + case 0: + // $FlowIgnore + sp = fill(" ", formula[0][last_sp][1][1]); break; + case 1: + // $FlowIgnore + sp = fill("\r", formula[0][last_sp][1][1]); break; + default: + sp = ""; + // $FlowIgnore + if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]); + } + e2 = e2 + sp; + last_sp = -1; + } + stack.push(e2+PtgBinOp[f[0]]+e1); + break; + + case 'PtgIsect': /* [MS-XLS] 2.5.198.67 */ + e1 = stack.pop(); e2 = stack.pop(); + stack.push(e2+" "+e1); + break; + case 'PtgUnion': /* [MS-XLS] 2.5.198.94 */ + e1 = stack.pop(); e2 = stack.pop(); + stack.push(e2+","+e1); + break; + case 'PtgRange': /* [MS-XLS] 2.5.198.83 */ + e1 = stack.pop(); e2 = stack.pop(); + stack.push(make_3d_range(e2,e1)); + break; + + case 'PtgAttrChoose': /* [MS-XLS] 2.5.198.34 */ + break; + case 'PtgAttrGoto': /* [MS-XLS] 2.5.198.35 */ + break; + case 'PtgAttrIf': /* [MS-XLS] 2.5.198.36 */ + break; + case 'PtgAttrIfError': /* [MS-XLSB] 2.5.97.28 */ + break; + + + case 'PtgRef': /* [MS-XLS] 2.5.198.84 */ + /*::type = f[1][0]; */c = shift_cell_xls((f[1][1]/*:any*/), _range, opts); + stack.push(encode_cell_xls(c, biff)); + break; + case 'PtgRefN': /* [MS-XLS] 2.5.198.88 */ + /*::type = f[1][0]; */c = cell ? shift_cell_xls((f[1][1]/*:any*/), cell, opts) : (f[1][1]/*:any*/); + stack.push(encode_cell_xls(c, biff)); + break; + case 'PtgRef3d': /* [MS-XLS] 2.5.198.85 */ + /*::type = f[1][0]; */ixti = /*::Number(*/f[1][1]/*::)*/; c = shift_cell_xls((f[1][2]/*:any*/), _range, opts); + sname = get_ixti(supbooks, ixti, opts); + var w = sname; /* IE9 fails on defined names */ // eslint-disable-line no-unused-vars + stack.push(sname + "!" + encode_cell_xls(c, biff)); + break; + + case 'PtgFunc': /* [MS-XLS] 2.5.198.62 */ + case 'PtgFuncVar': /* [MS-XLS] 2.5.198.63 */ + /* f[1] = [argc, func, type] */ + var argc/*:number*/ = (f[1][0]/*:any*/), func/*:string*/ = (f[1][1]/*:any*/); + if(!argc) argc = 0; + argc &= 0x7F; + var args = argc == 0 ? [] : stack.slice(-argc); + stack.length -= argc; + if(func === 'User') func = args.shift(); + stack.push(func + "(" + args.join(",") + ")"); + break; + + case 'PtgBool': /* [MS-XLS] 2.5.198.42 */ + stack.push(f[1] ? "TRUE" : "FALSE"); break; + case 'PtgInt': /* [MS-XLS] 2.5.198.66 */ + stack.push(/*::String(*/f[1]/*::)*/); break; + case 'PtgNum': /* [MS-XLS] 2.5.198.79 TODO: precision? */ + stack.push(String(f[1])); break; + case 'PtgStr': /* [MS-XLS] 2.5.198.89 */ + // $FlowIgnore + stack.push('"' + f[1].replace(/"/g, '""') + '"'); break; + case 'PtgErr': /* [MS-XLS] 2.5.198.57 */ + stack.push(/*::String(*/f[1]/*::)*/); break; + case 'PtgAreaN': /* [MS-XLS] 2.5.198.31 TODO */ + /*::type = f[1][0]; */r = shift_range_xls(f[1][1], cell ? {s:cell} : _range, opts); + stack.push(encode_range_xls((r/*:any*/), opts)); + break; + case 'PtgArea': /* [MS-XLS] 2.5.198.27 TODO: fixed points */ + /*::type = f[1][0]; */r = shift_range_xls(f[1][1], _range, opts); + stack.push(encode_range_xls((r/*:any*/), opts)); + break; + case 'PtgArea3d': /* [MS-XLS] 2.5.198.28 TODO */ + /*::type = f[1][0]; */ixti = /*::Number(*/f[1][1]/*::)*/; r = f[1][2]; + sname = get_ixti(supbooks, ixti, opts); + stack.push(sname + "!" + encode_range_xls((r/*:any*/), opts)); + break; + case 'PtgAttrSum': /* [MS-XLS] 2.5.198.41 */ + stack.push("SUM(" + stack.pop() + ")"); + break; + + case 'PtgAttrBaxcel': /* [MS-XLS] 2.5.198.33 */ + case 'PtgAttrSemi': /* [MS-XLS] 2.5.198.37 */ + break; + + case 'PtgName': /* [MS-XLS] 2.5.198.76 ; [MS-XLSB] 2.5.97.60 TODO: revisions */ + /* f[1] = type, 0, nameindex */ + nameidx = (f[1][2]/*:any*/); + var lbl = (supbooks.names||[])[nameidx-1] || (supbooks[0]||[])[nameidx]; + var name = lbl ? lbl.Name : "SH33TJSNAME" + String(nameidx); + /* [MS-XLSB] 2.5.97.10 Ftab -- last verified 20220204 */ + if(name && name.slice(0,6) == "_xlfn." && !opts.xlfn) name = name.slice(6); + stack.push(name); + break; + + case 'PtgNameX': /* [MS-XLS] 2.5.198.77 ; [MS-XLSB] 2.5.97.61 TODO: revisions */ + /* f[1] = type, ixti, nameindex */ + var bookidx/*:number*/ = (f[1][1]/*:any*/); nameidx = (f[1][2]/*:any*/); var externbook; + /* TODO: Properly handle missing values -- this should be using get_ixti_raw primarily */ + if(opts.biff <= 5) { + if(bookidx < 0) bookidx = -bookidx; + if(supbooks[bookidx]) externbook = supbooks[bookidx][nameidx]; + } else { + var o = ""; + if(((supbooks[bookidx]||[])[0]||[])[0] == 0x3A01){/* empty */} + else if(((supbooks[bookidx]||[])[0]||[])[0] == 0x0401){ + if(supbooks[bookidx][nameidx] && supbooks[bookidx][nameidx].itab > 0) { + o = supbooks.SheetNames[supbooks[bookidx][nameidx].itab-1] + "!"; + } + } + else o = supbooks.SheetNames[nameidx-1]+ "!"; + if(supbooks[bookidx] && supbooks[bookidx][nameidx]) o += supbooks[bookidx][nameidx].Name; + else if(supbooks[0] && supbooks[0][nameidx]) o += supbooks[0][nameidx].Name; + else { + var ixtidata = (get_ixti_raw(supbooks, bookidx, opts)||"").split(";;"); + if(ixtidata[nameidx - 1]) o = ixtidata[nameidx - 1]; // TODO: confirm this is correct + else o += "SH33TJSERRX"; + } + stack.push(o); + break; + } + if(!externbook) externbook = {Name: "SH33TJSERRY"}; + stack.push(externbook.Name); + break; + + case 'PtgParen': /* [MS-XLS] 2.5.198.80 */ + var lp = '(', rp = ')'; + if(last_sp >= 0) { + sp = ""; + switch(formula[0][last_sp][1][0]) { + // $FlowIgnore + case 2: lp = fill(" ", formula[0][last_sp][1][1]) + lp; break; + // $FlowIgnore + case 3: lp = fill("\r", formula[0][last_sp][1][1]) + lp; break; + // $FlowIgnore + case 4: rp = fill(" ", formula[0][last_sp][1][1]) + rp; break; + // $FlowIgnore + case 5: rp = fill("\r", formula[0][last_sp][1][1]) + rp; break; + default: + // $FlowIgnore + if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + formula[0][last_sp][1][0]); + } + last_sp = -1; + } + stack.push(lp + stack.pop() + rp); break; + + case 'PtgRefErr': /* [MS-XLS] 2.5.198.86 */ + stack.push('#REF!'); break; + + case 'PtgRefErr3d': /* [MS-XLS] 2.5.198.87 */ + stack.push('#REF!'); break; + + case 'PtgExp': /* [MS-XLS] 2.5.198.58 TODO */ + c = {c:(f[1][1]/*:any*/),r:(f[1][0]/*:any*/)}; + var q = ({c: cell.c, r:cell.r}/*:any*/); + if(supbooks.sharedf[encode_cell(c)]) { + var parsedf = (supbooks.sharedf[encode_cell(c)]); + stack.push(stringify_formula(parsedf, _range, q, supbooks, opts)); + } else { + var fnd = false; + for(e1=0;e1!=supbooks.arrayf.length; ++e1) { + /* TODO: should be something like range_has */ + e2 = supbooks.arrayf[e1]; + if(c.c < e2[0].s.c || c.c > e2[0].e.c) continue; + if(c.r < e2[0].s.r || c.r > e2[0].e.r) continue; + stack.push(stringify_formula(e2[1], _range, q, supbooks, opts)); + fnd = true; + break; + } + if(!fnd) stack.push(/*::String(*/f[1]/*::)*/); + } + break; + + case 'PtgArray': /* [MS-XLS] 2.5.198.32 TODO */ + stack.push("{" + stringify_array(/*::(*/f[1]/*:: :any)*/) + "}"); + break; + + case 'PtgMemArea': /* [MS-XLS] 2.5.198.70 TODO: confirm this is a non-display */ + //stack.push("(" + f[2].map(encode_range).join(",") + ")"); + break; + + case 'PtgAttrSpace': /* [MS-XLS] 2.5.198.38 */ + case 'PtgAttrSpaceSemi': /* [MS-XLS] 2.5.198.39 */ + last_sp = ff; + break; + + case 'PtgTbl': /* [MS-XLS] 2.5.198.92 TODO */ + break; + + case 'PtgMemErr': /* [MS-XLS] 2.5.198.71 */ + break; + + case 'PtgMissArg': /* [MS-XLS] 2.5.198.74 */ + stack.push(""); + break; + + case 'PtgAreaErr': /* [MS-XLS] 2.5.198.29 */ + stack.push("#REF!"); break; + + case 'PtgAreaErr3d': /* [MS-XLS] 2.5.198.30 */ + stack.push("#REF!"); break; + + case 'PtgList': /* [MS-XLSB] 2.5.97.52 */ + // $FlowIgnore + stack.push("Table" + f[1].idx + "[#" + f[1].rt + "]"); + break; + + case 'PtgMemAreaN': + case 'PtgMemNoMemN': + case 'PtgAttrNoop': + case 'PtgSheet': + case 'PtgEndSheet': + break; + + case 'PtgMemFunc': /* [MS-XLS] 2.5.198.72 TODO */ + break; + case 'PtgMemNoMem': /* [MS-XLS] 2.5.198.73 TODO */ + break; + + case 'PtgElfCol': /* [MS-XLS] 2.5.198.46 */ + case 'PtgElfColS': /* [MS-XLS] 2.5.198.47 */ + case 'PtgElfColSV': /* [MS-XLS] 2.5.198.48 */ + case 'PtgElfColV': /* [MS-XLS] 2.5.198.49 */ + case 'PtgElfLel': /* [MS-XLS] 2.5.198.50 */ + case 'PtgElfRadical': /* [MS-XLS] 2.5.198.51 */ + case 'PtgElfRadicalLel': /* [MS-XLS] 2.5.198.52 */ + case 'PtgElfRadicalS': /* [MS-XLS] 2.5.198.53 */ + case 'PtgElfRw': /* [MS-XLS] 2.5.198.54 */ + case 'PtgElfRwV': /* [MS-XLS] 2.5.198.55 */ + throw new Error("Unsupported ELFs"); + + case 'PtgSxName': /* [MS-XLS] 2.5.198.91 TODO -- find a test case */ + throw new Error('Unrecognized Formula Token: ' + String(f)); + default: throw new Error('Unrecognized Formula Token: ' + String(f)); + } + var PtgNonDisp = ['PtgAttrSpace', 'PtgAttrSpaceSemi', 'PtgAttrGoto']; + if(opts.biff != 3) if(last_sp >= 0 && PtgNonDisp.indexOf(formula[0][ff][0]) == -1) { + f = formula[0][last_sp]; + var _left = true; + switch(f[1][0]) { + /* note: some bad XLSB files omit the PtgParen */ + case 4: _left = false; + /* falls through */ + case 0: + // $FlowIgnore + sp = fill(" ", f[1][1]); break; + case 5: _left = false; + /* falls through */ + case 1: + // $FlowIgnore + sp = fill("\r", f[1][1]); break; + default: + sp = ""; + // $FlowIgnore + if(opts.WTF) throw new Error("Unexpected PtgAttrSpaceType " + f[1][0]); + } + stack.push((_left ? sp : "") + stack.pop() + (_left ? "" : sp)); + last_sp = -1; + } + } + if(stack.length > 1 && opts.WTF) throw new Error("bad formula stack"); + if(stack[0] == "TRUE") return true; if(stack[0] == "FALSE") return false; + return stack[0]; +} + +/* [MS-XLS] 2.5.198.1 TODO */ +function parse_ArrayParsedFormula(blob, length, opts/*::, ref*/) { + var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; + var rgcb, cce = blob.read_shift(len); // length of rgce + if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; + var rgce = parse_Rgce(blob, cce, opts); + if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); + blob.l = target; + return [rgce, rgcb]; +} + +/* [MS-XLS] 2.5.198.3 TODO */ +function parse_XLSCellParsedFormula(blob, length, opts) { + var target = blob.l + length, len = opts.biff == 2 ? 1 : 2; + var rgcb, cce = blob.read_shift(len); // length of rgce + if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; + var rgce = parse_Rgce(blob, cce, opts); + if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts); + blob.l = target; + return [rgce, rgcb]; +} + +/* [MS-XLS] 2.5.198.21 */ +function parse_NameParsedFormula(blob, length, opts, cce) { + var target = blob.l + length; + var rgce = parse_Rgce(blob, cce, opts); + var rgcb; + if(target !== blob.l) rgcb = parse_RgbExtra(blob, target - blob.l, rgce, opts); + return [rgce, rgcb]; +} + +/* [MS-XLS] 2.5.198.118 TODO */ +function parse_SharedParsedFormula(blob, length, opts) { + var target = blob.l + length; + var rgcb, cce = blob.read_shift(2); // length of rgce + var rgce = parse_Rgce(blob, cce, opts); + if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)]; + if(length !== cce + 2) rgcb = parse_RgbExtra(blob, target - cce - 2, rgce, opts); + return [rgce, rgcb]; +} + +/* [MS-XLS] 2.5.133 TODO: how to emit empty strings? */ +function parse_FormulaValue(blob/*::, length*/) { + var b; + if(__readUInt16LE(blob,blob.l + 6) !== 0xFFFF) return [parse_Xnum(blob),'n']; + switch(blob[blob.l]) { + case 0x00: blob.l += 8; return ["String", 's']; + case 0x01: b = blob[blob.l+2] === 0x1; blob.l += 8; return [b,'b']; + case 0x02: b = blob[blob.l+2]; blob.l += 8; return [b,'e']; + case 0x03: blob.l += 8; return ["",'s']; + } + return []; +} +function write_FormulaValue(value) { + if(value == null) { + // Blank String Value + var o = new_buf(8); + o.write_shift(1, 0x03); + o.write_shift(1, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0xFFFF); + return o; + } else if(typeof value == "number") return write_Xnum(value); + return write_Xnum(0); +} + +/* [MS-XLS] 2.4.127 TODO */ +function parse_Formula(blob, length, opts) { + var end = blob.l + length; + var cell = parse_XLSCell(blob, 6, opts); + var val = parse_FormulaValue(blob,8); + var flags = blob.read_shift(1); + if(opts.biff != 2) { + blob.read_shift(1); + if(opts.biff >= 5) { + /*var chn = */blob.read_shift(4); + } + } + var cbf = parse_XLSCellParsedFormula(blob, end - blob.l, opts); + return {cell:cell, val:val[0], formula:cbf, shared: (flags >> 3) & 1, tt:val[1]}; +} +function write_Formula(cell/*:Cell*/, R/*:number*/, C/*:number*/, opts, os/*:number*/) { + // Cell + var o1 = write_XLSCell(R, C, os); + + // FormulaValue + var o2 = write_FormulaValue(cell.v); + + // flags + cache + var o3 = new_buf(6); + var flags = 0x01 | 0x20; + o3.write_shift(2, flags); + o3.write_shift(4, 0); + + // CellParsedFormula + var bf = new_buf(cell.bf.length); + for(var i = 0; i < cell.bf.length; ++i) bf[i] = cell.bf[i]; + + var out = bconcat([o1, o2, o3, bf]); + return out; +} + + +/* XLSB Parsed Formula records have the same shape */ +function parse_XLSBParsedFormula(data, length, opts) { + var cce = data.read_shift(4); + var rgce = parse_Rgce(data, cce, opts); + var cb = data.read_shift(4); + var rgcb = cb > 0 ? parse_RgbExtra(data, cb, rgce, opts) : null; + return [rgce, rgcb]; +} + +/* [MS-XLSB] 2.5.97.1 ArrayParsedFormula */ +var parse_XLSBArrayParsedFormula = parse_XLSBParsedFormula; +/* [MS-XLSB] 2.5.97.4 CellParsedFormula */ +var parse_XLSBCellParsedFormula = parse_XLSBParsedFormula; +/* [MS-XLSB] 2.5.97.8 DVParsedFormula */ +//var parse_XLSBDVParsedFormula = parse_XLSBParsedFormula; +/* [MS-XLSB] 2.5.97.9 FRTParsedFormula */ +//var parse_XLSBFRTParsedFormula = parse_XLSBParsedFormula2; +/* [MS-XLSB] 2.5.97.12 NameParsedFormula */ +var parse_XLSBNameParsedFormula = parse_XLSBParsedFormula; +/* [MS-XLSB] 2.5.97.98 SharedParsedFormula */ +var parse_XLSBSharedParsedFormula = parse_XLSBParsedFormula; + +/* Writes a PtgNum or PtgInt */ +function write_XLSBFormulaNum(val/*:number*/) { + if((val | 0) == val && val < Math.pow(2,16) && val >= 0) { + var oint = new_buf(11); + oint.write_shift(4, 3); + oint.write_shift(1, 0x1e); + oint.write_shift(2, val); + oint.write_shift(4, 0); + return oint; + } + + var num = new_buf(17); + num.write_shift(4, 11); + num.write_shift(1, 0x1f); + num.write_shift(8, val); + num.write_shift(4, 0); + return num; +} +/* Writes a PtgErr */ +function write_XLSBFormulaErr(val/*:number*/) { + var oint = new_buf(10); + oint.write_shift(4, 2); + oint.write_shift(1, 0x1C); + oint.write_shift(1, val); + oint.write_shift(4, 0); + return oint; +} +/* Writes a PtgBool */ +function write_XLSBFormulaBool(val/*:boolean*/) { + var oint = new_buf(10); + oint.write_shift(4, 2); + oint.write_shift(1, 0x1D); + oint.write_shift(1, val?1:0); + oint.write_shift(4, 0); + return oint; +} + +/* Writes a PtgStr */ +function write_XLSBFormulaStr(val/*:string*/) { + var preamble = new_buf(7); + preamble.write_shift(4, 3 + 2 * val.length); + preamble.write_shift(1, 0x17); + preamble.write_shift(2, val.length); + + var body = new_buf(2 * val.length); + body.write_shift(2 * val.length, val, "utf16le"); + + var postamble = new_buf(4); + postamble.write_shift(4, 0); + + return bconcat([preamble, body, postamble]); +} + +/* Writes a PtgRef */ +function write_XLSBFormulaRef(str) { + var cell = decode_cell(str); + var out = new_buf(15); + out.write_shift(4, 7); + out.write_shift(1, 0x04 | ((1)<<5)); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1)<<14) | ((str.match(/\$\d/) ? 0 : 1)<<15)); // <== ColRelShort + out.write_shift(4, 0); + + return out; +} + +/* Writes a PtgRef3d */ +function write_XLSBFormulaRef3D(str, wb) { + var lastbang = str.lastIndexOf("!"); + var sname = str.slice(0, lastbang); + str = str.slice(lastbang+1); + var cell = decode_cell(str); + if(sname.charAt(0) == "'") sname = sname.slice(1, -1).replace(/''/g, "'"); + + var out = new_buf(17); + out.write_shift(4, 9); + out.write_shift(1, 0x1A | ((1)<<5)); + out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1)<<14) | ((str.match(/\$\d/) ? 0 : 1)<<15)); // <== ColRelShort + out.write_shift(4, 0); + + return out; +} + +/* Writes a PtgRefErr3d */ +function write_XLSBFormulaRefErr3D(str, wb) { + var lastbang = str.lastIndexOf("!"); + var sname = str.slice(0, lastbang); + str = str.slice(lastbang+1); + if(sname.charAt(0) == "'") sname = sname.slice(1, -1).replace(/''/g, "'"); + + var out = new_buf(17); + out.write_shift(4, 9); + out.write_shift(1, 0x1C | ((1)<<5)); + out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, 0); + out.write_shift(2, 0); // <== ColRelShort + out.write_shift(4, 0); + + return out; +} + +/* Writes a single sheet range [PtgRef PtgRef PtgRange] */ +function write_XLSBFormulaRange(_str) { + var parts = _str.split(":"), str = parts[0]; + + var out = new_buf(23); + out.write_shift(4, 15); + + /* start cell */ + str = parts[0]; var cell = decode_cell(str); + out.write_shift(1, 0x04 | ((1)<<5)); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1)<<14) | ((str.match(/\$\d/) ? 0 : 1)<<15)); // <== ColRelShort + out.write_shift(4, 0); + + /* end cell */ + str = parts[1]; cell = decode_cell(str); + out.write_shift(1, 0x04 | ((1)<<5)); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1)<<14) | ((str.match(/\$\d/) ? 0 : 1)<<15)); // <== ColRelShort + out.write_shift(4, 0); + + /* PtgRange */ + out.write_shift(1, 0x11); + + out.write_shift(4, 0); + + return out; +} + +/* Writes a range with explicit sheet name [PtgRef3D PtgRef3D PtgRange] */ +function write_XLSBFormulaRangeWS(_str, wb) { + var lastbang = _str.lastIndexOf("!"); + var sname = _str.slice(0, lastbang); + _str = _str.slice(lastbang+1); + if(sname.charAt(0) == "'") sname = sname.slice(1, -1).replace(/''/g, "'"); + var parts = _str.split(":"); + + var out = new_buf(27); + out.write_shift(4, 19); + + /* start cell */ + var str = parts[0], cell = decode_cell(str); + out.write_shift(1, 0x1A | ((1)<<5)); + out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1)<<14) | ((str.match(/\$\d/) ? 0 : 1)<<15)); // <== ColRelShort + + /* end cell */ + str = parts[1]; cell = decode_cell(str); + out.write_shift(1, 0x1A | ((1)<<5)); + out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, cell.r); + out.write_shift(2, cell.c | ((str.charAt(0) == "$" ? 0 : 1)<<14) | ((str.match(/\$\d/) ? 0 : 1)<<15)); // <== ColRelShort + + /* PtgRange */ + out.write_shift(1, 0x11); + + out.write_shift(4, 0); + + return out; +} + +/* Writes a range with explicit sheet name [PtgArea3d] */ +function write_XLSBFormulaArea3D(_str, wb) { + var lastbang = _str.lastIndexOf("!"); + var sname = _str.slice(0, lastbang); + _str = _str.slice(lastbang+1); + if(sname.charAt(0) == "'") sname = sname.slice(1, -1).replace(/''/g, "'"); + var range = decode_range(_str); + + var out = new_buf(23); + out.write_shift(4, 15); + + out.write_shift(1, 0x1B | ((1)<<5)); + out.write_shift(2, 2 + wb.SheetNames.map(function(n) { return n.toLowerCase(); }).indexOf(sname.toLowerCase())); + out.write_shift(4, range.s.r); + out.write_shift(4, range.e.r); + out.write_shift(2, range.s.c); + out.write_shift(2, range.e.c); + + out.write_shift(4, 0); + + return out; +} + + +/* General Formula */ +function write_XLSBFormula(val/*:string|number*/, wb) { + if(typeof val == "number") return write_XLSBFormulaNum(val); + if(typeof val == "boolean") return write_XLSBFormulaBool(val); + if(/^#(DIV\/0!|GETTING_DATA|N\/A|NAME\?|NULL!|NUM!|REF!|VALUE!)$/.test(val)) return write_XLSBFormulaErr(+RBErr[val]); + if(val.match(/^\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) return write_XLSBFormulaRef(val); + if(val.match(/^\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5}):\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) return write_XLSBFormulaRange(val); + if(val.match(/^#REF!\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5}):\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) return write_XLSBFormulaArea3D(val, wb); + if(val.match(/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) return write_XLSBFormulaRef3D(val, wb); + if(val.match(/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5}):\$?(?:[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D]|[A-Z]{1,2})\$?(?:10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})$/)) return write_XLSBFormulaRangeWS(val, wb); + if(/^(?:'[^\\\/?*\[\]:]*'|[^'][^\\\/?*\[\]:'`~!@#$%^()\-=+{}|;,<.>]*)!#REF!$/.test(val)) return write_XLSBFormulaRefErr3D(val, wb); + if(/^".*"$/.test(val)) return write_XLSBFormulaStr(val); + if(/^[+-]\d+$/.test(val)) return write_XLSBFormulaNum(parseInt(val, 10)); + throw "Formula |" + val + "| not supported for XLSB"; +} +var write_XLSBNameParsedFormula = write_XLSBFormula; +var Cetab = { + 0: "BEEP", + 1: "OPEN", + 2: "OPEN.LINKS", + 3: "CLOSE.ALL", + 4: "SAVE", + 5: "SAVE.AS", + 6: "FILE.DELETE", + 7: "PAGE.SETUP", + 8: "PRINT", + 9: "PRINTER.SETUP", + 10: "QUIT", + 11: "NEW.WINDOW", + 12: "ARRANGE.ALL", + 13: "WINDOW.SIZE", + 14: "WINDOW.MOVE", + 15: "FULL", + 16: "CLOSE", + 17: "RUN", + 22: "SET.PRINT.AREA", + 23: "SET.PRINT.TITLES", + 24: "SET.PAGE.BREAK", + 25: "REMOVE.PAGE.BREAK", + 26: "FONT", + 27: "DISPLAY", + 28: "PROTECT.DOCUMENT", + 29: "PRECISION", + 30: "A1.R1C1", + 31: "CALCULATE.NOW", + 32: "CALCULATION", + 34: "DATA.FIND", + 35: "EXTRACT", + 36: "DATA.DELETE", + 37: "SET.DATABASE", + 38: "SET.CRITERIA", + 39: "SORT", + 40: "DATA.SERIES", + 41: "TABLE", + 42: "FORMAT.NUMBER", + 43: "ALIGNMENT", + 44: "STYLE", + 45: "BORDER", + 46: "CELL.PROTECTION", + 47: "COLUMN.WIDTH", + 48: "UNDO", + 49: "CUT", + 50: "COPY", + 51: "PASTE", + 52: "CLEAR", + 53: "PASTE.SPECIAL", + 54: "EDIT.DELETE", + 55: "INSERT", + 56: "FILL.RIGHT", + 57: "FILL.DOWN", + 61: "DEFINE.NAME", + 62: "CREATE.NAMES", + 63: "FORMULA.GOTO", + 64: "FORMULA.FIND", + 65: "SELECT.LAST.CELL", + 66: "SHOW.ACTIVE.CELL", + 67: "GALLERY.AREA", + 68: "GALLERY.BAR", + 69: "GALLERY.COLUMN", + 70: "GALLERY.LINE", + 71: "GALLERY.PIE", + 72: "GALLERY.SCATTER", + 73: "COMBINATION", + 74: "PREFERRED", + 75: "ADD.OVERLAY", + 76: "GRIDLINES", + 77: "SET.PREFERRED", + 78: "AXES", + 79: "LEGEND", + 80: "ATTACH.TEXT", + 81: "ADD.ARROW", + 82: "SELECT.CHART", + 83: "SELECT.PLOT.AREA", + 84: "PATTERNS", + 85: "MAIN.CHART", + 86: "OVERLAY", + 87: "SCALE", + 88: "FORMAT.LEGEND", + 89: "FORMAT.TEXT", + 90: "EDIT.REPEAT", + 91: "PARSE", + 92: "JUSTIFY", + 93: "HIDE", + 94: "UNHIDE", + 95: "WORKSPACE", + 96: "FORMULA", + 97: "FORMULA.FILL", + 98: "FORMULA.ARRAY", + 99: "DATA.FIND.NEXT", + 100: "DATA.FIND.PREV", + 101: "FORMULA.FIND.NEXT", + 102: "FORMULA.FIND.PREV", + 103: "ACTIVATE", + 104: "ACTIVATE.NEXT", + 105: "ACTIVATE.PREV", + 106: "UNLOCKED.NEXT", + 107: "UNLOCKED.PREV", + 108: "COPY.PICTURE", + 109: "SELECT", + 110: "DELETE.NAME", + 111: "DELETE.FORMAT", + 112: "VLINE", + 113: "HLINE", + 114: "VPAGE", + 115: "HPAGE", + 116: "VSCROLL", + 117: "HSCROLL", + 118: "ALERT", + 119: "NEW", + 120: "CANCEL.COPY", + 121: "SHOW.CLIPBOARD", + 122: "MESSAGE", + 124: "PASTE.LINK", + 125: "APP.ACTIVATE", + 126: "DELETE.ARROW", + 127: "ROW.HEIGHT", + 128: "FORMAT.MOVE", + 129: "FORMAT.SIZE", + 130: "FORMULA.REPLACE", + 131: "SEND.KEYS", + 132: "SELECT.SPECIAL", + 133: "APPLY.NAMES", + 134: "REPLACE.FONT", + 135: "FREEZE.PANES", + 136: "SHOW.INFO", + 137: "SPLIT", + 138: "ON.WINDOW", + 139: "ON.DATA", + 140: "DISABLE.INPUT", + 142: "OUTLINE", + 143: "LIST.NAMES", + 144: "FILE.CLOSE", + 145: "SAVE.WORKBOOK", + 146: "DATA.FORM", + 147: "COPY.CHART", + 148: "ON.TIME", + 149: "WAIT", + 150: "FORMAT.FONT", + 151: "FILL.UP", + 152: "FILL.LEFT", + 153: "DELETE.OVERLAY", + 155: "SHORT.MENUS", + 159: "SET.UPDATE.STATUS", + 161: "COLOR.PALETTE", + 162: "DELETE.STYLE", + 163: "WINDOW.RESTORE", + 164: "WINDOW.MAXIMIZE", + 166: "CHANGE.LINK", + 167: "CALCULATE.DOCUMENT", + 168: "ON.KEY", + 169: "APP.RESTORE", + 170: "APP.MOVE", + 171: "APP.SIZE", + 172: "APP.MINIMIZE", + 173: "APP.MAXIMIZE", + 174: "BRING.TO.FRONT", + 175: "SEND.TO.BACK", + 185: "MAIN.CHART.TYPE", + 186: "OVERLAY.CHART.TYPE", + 187: "SELECT.END", + 188: "OPEN.MAIL", + 189: "SEND.MAIL", + 190: "STANDARD.FONT", + 191: "CONSOLIDATE", + 192: "SORT.SPECIAL", + 193: "GALLERY.3D.AREA", + 194: "GALLERY.3D.COLUMN", + 195: "GALLERY.3D.LINE", + 196: "GALLERY.3D.PIE", + 197: "VIEW.3D", + 198: "GOAL.SEEK", + 199: "WORKGROUP", + 200: "FILL.GROUP", + 201: "UPDATE.LINK", + 202: "PROMOTE", + 203: "DEMOTE", + 204: "SHOW.DETAIL", + 206: "UNGROUP", + 207: "OBJECT.PROPERTIES", + 208: "SAVE.NEW.OBJECT", + 209: "SHARE", + 210: "SHARE.NAME", + 211: "DUPLICATE", + 212: "APPLY.STYLE", + 213: "ASSIGN.TO.OBJECT", + 214: "OBJECT.PROTECTION", + 215: "HIDE.OBJECT", + 216: "SET.EXTRACT", + 217: "CREATE.PUBLISHER", + 218: "SUBSCRIBE.TO", + 219: "ATTRIBUTES", + 220: "SHOW.TOOLBAR", + 222: "PRINT.PREVIEW", + 223: "EDIT.COLOR", + 224: "SHOW.LEVELS", + 225: "FORMAT.MAIN", + 226: "FORMAT.OVERLAY", + 227: "ON.RECALC", + 228: "EDIT.SERIES", + 229: "DEFINE.STYLE", + 240: "LINE.PRINT", + 243: "ENTER.DATA", + 249: "GALLERY.RADAR", + 250: "MERGE.STYLES", + 251: "EDITION.OPTIONS", + 252: "PASTE.PICTURE", + 253: "PASTE.PICTURE.LINK", + 254: "SPELLING", + 256: "ZOOM", + 259: "INSERT.OBJECT", + 260: "WINDOW.MINIMIZE", + 265: "SOUND.NOTE", + 266: "SOUND.PLAY", + 267: "FORMAT.SHAPE", + 268: "EXTEND.POLYGON", + 269: "FORMAT.AUTO", + 272: "GALLERY.3D.BAR", + 273: "GALLERY.3D.SURFACE", + 274: "FILL.AUTO", + 276: "CUSTOMIZE.TOOLBAR", + 277: "ADD.TOOL", + 278: "EDIT.OBJECT", + 279: "ON.DOUBLECLICK", + 280: "ON.ENTRY", + 281: "WORKBOOK.ADD", + 282: "WORKBOOK.MOVE", + 283: "WORKBOOK.COPY", + 284: "WORKBOOK.OPTIONS", + 285: "SAVE.WORKSPACE", + 288: "CHART.WIZARD", + 289: "DELETE.TOOL", + 290: "MOVE.TOOL", + 291: "WORKBOOK.SELECT", + 292: "WORKBOOK.ACTIVATE", + 293: "ASSIGN.TO.TOOL", + 295: "COPY.TOOL", + 296: "RESET.TOOL", + 297: "CONSTRAIN.NUMERIC", + 298: "PASTE.TOOL", + 302: "WORKBOOK.NEW", + 305: "SCENARIO.CELLS", + 306: "SCENARIO.DELETE", + 307: "SCENARIO.ADD", + 308: "SCENARIO.EDIT", + 309: "SCENARIO.SHOW", + 310: "SCENARIO.SHOW.NEXT", + 311: "SCENARIO.SUMMARY", + 312: "PIVOT.TABLE.WIZARD", + 313: "PIVOT.FIELD.PROPERTIES", + 314: "PIVOT.FIELD", + 315: "PIVOT.ITEM", + 316: "PIVOT.ADD.FIELDS", + 318: "OPTIONS.CALCULATION", + 319: "OPTIONS.EDIT", + 320: "OPTIONS.VIEW", + 321: "ADDIN.MANAGER", + 322: "MENU.EDITOR", + 323: "ATTACH.TOOLBARS", + 324: "VBAActivate", + 325: "OPTIONS.CHART", + 328: "VBA.INSERT.FILE", + 330: "VBA.PROCEDURE.DEFINITION", + 336: "ROUTING.SLIP", + 338: "ROUTE.DOCUMENT", + 339: "MAIL.LOGON", + 342: "INSERT.PICTURE", + 343: "EDIT.TOOL", + 344: "GALLERY.DOUGHNUT", + 350: "CHART.TREND", + 352: "PIVOT.ITEM.PROPERTIES", + 354: "WORKBOOK.INSERT", + 355: "OPTIONS.TRANSITION", + 356: "OPTIONS.GENERAL", + 370: "FILTER.ADVANCED", + 373: "MAIL.ADD.MAILER", + 374: "MAIL.DELETE.MAILER", + 375: "MAIL.REPLY", + 376: "MAIL.REPLY.ALL", + 377: "MAIL.FORWARD", + 378: "MAIL.NEXT.LETTER", + 379: "DATA.LABEL", + 380: "INSERT.TITLE", + 381: "FONT.PROPERTIES", + 382: "MACRO.OPTIONS", + 383: "WORKBOOK.HIDE", + 384: "WORKBOOK.UNHIDE", + 385: "WORKBOOK.DELETE", + 386: "WORKBOOK.NAME", + 388: "GALLERY.CUSTOM", + 390: "ADD.CHART.AUTOFORMAT", + 391: "DELETE.CHART.AUTOFORMAT", + 392: "CHART.ADD.DATA", + 393: "AUTO.OUTLINE", + 394: "TAB.ORDER", + 395: "SHOW.DIALOG", + 396: "SELECT.ALL", + 397: "UNGROUP.SHEETS", + 398: "SUBTOTAL.CREATE", + 399: "SUBTOTAL.REMOVE", + 400: "RENAME.OBJECT", + 412: "WORKBOOK.SCROLL", + 413: "WORKBOOK.NEXT", + 414: "WORKBOOK.PREV", + 415: "WORKBOOK.TAB.SPLIT", + 416: "FULL.SCREEN", + 417: "WORKBOOK.PROTECT", + 420: "SCROLLBAR.PROPERTIES", + 421: "PIVOT.SHOW.PAGES", + 422: "TEXT.TO.COLUMNS", + 423: "FORMAT.CHARTTYPE", + 424: "LINK.FORMAT", + 425: "TRACER.DISPLAY", + 430: "TRACER.NAVIGATE", + 431: "TRACER.CLEAR", + 432: "TRACER.ERROR", + 433: "PIVOT.FIELD.GROUP", + 434: "PIVOT.FIELD.UNGROUP", + 435: "CHECKBOX.PROPERTIES", + 436: "LABEL.PROPERTIES", + 437: "LISTBOX.PROPERTIES", + 438: "EDITBOX.PROPERTIES", + 439: "PIVOT.REFRESH", + 440: "LINK.COMBO", + 441: "OPEN.TEXT", + 442: "HIDE.DIALOG", + 443: "SET.DIALOG.FOCUS", + 444: "ENABLE.OBJECT", + 445: "PUSHBUTTON.PROPERTIES", + 446: "SET.DIALOG.DEFAULT", + 447: "FILTER", + 448: "FILTER.SHOW.ALL", + 449: "CLEAR.OUTLINE", + 450: "FUNCTION.WIZARD", + 451: "ADD.LIST.ITEM", + 452: "SET.LIST.ITEM", + 453: "REMOVE.LIST.ITEM", + 454: "SELECT.LIST.ITEM", + 455: "SET.CONTROL.VALUE", + 456: "SAVE.COPY.AS", + 458: "OPTIONS.LISTS.ADD", + 459: "OPTIONS.LISTS.DELETE", + 460: "SERIES.AXES", + 461: "SERIES.X", + 462: "SERIES.Y", + 463: "ERRORBAR.X", + 464: "ERRORBAR.Y", + 465: "FORMAT.CHART", + 466: "SERIES.ORDER", + 467: "MAIL.LOGOFF", + 468: "CLEAR.ROUTING.SLIP", + 469: "APP.ACTIVATE.MICROSOFT", + 470: "MAIL.EDIT.MAILER", + 471: "ON.SHEET", + 472: "STANDARD.WIDTH", + 473: "SCENARIO.MERGE", + 474: "SUMMARY.INFO", + 475: "FIND.FILE", + 476: "ACTIVE.CELL.FONT", + 477: "ENABLE.TIPWIZARD", + 478: "VBA.MAKE.ADDIN", + 480: "INSERTDATATABLE", + 481: "WORKGROUP.OPTIONS", + 482: "MAIL.SEND.MAILER", + 485: "AUTOCORRECT", + 489: "POST.DOCUMENT", + 491: "PICKLIST", + 493: "VIEW.SHOW", + 494: "VIEW.DEFINE", + 495: "VIEW.DELETE", + 509: "SHEET.BACKGROUND", + 510: "INSERT.MAP.OBJECT", + 511: "OPTIONS.MENONO", + 517: "MSOCHECKS", + 518: "NORMAL", + 519: "LAYOUT", + 520: "RM.PRINT.AREA", + 521: "CLEAR.PRINT.AREA", + 522: "ADD.PRINT.AREA", + 523: "MOVE.BRK", + 545: "HIDECURR.NOTE", + 546: "HIDEALL.NOTES", + 547: "DELETE.NOTE", + 548: "TRAVERSE.NOTES", + 549: "ACTIVATE.NOTES", + 620: "PROTECT.REVISIONS", + 621: "UNPROTECT.REVISIONS", + 647: "OPTIONS.ME", + 653: "WEB.PUBLISH", + 667: "NEWWEBQUERY", + 673: "PIVOT.TABLE.CHART", + 753: "OPTIONS.SAVE", + 755: "OPTIONS.SPELL", + 808: "HIDEALL.INKANNOTS" +}; +var Ftab = { + 0: "COUNT", + 1: "IF", + 2: "ISNA", + 3: "ISERROR", + 4: "SUM", + 5: "AVERAGE", + 6: "MIN", + 7: "MAX", + 8: "ROW", + 9: "COLUMN", + 10: "NA", + 11: "NPV", + 12: "STDEV", + 13: "DOLLAR", + 14: "FIXED", + 15: "SIN", + 16: "COS", + 17: "TAN", + 18: "ATAN", + 19: "PI", + 20: "SQRT", + 21: "EXP", + 22: "LN", + 23: "LOG10", + 24: "ABS", + 25: "INT", + 26: "SIGN", + 27: "ROUND", + 28: "LOOKUP", + 29: "INDEX", + 30: "REPT", + 31: "MID", + 32: "LEN", + 33: "VALUE", + 34: "TRUE", + 35: "FALSE", + 36: "AND", + 37: "OR", + 38: "NOT", + 39: "MOD", + 40: "DCOUNT", + 41: "DSUM", + 42: "DAVERAGE", + 43: "DMIN", + 44: "DMAX", + 45: "DSTDEV", + 46: "VAR", + 47: "DVAR", + 48: "TEXT", + 49: "LINEST", + 50: "TREND", + 51: "LOGEST", + 52: "GROWTH", + 53: "GOTO", + 54: "HALT", + 55: "RETURN", + 56: "PV", + 57: "FV", + 58: "NPER", + 59: "PMT", + 60: "RATE", + 61: "MIRR", + 62: "IRR", + 63: "RAND", + 64: "MATCH", + 65: "DATE", + 66: "TIME", + 67: "DAY", + 68: "MONTH", + 69: "YEAR", + 70: "WEEKDAY", + 71: "HOUR", + 72: "MINUTE", + 73: "SECOND", + 74: "NOW", + 75: "AREAS", + 76: "ROWS", + 77: "COLUMNS", + 78: "OFFSET", + 79: "ABSREF", + 80: "RELREF", + 81: "ARGUMENT", + 82: "SEARCH", + 83: "TRANSPOSE", + 84: "ERROR", + 85: "STEP", + 86: "TYPE", + 87: "ECHO", + 88: "SET.NAME", + 89: "CALLER", + 90: "DEREF", + 91: "WINDOWS", + 92: "SERIES", + 93: "DOCUMENTS", + 94: "ACTIVE.CELL", + 95: "SELECTION", + 96: "RESULT", + 97: "ATAN2", + 98: "ASIN", + 99: "ACOS", + 100: "CHOOSE", + 101: "HLOOKUP", + 102: "VLOOKUP", + 103: "LINKS", + 104: "INPUT", + 105: "ISREF", + 106: "GET.FORMULA", + 107: "GET.NAME", + 108: "SET.VALUE", + 109: "LOG", + 110: "EXEC", + 111: "CHAR", + 112: "LOWER", + 113: "UPPER", + 114: "PROPER", + 115: "LEFT", + 116: "RIGHT", + 117: "EXACT", + 118: "TRIM", + 119: "REPLACE", + 120: "SUBSTITUTE", + 121: "CODE", + 122: "NAMES", + 123: "DIRECTORY", + 124: "FIND", + 125: "CELL", + 126: "ISERR", + 127: "ISTEXT", + 128: "ISNUMBER", + 129: "ISBLANK", + 130: "T", + 131: "N", + 132: "FOPEN", + 133: "FCLOSE", + 134: "FSIZE", + 135: "FREADLN", + 136: "FREAD", + 137: "FWRITELN", + 138: "FWRITE", + 139: "FPOS", + 140: "DATEVALUE", + 141: "TIMEVALUE", + 142: "SLN", + 143: "SYD", + 144: "DDB", + 145: "GET.DEF", + 146: "REFTEXT", + 147: "TEXTREF", + 148: "INDIRECT", + 149: "REGISTER", + 150: "CALL", + 151: "ADD.BAR", + 152: "ADD.MENU", + 153: "ADD.COMMAND", + 154: "ENABLE.COMMAND", + 155: "CHECK.COMMAND", + 156: "RENAME.COMMAND", + 157: "SHOW.BAR", + 158: "DELETE.MENU", + 159: "DELETE.COMMAND", + 160: "GET.CHART.ITEM", + 161: "DIALOG.BOX", + 162: "CLEAN", + 163: "MDETERM", + 164: "MINVERSE", + 165: "MMULT", + 166: "FILES", + 167: "IPMT", + 168: "PPMT", + 169: "COUNTA", + 170: "CANCEL.KEY", + 171: "FOR", + 172: "WHILE", + 173: "BREAK", + 174: "NEXT", + 175: "INITIATE", + 176: "REQUEST", + 177: "POKE", + 178: "EXECUTE", + 179: "TERMINATE", + 180: "RESTART", + 181: "HELP", + 182: "GET.BAR", + 183: "PRODUCT", + 184: "FACT", + 185: "GET.CELL", + 186: "GET.WORKSPACE", + 187: "GET.WINDOW", + 188: "GET.DOCUMENT", + 189: "DPRODUCT", + 190: "ISNONTEXT", + 191: "GET.NOTE", + 192: "NOTE", + 193: "STDEVP", + 194: "VARP", + 195: "DSTDEVP", + 196: "DVARP", + 197: "TRUNC", + 198: "ISLOGICAL", + 199: "DCOUNTA", + 200: "DELETE.BAR", + 201: "UNREGISTER", + 204: "USDOLLAR", + 205: "FINDB", + 206: "SEARCHB", + 207: "REPLACEB", + 208: "LEFTB", + 209: "RIGHTB", + 210: "MIDB", + 211: "LENB", + 212: "ROUNDUP", + 213: "ROUNDDOWN", + 214: "ASC", + 215: "DBCS", + 216: "RANK", + 219: "ADDRESS", + 220: "DAYS360", + 221: "TODAY", + 222: "VDB", + 223: "ELSE", + 224: "ELSE.IF", + 225: "END.IF", + 226: "FOR.CELL", + 227: "MEDIAN", + 228: "SUMPRODUCT", + 229: "SINH", + 230: "COSH", + 231: "TANH", + 232: "ASINH", + 233: "ACOSH", + 234: "ATANH", + 235: "DGET", + 236: "CREATE.OBJECT", + 237: "VOLATILE", + 238: "LAST.ERROR", + 239: "CUSTOM.UNDO", + 240: "CUSTOM.REPEAT", + 241: "FORMULA.CONVERT", + 242: "GET.LINK.INFO", + 243: "TEXT.BOX", + 244: "INFO", + 245: "GROUP", + 246: "GET.OBJECT", + 247: "DB", + 248: "PAUSE", + 251: "RESUME", + 252: "FREQUENCY", + 253: "ADD.TOOLBAR", + 254: "DELETE.TOOLBAR", + 255: "User", + 256: "RESET.TOOLBAR", + 257: "EVALUATE", + 258: "GET.TOOLBAR", + 259: "GET.TOOL", + 260: "SPELLING.CHECK", + 261: "ERROR.TYPE", + 262: "APP.TITLE", + 263: "WINDOW.TITLE", + 264: "SAVE.TOOLBAR", + 265: "ENABLE.TOOL", + 266: "PRESS.TOOL", + 267: "REGISTER.ID", + 268: "GET.WORKBOOK", + 269: "AVEDEV", + 270: "BETADIST", + 271: "GAMMALN", + 272: "BETAINV", + 273: "BINOMDIST", + 274: "CHIDIST", + 275: "CHIINV", + 276: "COMBIN", + 277: "CONFIDENCE", + 278: "CRITBINOM", + 279: "EVEN", + 280: "EXPONDIST", + 281: "FDIST", + 282: "FINV", + 283: "FISHER", + 284: "FISHERINV", + 285: "FLOOR", + 286: "GAMMADIST", + 287: "GAMMAINV", + 288: "CEILING", + 289: "HYPGEOMDIST", + 290: "LOGNORMDIST", + 291: "LOGINV", + 292: "NEGBINOMDIST", + 293: "NORMDIST", + 294: "NORMSDIST", + 295: "NORMINV", + 296: "NORMSINV", + 297: "STANDARDIZE", + 298: "ODD", + 299: "PERMUT", + 300: "POISSON", + 301: "TDIST", + 302: "WEIBULL", + 303: "SUMXMY2", + 304: "SUMX2MY2", + 305: "SUMX2PY2", + 306: "CHITEST", + 307: "CORREL", + 308: "COVAR", + 309: "FORECAST", + 310: "FTEST", + 311: "INTERCEPT", + 312: "PEARSON", + 313: "RSQ", + 314: "STEYX", + 315: "SLOPE", + 316: "TTEST", + 317: "PROB", + 318: "DEVSQ", + 319: "GEOMEAN", + 320: "HARMEAN", + 321: "SUMSQ", + 322: "KURT", + 323: "SKEW", + 324: "ZTEST", + 325: "LARGE", + 326: "SMALL", + 327: "QUARTILE", + 328: "PERCENTILE", + 329: "PERCENTRANK", + 330: "MODE", + 331: "TRIMMEAN", + 332: "TINV", + 334: "MOVIE.COMMAND", + 335: "GET.MOVIE", + 336: "CONCATENATE", + 337: "POWER", + 338: "PIVOT.ADD.DATA", + 339: "GET.PIVOT.TABLE", + 340: "GET.PIVOT.FIELD", + 341: "GET.PIVOT.ITEM", + 342: "RADIANS", + 343: "DEGREES", + 344: "SUBTOTAL", + 345: "SUMIF", + 346: "COUNTIF", + 347: "COUNTBLANK", + 348: "SCENARIO.GET", + 349: "OPTIONS.LISTS.GET", + 350: "ISPMT", + 351: "DATEDIF", + 352: "DATESTRING", + 353: "NUMBERSTRING", + 354: "ROMAN", + 355: "OPEN.DIALOG", + 356: "SAVE.DIALOG", + 357: "VIEW.GET", + 358: "GETPIVOTDATA", + 359: "HYPERLINK", + 360: "PHONETIC", + 361: "AVERAGEA", + 362: "MAXA", + 363: "MINA", + 364: "STDEVPA", + 365: "VARPA", + 366: "STDEVA", + 367: "VARA", + 368: "BAHTTEXT", + 369: "THAIDAYOFWEEK", + 370: "THAIDIGIT", + 371: "THAIMONTHOFYEAR", + 372: "THAINUMSOUND", + 373: "THAINUMSTRING", + 374: "THAISTRINGLENGTH", + 375: "ISTHAIDIGIT", + 376: "ROUNDBAHTDOWN", + 377: "ROUNDBAHTUP", + 378: "THAIYEAR", + 379: "RTD", + 380: "CUBEVALUE", + 381: "CUBEMEMBER", + 382: "CUBEMEMBERPROPERTY", + 383: "CUBERANKEDMEMBER", + 384: "HEX2BIN", + 385: "HEX2DEC", + 386: "HEX2OCT", + 387: "DEC2BIN", + 388: "DEC2HEX", + 389: "DEC2OCT", + 390: "OCT2BIN", + 391: "OCT2HEX", + 392: "OCT2DEC", + 393: "BIN2DEC", + 394: "BIN2OCT", + 395: "BIN2HEX", + 396: "IMSUB", + 397: "IMDIV", + 398: "IMPOWER", + 399: "IMABS", + 400: "IMSQRT", + 401: "IMLN", + 402: "IMLOG2", + 403: "IMLOG10", + 404: "IMSIN", + 405: "IMCOS", + 406: "IMEXP", + 407: "IMARGUMENT", + 408: "IMCONJUGATE", + 409: "IMAGINARY", + 410: "IMREAL", + 411: "COMPLEX", + 412: "IMSUM", + 413: "IMPRODUCT", + 414: "SERIESSUM", + 415: "FACTDOUBLE", + 416: "SQRTPI", + 417: "QUOTIENT", + 418: "DELTA", + 419: "GESTEP", + 420: "ISEVEN", + 421: "ISODD", + 422: "MROUND", + 423: "ERF", + 424: "ERFC", + 425: "BESSELJ", + 426: "BESSELK", + 427: "BESSELY", + 428: "BESSELI", + 429: "XIRR", + 430: "XNPV", + 431: "PRICEMAT", + 432: "YIELDMAT", + 433: "INTRATE", + 434: "RECEIVED", + 435: "DISC", + 436: "PRICEDISC", + 437: "YIELDDISC", + 438: "TBILLEQ", + 439: "TBILLPRICE", + 440: "TBILLYIELD", + 441: "PRICE", + 442: "YIELD", + 443: "DOLLARDE", + 444: "DOLLARFR", + 445: "NOMINAL", + 446: "EFFECT", + 447: "CUMPRINC", + 448: "CUMIPMT", + 449: "EDATE", + 450: "EOMONTH", + 451: "YEARFRAC", + 452: "COUPDAYBS", + 453: "COUPDAYS", + 454: "COUPDAYSNC", + 455: "COUPNCD", + 456: "COUPNUM", + 457: "COUPPCD", + 458: "DURATION", + 459: "MDURATION", + 460: "ODDLPRICE", + 461: "ODDLYIELD", + 462: "ODDFPRICE", + 463: "ODDFYIELD", + 464: "RANDBETWEEN", + 465: "WEEKNUM", + 466: "AMORDEGRC", + 467: "AMORLINC", + 468: "CONVERT", + 724: "SHEETJS", + 469: "ACCRINT", + 470: "ACCRINTM", + 471: "WORKDAY", + 472: "NETWORKDAYS", + 473: "GCD", + 474: "MULTINOMIAL", + 475: "LCM", + 476: "FVSCHEDULE", + 477: "CUBEKPIMEMBER", + 478: "CUBESET", + 479: "CUBESETCOUNT", + 480: "IFERROR", + 481: "COUNTIFS", + 482: "SUMIFS", + 483: "AVERAGEIF", + 484: "AVERAGEIFS" +}; +var FtabArgc = { + 2: 1, + 3: 1, + 10: 0, + 15: 1, + 16: 1, + 17: 1, + 18: 1, + 19: 0, + 20: 1, + 21: 1, + 22: 1, + 23: 1, + 24: 1, + 25: 1, + 26: 1, + 27: 2, + 30: 2, + 31: 3, + 32: 1, + 33: 1, + 34: 0, + 35: 0, + 38: 1, + 39: 2, + 40: 3, + 41: 3, + 42: 3, + 43: 3, + 44: 3, + 45: 3, + 47: 3, + 48: 2, + 53: 1, + 61: 3, + 63: 0, + 65: 3, + 66: 3, + 67: 1, + 68: 1, + 69: 1, + 70: 1, + 71: 1, + 72: 1, + 73: 1, + 74: 0, + 75: 1, + 76: 1, + 77: 1, + 79: 2, + 80: 2, + 83: 1, + 85: 0, + 86: 1, + 89: 0, + 90: 1, + 94: 0, + 95: 0, + 97: 2, + 98: 1, + 99: 1, + 101: 3, + 102: 3, + 105: 1, + 106: 1, + 108: 2, + 111: 1, + 112: 1, + 113: 1, + 114: 1, + 117: 2, + 118: 1, + 119: 4, + 121: 1, + 126: 1, + 127: 1, + 128: 1, + 129: 1, + 130: 1, + 131: 1, + 133: 1, + 134: 1, + 135: 1, + 136: 2, + 137: 2, + 138: 2, + 140: 1, + 141: 1, + 142: 3, + 143: 4, + 144: 4, + 161: 1, + 162: 1, + 163: 1, + 164: 1, + 165: 2, + 172: 1, + 175: 2, + 176: 2, + 177: 3, + 178: 2, + 179: 1, + 184: 1, + 186: 1, + 189: 3, + 190: 1, + 195: 3, + 196: 3, + 197: 1, + 198: 1, + 199: 3, + 201: 1, + 207: 4, + 210: 3, + 211: 1, + 212: 2, + 213: 2, + 214: 1, + 215: 1, + 225: 0, + 229: 1, + 230: 1, + 231: 1, + 232: 1, + 233: 1, + 234: 1, + 235: 3, + 244: 1, + 247: 4, + 252: 2, + 257: 1, + 261: 1, + 271: 1, + 273: 4, + 274: 2, + 275: 2, + 276: 2, + 277: 3, + 278: 3, + 279: 1, + 280: 3, + 281: 3, + 282: 3, + 283: 1, + 284: 1, + 285: 2, + 286: 4, + 287: 3, + 288: 2, + 289: 4, + 290: 3, + 291: 3, + 292: 3, + 293: 4, + 294: 1, + 295: 3, + 296: 1, + 297: 3, + 298: 1, + 299: 2, + 300: 3, + 301: 3, + 302: 4, + 303: 2, + 304: 2, + 305: 2, + 306: 2, + 307: 2, + 308: 2, + 309: 3, + 310: 2, + 311: 2, + 312: 2, + 313: 2, + 314: 2, + 315: 2, + 316: 4, + 325: 2, + 326: 2, + 327: 2, + 328: 2, + 331: 2, + 332: 2, + 337: 2, + 342: 1, + 343: 1, + 346: 2, + 347: 1, + 350: 4, + 351: 3, + 352: 1, + 353: 2, + 360: 1, + 368: 1, + 369: 1, + 370: 1, + 371: 1, + 372: 1, + 373: 1, + 374: 1, + 375: 1, + 376: 1, + 377: 1, + 378: 1, + 382: 3, + 385: 1, + 392: 1, + 393: 1, + 396: 2, + 397: 2, + 398: 2, + 399: 1, + 400: 1, + 401: 1, + 402: 1, + 403: 1, + 404: 1, + 405: 1, + 406: 1, + 407: 1, + 408: 1, + 409: 1, + 410: 1, + 414: 4, + 415: 1, + 416: 1, + 417: 2, + 420: 1, + 421: 1, + 422: 2, + 424: 1, + 425: 2, + 426: 2, + 427: 2, + 428: 2, + 430: 3, + 438: 3, + 439: 3, + 440: 3, + 443: 2, + 444: 2, + 445: 2, + 446: 2, + 447: 6, + 448: 6, + 449: 2, + 450: 2, + 464: 2, + 468: 3, + 476: 2, + 479: 1, + 480: 2, + 65535: 0 +}; +/* Part 3 TODO: actually parse formulae */ +function ods_to_csf_formula(f/*:string*/)/*:string*/ { + if(f.slice(0,3) == "of:") f = f.slice(3); + /* 5.2 Basic Expressions */ + if(f.charCodeAt(0) == 61) { + f = f.slice(1); + if(f.charCodeAt(0) == 61) f = f.slice(1); + } + f = f.replace(/COM\.MICROSOFT\./g, ""); + /* Part 3 Section 5.8 References */ + f = f.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g, function($$, $1) { return $1.replace(/\./g,""); }); + f = f.replace(/\$'([^']|'')+'/g, function($$) { return $$.slice(1); }); + f = f.replace(/\$([^\]\. #$]+)/g, function($$, $1) { return ($1).match(/^([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])?(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})?$/) ? $$ : $1; }); + /* TODO: something other than this */ + f = f.replace(/\[.(#[A-Z]*[?!])\]/g, "$1"); + return f.replace(/[;~]/g,",").replace(/\|/g,";"); +} + +function csf_to_ods_formula(f/*:string*/)/*:string*/ { + var o = "of:=" + f.replace(crefregex, "$1[.$2$3$4$5]").replace(/\]:\[/g,":"); + /* TODO: something other than this */ + return o.replace(/;/g, "|").replace(/,/g,";"); +} + +function ods_to_csf_3D(r/*:string*/)/*:[string, string]*/ { + r = r.replace(/\$'([^']|'')+'/g, function($$) { return $$.slice(1); }); + r = r.replace(/\$([^\]\. #$]+)/g, function($$, $1) { return ($1).match(/^([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])?(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})?$/) ? $$ : $1; }); + var a = r.split(":"); + var s = a[0].split(".")[0]; + return [s, a[0].split(".")[1] + (a.length > 1 ? (":" + (a[1].split(".")[1] || a[1].split(".")[0])) : "")]; +} + +function csf_to_ods_3D(r/*:string*/)/*:string*/ { + return r.replace(/!/,".").replace(/:/, ":."); +} + +var strs = {}; // shared strings +var _ssfopts = {}; // spreadsheet formatting options + + +/*global Map */ +var browser_has_Map = typeof Map !== 'undefined'; + +function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ { + var i = 0, len = sst.length; + if(rev) { + if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) { + var revarr = browser_has_Map ? rev.get(str) : rev[str]; + for(; i < revarr.length; ++i) { + if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; } + } + } + } else for(; i < len; ++i) { + if(sst[i].t === str) { sst.Count ++; return i; } + } + sst[len] = ({t:str}/*:any*/); sst.Count ++; sst.Unique ++; + if(rev) { + if(browser_has_Map) { + if(!rev.has(str)) rev.set(str, []); + rev.get(str).push(len); + } else { + if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = []; + rev[str].push(len); + } + } + return len; +} + +function col_obj_w(C/*:number*/, col) { + var p = ({min:C+1,max:C+1}/*:any*/); + /* wch (chars), wpx (pixels) */ + var wch = -1; + if(col.MDW) MDW = col.MDW; + if(col.width != null) p.customWidth = 1; + else if(col.wpx != null) wch = px2char(col.wpx); + else if(col.wch != null) wch = col.wch; + if(wch > -1) { p.width = char2width(wch); p.customWidth = 1; } + else if(col.width != null) p.width = col.width; + if(col.hidden) p.hidden = true; + if(col.level != null) { p.outlineLevel = p.level = col.level; } + return p; +} + +function default_margins(margins/*:Margins*/, mode/*:?string*/) { + if(!margins) return; + var defs = [0.7, 0.7, 0.75, 0.75, 0.3, 0.3]; + if(mode == 'xlml') defs = [1, 1, 1, 1, 0.5, 0.5]; + if(margins.left == null) margins.left = defs[0]; + if(margins.right == null) margins.right = defs[1]; + if(margins.top == null) margins.top = defs[2]; + if(margins.bottom == null) margins.bottom = defs[3]; + if(margins.header == null) margins.header = defs[4]; + if(margins.footer == null) margins.footer = defs[5]; +} + +function get_cell_style(styles/*:Array*/, cell/*:Cell*/, opts) { + var z = opts.revssf[cell.z != null ? cell.z : "General"]; + var i = 0x3c, len = styles.length; + if(z == null && opts.ssf) { + for(; i < 0x188; ++i) if(opts.ssf[i] == null) { + SSF__load(cell.z, i); + // $FlowIgnore + opts.ssf[i] = cell.z; + opts.revssf[cell.z] = z = i; + break; + } + } + for(i = 0; i != len; ++i) if(styles[i].numFmtId === z) return i; + styles[len] = { + numFmtId:z, + fontId:0, + fillId:0, + borderId:0, + xfId:0, + applyNumberFormat:1 + }; + return len; +} + +function safe_format(p/*:Cell*/, fmtid/*:number*/, fillid/*:?number*/, opts, themes, styles, date1904) { + try { + if(opts.cellNF) p.z = table_fmt[fmtid]; + } catch(e) { if(opts.WTF) throw e; } + if(p.t === 'z' && !opts.cellStyles) return; + if(p.t === 'd' && typeof p.v === 'string') p.v = parseDate(p.v); + if((!opts || opts.cellText !== false) && p.t !== 'z') try { + if(table_fmt[fmtid] == null) SSF__load(SSFImplicit[fmtid] || "General", fmtid); + if(p.t === 'e') p.w = p.w || BErr[p.v]; + else if(fmtid === 0) { + if(p.t === 'n') { + if((p.v|0) === p.v) p.w = p.v.toString(10); + else p.w = SSF_general_num(p.v); + } + else if(p.t === 'd') { + var dd = datenum(p.v, !!date1904); + if((dd|0) === dd) p.w = dd.toString(10); + else p.w = SSF_general_num(dd); + } + else if(p.v === undefined) return ""; + else p.w = SSF_general(p.v,_ssfopts); + } + else if(p.t === 'd') p.w = SSF_format(fmtid,datenum(p.v, !!date1904),_ssfopts); + else p.w = SSF_format(fmtid,p.v,_ssfopts); + } catch(e) { if(opts.WTF) throw e; } + if(!opts.cellStyles) return; + if(fillid != null) try { + p.s = styles.Fills[fillid]; + if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) { + p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0); + if(opts.WTF) p.s.fgColor.raw_rgb = themes.themeElements.clrScheme[p.s.fgColor.theme].rgb; + } + if (p.s.bgColor && p.s.bgColor.theme) { + p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0); + if(opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb; + } + } catch(e) { if(opts.WTF && styles.Fills) throw e; } +} + +function check_ws(ws/*:Worksheet*/, sname/*:string*/, i/*:number*/) { + if(ws && ws['!ref']) { + var range = safe_decode_range(ws['!ref']); + if(range.e.c < range.s.c || range.e.r < range.s.r) throw new Error("Bad range (" + i + "): " + ws['!ref']); + } +} +function parse_ws_xml_dim(ws/*:Worksheet*/, s/*:string*/) { + var d = safe_decode_range(s); + if(d.s.r<=d.e.r && d.s.c<=d.e.c && d.s.r>=0 && d.s.c>=0) ws["!ref"] = encode_range(d); +} +var mergecregex = /<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g; +var sheetdataregex = /<(?:\w+:)?sheetData[^>]*>([\s\S]*)<\/(?:\w+:)?sheetData>/; +var hlinkregex = /<(?:\w:)?hyperlink [^>]*>/mg; +var dimregex = /"(\w*:\w*)"/; +var colregex = /<(?:\w:)?col\b[^>]*[\/]?>/g; +var afregex = /<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g; +var marginregex= /<(?:\w:)?pageMargins[^>]*\/>/g; +var sheetprregex = /<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/; +var sheetprregex2= /<(?:\w:)?sheetPr[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetPr)>/; +var svsregex = /<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/; + +/* 18.3 Worksheets */ +function parse_ws_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*:WBWBProps*/, themes, styles)/*:Worksheet*/ { + if(!data) return data; + if(!rels) rels = {'!id':{}}; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + + /* 18.3.1.99 worksheet CT_Worksheet */ + var s = ({}/*:any*/); if(opts.dense) s["!data"] = []; + var refguess/*:Range*/ = ({s: {r:2000000, c:2000000}, e: {r:0, c:0} }/*:any*/); + + var data1 = "", data2 = ""; + var mtch/*:?any*/ = data.match(sheetdataregex); + if(mtch) { + data1 = data.slice(0, mtch.index); + data2 = data.slice(mtch.index + mtch[0].length); + } else data1 = data2 = data; + + /* 18.3.1.82 sheetPr CT_SheetPr */ + var sheetPr = data1.match(sheetprregex); + if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx); + else if((sheetPr = data1.match(sheetprregex2))) parse_ws_xml_sheetpr2(sheetPr[0], sheetPr[1]||"", s, wb, idx, styles, themes); + + /* 18.3.1.35 dimension CT_SheetDimension */ + var ridx = (data1.match(/<(?:\w*:)?dimension/)||{index:-1}).index; + if(ridx > 0) { + var ref = data1.slice(ridx,ridx+50).match(dimregex); + if(ref && !(opts && opts.nodim)) parse_ws_xml_dim(s, ref[1]); + } + + /* 18.3.1.88 sheetViews CT_SheetViews */ + var svs = data1.match(svsregex); + if(svs && svs[1]) parse_ws_xml_sheetviews(svs[1], wb); + + /* 18.3.1.17 cols CT_Cols */ + var columns/*:Array*/ = []; + if(opts.cellStyles) { + /* 18.3.1.13 col CT_Col */ + var cols = data1.match(colregex); + if(cols) parse_ws_xml_cols(columns, cols); + } + + /* 18.3.1.80 sheetData CT_SheetData ? */ + if(mtch) parse_ws_xml_data(mtch[1], s, opts, refguess, themes, styles, wb); + + /* 18.3.1.2 autoFilter CT_AutoFilter */ + var afilter = data2.match(afregex); + if(afilter) s['!autofilter'] = parse_ws_xml_autofilter(afilter[0]); + + /* 18.3.1.55 mergeCells CT_MergeCells */ + var merges/*:Array*/ = []; + var _merge = data2.match(mergecregex); + if(_merge) for(ridx = 0; ridx != _merge.length; ++ridx) + merges[ridx] = safe_decode_range(_merge[ridx].slice(_merge[ridx].indexOf("\"")+1)); + + /* 18.3.1.48 hyperlinks CT_Hyperlinks */ + var hlink = data2.match(hlinkregex); + if(hlink) parse_ws_xml_hlinks(s, hlink, rels); + + /* 18.3.1.62 pageMargins CT_PageMargins */ + var margins = data2.match(marginregex); + if(margins) s['!margins'] = parse_ws_xml_margins(parsexmltag(margins[0])); + + /* legacyDrawing */ + var m; + if((m = data2.match(/legacyDrawing r:id="(.*?)"/))) s['!legrel'] = m[1]; + + if(opts && opts.nodim) refguess.s.c = refguess.s.r = 0; + if(!s["!ref"] && refguess.e.c >= refguess.s.c && refguess.e.r >= refguess.s.r) s["!ref"] = encode_range(refguess); + if(opts.sheetRows > 0 && s["!ref"]) { + var tmpref = safe_decode_range(s["!ref"]); + if(opts.sheetRows <= +tmpref.e.r) { + tmpref.e.r = opts.sheetRows - 1; + if(tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r; + if(tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r; + if(tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c; + if(tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c; + s["!fullref"] = s["!ref"]; + s["!ref"] = encode_range(tmpref); + } + } + if(columns.length > 0) s["!cols"] = columns; + if(merges.length > 0) s["!merges"] = merges; + if(rels['!id'][s['!legrel']]) s['!legdrawel'] = rels['!id'][s['!legrel']]; + return s; +} + +function write_ws_xml_merges(merges/*:Array*/)/*:string*/ { + if(merges.length === 0) return ""; + var o = ''; + for(var i = 0; i != merges.length; ++i) o += ''; + return o + ''; +} + +/* 18.3.1.82-3 sheetPr CT_ChartsheetPr / CT_SheetPr */ +function parse_ws_xml_sheetpr(sheetPr/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/) { + var data = parsexmltag(sheetPr); + if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; + if(data.codeName) wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName)); +} +function parse_ws_xml_sheetpr2(sheetPr/*:string*/, body/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/) { + parse_ws_xml_sheetpr(sheetPr.slice(0, sheetPr.indexOf(">")), s, wb, idx); +} +function write_ws_xml_sheetpr(ws, wb, idx, opts, o) { + var needed = false; + var props = {}, payload = null; + if(opts.bookType !== 'xlsx' && wb.vbaraw) { + var cname = wb.SheetNames[idx]; + try { if(wb.Workbook) cname = wb.Workbook.Sheets[idx].CodeName || cname; } catch(e) {} + needed = true; + props.codeName = utf8write(escapexml(cname)); + } + + if(ws && ws["!outline"]) { + var outlineprops = {summaryBelow:1, summaryRight:1}; + if(ws["!outline"].above) outlineprops.summaryBelow = 0; + if(ws["!outline"].left) outlineprops.summaryRight = 0; + payload = (payload||"") + writextag('outlinePr', null, outlineprops); + } + + if(!needed && !payload) return; + o[o.length] = (writextag('sheetPr', payload, props)); +} + +/* 18.3.1.85 sheetProtection CT_SheetProtection */ +var sheetprot_deffalse = ["objects", "scenarios", "selectLockedCells", "selectUnlockedCells"]; +var sheetprot_deftrue = [ + "formatColumns", "formatRows", "formatCells", + "insertColumns", "insertRows", "insertHyperlinks", + "deleteColumns", "deleteRows", + "sort", "autoFilter", "pivotTables" +]; +function write_ws_xml_protection(sp)/*:string*/ { + // algorithmName, hashValue, saltValue, spinCount + var o = ({sheet:1}/*:any*/); + sheetprot_deffalse.forEach(function(n) { if(sp[n] != null && sp[n]) o[n] = "1"; }); + sheetprot_deftrue.forEach(function(n) { if(sp[n] != null && !sp[n]) o[n] = "0"; }); + /* TODO: algorithm */ + if(sp.password) o.password = crypto_CreatePasswordVerifier_Method1(sp.password).toString(16).toUpperCase(); + return writextag('sheetProtection', null, o); +} + +function parse_ws_xml_hlinks(s, data/*:Array*/, rels) { + var dense = s["!data"] != null; + for(var i = 0; i != data.length; ++i) { + var val = parsexmltag(utf8read(data[i]), true); + if(!val.ref) return; + var rel = ((rels || {})['!id']||[])[val.id]; + if(rel) { + val.Target = rel.Target; + if(val.location) val.Target += "#"+unescapexml(val.location); + } else { + val.Target = "#" + unescapexml(val.location); + rel = {Target: val.Target, TargetMode: 'Internal'}; + } + val.Rel = rel; + if(val.tooltip) { val.Tooltip = val.tooltip; delete val.tooltip; } + var rng = safe_decode_range(val.ref); + for(var R=rng.s.r;R<=rng.e.r;++R) for(var C=rng.s.c;C<=rng.e.c;++C) { + var addr = encode_col(C) + encode_row(R); + if(dense) { + if(!s["!data"][R]) s["!data"][R] = []; + if(!s["!data"][R][C]) s["!data"][R][C] = {t:"z",v:undefined}; + s["!data"][R][C].l = val; + } else { + if(!s[addr]) s[addr] = {t:"z",v:undefined}; + s[addr].l = val; + } + } + } +} + +function parse_ws_xml_margins(margin) { + var o = {}; + ["left", "right", "top", "bottom", "header", "footer"].forEach(function(k) { + if(margin[k]) o[k] = parseFloat(margin[k]); + }); + return o; +} +function write_ws_xml_margins(margin)/*:string*/ { + default_margins(margin); + return writextag('pageMargins', null, margin); +} + +function parse_ws_xml_cols(columns, cols) { + var seencol = false; + for(var coli = 0; coli != cols.length; ++coli) { + var coll = parsexmltag(cols[coli], true); + if(coll.hidden) coll.hidden = parsexmlbool(coll.hidden); + var colm=parseInt(coll.min, 10)-1, colM=parseInt(coll.max,10)-1; + if(coll.outlineLevel) coll.level = (+coll.outlineLevel || 0); + delete coll.min; delete coll.max; coll.width = +coll.width; + if(!seencol && coll.width) { seencol = true; find_mdw_colw(coll.width); } + process_col(coll); + while(colm <= colM) columns[colm++] = dup(coll); + } +} +function write_ws_xml_cols(ws, cols)/*:string*/ { + var o = [""], col; + for(var i = 0; i != cols.length; ++i) { + if(!(col = cols[i])) continue; + o[o.length] = (writextag('col', null, col_obj_w(i, col))); + } + o[o.length] = ""; + return o.join(""); +} + +function parse_ws_xml_autofilter(data/*:string*/) { + var o = { ref: (data.match(/ref="([^"]*)"/)||[])[1]}; + return o; +} +function write_ws_xml_autofilter(data, ws, wb, idx)/*:string*/ { + var ref = typeof data.ref == "string" ? data.ref : encode_range(data.ref); + if(!wb.Workbook) wb.Workbook = ({Sheets:[]}/*:any*/); + if(!wb.Workbook.Names) wb.Workbook.Names = []; + var names/*: Array */ = wb.Workbook.Names; + var range = decode_range(ref); + if(range.s.r == range.e.r) { range.e.r = decode_range(ws["!ref"]).e.r; ref = encode_range(range); } + for(var i = 0; i < names.length; ++i) { + var name = names[i]; + if(name.Name != '_xlnm._FilterDatabase') continue; + if(name.Sheet != idx) continue; + name.Ref = formula_quote_sheet_name(wb.SheetNames[idx]) + "!" + fix_range(ref); break; + } + if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: "'" + wb.SheetNames[idx] + "'!" + ref }); + return writextag("autoFilter", null, {ref:ref}); +} + +/* 18.3.1.88 sheetViews CT_SheetViews */ +/* 18.3.1.87 sheetView CT_SheetView */ +var sviewregex = /<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/?>/g; +function parse_ws_xml_sheetviews(data, wb/*:WBWBProps*/) { + if(!wb.Views) wb.Views = [{}]; + (data.match(sviewregex)||[]).forEach(function(r/*:string*/, i/*:number*/) { + var tag = parsexmltag(r); + // $FlowIgnore + if(!wb.Views[i]) wb.Views[i] = {}; + // $FlowIgnore + if(+tag.zoomScale) wb.Views[i].zoom = +tag.zoomScale; + // $FlowIgnore + if(tag.rightToLeft && parsexmlbool(tag.rightToLeft)) wb.Views[i].RTL = true; + }); +} +function write_ws_xml_sheetviews(ws, opts, idx, wb)/*:string*/ { + var sview = ({workbookViewId:"0"}/*:any*/); + // $FlowIgnore + if((((wb||{}).Workbook||{}).Views||[])[0]) sview.rightToLeft = wb.Workbook.Views[0].RTL ? "1" : "0"; + return writextag("sheetViews", writextag("sheetView", null, sview), {}); +} + +function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts, idx, wb, date1904)/*:string*/ { + if(cell.c) ws['!comments'].push([ref, cell.c]); + if((cell.v === undefined || cell.t === "z" && !(opts||{}).sheetStubs) && typeof cell.f !== "string" && typeof cell.z == "undefined") return ""; + var vv = ""; + var oldt = cell.t, oldv = cell.v; + if(cell.t !== "z") switch(cell.t) { + case 'b': vv = cell.v ? "1" : "0"; break; + case 'n': + if(isNaN(cell.v)) { cell.t = "e"; vv = BErr[cell.v = 0x24]; } // #NUM! + else if(!isFinite(cell.v)) { cell.t = "e"; vv = BErr[cell.v = 0x07]; } // #DIV/0! + else vv = ''+cell.v; break; + case 'e': vv = BErr[cell.v]; break; + case 'd': + if(opts && opts.cellDates) { + var _vv = parseDate(cell.v, date1904); + vv = _vv.toISOString(); + if(_vv.getUTCFullYear() < 1900) vv = vv.slice(vv.indexOf("T") + 1).replace("Z",""); + } else { + cell = dup(cell); + cell.t = 'n'; + vv = ''+(cell.v = datenum(parseDate(cell.v, date1904), date1904)); + } + if(typeof cell.z === 'undefined') cell.z = table_fmt[14]; + break; + default: vv = cell.v; break; + } + var v = (cell.t == "z" || cell.v == null)? "" : writetag('v', escapexml(vv)), o = ({r:ref}/*:any*/); + /* TODO: cell style */ + var os = get_cell_style(opts.cellXfs, cell, opts); + if(os !== 0) o.s = os; + switch(cell.t) { + case 'n': break; + case 'd': o.t = "d"; break; + case 'b': o.t = "b"; break; + case 'e': o.t = "e"; break; + case 'z': break; + default: if(cell.v == null) { delete cell.t; break; } + if(cell.v.length > 32767) throw new Error("Text length must not exceed 32767 characters"); + if(opts && opts.bookSST) { + v = writetag('v', ''+get_sst_id(opts.Strings, cell.v, opts.revStrings)); + o.t = "s"; break; + } + else o.t = "str"; break; + } + if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; } + if(typeof cell.f == "string" && cell.f) { + var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null; + v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : ""); + } + if(cell.l) { + cell.l.display = escapexml(vv); + ws['!links'].push([ref, cell.l]); + } + if(cell.D) o.cm = 1; + return writextag('c', v, o); +} + +var parse_ws_xml_data = /*#__PURE__*/(function() { + var cellregex = /<(?:\w+:)?c[ \/>]/, rowregex = /<\/(?:\w+:)?row>/; + var rregex = /r=["']([^"']*)["']/, isregex = /<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/; + var refregex = /ref=["']([^"']*)["']/; + var match_v = matchtag("v"), match_f = matchtag("f"); + +return function parse_ws_xml_data(sdata/*:string*/, s, opts, guess/*:Range*/, themes, styles, wb) { + var ri = 0, x = "", cells/*:Array*/ = [], cref/*:?Array*/ = [], idx=0, i=0, cc=0, d="", p/*:any*/; + var tag, tagr = 0, tagc = 0; + var sstr, ftag; + var fmtid = 0, fillid = 0; + var do_format = Array.isArray(styles.CellXf), cf; + var arrayf/*:Array<[Range, string]>*/ = []; + var sharedf = []; + var dense = s["!data"] != null; + var rows/*:Array*/ = [], rowobj = {}, rowrite = false; + var sheetStubs = !!opts.sheetStubs; + var date1904 = !!((wb||{}).WBProps||{}).date1904; + for(var marr = sdata.split(rowregex), mt = 0, marrlen = marr.length; mt != marrlen; ++mt) { + x = marr[mt].trim(); + var xlen = x.length; + if(xlen === 0) continue; + + /* 18.3.1.73 row CT_Row */ + var rstarti = 0; + outa: for(ri = 0; ri < xlen; ++ri) switch(/*x.charCodeAt(ri)*/x[ri]) { + case ">" /*62*/: + if(/*x.charCodeAt(ri-1) != 47*/x[ri-1] != "/") { ++ri; break outa; } + if(opts && opts.cellStyles) { + // TODO: avoid duplication + tag = parsexmltag(x.slice(rstarti,ri), true); + tagr = tag.r != null ? parseInt(tag.r, 10) : tagr+1; tagc = -1; + if(opts.sheetRows && opts.sheetRows < tagr) continue; + rowobj = {}; rowrite = false; + if(tag.ht) { rowrite = true; rowobj.hpt = parseFloat(tag.ht); rowobj.hpx = pt2px(rowobj.hpt); } + if(tag.hidden && parsexmlbool(tag.hidden)) { rowrite = true; rowobj.hidden = true; } + if(tag.outlineLevel != null) { rowrite = true; rowobj.level = +tag.outlineLevel; } + if(rowrite) rows[tagr-1] = rowobj; + } + break; + case "<" /*60*/: rstarti = ri; break; + } + if(rstarti >= ri) break; + tag = parsexmltag(x.slice(rstarti,ri), true); + tagr = tag.r != null ? parseInt(tag.r, 10) : tagr+1; tagc = -1; + if(opts.sheetRows && opts.sheetRows < tagr) continue; + if(!opts.nodim) { + if(guess.s.r > tagr - 1) guess.s.r = tagr - 1; + if(guess.e.r < tagr - 1) guess.e.r = tagr - 1; + } + + if(opts && opts.cellStyles) { + rowobj = {}; rowrite = false; + if(tag.ht) { rowrite = true; rowobj.hpt = parseFloat(tag.ht); rowobj.hpx = pt2px(rowobj.hpt); } + if(tag.hidden && parsexmlbool(tag.hidden)) { rowrite = true; rowobj.hidden = true; } + if(tag.outlineLevel != null) { rowrite = true; rowobj.level = +tag.outlineLevel; } + if(rowrite) rows[tagr-1] = rowobj; + } + + /* 18.3.1.4 c CT_Cell */ + cells = x.slice(ri).split(cellregex); + for(var rslice = 0; rslice != cells.length; ++rslice) if(cells[rslice].trim().charAt(0) != "<") break; + cells = cells.slice(rslice); + for(ri = 0; ri != cells.length; ++ri) { + x = cells[ri].trim(); + if(x.length === 0) continue; + cref = x.match(rregex); idx = ri; i=0; cc=0; + x = "":"") + x; + if(cref != null && cref.length === 2) { + idx = 0; d=cref[1]; + for(i=0; i != d.length; ++i) { + if((cc=d.charCodeAt(i)-64) < 1 || cc > 26) break; + idx = 26*idx + cc; + } + --idx; + tagc = idx; + } else ++tagc; + for(i = 0; i != x.length; ++i) if(x.charCodeAt(i) === 62) break; ++i; + tag = parsexmltag(x.slice(0,i), true); + if(!tag.r) tag.r = encode_cell({r:tagr-1, c:tagc}); + d = x.slice(i); + p = ({t:""}/*:any*/); + + if((cref=d.match(match_v))!= null && /*::cref != null && */cref[1] !== '') p.v=unescapexml(cref[1]); + if(opts.cellFormula) { + if((cref=d.match(match_f))!= null /*:: && cref != null*/) { + if(cref[1] == "") { + if(/*::cref != null && cref[0] != null && */cref[0].indexOf('t="shared"') > -1) { + // TODO: parse formula + ftag = parsexmltag(cref[0]); + if(sharedf[ftag.si]) p.f = shift_formula_xlsx(sharedf[ftag.si][1], sharedf[ftag.si][2]/*[0].ref*/, tag.r); + } + } else { + /* TODO: match against XLSXFutureFunctions */ + p.f=unescapexml(utf8read(cref[1]), true); + if(!opts.xlfn) p.f = _xlfn(p.f); + if(/*::cref != null && cref[0] != null && */cref[0].indexOf('t="array"') > -1) { + p.F = (d.match(refregex)||[])[1]; + if(p.F.indexOf(":") > -1) arrayf.push([safe_decode_range(p.F), p.F]); + } else if(/*::cref != null && cref[0] != null && */cref[0].indexOf('t="shared"') > -1) { + // TODO: parse formula + ftag = parsexmltag(cref[0]); + var ___f = unescapexml(utf8read(cref[1])); + if(!opts.xlfn) ___f = _xlfn(___f); + sharedf[parseInt(ftag.si, 10)] = [ftag, ___f, tag.r]; + } + } + } else if((cref=d.match(/]*\/>/))) { + ftag = parsexmltag(cref[0]); + if(sharedf[ftag.si]) p.f = shift_formula_xlsx(sharedf[ftag.si][1], sharedf[ftag.si][2]/*[0].ref*/, tag.r); + } + /* TODO: factor out contains logic */ + var _tag = decode_cell(tag.r); + for(i = 0; i < arrayf.length; ++i) + if(_tag.r >= arrayf[i][0].s.r && _tag.r <= arrayf[i][0].e.r) + if(_tag.c >= arrayf[i][0].s.c && _tag.c <= arrayf[i][0].e.c) + p.F = arrayf[i][1]; + } + + if(tag.t == null && p.v === undefined) { + if(p.f || p.F) { + p.v = 0; p.t = "n"; + } else if(!sheetStubs) continue; + else p.t = "z"; + } + else p.t = tag.t || "n"; + if(guess.s.c > tagc) guess.s.c = tagc; + if(guess.e.c < tagc) guess.e.c = tagc; + /* 18.18.11 t ST_CellType */ + switch(p.t) { + case 'n': + if(p.v == "" || p.v == null) { + if(!sheetStubs) continue; + p.t = 'z'; + } else p.v = parseFloat(p.v); + break; + case 's': + if(typeof p.v == 'undefined') { + if(!sheetStubs) continue; + p.t = 'z'; + } else { + sstr = strs[parseInt(p.v, 10)]; + p.v = sstr.t; + p.r = sstr.r; + if(opts.cellHTML) p.h = sstr.h; + } + break; + case 'str': + p.t = "s"; + p.v = (p.v!=null) ? unescapexml(utf8read(p.v), true) : ''; + if(opts.cellHTML) p.h = escapehtml(p.v); + break; + case 'inlineStr': + cref = d.match(isregex); + p.t = 's'; + if(cref != null && (sstr = parse_si(cref[1]))) { + p.v = sstr.t; + if(opts.cellHTML) p.h = sstr.h; + } else p.v = ""; + break; + case 'b': p.v = parsexmlbool(p.v); break; + case 'd': + if(opts.cellDates) p.v = parseDate(p.v, date1904); + else { p.v = datenum(parseDate(p.v, date1904), date1904); p.t = 'n'; } + break; + /* error string in .w, number in .v */ + case 'e': + if(!opts || opts.cellText !== false) p.w = p.v; + p.v = RBErr[p.v]; break; + } + /* formatting */ + fmtid = fillid = 0; + cf = null; + if(do_format && tag.s !== undefined) { + cf = styles.CellXf[tag.s]; + if(cf != null) { + if(cf.numFmtId != null) fmtid = cf.numFmtId; + if(opts.cellStyles) { + if(cf.fillId != null) fillid = cf.fillId; + } + } + } + safe_format(p, fmtid, fillid, opts, themes, styles, date1904); + if(opts.cellDates && do_format && p.t == 'n' && fmt_is_date(table_fmt[fmtid])) { p.v = numdate(p.v + (date1904 ? 1462 : 0)); p.t = typeof p.v == "number" ? 'n' : 'd'; } + if(tag.cm && opts.xlmeta) { + var cm = (opts.xlmeta.Cell||[])[+tag.cm-1]; + if(cm && cm.type == 'XLDAPR') p.D = true; + } + var _r; + if(opts.nodim) { + _r = decode_cell(tag.r); + if(guess.s.r > _r.r) guess.s.r = _r.r; + if(guess.e.r < _r.r) guess.e.r = _r.r; + } + if(dense) { + _r = decode_cell(tag.r); + if(!s["!data"][_r.r]) s["!data"][_r.r] = []; + s["!data"][_r.r][_r.c] = p; + } else s[tag.r] = p; + } + } + if(rows.length > 0) s['!rows'] = rows; +}; })(); + +function write_ws_xml_data(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*//*::, rels*/)/*:string*/ { + var o/*:Array*/ = [], r/*:Array*/ = [], range = safe_decode_range(ws['!ref']), cell="", ref, rr = "", cols/*:Array*/ = [], R=0, C=0, rows = ws['!rows']; + var dense = ws["!data"] != null; + var params = ({r:rr}/*:any*/), row/*:RowInfo*/, height = -1; + var date1904 = (((wb||{}).Workbook||{}).WBProps||{}).date1904; + for(C = range.s.c; C <= range.e.c; ++C) cols[C] = encode_col(C); + for(R = range.s.r; R <= range.e.r; ++R) { + r = []; + rr = encode_row(R); + for(C = range.s.c; C <= range.e.c; ++C) { + ref = cols[C] + rr; + var _cell = dense ? (ws["!data"][R]||[])[C]: ws[ref]; + if(_cell === undefined) continue; + if((cell = write_ws_xml_cell(_cell, ref, ws, opts, idx, wb, date1904)) != null) r.push(cell); + } + if(r.length > 0 || (rows && rows[R])) { + params = ({r:rr}/*:any*/); + if(rows && rows[R]) { + row = rows[R]; + if(row.hidden) params.hidden = 1; + height = -1; + if(row.hpx) height = px2pt(row.hpx); + else if(row.hpt) height = row.hpt; + if(height > -1) { params.ht = height; params.customHeight = 1; } + if(row.level) { params.outlineLevel = row.level; } + } + o[o.length] = (writextag('row', r.join(""), params)); + } + } + if(rows) for(; R < rows.length; ++R) { + if(rows && rows[R]) { + params = ({r:R+1}/*:any*/); + row = rows[R]; + if(row.hidden) params.hidden = 1; + height = -1; + if (row.hpx) height = px2pt(row.hpx); + else if (row.hpt) height = row.hpt; + if (height > -1) { params.ht = height; params.customHeight = 1; } + if (row.level) { params.outlineLevel = row.level; } + o[o.length] = (writextag('row', "", params)); + } + } + return o.join(""); +} + +function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ { + var o = [XML_HEADER, writextag('worksheet', null, { + 'xmlns': XMLNS_main[0], + 'xmlns:r': XMLNS.r + })]; + var s = wb.SheetNames[idx], sidx = 0, rdata = ""; + var ws = wb.Sheets[s]; + if(ws == null) ws = {}; + var ref = ws['!ref'] || 'A1'; + var range = safe_decode_range(ref); + if(range.e.c > 0x3FFF || range.e.r > 0xFFFFF) { + if(opts.WTF) throw new Error("Range " + ref + " exceeds format limit A1:XFD1048576"); + range.e.c = Math.min(range.e.c, 0x3FFF); + range.e.r = Math.min(range.e.c, 0xFFFFF); + ref = encode_range(range); + } + if(!rels) rels = {}; + ws['!comments'] = []; + var _drawing = []; + + write_ws_xml_sheetpr(ws, wb, idx, opts, o); + + o[o.length] = (writextag('dimension', null, {'ref': ref})); + + o[o.length] = write_ws_xml_sheetviews(ws, opts, idx, wb); + + /* TODO: store in WB, process styles */ + if(opts.sheetFormat) o[o.length] = (writextag('sheetFormatPr', null, { + defaultRowHeight:opts.sheetFormat.defaultRowHeight||'16', + baseColWidth:opts.sheetFormat.baseColWidth||'10', + outlineLevelRow:opts.sheetFormat.outlineLevelRow||'7' + })); + + if(ws['!cols'] != null && ws['!cols'].length > 0) o[o.length] = (write_ws_xml_cols(ws, ws['!cols'])); + + o[sidx = o.length] = ''; + ws['!links'] = []; + if(ws['!ref'] != null) { + rdata = write_ws_xml_data(ws, opts, idx, wb, rels); + if(rdata.length > 0) o[o.length] = (rdata); + } + if(o.length>sidx+1) { o[o.length] = (''); o[sidx]=o[sidx].replace("/>",">"); } + + /* sheetCalcPr */ + + if(ws['!protect']) o[o.length] = write_ws_xml_protection(ws['!protect']); + + /* protectedRanges */ + /* scenarios */ + + if(ws['!autofilter'] != null) o[o.length] = write_ws_xml_autofilter(ws['!autofilter'], ws, wb, idx); + + /* sortState */ + /* dataConsolidate */ + /* customSheetViews */ + + if(ws['!merges'] != null && ws['!merges'].length > 0) o[o.length] = (write_ws_xml_merges(ws['!merges'])); + + /* phoneticPr */ + /* conditionalFormatting */ + /* dataValidations */ + + var relc = -1, rel, rId = -1; + if(/*::(*/ws['!links']/*::||[])*/.length > 0) { + o[o.length] = ""; + /*::(*/ws['!links']/*::||[])*/.forEach(function(l) { + if(!l[1].Target) return; + rel = ({"ref":l[0]}/*:any*/); + if(l[1].Target.charAt(0) != "#") { + rId = add_rels(rels, -1, escapexml(l[1].Target).replace(/#.*$/, ""), RELS.HLINK); + rel["r:id"] = "rId"+rId; + } + if((relc = l[1].Target.indexOf("#")) > -1) rel.location = escapexml(l[1].Target.slice(relc+1)); + if(l[1].Tooltip) rel.tooltip = escapexml(l[1].Tooltip); + rel.display = l[1].display; + o[o.length] = writextag("hyperlink",null,rel); + }); + o[o.length] = ""; + } + delete ws['!links']; + + /* printOptions */ + + if(ws['!margins'] != null) o[o.length] = write_ws_xml_margins(ws['!margins']); + + /* pageSetup */ + /* headerFooter */ + /* rowBreaks */ + /* colBreaks */ + /* customProperties */ + /* cellWatches */ + + if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref})); + + /* smartTags */ + + if(_drawing.length > 0) { + rId = add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW); + o[o.length] = writextag("drawing", null, {"r:id":"rId" + rId}); + ws['!drawing'] = _drawing; + } + + if(ws['!comments'].length > 0) { + rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx+1) + ".vml", RELS.VML); + o[o.length] = writextag("legacyDrawing", null, {"r:id":"rId" + rId}); + ws['!legacy'] = rId; + } + + /* legacyDrawingHF */ + /* picture */ + /* oleObjects */ + /* controls */ + /* webPublishItems */ + /* tableParts */ + /* extLst */ + + if(o.length>1) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } + return o.join(""); +} + +/* [MS-XLSB] 2.4.726 BrtRowHdr */ +function parse_BrtRowHdr(data, length) { + var z = ({}/*:any*/); + var tgt = data.l + length; + z.r = data.read_shift(4); + data.l += 4; // TODO: ixfe + var miyRw = data.read_shift(2); + data.l += 1; // TODO: top/bot padding + var flags = data.read_shift(1); + data.l = tgt; + if(flags & 0x07) z.level = flags & 0x07; + if(flags & 0x10) z.hidden = true; + if(flags & 0x20) z.hpt = miyRw / 20; + return z; +} +function write_BrtRowHdr(R/*:number*/, range, ws) { + var o = new_buf(17+8*16); + var row = (ws['!rows']||[])[R]||{}; + o.write_shift(4, R); + + o.write_shift(4, 0); /* TODO: ixfe */ + + var miyRw = 0x0140; + if(row.hpx) miyRw = px2pt(row.hpx) * 20; + else if(row.hpt) miyRw = row.hpt * 20; + o.write_shift(2, miyRw); + + o.write_shift(1, 0); /* top/bot padding */ + + var flags = 0x0; + if(row.level) flags |= row.level; + if(row.hidden) flags |= 0x10; + if(row.hpx || row.hpt) flags |= 0x20; + o.write_shift(1, flags); + + o.write_shift(1, 0); /* phonetic guide */ + + /* [MS-XLSB] 2.5.8 BrtColSpan explains the mechanism */ + var ncolspan = 0, lcs = o.l; + o.l += 4; + + var caddr = {r:R, c:0}; + var dense = ws["!data"] != null; + for(var i = 0; i < 16; ++i) { + if((range.s.c > ((i+1) << 10)) || (range.e.c < (i << 10))) continue; + var first = -1, last = -1; + for(var j = (i<<10); j < ((i+1)<<10); ++j) { + caddr.c = j; + var cell = dense ? (ws["!data"][caddr.r]||[])[caddr.c] : ws[encode_cell(caddr)]; + if(cell) { if(first < 0) first = j; last = j; } + } + if(first < 0) continue; + ++ncolspan; + o.write_shift(4, first); + o.write_shift(4, last); + } + + var l = o.l; + o.l = lcs; + o.write_shift(4, ncolspan); + o.l = l; + + return o.length > o.l ? o.slice(0, o.l) : o; +} +function write_row_header(ba, ws, range, R) { + var o = write_BrtRowHdr(R, range, ws); + if((o.length > 17) || (ws['!rows']||[])[R]) write_record(ba, 0x0000 /* BrtRowHdr */, o); +} + +/* [MS-XLSB] 2.4.820 BrtWsDim */ +var parse_BrtWsDim = parse_UncheckedRfX; +var write_BrtWsDim = write_UncheckedRfX; + +/* [MS-XLSB] 2.4.821 BrtWsFmtInfo */ +function parse_BrtWsFmtInfo(/*::data, length*/) { +} +//function write_BrtWsFmtInfo(ws, o) { } + +/* [MS-XLSB] 2.4.823 BrtWsProp */ +function parse_BrtWsProp(data, length) { + var z = {}; + var f = data[data.l]; ++data.l; + z.above = !(f & 0x40); + z.left = !(f & 0x80); + /* TODO: pull flags */ + data.l += 18; + z.name = parse_XLSBCodeName(data, length - 19); + return z; +} +function write_BrtWsProp(str, outl, o) { + if(o == null) o = new_buf(84+4*str.length); + var f = 0xC0; + if(outl) { + if(outl.above) f &= ~0x40; + if(outl.left) f &= ~0x80; + } + o.write_shift(1, f); + for(var i = 1; i < 3; ++i) o.write_shift(1,0); + write_BrtColor({auto:1}, o); + o.write_shift(-4,-1); + o.write_shift(-4,-1); + write_XLSBCodeName(str, o); + return o.slice(0, o.l); +} + +/* [MS-XLSB] 2.4.306 BrtCellBlank */ +function parse_BrtCellBlank(data) { + var cell = parse_XLSBCell(data); + return [cell]; +} +function write_BrtCellBlank(cell, ncell, o) { + if(o == null) o = new_buf(8); + return write_XLSBCell(ncell, o); +} +function parse_BrtShortBlank(data) { + var cell = parse_XLSBShortCell(data); + return [cell]; +} +function write_BrtShortBlank(cell, ncell, o) { + if(o == null) o = new_buf(4); + return write_XLSBShortCell(ncell, o); +} + +/* [MS-XLSB] 2.4.307 BrtCellBool */ +function parse_BrtCellBool(data) { + var cell = parse_XLSBCell(data); + var fBool = data.read_shift(1); + return [cell, fBool, 'b']; +} +function write_BrtCellBool(cell, ncell, o) { + if(o == null) o = new_buf(9); + write_XLSBCell(ncell, o); + o.write_shift(1, cell.v ? 1 : 0); + return o; +} +function parse_BrtShortBool(data) { + var cell = parse_XLSBShortCell(data); + var fBool = data.read_shift(1); + return [cell, fBool, 'b']; +} +function write_BrtShortBool(cell, ncell, o) { + if(o == null) o = new_buf(5); + write_XLSBShortCell(ncell, o); + o.write_shift(1, cell.v ? 1 : 0); + return o; +} + +/* [MS-XLSB] 2.4.308 BrtCellError */ +function parse_BrtCellError(data) { + var cell = parse_XLSBCell(data); + var bError = data.read_shift(1); + return [cell, bError, 'e']; +} +function write_BrtCellError(cell, ncell, o) { + if(o == null) o = new_buf(9); + write_XLSBCell(ncell, o); + o.write_shift(1, cell.v); + return o; +} +function parse_BrtShortError(data) { + var cell = parse_XLSBShortCell(data); + var bError = data.read_shift(1); + return [cell, bError, 'e']; +} +function write_BrtShortError(cell, ncell, o) { + if(o == null) o = new_buf(8); + write_XLSBShortCell(ncell, o); + o.write_shift(1, cell.v); + o.write_shift(2, 0); + o.write_shift(1, 0); + return o; +} + + +/* [MS-XLSB] 2.4.311 BrtCellIsst */ +function parse_BrtCellIsst(data) { + var cell = parse_XLSBCell(data); + var isst = data.read_shift(4); + return [cell, isst, 's']; +} +function write_BrtCellIsst(cell, ncell, o) { + if(o == null) o = new_buf(12); + write_XLSBCell(ncell, o); + o.write_shift(4, ncell.v); + return o; +} +function parse_BrtShortIsst(data) { + var cell = parse_XLSBShortCell(data); + var isst = data.read_shift(4); + return [cell, isst, 's']; +} +function write_BrtShortIsst(cell, ncell, o) { + if(o == null) o = new_buf(8); + write_XLSBShortCell(ncell, o); + o.write_shift(4, ncell.v); + return o; +} + +/* [MS-XLSB] 2.4.313 BrtCellReal */ +function parse_BrtCellReal(data) { + var cell = parse_XLSBCell(data); + var value = parse_Xnum(data); + return [cell, value, 'n']; +} +function write_BrtCellReal(cell, ncell, o) { + if(o == null) o = new_buf(16); + write_XLSBCell(ncell, o); + write_Xnum(cell.v, o); + return o; +} +function parse_BrtShortReal(data) { + var cell = parse_XLSBShortCell(data); + var value = parse_Xnum(data); + return [cell, value, 'n']; +} +function write_BrtShortReal(cell, ncell, o) { + if(o == null) o = new_buf(12); + write_XLSBShortCell(ncell, o); + write_Xnum(cell.v, o); + return o; +} + +/* [MS-XLSB] 2.4.314 BrtCellRk */ +function parse_BrtCellRk(data) { + var cell = parse_XLSBCell(data); + var value = parse_RkNumber(data); + return [cell, value, 'n']; +} +function write_BrtCellRk(cell, ncell, o) { + if(o == null) o = new_buf(12); + write_XLSBCell(ncell, o); + write_RkNumber(cell.v, o); + return o; +} +function parse_BrtShortRk(data) { + var cell = parse_XLSBShortCell(data); + var value = parse_RkNumber(data); + return [cell, value, 'n']; +} +function write_BrtShortRk(cell, ncell, o) { + if(o == null) o = new_buf(8); + write_XLSBShortCell(ncell, o); + write_RkNumber(cell.v, o); + return o; +} + +/* [MS-XLSB] 2.4.323 BrtCellRString */ +function parse_BrtCellRString(data) { + var cell = parse_XLSBCell(data); + var value = parse_RichStr(data); + return [cell, value, 'is']; +} + +/* [MS-XLSB] 2.4.317 BrtCellSt */ +function parse_BrtCellSt(data) { + var cell = parse_XLSBCell(data); + var value = parse_XLWideString(data); + return [cell, value, 'str']; +} +function write_BrtCellSt(cell, ncell, o) { + var data = cell.v == null ? "" : String(cell.v); + if(o == null) o = new_buf(12 + 4 * cell.v.length); + write_XLSBCell(ncell, o); + write_XLWideString(data, o); + return o.length > o.l ? o.slice(0, o.l) : o; +} +function parse_BrtShortSt(data) { + var cell = parse_XLSBShortCell(data); + var value = parse_XLWideString(data); + return [cell, value, 'str']; +} +function write_BrtShortSt(cell, ncell, o) { + var data = cell.v == null ? "" : String(cell.v); + if(o == null) o = new_buf(8 + 4 * data.length); + write_XLSBShortCell(ncell, o); + write_XLWideString(data, o); + return o.length > o.l ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.4.653 BrtFmlaBool */ +function parse_BrtFmlaBool(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = data.read_shift(1); + var o = [cell, value, 'b']; + if(opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ + } + else data.l = end; + return o; +} + +/* [MS-XLSB] 2.4.654 BrtFmlaError */ +function parse_BrtFmlaError(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = data.read_shift(1); + var o = [cell, value, 'e']; + if(opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ + } + else data.l = end; + return o; +} + +/* [MS-XLSB] 2.4.655 BrtFmlaNum */ +function parse_BrtFmlaNum(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = parse_Xnum(data); + var o = [cell, value, 'n']; + if(opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ + } + else data.l = end; + return o; +} + +/* [MS-XLSB] 2.4.656 BrtFmlaString */ +function parse_BrtFmlaString(data, length, opts) { + var end = data.l + length; + var cell = parse_XLSBCell(data); + cell.r = opts['!row']; + var value = parse_XLWideString(data); + var o = [cell, value, 'str']; + if(opts.cellFormula) { + data.l += 2; + var formula = parse_XLSBCellParsedFormula(data, end - data.l, opts); + o[3] = stringify_formula(formula, null/*range*/, cell, opts.supbooks, opts);/* TODO */ + } + else data.l = end; + return o; +} + +/* [MS-XLSB] 2.4.682 BrtMergeCell */ +var parse_BrtMergeCell = parse_UncheckedRfX; +var write_BrtMergeCell = write_UncheckedRfX; +/* [MS-XLSB] 2.4.107 BrtBeginMergeCells */ +function write_BrtBeginMergeCells(cnt, o) { + if(o == null) o = new_buf(4); + o.write_shift(4, cnt); + return o; +} + +/* [MS-XLSB] 2.4.662 BrtHLink */ +function parse_BrtHLink(data, length/*::, opts*/) { + var end = data.l + length; + var rfx = parse_UncheckedRfX(data, 16); + var relId = parse_XLNullableWideString(data); + var loc = parse_XLWideString(data); + var tooltip = parse_XLWideString(data); + var display = parse_XLWideString(data); + data.l = end; + var o = ({rfx:rfx, relId:relId, loc:loc, display:display}/*:any*/); + if(tooltip) o.Tooltip = tooltip; + return o; +} +function write_BrtHLink(l, rId) { + var o = new_buf(50+4*(l[1].Target.length + (l[1].Tooltip || "").length)); + write_UncheckedRfX({s:decode_cell(l[0]), e:decode_cell(l[0])}, o); + write_RelID("rId" + rId, o); + var locidx = l[1].Target.indexOf("#"); + var loc = locidx == -1 ? "" : l[1].Target.slice(locidx+1); + write_XLWideString(loc || "", o); + write_XLWideString(l[1].Tooltip || "", o); + write_XLWideString("", o); + return o.slice(0, o.l); +} + +/* [MS-XLSB] 2.4.692 BrtPane */ +function parse_BrtPane(/*data, length, opts*/) { +} + +/* [MS-XLSB] 2.4.6 BrtArrFmla */ +function parse_BrtArrFmla(data, length, opts) { + var end = data.l + length; + var rfx = parse_RfX(data, 16); + var fAlwaysCalc = data.read_shift(1); + var o = [rfx]; o[2] = fAlwaysCalc; + if(opts.cellFormula) { + var formula = parse_XLSBArrayParsedFormula(data, end - data.l, opts); + o[1] = formula; + } else data.l = end; + return o; +} + +/* [MS-XLSB] 2.4.750 BrtShrFmla */ +function parse_BrtShrFmla(data, length, opts) { + var end = data.l + length; + var rfx = parse_UncheckedRfX(data, 16); + var o = [rfx]; + if(opts.cellFormula) { + var formula = parse_XLSBSharedParsedFormula(data, end - data.l, opts); + o[1] = formula; + data.l = end; + } else data.l = end; + return o; +} + +/* [MS-XLSB] 2.4.323 BrtColInfo */ +/* TODO: once XLS ColInfo is set, combine the functions */ +function write_BrtColInfo(C/*:number*/, col, o) { + if(o == null) o = new_buf(18); + var p = col_obj_w(C, col); + o.write_shift(-4, C); + o.write_shift(-4, C); + o.write_shift(4, (p.width || 10) * 256); + o.write_shift(4, 0/*ixfe*/); // style + var flags = 0; + if(col.hidden) flags |= 0x01; + if(typeof p.width == 'number') flags |= 0x02; + if(col.level) flags |= (col.level << 8); + o.write_shift(2, flags); // bit flag + return o; +} + +/* [MS-XLSB] 2.4.678 BrtMargins */ +var BrtMarginKeys = ["left","right","top","bottom","header","footer"]; +function parse_BrtMargins(data/*::, length, opts*/)/*:Margins*/ { + var margins = ({}/*:any*/); + BrtMarginKeys.forEach(function(k) { margins[k] = parse_Xnum(data, 8); }); + return margins; +} +function write_BrtMargins(margins/*:Margins*/, o) { + if(o == null) o = new_buf(6*8); + default_margins(margins); + BrtMarginKeys.forEach(function(k) { write_Xnum((margins/*:any*/)[k], o); }); + return o; +} + +/* [MS-XLSB] 2.4.299 BrtBeginWsView */ +function parse_BrtBeginWsView(data/*::, length, opts*/) { + var f = data.read_shift(2); + data.l += 28; + return { RTL: f & 0x20 }; +} +function write_BrtBeginWsView(ws, Workbook, o) { + if(o == null) o = new_buf(30); + var f = 0x39c; + if((((Workbook||{}).Views||[])[0]||{}).RTL) f |= 0x20; + o.write_shift(2, f); // bit flag + o.write_shift(4, 0); + o.write_shift(4, 0); // view first row + o.write_shift(4, 0); // view first col + o.write_shift(1, 0); // gridline color ICV + o.write_shift(1, 0); + o.write_shift(2, 0); + o.write_shift(2, 100); // zoom scale + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(2, 0); + o.write_shift(4, 0); // workbook view id + return o; +} + +/* [MS-XLSB] 2.4.309 BrtCellIgnoreEC */ +function write_BrtCellIgnoreEC(ref) { + var o = new_buf(24); + o.write_shift(4, 4); + o.write_shift(4, 1); + write_UncheckedRfX(ref, o); + return o; +} + +/* [MS-XLSB] 2.4.748 BrtSheetProtection */ +function write_BrtSheetProtection(sp, o) { + if(o == null) o = new_buf(16*4+2); + o.write_shift(2, sp.password ? crypto_CreatePasswordVerifier_Method1(sp.password) : 0); + o.write_shift(4, 1); // this record should not be written if no protection + [ + ["objects", false], // fObjects + ["scenarios", false], // fScenarios + ["formatCells", true], // fFormatCells + ["formatColumns", true], // fFormatColumns + ["formatRows", true], // fFormatRows + ["insertColumns", true], // fInsertColumns + ["insertRows", true], // fInsertRows + ["insertHyperlinks", true], // fInsertHyperlinks + ["deleteColumns", true], // fDeleteColumns + ["deleteRows", true], // fDeleteRows + ["selectLockedCells", false], // fSelLockedCells + ["sort", true], // fSort + ["autoFilter", true], // fAutoFilter + ["pivotTables", true], // fPivotTables + ["selectUnlockedCells", false] // fSelUnlockedCells + ].forEach(function(n) { + /*:: if(o == null) throw "unreachable"; */ + if(n[1]) o.write_shift(4, sp[n[0]] != null && !sp[n[0]] ? 1 : 0); + else o.write_shift(4, sp[n[0]] != null && sp[n[0]] ? 0 : 1); + }); + return o; +} + +function parse_BrtDVal(/*data, length, opts*/) { +} +function parse_BrtDVal14(/*data, length, opts*/) { +} +/* [MS-XLSB] 2.1.7.61 Worksheet */ +function parse_ws_bin(data, _opts, idx, rels, wb/*:WBWBProps*/, themes, styles)/*:Worksheet*/ { + if(!data) return data; + var opts = _opts || {}; + if(!rels) rels = {'!id':{}}; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + var s/*:Worksheet*/ = ({}); if(opts.dense) s["!data"] = []; + + var ref; + var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; + + var state/*:Array*/ = []; + var pass = false, end = false; + var row, p, cf, R, C, addr, sstr, rr, cell/*:Cell*/; + var merges/*:Array*/ = []; + opts.biff = 12; + opts['!row'] = 0; + + var ai = 0, af = false; + + var arrayf/*:Array<[Range, string]>*/ = []; + var sharedf = {}; + var supbooks = opts.supbooks || /*::(*/wb/*:: :any)*/.supbooks || ([[]]/*:any*/); + supbooks.sharedf = sharedf; + supbooks.arrayf = arrayf; + supbooks.SheetNames = wb.SheetNames || wb.Sheets.map(function(x) { return x.name; }); + if(!opts.supbooks) { + opts.supbooks = supbooks; + if(wb.Names) for(var i = 0; i < wb.Names.length; ++i) supbooks[0][i+1] = wb.Names[i]; + } + + var colinfo/*:Array*/ = [], rowinfo/*:Array*/ = []; + var seencol = false; + + XLSBRecordEnum[0x0010] = { n:"BrtShortReal", f:parse_BrtShortReal }; + + var cm, vm; + var date1904 = 1462 * +!!((wb||{}).WBProps||{}).date1904; + + recordhopper(data, function ws_parse(val, RR, RT) { + if(end) return; + switch(RT) { + case 0x0094: /* 'BrtWsDim' */ + ref = val; break; + case 0x0000: /* 'BrtRowHdr' */ + row = val; + if(opts.sheetRows && opts.sheetRows <= row.r) end=true; + rr = encode_row(R = row.r); + opts['!row'] = row.r; + if(val.hidden || val.hpt || val.level != null) { + if(val.hpt) val.hpx = pt2px(val.hpt); + rowinfo[val.r] = val; + } + break; + + case 0x0002: /* 'BrtCellRk' */ + case 0x0003: /* 'BrtCellError' */ + case 0x0004: /* 'BrtCellBool' */ + case 0x0005: /* 'BrtCellReal' */ + case 0x0006: /* 'BrtCellSt' */ + case 0x0007: /* 'BrtCellIsst' */ + case 0x0008: /* 'BrtFmlaString' */ + case 0x0009: /* 'BrtFmlaNum' */ + case 0x000A: /* 'BrtFmlaBool' */ + case 0x000B: /* 'BrtFmlaError' */ + case 0x000D: /* 'BrtShortRk' */ + case 0x000E: /* 'BrtShortError' */ + case 0x000F: /* 'BrtShortBool' */ + case 0x0010: /* 'BrtShortReal' */ + case 0x0011: /* 'BrtShortSt' */ + case 0x0012: /* 'BrtShortIsst' */ + case 0x003E: /* 'BrtCellRString' */ + p = ({t:val[2]}/*:any*/); + switch(val[2]) { + case 'n': p.v = val[1]; break; + case 's': sstr = strs[val[1]]; p.v = sstr.t; p.r = sstr.r; break; + case 'b': p.v = val[1] ? true : false; break; + case 'e': p.v = val[1]; if(opts.cellText !== false) p.w = BErr[p.v]; break; + case 'str': p.t = 's'; p.v = val[1]; break; + case 'is': p.t = 's'; p.v = val[1].t; break; + } + if((cf = styles.CellXf[val[0].iStyleRef])) safe_format(p,cf.numFmtId,null,opts, themes, styles, date1904>0); + C = val[0].c == -1 ? C + 1 : val[0].c; + if(opts.dense) { if(!s["!data"][R]) s["!data"][R] = []; s["!data"][R][C] = p; } + else s[encode_col(C) + rr] = p; + if(opts.cellFormula) { + af = false; + for(ai = 0; ai < arrayf.length; ++ai) { + var aii = arrayf[ai]; + if(row.r >= aii[0].s.r && row.r <= aii[0].e.r) + if(C >= aii[0].s.c && C <= aii[0].e.c) { + p.F = encode_range(aii[0]); af = true; + } + } + if(!af && val.length > 3) p.f = val[3]; + } + + if(refguess.s.r > row.r) refguess.s.r = row.r; + if(refguess.s.c > C) refguess.s.c = C; + if(refguess.e.r < row.r) refguess.e.r = row.r; + if(refguess.e.c < C) refguess.e.c = C; + if(opts.cellDates && cf && p.t == 'n' && fmt_is_date(table_fmt[cf.numFmtId])) { + var _d = SSF_parse_date_code(p.v + date1904); if(_d) { p.t = 'd'; p.v = new Date(Date.UTC(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u)); } + } + if(cm) { + if(cm.type == 'XLDAPR') p.D = true; + cm = void 0; + } + if(vm) vm = void 0; + break; + + case 0x0001: /* 'BrtCellBlank' */ + case 0x000C: /* 'BrtShortBlank' */ + if(!opts.sheetStubs || pass) break; + p = ({t:'z',v:void 0}/*:any*/); + C = val[0].c == -1 ? C + 1 : val[0].c; + if(opts.dense) { if(!s["!data"][R]) s["!data"][R] = []; s["!data"][R][C] = p; } + else s[encode_col(C) + rr] = p; + if(refguess.s.r > row.r) refguess.s.r = row.r; + if(refguess.s.c > C) refguess.s.c = C; + if(refguess.e.r < row.r) refguess.e.r = row.r; + if(refguess.e.c < C) refguess.e.c = C; + if(cm) { + if(cm.type == 'XLDAPR') p.D = true; + cm = void 0; + } + if(vm) vm = void 0; + break; + + case 0x00B0: /* 'BrtMergeCell' */ + merges.push(val); break; + + case 0x0031: { /* 'BrtCellMeta' */ + cm = ((opts.xlmeta||{}).Cell||[])[val-1]; + } break; + + case 0x01EE: /* 'BrtHLink' */ + var rel = rels['!id'][val.relId]; + if(rel) { + val.Target = rel.Target; + if(val.loc) val.Target += "#"+val.loc; + val.Rel = rel; + } else if(val.relId == '') { + val.Target = "#" + val.loc; + } + for(R=val.rfx.s.r;R<=val.rfx.e.r;++R) for(C=val.rfx.s.c;C<=val.rfx.e.c;++C) { + if(opts.dense) { + if(!s["!data"][R]) s["!data"][R] = []; + if(!s["!data"][R][C]) s["!data"][R][C] = {t:'z',v:undefined}; + s["!data"][R][C].l = val; + } else { + addr = encode_col(C) + encode_row(R); + if(!s[addr]) s[addr] = {t:'z',v:undefined}; + s[addr].l = val; + } + } + break; + + case 0x01AA: /* 'BrtArrFmla' */ + if(!opts.cellFormula) break; + arrayf.push(val); + cell = ((opts.dense ? s["!data"][R][C] : s[encode_col(C) + rr])/*:any*/); + cell.f = stringify_formula(val[1], refguess, {r:row.r, c:C}, supbooks, opts); + cell.F = encode_range(val[0]); + break; + case 0x01AB: /* 'BrtShrFmla' */ + if(!opts.cellFormula) break; + sharedf[encode_cell(val[0].s)] = val[1]; + cell = (opts.dense ? s["!data"][R][C] : s[encode_col(C) + rr]); + cell.f = stringify_formula(val[1], refguess, {r:row.r, c:C}, supbooks, opts); + break; + + /* identical to 'ColInfo' in XLS */ + case 0x003C: /* 'BrtColInfo' */ + if(!opts.cellStyles) break; + while(val.e >= val.s) { + colinfo[val.e--] = { width: val.w/256, hidden: !!(val.flags & 0x01), level: val.level }; + if(!seencol) { seencol = true; find_mdw_colw(val.w/256); } + process_col(colinfo[val.e+1]); + } + break; + + case 0x0227: /* 'BrtLegacyDrawing' */ + if(val) s["!legrel"] = val; + break; + + case 0x00A1: /* 'BrtBeginAFilter' */ + s['!autofilter'] = { ref:encode_range(val) }; + break; + + case 0x01DC: /* 'BrtMargins' */ + s['!margins'] = val; + break; + + case 0x0093: /* 'BrtWsProp' */ + if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; + if(val.name) wb.Sheets[idx].CodeName = val.name; + if(val.above || val.left) s['!outline'] = { above: val.above, left: val.left }; + break; + + case 0x0089: /* 'BrtBeginWsView' */ + if(!wb.Views) wb.Views = [{}]; + if(!wb.Views[0]) wb.Views[0] = {}; + if(val.RTL) wb.Views[0].RTL = true; + break; + + case 0x01E5: /* 'BrtWsFmtInfo' */ + break; + + case 0x0040: /* 'BrtDVal' */ + case 0x041D: /* 'BrtDVal14' */ + break; + + case 0x0097: /* 'BrtPane' */ + break; + case 0x0098: /* 'BrtSel' */ + case 0x00AF: /* 'BrtAFilterDateGroupItem' */ + case 0x0284: /* 'BrtActiveX' */ + case 0x0271: /* 'BrtBigName' */ + case 0x0232: /* 'BrtBkHim' */ + case 0x018C: /* 'BrtBrk' */ + case 0x0458: /* 'BrtCFIcon' */ + case 0x047A: /* 'BrtCFRuleExt' */ + case 0x01D7: /* 'BrtCFVO' */ + case 0x041A: /* 'BrtCFVO14' */ + case 0x0289: /* 'BrtCellIgnoreEC' */ + case 0x0451: /* 'BrtCellIgnoreEC14' */ + case 0x024D: /* 'BrtCellSmartTagProperty' */ + case 0x025F: /* 'BrtCellWatch' */ + case 0x0234: /* 'BrtColor' */ + case 0x041F: /* 'BrtColor14' */ + case 0x00A8: /* 'BrtColorFilter' */ + case 0x00AE: /* 'BrtCustomFilter' */ + case 0x049C: /* 'BrtCustomFilter14' */ + case 0x01F3: /* 'BrtDRef' */ + case 0x01FB: /* 'BrtDXF' */ + case 0x0226: /* 'BrtDrawing' */ + case 0x00AB: /* 'BrtDynamicFilter' */ + case 0x00A7: /* 'BrtFilter' */ + case 0x0499: /* 'BrtFilter14' */ + case 0x00A9: /* 'BrtIconFilter' */ + case 0x049D: /* 'BrtIconFilter14' */ + case 0x0228: /* 'BrtLegacyDrawingHF' */ + case 0x0295: /* 'BrtListPart' */ + case 0x027F: /* 'BrtOleObject' */ + case 0x01DE: /* 'BrtPageSetup' */ + case 0x0219: /* 'BrtPhoneticInfo' */ + case 0x01DD: /* 'BrtPrintOptions' */ + case 0x0218: /* 'BrtRangeProtection' */ + case 0x044F: /* 'BrtRangeProtection14' */ + case 0x02A8: /* 'BrtRangeProtectionIso' */ + case 0x0450: /* 'BrtRangeProtectionIso14' */ + case 0x0400: /* 'BrtRwDescent' */ + case 0x0297: /* 'BrtSheetCalcProp' */ + case 0x0217: /* 'BrtSheetProtection' */ + case 0x02A6: /* 'BrtSheetProtectionIso' */ + case 0x01F8: /* 'BrtSlc' */ + case 0x0413: /* 'BrtSparkline' */ + case 0x01AC: /* 'BrtTable' */ + case 0x00AA: /* 'BrtTop10Filter' */ + case 0x0C00: /* 'BrtUid' */ + case 0x0032: /* 'BrtValueMeta' */ + case 0x0816: /* 'BrtWebExtension' */ + case 0x0415: /* 'BrtWsFmtInfoEx14' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + case 0x0025: /* 'BrtACBegin' */ + state.push(RT); pass = true; break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); pass = false; break; + + default: + if(RR.T){/* empty */} + else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }, opts); + + delete opts.supbooks; + delete opts['!row']; + + if(!s["!ref"] && (refguess.s.r < 2000000 || ref && (ref.e.r > 0 || ref.e.c > 0 || ref.s.r > 0 || ref.s.c > 0))) s["!ref"] = encode_range(ref || refguess); + if(opts.sheetRows && s["!ref"]) { + var tmpref = safe_decode_range(s["!ref"]); + if(opts.sheetRows <= +tmpref.e.r) { + tmpref.e.r = opts.sheetRows - 1; + if(tmpref.e.r > refguess.e.r) tmpref.e.r = refguess.e.r; + if(tmpref.e.r < tmpref.s.r) tmpref.s.r = tmpref.e.r; + if(tmpref.e.c > refguess.e.c) tmpref.e.c = refguess.e.c; + if(tmpref.e.c < tmpref.s.c) tmpref.s.c = tmpref.e.c; + s["!fullref"] = s["!ref"]; + s["!ref"] = encode_range(tmpref); + } + } + if(merges.length > 0) s["!merges"] = merges; + if(colinfo.length > 0) s["!cols"] = colinfo; + if(rowinfo.length > 0) s["!rows"] = rowinfo; + if(rels['!id'][s['!legrel']]) s['!legdrawel'] = rels['!id'][s['!legrel']]; + return s; +} + +/* TODO: something useful -- this is a stub */ +function write_ws_bin_cell(ba/*:BufArray*/, cell/*:Cell*/, R/*:number*/, C/*:number*/, opts, ws/*:Worksheet*/, last_seen/*:boolean*/, date1904/*:boolean*/)/*:boolean*/ { + var o/*:any*/ = ({r:R, c:C}/*:any*/); + if(cell.c) ws['!comments'].push([encode_cell(o), cell.c]); + if(cell.v === undefined) return false; + var vv = ""; + switch(cell.t) { + case 'b': vv = cell.v ? "1" : "0"; break; + case 'd': // no BrtCellDate :( + cell = dup(cell); + cell.z = cell.z || table_fmt[14]; + cell.v = datenum(parseDate(cell.v, date1904), date1904); cell.t = 'n'; + break; + /* falls through */ + case 'n': case 'e': vv = ''+cell.v; break; + default: vv = cell.v; break; + } + /* TODO: cell style */ + o.s = get_cell_style(opts.cellXfs, cell, opts); + if(cell.l) ws['!links'].push([encode_cell(o), cell.l]); + switch(cell.t) { + case 's': case 'str': + if(opts.bookSST) { + vv = get_sst_id(opts.Strings, (cell.v == null ? "" : String(cell.v)/*:any*/), opts.revStrings); + o.t = "s"; o.v = vv; + if(last_seen) write_record(ba, 0x0012 /* BrtShortIsst */, write_BrtShortIsst(cell, o)); + else write_record(ba, 0x0007 /* BrtCellIsst */, write_BrtCellIsst(cell, o)); + } else { + o.t = "str"; + if(last_seen) write_record(ba, 0x0011 /* BrtShortSt */, write_BrtShortSt(cell, o)); + else write_record(ba, 0x0006 /* BrtCellSt */, write_BrtCellSt(cell, o)); + } + return true; + case 'n': + /* TODO: determine threshold for Real vs RK */ + if(cell.v == (cell.v | 0) && cell.v > -1000 && cell.v < 1000) { + if(last_seen) write_record(ba, 0x000D /* BrtShortRk */, write_BrtShortRk(cell, o)); + else write_record(ba, 0x0002 /* BrtCellRk */, write_BrtCellRk(cell, o)); + } else if(isNaN(cell.v)) { + if(last_seen) write_record(ba, 0x000E /* BrtShortError */, write_BrtShortError({t:"e", v: 0x24}, o)); // #NUM! + else write_record(ba, 0x0003 /* BrtCellError */, write_BrtCellError({t:"e", v: 0x24}, o)); // #NUM! + } else if(!isFinite(cell.v)) { + if(last_seen) write_record(ba, 0x000E /* BrtShortError */, write_BrtShortError({t:"e", v: 0x07}, o)); // #DIV/0! + else write_record(ba, 0x0003 /* BrtCellError */, write_BrtCellError({t:"e", v: 0x07}, o)); // #DIV/0! + } else { + if(last_seen) write_record(ba, 0x0010 /* BrtShortReal */, write_BrtShortReal(cell, o)); + else write_record(ba, 0x0005 /* BrtCellReal */, write_BrtCellReal(cell, o)); + } return true; + case 'b': + o.t = "b"; + if(last_seen) write_record(ba, 0x000F /* BrtShortBool */, write_BrtShortBool(cell, o)); + else write_record(ba, 0x0004 /* BrtCellBool */, write_BrtCellBool(cell, o)); + return true; + case 'e': + o.t = "e"; + if(last_seen) write_record(ba, 0x000E /* BrtShortError */, write_BrtShortError(cell, o)); + else write_record(ba, 0x0003 /* BrtCellError */, write_BrtCellError(cell, o)); + return true; + } + if(last_seen) write_record(ba, 0x000C /* BrtShortBlank */, write_BrtShortBlank(cell, o)); + else write_record(ba, 0x0001 /* BrtCellBlank */, write_BrtCellBlank(cell, o)); + return true; +} + +function write_CELLTABLE(ba, ws/*:Worksheet*/, idx/*:number*/, opts, wb/*:Workbook*/) { + var range = safe_decode_range(ws['!ref'] || "A1"), ref, rr = "", cols/*:Array*/ = []; + var date1904 = (((wb||{}).Workbook||{}).WBProps||{}).date1904; + write_record(ba, 0x0091 /* BrtBeginSheetData */); + var dense = ws["!data"] != null; + var cap = range.e.r; + if(ws['!rows']) cap = Math.max(range.e.r, ws['!rows'].length - 1); + for(var R = range.s.r; R <= cap; ++R) { + rr = encode_row(R); + /* [ACCELLTABLE] */ + /* BrtRowHdr */ + write_row_header(ba, ws, range, R); + var last_seen = false; + if(R <= range.e.r) for(var C = range.s.c; C <= range.e.c; ++C) { + /* *16384CELL */ + if(R === range.s.r) cols[C] = encode_col(C); + ref = cols[C] + rr; + var cell = dense ? (ws["!data"][R]||[])[C] : ws[ref]; + if(!cell) { last_seen = false; continue; } + /* write cell */ + last_seen = write_ws_bin_cell(ba, cell, R, C, opts, ws, last_seen, date1904); + } + } + write_record(ba, 0x0092 /* BrtEndSheetData */); +} + +function write_MERGECELLS(ba, ws/*:Worksheet*/) { + if(!ws || !ws['!merges']) return; + write_record(ba, 0x00B1 /* BrtBeginMergeCells */, write_BrtBeginMergeCells(ws['!merges'].length)); + ws['!merges'].forEach(function(m) { write_record(ba, 0x00B0 /* BrtMergeCell */, write_BrtMergeCell(m)); }); + write_record(ba, 0x00B2 /* BrtEndMergeCells */); +} + +function write_COLINFOS(ba, ws/*:Worksheet*//*::, idx:number, opts, wb:Workbook*/) { + if(!ws || !ws['!cols']) return; + write_record(ba, 0x0186 /* BrtBeginColInfos */); + ws['!cols'].forEach(function(m, i) { if(m) write_record(ba, 0x003C /* 'BrtColInfo' */, write_BrtColInfo(i, m)); }); + write_record(ba, 0x0187 /* BrtEndColInfos */); +} + +function write_IGNOREECS(ba, ws/*:Worksheet*/) { + if(!ws || !ws['!ref']) return; + write_record(ba, 0x0288 /* BrtBeginCellIgnoreECs */); + write_record(ba, 0x0289 /* BrtCellIgnoreEC */, write_BrtCellIgnoreEC(safe_decode_range(ws['!ref']))); + write_record(ba, 0x028A /* BrtEndCellIgnoreECs */); +} + +function write_HLINKS(ba, ws/*:Worksheet*/, rels) { + /* *BrtHLink */ + ws['!links'].forEach(function(l) { + if(!l[1].Target) return; + var rId = add_rels(rels, -1, l[1].Target.replace(/#.*$/, ""), RELS.HLINK); + write_record(ba, 0x01EE /* BrtHLink */, write_BrtHLink(l, rId)); + }); + delete ws['!links']; +} +function write_LEGACYDRAWING(ba, ws/*:Worksheet*/, idx/*:number*/, rels) { + /* [BrtLegacyDrawing] */ + if(ws['!comments'].length > 0) { + var rId = add_rels(rels, -1, "../drawings/vmlDrawing" + (idx+1) + ".vml", RELS.VML); + write_record(ba, 0x0227 /* BrtLegacyDrawing */, write_RelID("rId" + rId)); + ws['!legacy'] = rId; + } +} + +function write_AUTOFILTER(ba, ws, wb, idx) { + if(!ws['!autofilter']) return; + var data = ws['!autofilter']; + var ref = typeof data.ref === "string" ? data.ref : encode_range(data.ref); + + /* Update FilterDatabase defined name for the worksheet */ + if(!wb.Workbook) wb.Workbook = ({Sheets:[]}/*:any*/); + if(!wb.Workbook.Names) wb.Workbook.Names = []; + var names/*: Array */ = wb.Workbook.Names; + var range = decode_range(ref); + if(range.s.r == range.e.r) { range.e.r = decode_range(ws["!ref"]).e.r; ref = encode_range(range); } + for(var i = 0; i < names.length; ++i) { + var name = names[i]; + if(name.Name != '_xlnm._FilterDatabase') continue; + if(name.Sheet != idx) continue; + name.Ref = formula_quote_sheet_name(wb.SheetNames[idx]) + "!" + fix_range(ref); break; + } + if(i == names.length) names.push({ Name: '_xlnm._FilterDatabase', Sheet: idx, Ref: formula_quote_sheet_name(wb.SheetNames[idx]) + "!" + fix_range(ref) }); + + write_record(ba, 0x00A1 /* BrtBeginAFilter */, write_UncheckedRfX(safe_decode_range(ref))); + /* *FILTERCOLUMN */ + /* [SORTSTATE] */ + /* BrtEndAFilter */ + write_record(ba, 0x00A2 /* BrtEndAFilter */); +} + +function write_WSVIEWS2(ba, ws, Workbook) { + write_record(ba, 0x0085 /* BrtBeginWsViews */); + { /* 1*WSVIEW2 */ + /* [ACUID] */ + write_record(ba, 0x0089 /* BrtBeginWsView */, write_BrtBeginWsView(ws, Workbook)); + /* [BrtPane] */ + /* *4BrtSel */ + /* *4SXSELECT */ + /* *FRT */ + write_record(ba, 0x008A /* BrtEndWsView */); + } + /* *FRT */ + write_record(ba, 0x0086 /* BrtEndWsViews */); +} + +function write_WSFMTINFO(/*::ba, ws*/) { + /* [ACWSFMTINFO] */ + // write_record(ba, 0x01E5 /* BrtWsFmtInfo */, write_BrtWsFmtInfo(ws)); +} + +function write_SHEETPROTECT(ba, ws) { + if(!ws['!protect']) return; + /* [BrtSheetProtectionIso] */ + write_record(ba, 0x0217 /* BrtSheetProtection */, write_BrtSheetProtection(ws['!protect'])); +} + +function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) { + var ba = buf_array(); + var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {}; + var c/*:string*/ = s; try { if(wb && wb.Workbook) c = wb.Workbook.Sheets[idx].CodeName || c; } catch(e) {} + var r = safe_decode_range(ws['!ref'] || "A1"); + if(r.e.c > 0x3FFF || r.e.r > 0xFFFFF) { + if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:XFD1048576"); + r.e.c = Math.min(r.e.c, 0x3FFF); + r.e.r = Math.min(r.e.c, 0xFFFFF); + } + ws['!links'] = []; + /* passed back to write_zip and removed there */ + ws['!comments'] = []; + write_record(ba, 0x0081 /* BrtBeginSheet */); + if(wb.vbaraw || ws['!outline']) write_record(ba, 0x0093 /* BrtWsProp */, write_BrtWsProp(c, ws['!outline'])); + write_record(ba, 0x0094 /* BrtWsDim */, write_BrtWsDim(r)); + write_WSVIEWS2(ba, ws, wb.Workbook); + write_WSFMTINFO(ba, ws); + write_COLINFOS(ba, ws, idx, opts, wb); + write_CELLTABLE(ba, ws, idx, opts, wb); + /* [BrtSheetCalcProp] */ + write_SHEETPROTECT(ba, ws); + /* *([BrtRangeProtectionIso] BrtRangeProtection) */ + /* [SCENMAN] */ + write_AUTOFILTER(ba, ws, wb, idx); + /* [SORTSTATE] */ + /* [DCON] */ + /* [USERSHVIEWS] */ + write_MERGECELLS(ba, ws); + /* [BrtPhoneticInfo] */ + /* *CONDITIONALFORMATTING */ + /* [DVALS] */ + write_HLINKS(ba, ws, rels); + /* [BrtPrintOptions] */ + if(ws['!margins']) write_record(ba, 0x01DC /* BrtMargins */, write_BrtMargins(ws['!margins'])); + /* [BrtPageSetup] */ + /* [HEADERFOOTER] */ + /* [RWBRK] */ + /* [COLBRK] */ + /* *BrtBigName */ + /* [CELLWATCHES] */ + if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws); + /* [SMARTTAGS] */ + /* [BrtDrawing] */ + write_LEGACYDRAWING(ba, ws, idx, rels); + /* [BrtLegacyDrawingHF] */ + /* [BrtBkHim] */ + /* [OLEOBJECTS] */ + /* [ACTIVEXCONTROLS] */ + /* [WEBPUBITEMS] */ + /* [LISTPARTS] */ + /* FRTWORKSHEET */ + write_record(ba, 0x0082 /* BrtEndSheet */); + return ba.end(); +} +function parse_Cache(data/*:string*/)/*:[Array, string, ?string]*/ { + var col/*:Array*/ = []; + var num = data.match(/^/); + var f; + + /* 21.2.2.150 pt CT_NumVal */ + (data.match(/(.*?)<\/c:pt>/mg)||[]).forEach(function(pt) { + var q = pt.match(/(.*)<\/c:v><\/c:pt>/); + if(!q) return; + col[+q[1]] = num ? +q[2] : q[2]; + }); + + /* 21.2.2.71 formatCode CT_Xstring */ + var nf = unescapexml((data.match(/([\s\S]*?)<\/c:formatCode>/) || ["","General"])[1]); + + (data.match(/(.*?)<\/c:f>/mg)||[]).forEach(function(F) { f = F.replace(/<.*?>/g,""); }); + + return [col, nf, f]; +} + +/* 21.2 DrawingML - Charts */ +function parse_chart(data/*:?string*/, name/*:string*/, opts, rels, wb, csheet) { + var cs/*:Worksheet*/ = ((csheet || {"!type":"chart"})/*:any*/); + if(!data) return csheet; + /* 21.2.2.27 chart CT_Chart */ + + var C = 0, R = 0, col = "A"; + var refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; + + /* 21.2.2.120 numCache CT_NumData */ + (data.match(/[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(nc) { + var cache = parse_Cache(nc); + refguess.s.r = refguess.s.c = 0; + refguess.e.c = C; + col = encode_col(C); + cache[0].forEach(function(n,i) { + if(cs["!data"]) { + if(!cs["!data"][i]) cs["!data"][i] = []; + cs["!data"][i][C] = {t:'n', v:n, z:cache[1] }; + } else cs[col + encode_row(i)] = {t:'n', v:n, z:cache[1] }; + R = i; + }); + if(refguess.e.r < R) refguess.e.r = R; + ++C; + }); + if(C > 0) cs["!ref"] = encode_range(refguess); + return cs; +} +/* 18.3 Worksheets also covers Chartsheets */ +function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Worksheet*/ { + if(!data) return data; + /* 18.3.1.12 chartsheet CT_ChartSheet */ + if(!rels) rels = {'!id':{}}; + var s = ({'!type':"chart", '!drawel':null, '!rel':""}/*:any*/); + var m; + + /* 18.3.1.83 sheetPr CT_ChartsheetPr */ + var sheetPr = data.match(sheetprregex); + if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx); + + /* 18.3.1.36 drawing CT_Drawing */ + if((m = data.match(/drawing r:id="(.*?)"/))) s['!rel'] = m[1]; + + if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']]; + return s; +} +//function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ { +// var o = [XML_HEADER, writextag('chartsheet', null, { +// 'xmlns': XMLNS_main[0], +// 'xmlns:r': XMLNS.r +// })]; +// o[o.length] = writextag("drawing", null, {"r:id": "rId1"}); +// add_rels(rels, -1, "../drawings/drawing" + (idx+1) + ".xml", RELS.DRAW); +// if(o.length>2) { o[o.length] = (''); o[1]=o[1].replace("/>",">"); } +// return o.join(""); +//} + +/* [MS-XLSB] 2.4.331 BrtCsProp */ +function parse_BrtCsProp(data, length/*:number*/) { + data.l += 10; + var name = parse_XLWideString(data, length - 10); + return { name: name }; +} + +/* [MS-XLSB] 2.1.7.7 Chart Sheet */ +function parse_cs_bin(data, opts, idx/*:number*/, rels, wb/*::, themes, styles*/)/*:Worksheet*/ { + if(!data) return data; + if(!rels) rels = {'!id':{}}; + var s = {'!type':"chart", '!drawel':null, '!rel':""}; + var state/*:Array*/ = []; + var pass = false; + recordhopper(data, function cs_parse(val, R, RT) { + switch(RT) { + + case 0x0226: /* 'BrtDrawing' */ + s['!rel'] = val; break; + + case 0x028B: /* 'BrtCsProp' */ + if(!wb.Sheets[idx]) wb.Sheets[idx] = {}; + if(val.name) wb.Sheets[idx].CodeName = val.name; + break; + + case 0x0232: /* 'BrtBkHim' */ + case 0x028C: /* 'BrtCsPageSetup' */ + case 0x029D: /* 'BrtCsProtection' */ + case 0x02A7: /* 'BrtCsProtectionIso' */ + case 0x0227: /* 'BrtLegacyDrawing' */ + case 0x0228: /* 'BrtLegacyDrawingHF' */ + case 0x01DC: /* 'BrtMargins' */ + case 0x0C00: /* 'BrtUid' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + pass = false; break; + case 0x0025: /* 'BrtACBegin' */ + state.push(RT); break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); break; + + default: + if(R.T > 0) state.push(RT); + else if(R.T < 0) state.pop(); + else if(!pass || opts.WTF) throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }, opts); + + if(rels['!id'][s['!rel']]) s['!drawel'] = rels['!id'][s['!rel']]; + return s; +} +//function write_cs_bin(/*::idx:number, opts, wb:Workbook, rels*/) { +// var ba = buf_array(); +// write_record(ba, 0x0081 /* BrtBeginSheet */); +// /* [BrtCsProp] */ +// /* CSVIEWS */ +// /* [[BrtCsProtectionIso] BrtCsProtection] */ +// /* [USERCSVIEWS] */ +// /* [BrtMargins] */ +// /* [BrtCsPageSetup] */ +// /* [HEADERFOOTER] */ +// /* BrtDrawing */ +// /* [BrtLegacyDrawing] */ +// /* [BrtLegacyDrawingHF] */ +// /* [BrtBkHim] */ +// /* [WEBPUBITEMS] */ +// /* FRTCHARTSHEET */ +// write_record(ba, 0x0082 /* BrtEndSheet */); +// return ba.end(); +//} +/* 18.2.28 (CT_WorkbookProtection) Defaults */ +var WBPropsDef = [ + ['allowRefreshQuery', false, "bool"], + ['autoCompressPictures', true, "bool"], + ['backupFile', false, "bool"], + ['checkCompatibility', false, "bool"], + ['CodeName', ''], + ['date1904', false, "bool"], + ['defaultThemeVersion', 0, "int"], + ['filterPrivacy', false, "bool"], + ['hidePivotFieldList', false, "bool"], + ['promptedSolutions', false, "bool"], + ['publishItems', false, "bool"], + ['refreshAllConnections', false, "bool"], + ['saveExternalLinkValues', true, "bool"], + ['showBorderUnselectedTables', true, "bool"], + ['showInkAnnotation', true, "bool"], + ['showObjects', 'all'], + ['showPivotChartFilter', false, "bool"], + ['updateLinks', 'userSet'] +]; + +/* 18.2.30 (CT_BookView) Defaults */ +var WBViewDef = [ + ['activeTab', 0, "int"], + ['autoFilterDateGrouping', true, "bool"], + ['firstSheet', 0, "int"], + ['minimized', false, "bool"], + ['showHorizontalScroll', true, "bool"], + ['showSheetTabs', true, "bool"], + ['showVerticalScroll', true, "bool"], + ['tabRatio', 600, "int"], + ['visibility', 'visible'] + //window{Height,Width}, {x,y}Window +]; + +/* 18.2.19 (CT_Sheet) Defaults */ +var SheetDef = [ + //['state', 'visible'] +]; + +/* 18.2.2 (CT_CalcPr) Defaults */ +var CalcPrDef = [ + ['calcCompleted', 'true'], + ['calcMode', 'auto'], + ['calcOnSave', 'true'], + ['concurrentCalc', 'true'], + ['fullCalcOnLoad', 'false'], + ['fullPrecision', 'true'], + ['iterate', 'false'], + ['iterateCount', '100'], + ['iterateDelta', '0.001'], + ['refMode', 'A1'] +]; + +/* 18.2.3 (CT_CustomWorkbookView) Defaults */ +/*var CustomWBViewDef = [ + ['autoUpdate', 'false'], + ['changesSavedWin', 'false'], + ['includeHiddenRowCol', 'true'], + ['includePrintSettings', 'true'], + ['maximized', 'false'], + ['minimized', 'false'], + ['onlySync', 'false'], + ['personalView', 'false'], + ['showComments', 'commIndicator'], + ['showFormulaBar', 'true'], + ['showHorizontalScroll', 'true'], + ['showObjects', 'all'], + ['showSheetTabs', 'true'], + ['showStatusbar', 'true'], + ['showVerticalScroll', 'true'], + ['tabRatio', '600'], + ['xWindow', '0'], + ['yWindow', '0'] +];*/ + +function push_defaults_array(target, defaults) { + for(var j = 0; j != target.length; ++j) { var w = target[j]; + for(var i=0; i != defaults.length; ++i) { var z = defaults[i]; + if(w[z[0]] == null) w[z[0]] = z[1]; + else switch(z[2]) { + case "bool": if(typeof w[z[0]] == "string") w[z[0]] = parsexmlbool(w[z[0]]); break; + case "int": if(typeof w[z[0]] == "string") w[z[0]] = parseInt(w[z[0]], 10); break; + } + } + } +} +function push_defaults(target, defaults) { + for(var i = 0; i != defaults.length; ++i) { var z = defaults[i]; + if(target[z[0]] == null) target[z[0]] = z[1]; + else switch(z[2]) { + case "bool": if(typeof target[z[0]] == "string") target[z[0]] = parsexmlbool(target[z[0]]); break; + case "int": if(typeof target[z[0]] == "string") target[z[0]] = parseInt(target[z[0]], 10); break; + } + } +} + +function parse_wb_defaults(wb) { + push_defaults(wb.WBProps, WBPropsDef); + push_defaults(wb.CalcPr, CalcPrDef); + + push_defaults_array(wb.WBView, WBViewDef); + push_defaults_array(wb.Sheets, SheetDef); + + _ssfopts.date1904 = parsexmlbool(wb.WBProps.date1904); +} + +function safe1904(wb/*:Workbook*/)/*:string*/ { + /* TODO: store date1904 somewhere else */ + if(!wb.Workbook) return "false"; + if(!wb.Workbook.WBProps) return "false"; + return parsexmlbool(wb.Workbook.WBProps.date1904) ? "true" : "false"; +} + +var badchars = /*#__PURE__*/":][*?\/\\".split(""); +function check_ws_name(n/*:string*/, safe/*:?boolean*/)/*:boolean*/ { + try { + if(n == "") throw new Error("Sheet name cannot be blank"); + if(n.length > 31) throw new Error("Sheet name cannot exceed 31 chars"); + if(n.charCodeAt(0) == 0x27 || n.charCodeAt(n.length - 1) == 0x27) throw new Error("Sheet name cannot start or end with apostrophe (')"); + if(n.toLowerCase() == "history") throw new Error("Sheet name cannot be 'History'"); + badchars.forEach(function(c) { + if(n.indexOf(c) == -1) return; + throw new Error("Sheet name cannot contain : \\ / ? * [ ]"); + }); + } catch(e) { if(safe) return false; throw e; } + return true; +} +function check_wb_names(N, S, codes) { + N.forEach(function(n,i) { + check_ws_name(n); + for(var j = 0; j < i; ++j) if(n == N[j]) throw new Error("Duplicate Sheet Name: " + n); + if(codes) { + var cn = (S && S[i] && S[i].CodeName) || n; + if(cn.charCodeAt(0) == 95 && cn.length > 22) throw new Error("Bad Code Name: Worksheet" + cn); + } + }); +} +function check_wb(wb) { + if(!wb || !wb.SheetNames || !wb.Sheets) throw new Error("Invalid Workbook"); + if(!wb.SheetNames.length) throw new Error("Workbook is empty"); + var Sheets = (wb.Workbook && wb.Workbook.Sheets) || []; + check_wb_names(wb.SheetNames, Sheets, !!wb.vbaraw); + for(var i = 0; i < wb.SheetNames.length; ++i) check_ws(wb.Sheets[wb.SheetNames[i]], wb.SheetNames[i], i); + wb.SheetNames.forEach(function(n, i) { + var ws = wb.Sheets[n]; + if(!ws || !ws["!autofilter"]) return; + var DN; + if(!wb.Workbook) wb.Workbook = {}; + if(!wb.Workbook.Names) wb.Workbook.Names = []; + wb.Workbook.Names.forEach(function(dn) { if(dn.Name == "_xlnm._FilterDatabase" && dn.Sheet == i) DN = dn; }); + var nn = formula_quote_sheet_name(n) + "!" + fix_range(ws["!autofilter"].ref); + if(DN) DN.Ref = nn; + else wb.Workbook.Names.push({Name: "_xlnm._FilterDatabase", Sheet: i, Ref: nn}); + }); + /* TODO: validate workbook */ +} +/* 18.2 Workbook */ +var wbnsregex = /<\w+:workbook/; +function parse_wb_xml(data, opts)/*:WorkbookFile*/ { + if(!data) throw new Error("Could not find file"); + var wb = /*::(*/{ AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, Names:[], xmlns: "" }/*::)*/; + var pass = false, xmlns = "xmlns"; + var dname = {}, dnstart = 0; + data.replace(tagregex, function xml_wb(x, idx) { + var y/*:any*/ = parsexmltag(x); + switch(strip_ns(y[0])) { + case '': break; + + /* 18.2.13 fileVersion CT_FileVersion ? */ + case '': case '': break; + + /* 18.2.12 fileSharing CT_FileSharing ? */ + case '': break; + + /* 18.2.28 workbookPr CT_WorkbookPr ? */ + case '': + WBPropsDef.forEach(function(w) { + if(y[w[0]] == null) return; + switch(w[2]) { + case "bool": wb.WBProps[w[0]] = parsexmlbool(y[w[0]]); break; + case "int": wb.WBProps[w[0]] = parseInt(y[w[0]], 10); break; + default: wb.WBProps[w[0]] = y[w[0]]; + } + }); + if(y.codeName) wb.WBProps.CodeName = utf8read(y.codeName); + break; + case '': break; + + /* 18.2.29 workbookProtection CT_WorkbookProtection ? */ + case '': break; + + /* 18.2.1 bookViews CT_BookViews ? */ + case '': case '': break; + /* 18.2.30 workbookView CT_BookView + */ + case '': delete y[0]; wb.WBView.push(y); break; + case '': break; + + /* 18.2.20 sheets CT_Sheets 1 */ + case '': case '': break; // aggregate sheet + /* 18.2.19 sheet CT_Sheet + */ + case '': break; + + /* 18.2.15 functionGroups CT_FunctionGroups ? */ + case '': break; + /* 18.2.14 functionGroup CT_FunctionGroup + */ + case '': case '': break; + /* 18.2.8 externalReference CT_ExternalReference + */ + case '': break; + case '': case '': pass=false; break; + /* 18.2.5 definedName CT_DefinedName + */ + case '': { + dname.Ref = unescapexml(utf8read(data.slice(dnstart, idx))); + wb.Names.push(dname); + } break; + case '': break; + + /* 18.2.2 calcPr CT_CalcPr ? */ + case '': delete y[0]; wb.CalcPr = y; break; + case '': break; + + /* 18.2.16 oleSize CT_OleSize ? (ref required) */ + case '': case '': case '': break; + + /* 18.2.18 pivotCaches CT_PivotCaches ? */ + case '': case '': case '': break; + + /* 18.2.23 smartTagTypes CT_SmartTagTypes ? */ + case '': case '': break; + /* 18.2.22 smartTagType CT_SmartTagType ? */ + case '': break; + + /* 18.2.11 fileRecoveryPr CT_FileRecoveryPr ? */ + case '': break; + + /* 18.2.26 webPublishObjects CT_WebPublishObjects ? */ + case '': case '': break; + /* 18.2.25 webPublishObject CT_WebPublishObject ? */ + case '': case '': case '': break; + /* 18.2.7 ext CT_Extension + */ + case '': pass=false; break; + + /* Others */ + case '': pass=true; break; + case '': pass=false; break; + + /* TODO */ + case ' 0); + + /* fileVersion */ + /* fileSharing */ + + var workbookPr/*:any*/ = ({codeName:"ThisWorkbook"}/*:any*/); + if(wb.Workbook && wb.Workbook.WBProps) { + WBPropsDef.forEach(function(x) { + /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */ + if((wb.Workbook.WBProps[x[0]]/*:any*/) == null) return; + if((wb.Workbook.WBProps[x[0]]/*:any*/) == x[1]) return; + workbookPr[x[0]] = (wb.Workbook.WBProps[x[0]]/*:any*/); + }); + /*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */ + if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.CodeName; delete workbookPr.CodeName; } + } + o[o.length] = (writextag('workbookPr', null, workbookPr)); + + /* workbookProtection */ + + var sheets = wb.Workbook && wb.Workbook.Sheets || []; + var i = 0; + + /* bookViews only written if first worksheet is hidden */ + if(sheets && sheets[0] && !!sheets[0].Hidden) { + o[o.length] = ""; + for(i = 0; i != wb.SheetNames.length; ++i) { + if(!sheets[i]) break; + if(!sheets[i].Hidden) break; + } + if(i == wb.SheetNames.length) i = 0; + o[o.length] = ''; + o[o.length] = ""; + } + + o[o.length] = ""; + for(i = 0; i != wb.SheetNames.length; ++i) { + var sht = ({name:escapexml(wb.SheetNames[i].slice(0,31))}/*:any*/); + sht.sheetId = ""+(i+1); + sht["r:id"] = "rId"+(i+1); + if(sheets[i]) switch(sheets[i].Hidden) { + case 1: sht.state = "hidden"; break; + case 2: sht.state = "veryHidden"; break; + } + o[o.length] = (writextag('sheet',null,sht)); + } + o[o.length] = ""; + + /* functionGroups */ + /* externalReferences */ + + if(write_names) { + o[o.length] = ""; + if(wb.Workbook && wb.Workbook.Names) wb.Workbook.Names.forEach(function(n) { + var d/*:any*/ = {name:n.Name}; + if(n.Comment) d.comment = n.Comment; + if(n.Sheet != null) d.localSheetId = ""+n.Sheet; + if(n.Hidden) d.hidden = "1"; + if(!n.Ref) return; + o[o.length] = writextag('definedName', escapexml(n.Ref), d); + }); + o[o.length] = ""; + } + + /* calcPr */ + /* oleSize */ + /* customWorkbookViews */ + /* pivotCaches */ + /* smartTagPr */ + /* smartTagTypes */ + /* webPublishing */ + /* fileRecoveryPr */ + /* webPublishObjects */ + /* extLst */ + + if(o.length>2){ o[o.length] = ''; o[1]=o[1].replace("/>",">"); } + return o.join(""); +} +/* [MS-XLSB] 2.4.304 BrtBundleSh */ +function parse_BrtBundleSh(data, length/*:number*/) { + var z = {}; + z.Hidden = data.read_shift(4); //hsState ST_SheetState + z.iTabID = data.read_shift(4); + z.strRelID = parse_RelID(data,length-8); + z.name = parse_XLWideString(data); + return z; +} +function write_BrtBundleSh(data, o) { + if(!o) o = new_buf(127); + o.write_shift(4, data.Hidden); + o.write_shift(4, data.iTabID); + write_RelID(data.strRelID, o); + write_XLWideString(data.name.slice(0,31), o); + return o.length > o.l ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.4.815 BrtWbProp */ +function parse_BrtWbProp(data, length)/*:WBProps*/ { + var o/*:WBProps*/ = ({}/*:any*/); + var flags = data.read_shift(4); + o.defaultThemeVersion = data.read_shift(4); + var strName = (length > 8) ? parse_XLWideString(data) : ""; + if(strName.length > 0) o.CodeName = strName; + o.autoCompressPictures = !!(flags & 0x10000); + o.backupFile = !!(flags & 0x40); + o.checkCompatibility = !!(flags & 0x1000); + o.date1904 = !!(flags & 0x01); + o.filterPrivacy = !!(flags & 0x08); + o.hidePivotFieldList = !!(flags & 0x400); + o.promptedSolutions = !!(flags & 0x10); + o.publishItems = !!(flags & 0x800); + o.refreshAllConnections = !!(flags & 0x40000); + o.saveExternalLinkValues = !!(flags & 0x80); + o.showBorderUnselectedTables = !!(flags & 0x04); + o.showInkAnnotation = !!(flags & 0x20); + o.showObjects = ["all", "placeholders", "none"][(flags >> 13) & 0x03]; + o.showPivotChartFilter = !!(flags & 0x8000); + o.updateLinks = ["userSet", "never", "always"][(flags >> 8) & 0x03]; + return o; +} +function write_BrtWbProp(data/*:?WBProps*/, o) { + if(!o) o = new_buf(72); + var flags = 0; + if(data) { + /* TODO: mirror parse_BrtWbProp fields */ + if(data.date1904) flags |= 0x01; + if(data.filterPrivacy) flags |= 0x08; + } + o.write_shift(4, flags); + o.write_shift(4, 0); + write_XLSBCodeName(data && data.CodeName || "ThisWorkbook", o); + return o.slice(0, o.l); +} + +function parse_BrtFRTArchID$(data, length) { + var o = {}; + data.read_shift(4); + o.ArchID = data.read_shift(4); + data.l += length - 8; + return o; +} + +/* [MS-XLSB] 2.4.687 BrtName */ +function parse_BrtName(data, length, opts) { + var end = data.l + length; + var flags = data.read_shift(4); + data.l += 1; //var chKey = data.read_shift(1); + var itab = data.read_shift(4); + var name = parse_XLNameWideString(data); + var formula = parse_XLSBNameParsedFormula(data, 0, opts); + var comment = parse_XLNullableWideString(data); + if(flags & 0x20) name = "_xlnm." + name; + //if(0 /* fProc */) { + // unusedstring1: XLNullableWideString + // description: XLNullableWideString + // helpTopic: XLNullableWideString + // unusedstring2: XLNullableWideString + //} + data.l = end; + var out = ({Name:name, Ptg:formula, Flags: flags}/*:any*/); + if(itab < 0xFFFFFFF) out.Sheet = itab; + if(comment) out.Comment = comment; + return out; +} +function write_BrtName(name, wb) { + var o = new_buf(9); + var flags = 0; + var dname = name.Name; + if(XLSLblBuiltIn.indexOf(dname) > -1) { flags |= 0x20; dname = dname.slice(6); } + o.write_shift(4, flags); // flags + o.write_shift(1, 0); // chKey + o.write_shift(4, name.Sheet == null ? 0xFFFFFFFF : name.Sheet); + + var arr = [ + o, + write_XLWideString(dname), + write_XLSBNameParsedFormula(name.Ref, wb) + ]; + if(name.Comment) arr.push(write_XLNullableWideString(name.Comment)); + else { + var x = new_buf(4); + x.write_shift(4, 0xFFFFFFFF); + arr.push(x); + } + + // if macro (flags & 0x0F): + // write_shift(4, 0xFFFFFFFF); + // write_XLNullableWideString(description) + // write_XLNullableWideString(helpTopic) + // write_shift(4, 0xFFFFFFFF); + + return bconcat(arr); +} + +/* [MS-XLSB] 2.1.7.61 Workbook */ +function parse_wb_bin(data, opts)/*:WorkbookFile*/ { + var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" }; + var state/*:Array*/ = []; + var pass = false; + + if(!opts) opts = {}; + opts.biff = 12; + + var Names = []; + var supbooks = ([[]]/*:any*/); + supbooks.SheetNames = []; + supbooks.XTI = []; + + XLSBRecordEnum[0x0010] = { n:"BrtFRTArchID$", f:parse_BrtFRTArchID$ }; + + recordhopper(data, function hopper_wb(val, R, RT) { + switch(RT) { + case 0x009C: /* 'BrtBundleSh' */ + supbooks.SheetNames.push(val.name); + wb.Sheets.push(val); break; + + case 0x0099: /* 'BrtWbProp' */ + wb.WBProps = val; break; + + case 0x0027: /* 'BrtName' */ + if(val.Sheet != null) opts.SID = val.Sheet; + val.Ref = stringify_formula(val.Ptg, null, null, supbooks, opts); + delete opts.SID; + delete val.Ptg; + Names.push(val); + break; + case 0x040C: /* 'BrtNameExt' */ break; + + case 0x0165: /* 'BrtSupSelf' */ + case 0x0166: /* 'BrtSupSame' */ + case 0x0163: /* 'BrtSupBookSrc' */ + case 0x029B: /* 'BrtSupAddin' */ + if(!supbooks[0].length) supbooks[0] = [RT, val]; + else supbooks.push([RT, val]); + supbooks[supbooks.length - 1].XTI = []; + break; + case 0x016A: /* 'BrtExternSheet' */ + if(supbooks.length === 0) { supbooks[0] = []; supbooks[0].XTI = []; } + supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); + supbooks.XTI = supbooks.XTI.concat(val); + break; + case 0x0169: /* 'BrtPlaceholderName' */ + break; + + case 0x0817: /* 'BrtAbsPath15' */ + case 0x009E: /* 'BrtBookView' */ + case 0x008F: /* 'BrtBeginBundleShs' */ + case 0x0298: /* 'BrtBeginFnGroup' */ + case 0x0161: /* 'BrtBeginExternals' */ + break; + + /* case 'BrtModelTimeGroupingCalcCol' */ + case 0x0C00: /* 'BrtUid' */ + case 0x0C01: /* 'BrtRevisionPtr' */ + case 0x0216: /* 'BrtBookProtection' */ + case 0x02A5: /* 'BrtBookProtectionIso' */ + case 0x009D: /* 'BrtCalcProp' */ + case 0x0262: /* 'BrtCrashRecErr' */ + case 0x0802: /* 'BrtDecoupledPivotCacheID' */ + case 0x009B: /* 'BrtFileRecover' */ + case 0x0224: /* 'BrtFileSharing' */ + case 0x02A4: /* 'BrtFileSharingIso' */ + case 0x0080: /* 'BrtFileVersion' */ + case 0x0299: /* 'BrtFnGroup' */ + case 0x0850: /* 'BrtModelRelationship' */ + case 0x084D: /* 'BrtModelTable' */ + case 0x0225: /* 'BrtOleSize' */ + case 0x0805: /* 'BrtPivotTableRef' */ + case 0x0254: /* 'BrtSmartTagType' */ + case 0x081C: /* 'BrtTableSlicerCacheID' */ + case 0x081B: /* 'BrtTableSlicerCacheIDs' */ + case 0x0822: /* 'BrtTimelineCachePivotCacheID' */ + case 0x018D: /* 'BrtUserBookView' */ + case 0x009A: /* 'BrtWbFactoid' */ + case 0x045D: /* 'BrtWbProp14' */ + case 0x0229: /* 'BrtWebOpt' */ + case 0x082B: /* 'BrtWorkBookPr15' */ + break; + + case 0x0023: /* 'BrtFRTBegin' */ + state.push(RT); pass = true; break; + case 0x0024: /* 'BrtFRTEnd' */ + state.pop(); pass = false; break; + case 0x0025: /* 'BrtACBegin' */ + state.push(RT); pass = true; break; + case 0x0026: /* 'BrtACEnd' */ + state.pop(); pass = false; break; + + case 0x0010: /* 'BrtFRTArchID$' */ break; + + default: + if(R.T){/* empty */} + else if(!pass || (opts.WTF && state[state.length-1] != 0x0025 /* BrtACBegin */ && state[state.length-1] != 0x0023 /* BrtFRTBegin */)) throw new Error("Unexpected record 0x" + RT.toString(16)); + } + }, opts); + + parse_wb_defaults(wb); + + // $FlowIgnore + wb.Names = Names; + + (wb/*:any*/).supbooks = supbooks; + return wb; +} + +function write_BUNDLESHS(ba, wb/*::, opts*/) { + write_record(ba, 0x008F /* BrtBeginBundleShs */); + for(var idx = 0; idx != wb.SheetNames.length; ++idx) { + var viz = wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx] && wb.Workbook.Sheets[idx].Hidden || 0; + var d = { Hidden: viz, iTabID: idx+1, strRelID: 'rId' + (idx+1), name: wb.SheetNames[idx] }; + write_record(ba, 0x009C /* BrtBundleSh */, write_BrtBundleSh(d)); + } + write_record(ba, 0x0090 /* BrtEndBundleShs */); +} + +/* [MS-XLSB] 2.4.649 BrtFileVersion */ +function write_BrtFileVersion(data, o) { + if(!o) o = new_buf(127); + for(var i = 0; i != 4; ++i) o.write_shift(4, 0); + write_XLWideString("SheetJS", o); + write_XLWideString(XLSX.version, o); + write_XLWideString(XLSX.version, o); + write_XLWideString("7262", o); + return o.length > o.l ? o.slice(0, o.l) : o; +} + +/* [MS-XLSB] 2.4.301 BrtBookView */ +function write_BrtBookView(idx, o) { + if(!o) o = new_buf(29); + o.write_shift(-4, 0); + o.write_shift(-4, 460); + o.write_shift(4, 28800); + o.write_shift(4, 17600); + o.write_shift(4, 500); + o.write_shift(4, idx); + o.write_shift(4, idx); + var flags = 0x78; + o.write_shift(1, flags); + return o.length > o.l ? o.slice(0, o.l) : o; +} + +function write_BOOKVIEWS(ba, wb/*::, opts*/) { + /* required if hidden tab appears before visible tab */ + if(!wb.Workbook || !wb.Workbook.Sheets) return; + var sheets = wb.Workbook.Sheets; + var i = 0, vistab = -1, hidden = -1; + for(; i < sheets.length; ++i) { + if(!sheets[i] || !sheets[i].Hidden && vistab == -1) vistab = i; + else if(sheets[i].Hidden == 1 && hidden == -1) hidden = i; + } + if(hidden > vistab) return; + write_record(ba, 0x0087 /* BrtBeginBookViews */); + write_record(ba, 0x009E /* BrtBookView */, write_BrtBookView(vistab)); + /* 1*(BrtBookView *FRT) */ + write_record(ba, 0x0088 /* BrtEndBookViews */); +} + +function write_BRTNAMES(ba, wb) { + if(!wb.Workbook || !wb.Workbook.Names) return; + wb.Workbook.Names.forEach(function(name) { try { + if(name.Flags & 0x0e) return; // TODO: macro name write + write_record(ba, 0x0027 /* BrtName */, write_BrtName(name, wb)); + } catch(e) { + console.error("Could not serialize defined name " + JSON.stringify(name)); + } }); +} + +function write_SELF_EXTERNS_xlsb(wb) { + var L = wb.SheetNames.length; + var o = new_buf(12 * L + 28); + o.write_shift(4, L + 2); + o.write_shift(4, 0); o.write_shift(4, -2); o.write_shift(4, -2); // workbook-level reference + o.write_shift(4, 0); o.write_shift(4, -1); o.write_shift(4, -1); // #REF!... + for(var i = 0; i < L; ++i) { + o.write_shift(4, 0); o.write_shift(4, i); o.write_shift(4, i); + } + return o; +} +function write_EXTERNALS_xlsb(ba, wb) { + write_record(ba, 0x0161 /* BrtBeginExternals */); + write_record(ba, 0x0165 /* BrtSupSelf */); + write_record(ba, 0x016A /* BrtExternSheet */, write_SELF_EXTERNS_xlsb(wb, 0)); + write_record(ba, 0x0162 /* BrtEndExternals */); +} + +/* [MS-XLSB] 2.4.305 BrtCalcProp */ +/*function write_BrtCalcProp(data, o) { + if(!o) o = new_buf(26); + o.write_shift(4,0); // force recalc + o.write_shift(4,1); + o.write_shift(4,0); + write_Xnum(0, o); + o.write_shift(-4, 1023); + o.write_shift(1, 0x33); + o.write_shift(1, 0x00); + return o; +}*/ + +/* [MS-XLSB] 2.4.646 BrtFileRecover */ +/*function write_BrtFileRecover(data, o) { + if(!o) o = new_buf(1); + o.write_shift(1,0); + return o; +}*/ + +/* [MS-XLSB] 2.1.7.61 Workbook */ +function write_wb_bin(wb, opts) { + var ba = buf_array(); + write_record(ba, 0x0083 /* BrtBeginBook */); + write_record(ba, 0x0080 /* BrtFileVersion */, write_BrtFileVersion()); + /* [[BrtFileSharingIso] BrtFileSharing] */ + write_record(ba, 0x0099 /* BrtWbProp */, write_BrtWbProp(wb.Workbook && wb.Workbook.WBProps || null)); + /* [ACABSPATH] */ + /* [[BrtBookProtectionIso] BrtBookProtection] */ + write_BOOKVIEWS(ba, wb, opts); + write_BUNDLESHS(ba, wb, opts); + /* [FNGROUP] */ + write_EXTERNALS_xlsb(ba, wb); + if((wb.Workbook||{}).Names) write_BRTNAMES(ba, wb); + /* write_record(ba, 0x009D BrtCalcProp, write_BrtCalcProp()); */ + /* [BrtOleSize] */ + /* *(BrtUserBookView *FRT) */ + /* [PIVOTCACHEIDS] */ + /* [BrtWbFactoid] */ + /* [SMARTTAGTYPES] */ + /* [BrtWebOpt] */ + /* write_record(ba, 0x009B BrtFileRecover, write_BrtFileRecover()); */ + /* [WEBPUBITEMS] */ + /* [CRERRS] */ + /* FRTWORKBOOK */ + write_record(ba, 0x0084 /* BrtEndBook */); + + return ba.end(); +} +function parse_wb(data, name/*:string*/, opts)/*:WorkbookFile*/ { + if(name.slice(-4)===".bin") return parse_wb_bin((data/*:any*/), opts); + return parse_wb_xml((data/*:any*/), opts); +} + +function parse_ws(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { + if(name.slice(-4)===".bin") return parse_ws_bin((data/*:any*/), opts, idx, rels, wb, themes, styles); + return parse_ws_xml((data/*:any*/), opts, idx, rels, wb, themes, styles); +} + +function parse_cs(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { + if(name.slice(-4)===".bin") return parse_cs_bin((data/*:any*/), opts, idx, rels, wb, themes, styles); + return parse_cs_xml((data/*:any*/), opts, idx, rels, wb, themes, styles); +} + +function parse_ms(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { + if(name.slice(-4)===".bin") return parse_ms_bin((data/*:any*/), opts, idx, rels, wb, themes, styles); + return parse_ms_xml((data/*:any*/), opts, idx, rels, wb, themes, styles); +} + +function parse_ds(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { + if(name.slice(-4)===".bin") return parse_ds_bin((data/*:any*/), opts, idx, rels, wb, themes, styles); + return parse_ds_xml((data/*:any*/), opts, idx, rels, wb, themes, styles); +} + +function parse_sty(data, name/*:string*/, themes, opts) { + if(name.slice(-4)===".bin") return parse_sty_bin((data/*:any*/), themes, opts); + return parse_sty_xml((data/*:any*/), themes, opts); +} + +function parse_sst(data, name/*:string*/, opts)/*:SST*/ { + if(name.slice(-4)===".bin") return parse_sst_bin((data/*:any*/), opts); + return parse_sst_xml((data/*:any*/), opts); +} + +function parse_cmnt(data, name/*:string*/, opts)/*:Array*/ { + if(name.slice(-4)===".bin") return parse_comments_bin((data/*:any*/), opts); + return parse_comments_xml((data/*:any*/), opts); +} + +function parse_cc(data, name/*:string*/, opts) { + if(name.slice(-4)===".bin") return parse_cc_bin((data/*:any*/), name, opts); + return parse_cc_xml((data/*:any*/), name, opts); +} + +function parse_xlink(data, rel, name/*:string*/, opts) { + if(name.slice(-4)===".bin") return parse_xlink_bin((data/*:any*/), rel, name, opts); + return parse_xlink_xml((data/*:any*/), rel, name, opts); +} + +function parse_xlmeta(data, name/*:string*/, opts) { + if(name.slice(-4)===".bin") return parse_xlmeta_bin((data/*:any*/), name, opts); + return parse_xlmeta_xml((data/*:any*/), name, opts); +} +var attregexg2=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g; +var attregex2=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/; +function xlml_parsexmltag(tag/*:string*/, skip_root/*:?boolean*/) { + var words = tag.split(/\s+/); + var z/*:any*/ = ([]/*:any*/); if(!skip_root) z[0] = words[0]; + if(words.length === 1) return z; + var m = tag.match(attregexg2), y, j, w, i; + if(m) for(i = 0; i != m.length; ++i) { + y = m[i].match(attregex2); +/*:: if(!y || !y[2]) continue; */ + if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1); + else { + if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6); + else w = y[1].slice(j+1); + z[w] = y[2].slice(1,y[2].length-1); + } + } + return z; +} +function xlml_parsexmltagobj(tag/*:string*/) { + var words = tag.split(/\s+/); + var z = {}; + if(words.length === 1) return z; + var m = tag.match(attregexg2), y, j, w, i; + if(m) for(i = 0; i != m.length; ++i) { + y = m[i].match(attregex2); +/*:: if(!y || !y[2]) continue; */ + if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1); + else { + if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6); + else w = y[1].slice(j+1); + z[w] = y[2].slice(1,y[2].length-1); + } + } + return z; +} + +// ---- + +/* map from xlml named formats to SSF TODO: localize */ +var XLMLFormatMap/*: {[string]:string}*/; + +function xlml_format(format, value, date1904)/*:string*/ { + var fmt = XLMLFormatMap[format] || unescapexml(format); + if(fmt === "General") return SSF_general(value); + return SSF_format(fmt, value, {date1904: !!date1904}); +} + +function xlml_set_custprop(Custprops, key, cp, val/*:string*/) { + var oval/*:any*/ = val; + switch((cp[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]) { + case "boolean": oval = parsexmlbool(val); break; + case "i2": case "int": oval = parseInt(val, 10); break; + case "r4": case "float": oval = parseFloat(val); break; + case "date": case "dateTime.tz": oval = parseDate(val); break; + case "i8": case "string": case "fixed": case "uuid": case "bin.base64": break; + default: throw new Error("bad custprop:" + cp[0]); + } + Custprops[unescapexml(key)] = oval; +} + +function safe_format_xlml(cell/*:Cell*/, nf, o, date1904) { + if(cell.t === 'z') return; + if(!o || o.cellText !== false) try { + if(cell.t === 'e') { cell.w = cell.w || BErr[cell.v]; } + else if(nf === "General") { + if(cell.t === 'n') { + if((cell.v|0) === cell.v) cell.w = cell.v.toString(10); + else cell.w = SSF_general_num(cell.v); + } + else cell.w = SSF_general(cell.v); + } + else cell.w = xlml_format(nf||"General", cell.v, date1904); + } catch(e) { if(o.WTF) throw e; } + try { + var z = XLMLFormatMap[nf]||nf||"General"; + if(o.cellNF) cell.z = z; + if(o.cellDates && cell.t == 'n' && fmt_is_date(z)) { + var _d = SSF_parse_date_code(cell.v + (date1904 ? 1462 : 0)); if(_d) { cell.t = 'd'; cell.v = new Date(Date.UTC(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u)); } + } + } catch(e) { if(o.WTF) throw e; } +} + +function process_style_xlml(styles, stag, opts) { + if(opts.cellStyles) { + if(stag.Interior) { + var I = stag.Interior; + if(I.Pattern) I.patternType = XLMLPatternTypeMap[I.Pattern] || I.Pattern; + } + } + styles[stag.ID] = stag; +} + +/* TODO: there must exist some form of OSP-blessed spec */ +function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, arrayf, o, date1904) { + var nf = "General", sid = cell.StyleID, S = {}; o = o || {}; + var interiors = []; + var i = 0; + if(sid === undefined && row) sid = row.StyleID; + if(sid === undefined && csty) sid = csty.StyleID; + while(styles[sid] !== undefined) { + if(styles[sid].nf) nf = styles[sid].nf; + if(styles[sid].Interior) interiors.push(styles[sid].Interior); + if(!styles[sid].Parent) break; + sid = styles[sid].Parent; + } + switch(data.Type) { + case 'Boolean': + cell.t = 'b'; + cell.v = parsexmlbool(xml); + break; + case 'String': + cell.t = 's'; cell.r = xlml_fixstr(unescapexml(xml)); + cell.v = (xml.indexOf("<") > -1 ? unescapexml(ss||xml).replace(/<.*?>/g, "") : cell.r); // todo: BR etc + break; + case 'DateTime': + if(xml.slice(-1) != "Z") xml += "Z"; + cell.v = datenum(parseDate(xml, date1904), date1904); + if(cell.v !== cell.v) cell.v = unescapexml(xml); + if(!nf || nf == "General") nf = "yyyy-mm-dd"; + /* falls through */ + case 'Number': + if(cell.v === undefined) cell.v=+xml; + if(!cell.t) cell.t = 'n'; + break; + case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break; + default: + if(xml == "" && ss == "") { cell.t = 'z'; } + else { cell.t = 's'; cell.v = xlml_fixstr(ss||xml); } + break; + } + safe_format_xlml(cell, nf, o, date1904); + if(o.cellFormula !== false) { + if(cell.Formula) { + var fstr = unescapexml(cell.Formula); + /* strictly speaking, the leading = is required but some writers omit */ + if(fstr.charCodeAt(0) == 61 /* = */) fstr = fstr.slice(1); + cell.f = rc_to_a1(fstr, base); + delete cell.Formula; + if(cell.ArrayRange == "RC") cell.F = rc_to_a1("RC:RC", base); + else if(cell.ArrayRange) { + cell.F = rc_to_a1(cell.ArrayRange, base); + arrayf.push([safe_decode_range(cell.F), cell.F]); + } + } else { + for(i = 0; i < arrayf.length; ++i) + if(base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r) + if(base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c) + cell.F = arrayf[i][1]; + } + } + if(o.cellStyles) { + interiors.forEach(function(x) { + if(!S.patternType && x.patternType) S.patternType = x.patternType; + }); + cell.s = S; + } + if(cell.StyleID !== undefined) cell.ixfe = cell.StyleID; +} + +function xlml_prefix_dname(dname) { + return XLSLblBuiltIn.indexOf("_xlnm." + dname) > -1 ? "_xlnm." + dname : dname; +} + +function xlml_clean_comment(comment/*:any*/) { + comment.t = comment.v || ""; + comment.t = comment.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"); + comment.v = comment.w = comment.ixfe = undefined; +} + +/* TODO: Everything */ +function parse_xlml_xml(d, _opts)/*:Workbook*/ { + var opts = _opts || {}; + make_ssf(); + var str = debom(xlml_normalize(d)); + if(opts.type == 'binary' || opts.type == 'array' || opts.type == 'base64') { + if(typeof $cptable !== 'undefined') str = $cptable.utils.decode(65001, char_codes(str)); + else str = utf8read(str); + } + var opening = str.slice(0, 1024).toLowerCase(), ishtml = false; + opening = opening.replace(/".*?"/g, ""); + if((opening.indexOf(">") & 1023) > Math.min((opening.indexOf(",") & 1023), (opening.indexOf(";")&1023))) { var _o = dup(opts); _o.type = "string"; return PRN.to_workbook(str, _o); } + if(opening.indexOf("= 0) ishtml = true; }); + if(ishtml) return html_to_workbook(str, opts); + + XLMLFormatMap = ({ + "General Number": "General", + "General Date": table_fmt[22], + "Long Date": "dddd, mmmm dd, yyyy", + "Medium Date": table_fmt[15], + "Short Date": table_fmt[14], + "Long Time": table_fmt[19], + "Medium Time": table_fmt[18], + "Short Time": table_fmt[20], + "Currency": '"$"#,##0.00_);[Red]\\("$"#,##0.00\\)', + "Fixed": table_fmt[2], + "Standard": table_fmt[4], + "Percent": table_fmt[10], + "Scientific": table_fmt[11], + "Yes/No": '"Yes";"Yes";"No";@', + "True/False": '"True";"True";"False";@', + "On/Off": '"Yes";"Yes";"No";@' + }/*:any*/); + + + var Rn; + var state = [], tmp; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + var sheets = {}, sheetnames/*:Array*/ = [], cursheet/*:Worksheet*/ = ({}), sheetname = ""; if(opts.dense) cursheet["!data"] = []; + var cell = ({}/*:any*/), row = {};// eslint-disable-line no-unused-vars + var dtag = xlml_parsexmltag(''), didx = 0; + var c = 0, r = 0; + var refguess/*:Range*/ = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; + var styles = {}, stag = {}; + var ss = "", fidx = 0; + var merges/*:Array*/ = []; + var Props = {}, Custprops = {}, pidx = 0, cp = []; + var comments/*:Array*/ = [], comment/*:Comment*/ = ({}/*:any*/); + var cstys = [], csty, seencol = false; + var arrayf/*:Array<[Range, string]>*/ = []; + var rowinfo/*:Array*/ = [], rowobj = {}, cc = 0, rr = 0; + var Workbook/*:WBWBProps*/ = ({ Sheets:[], WBProps:{date1904:false} }/*:any*/), wsprops = {}; + xlmlregex.lastIndex = 0; + str = str.replace(//mg,""); + var raw_Rn3 = ""; + while((Rn = xlmlregex.exec(str))) switch((Rn[3] = (raw_Rn3 = Rn[3]).toLowerCase())) { + case 'data' /*case 'Data'*/: + if(raw_Rn3 == "data") { + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); + break; + } + if(state[state.length-1][1]) break; + if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]==/*"Comment"*/"comment"?comment:cell, {c:c,r:r}, styles, cstys[c], row, arrayf, opts, Workbook.WBProps.date1904); + else { ss = ""; dtag = xlml_parsexmltag(Rn[0]); didx = Rn.index + Rn[0].length; } + break; + case 'cell' /*case 'Cell'*/: + if(Rn[1]==='/'){ + if(comments.length > 0) cell.c = comments; + if((!opts.sheetRows || opts.sheetRows > r) && cell.v !== void 0) { + if(opts.dense) { + if(!cursheet["!data"][r]) cursheet["!data"][r] = []; + cursheet["!data"][r][c] = cell; + } else cursheet[encode_col(c) + encode_row(r)] = cell; + } + if(cell.HRef) { + cell.l = ({Target:unescapexml(cell.HRef)}/*:any*/); + if(cell.HRefScreenTip) cell.l.Tooltip = cell.HRefScreenTip; + delete cell.HRef; delete cell.HRefScreenTip; + } + if(cell.MergeAcross || cell.MergeDown) { + cc = c + (parseInt(cell.MergeAcross,10)|0); + rr = r + (parseInt(cell.MergeDown,10)|0); + if(cc > c || rr > r) merges.push({s:{c:c,r:r},e:{c:cc,r:rr}}); + } + if(!opts.sheetStubs) { if(cell.MergeAcross) c = cc + 1; else ++c; } + else if(cell.MergeAcross || cell.MergeDown) { + /*:: if(!cc) cc = 0; if(!rr) rr = 0; */ + for(var cma = c; cma <= cc; ++cma) { + for(var cmd = r; cmd <= rr; ++cmd) { + if(cma > c || cmd > r) { + if(opts.dense) { + if(!cursheet["!data"][cmd]) cursheet["!data"][cmd] = []; + cursheet["!data"][cmd][cma] = {t:'z'}; + } else cursheet[encode_col(cma) + encode_row(cmd)] = {t:'z'}; + } + } + } + c = cc + 1; + } + else ++c; + } else { + cell = xlml_parsexmltagobj(Rn[0]); + if(cell.Index) c = +cell.Index - 1; + if(c < refguess.s.c) refguess.s.c = c; + if(c > refguess.e.c) refguess.e.c = c; + if(Rn[0].slice(-2) === "/>") ++c; + comments = []; + } + break; + case 'row' /*case 'Row'*/: + if(Rn[1]==='/' || Rn[0].slice(-2) === "/>") { + if(r < refguess.s.r) refguess.s.r = r; + if(r > refguess.e.r) refguess.e.r = r; + if(Rn[0].slice(-2) === "/>") { + row = xlml_parsexmltag(Rn[0]); + if(row.Index) r = +row.Index - 1; + } + c = 0; ++r; + } else { + row = xlml_parsexmltag(Rn[0]); + if(row.Index) r = +row.Index - 1; + rowobj = {}; + if(row.AutoFitHeight == "0" || row.Height) { + rowobj.hpx = parseInt(row.Height, 10); rowobj.hpt = px2pt(rowobj.hpx); + rowinfo[r] = rowobj; + } + if(row.Hidden == "1") { rowobj.hidden = true; rowinfo[r] = rowobj; } + } + break; + case 'worksheet' /*case 'Worksheet'*/: /* TODO: read range from FullRows/FullColumns */ + if(Rn[1]==='/'){ + if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|")); + sheetnames.push(sheetname); + if(refguess.s.r <= refguess.e.r && refguess.s.c <= refguess.e.c) { + cursheet["!ref"] = encode_range(refguess); + if(opts.sheetRows && opts.sheetRows <= refguess.e.r) { + cursheet["!fullref"] = cursheet["!ref"]; + refguess.e.r = opts.sheetRows - 1; + cursheet["!ref"] = encode_range(refguess); + } + } + if(merges.length) cursheet["!merges"] = merges; + if(cstys.length > 0) cursheet["!cols"] = cstys; + if(rowinfo.length > 0) cursheet["!rows"] = rowinfo; + sheets[sheetname] = cursheet; + } else { + refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} }; + r = c = 0; + state.push([Rn[3], false]); + tmp = xlml_parsexmltag(Rn[0]); + sheetname = unescapexml(tmp.Name); + cursheet = ({}); if(opts.dense) cursheet["!data"] = []; + merges = []; + arrayf = []; + rowinfo = []; + wsprops = {name:sheetname, Hidden:0}; + Workbook.Sheets.push(wsprops); + } + break; + case 'table' /*case 'Table'*/: + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else if(Rn[0].slice(-2) == "/>") break; + else { + state.push([Rn[3], false]); + cstys = []; seencol = false; + } + break; + + case 'style' /*case 'Style'*/: + if(Rn[1]==='/') process_style_xlml(styles, stag, opts); + else stag = xlml_parsexmltag(Rn[0]); + break; + + case 'numberformat' /*case 'NumberFormat'*/: + stag.nf = unescapexml(xlml_parsexmltag(Rn[0]).Format || "General"); + if(XLMLFormatMap[stag.nf]) stag.nf = XLMLFormatMap[stag.nf]; + for(var ssfidx = 0; ssfidx != 0x188; ++ssfidx) if(table_fmt[ssfidx] == stag.nf) break; + if(ssfidx == 0x188) for(ssfidx = 0x39; ssfidx != 0x188; ++ssfidx) if(table_fmt[ssfidx] == null) { SSF__load(stag.nf, ssfidx); break; } + break; + + case 'column' /*case 'Column'*/: + if(state[state.length-1][0] !== /*'Table'*/'table') break; + if(Rn[1]==='/') break; + csty = xlml_parsexmltag(Rn[0]); + if(csty.Hidden) { csty.hidden = true; delete csty.Hidden; } + if(csty.Width) csty.wpx = parseInt(csty.Width, 10); + if(!seencol && csty.wpx > 10) { + seencol = true; MDW = DEF_MDW; //find_mdw_wpx(csty.wpx); + for(var _col = 0; _col < cstys.length; ++_col) if(cstys[_col]) process_col(cstys[_col]); + } + if(seencol) process_col(csty); + cstys[(csty.Index-1||cstys.length)] = csty; + for(var i = 0; i < +csty.Span; ++i) cstys[cstys.length] = dup(csty); + break; + + case 'namedrange' /*case 'NamedRange'*/: + if(Rn[1]==='/') break; + if(!Workbook.Names) Workbook.Names = []; + var _NamedRange = parsexmltag(Rn[0]); + var _DefinedName/*:DefinedName*/ = ({ + Name: xlml_prefix_dname(_NamedRange.Name), + Ref: rc_to_a1(_NamedRange.RefersTo.slice(1), {r:0, c:0}) + }/*:any*/); + if(Workbook.Sheets.length>0) _DefinedName.Sheet=Workbook.Sheets.length-1; + /*:: if(Workbook.Names) */Workbook.Names.push(_DefinedName); + break; + + case 'namedcell' /*case 'NamedCell'*/: break; + case 'b' /*case 'B'*/: break; + case 'i' /*case 'I'*/: break; + case 'u' /*case 'U'*/: break; + case 's' /*case 'S'*/: break; + case 'em' /*case 'EM'*/: break; + case 'h2' /*case 'H2'*/: break; + case 'h3' /*case 'H3'*/: break; + case 'sub' /*case 'Sub'*/: break; + case 'sup' /*case 'Sup'*/: break; + case 'span' /*case 'Span'*/: break; + case 'alignment' /*case 'Alignment'*/: + break; + case 'borders' /*case 'Borders'*/: break; + case 'border' /*case 'Border'*/: break; + case 'font' /*case 'Font'*/: + if(Rn[0].slice(-2) === "/>") break; + else if(Rn[1]==="/") ss += str.slice(fidx, Rn.index); + else fidx = Rn.index + Rn[0].length; + break; + case 'interior' /*case 'Interior'*/: + if(!opts.cellStyles) break; + stag.Interior = xlml_parsexmltag(Rn[0]); + break; + case 'protection' /*case 'Protection'*/: break; + + case 'author' /*case 'Author'*/: + case 'title' /*case 'Title'*/: + case 'description' /*case 'Description'*/: + case 'created' /*case 'Created'*/: + case 'keywords' /*case 'Keywords'*/: + case 'subject' /*case 'Subject'*/: + case 'category' /*case 'Category'*/: + case 'company' /*case 'Company'*/: + case 'lastauthor' /*case 'LastAuthor'*/: + case 'lastsaved' /*case 'LastSaved'*/: + case 'lastprinted' /*case 'LastPrinted'*/: + case 'version' /*case 'Version'*/: + case 'revision' /*case 'Revision'*/: + case 'totaltime' /*case 'TotalTime'*/: + case 'hyperlinkbase' /*case 'HyperlinkBase'*/: + case 'manager' /*case 'Manager'*/: + case 'contentstatus' /*case 'ContentStatus'*/: + case 'identifier' /*case 'Identifier'*/: + case 'language' /*case 'Language'*/: + case 'appname' /*case 'AppName'*/: + if(Rn[0].slice(-2) === "/>") break; + else if(Rn[1]==="/") xlml_set_prop(Props, raw_Rn3, str.slice(pidx, Rn.index)); + else pidx = Rn.index + Rn[0].length; + break; + case 'paragraphs' /*case 'Paragraphs'*/: break; + + case 'styles' /*case 'Styles'*/: + case 'workbook' /*case 'Workbook'*/: + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else state.push([Rn[3], false]); + break; + + case 'comment' /*case 'Comment'*/: + if(Rn[1]==='/'){ + if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|")); + xlml_clean_comment(comment); + comments.push(comment); + } else { + state.push([Rn[3], false]); + tmp = xlml_parsexmltag(Rn[0]); + if(!parsexmlbool(tmp["ShowAlways"]||"0")) comments.hidden = true; + comment = ({a:tmp.Author}/*:any*/); + } + break; + + case 'autofilter' /*case 'AutoFilter'*/: + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + var AutoFilter = xlml_parsexmltag(Rn[0]); + cursheet['!autofilter'] = { ref:rc_to_a1(AutoFilter.Range).replace(/\$/g,"") }; + state.push([Rn[3], true]); + } + break; + + case 'name' /*case 'Name'*/: break; + + case 'datavalidation' /*case 'DataValidation'*/: + if(Rn[1]==='/'){ + if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|")); + } else { + if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); + } + break; + + case 'pixelsperinch' /*case 'PixelsPerInch'*/: + break; + case 'componentoptions' /*case 'ComponentOptions'*/: + case 'documentproperties' /*case 'DocumentProperties'*/: + case 'customdocumentproperties' /*case 'CustomDocumentProperties'*/: + case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: + case 'pivottable' /*case 'PivotTable'*/: + case 'pivotcache' /*case 'PivotCache'*/: + case 'names' /*case 'Names'*/: + case 'mapinfo' /*case 'MapInfo'*/: + case 'pagebreaks' /*case 'PageBreaks'*/: + case 'querytable' /*case 'QueryTable'*/: + case 'sorting' /*case 'Sorting'*/: + case 'schema' /*case 'Schema'*/: //case 'data' /*case 'data'*/: + case 'conditionalformatting' /*case 'ConditionalFormatting'*/: + case 'smarttagtype' /*case 'SmartTagType'*/: + case 'smarttags' /*case 'SmartTags'*/: + case 'excelworkbook' /*case 'ExcelWorkbook'*/: + case 'workbookoptions' /*case 'WorkbookOptions'*/: + case 'worksheetoptions' /*case 'WorksheetOptions'*/: + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); + break; + + case 'null' /*case 'Null'*/: break; + + default: + /* FODS file root is */ + if(state.length == 0 && Rn[3] == "document") return parse_fods(str, opts); + /* UOS file root is */ + if(state.length == 0 && Rn[3] == "uof"/*"UOF"*/) return parse_fods(str, opts); + + var seen = true; + switch(state[state.length-1][0]) { + /* OfficeDocumentSettings */ + case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: switch(Rn[3]) { + case 'allowpng' /*case 'AllowPNG'*/: break; + case 'removepersonalinformation' /*case 'RemovePersonalInformation'*/: break; + case 'downloadcomponents' /*case 'DownloadComponents'*/: break; + case 'locationofcomponents' /*case 'LocationOfComponents'*/: break; + case 'colors' /*case 'Colors'*/: break; + case 'color' /*case 'Color'*/: break; + case 'index' /*case 'Index'*/: break; + case 'rgb' /*case 'RGB'*/: break; + case 'targetscreensize' /*case 'TargetScreenSize'*/: break; + case 'readonlyrecommended' /*case 'ReadOnlyRecommended'*/: break; + default: seen = false; + } break; + + /* ComponentOptions */ + case 'componentoptions' /*case 'ComponentOptions'*/: switch(Rn[3]) { + case 'toolbar' /*case 'Toolbar'*/: break; + case 'hideofficelogo' /*case 'HideOfficeLogo'*/: break; + case 'spreadsheetautofit' /*case 'SpreadsheetAutoFit'*/: break; + case 'label' /*case 'Label'*/: break; + case 'caption' /*case 'Caption'*/: break; + case 'maxheight' /*case 'MaxHeight'*/: break; + case 'maxwidth' /*case 'MaxWidth'*/: break; + case 'nextsheetnumber' /*case 'NextSheetNumber'*/: break; + default: seen = false; + } break; + + /* ExcelWorkbook */ + case 'excelworkbook' /*case 'ExcelWorkbook'*/: switch(Rn[3]) { + case 'date1904' /*case 'Date1904'*/: + /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ + Workbook.WBProps.date1904 = true; + break; + case 'hidehorizontalscrollbar' /*case 'HideHorizontalScrollBar'*/: break; + case 'hideverticalscrollbar' /*case 'HideVerticalScrollBar'*/: break; + case 'hideworkbooktabs' /*case 'HideWorkbookTabs'*/: break; + case 'windowheight' /*case 'WindowHeight'*/: break; + case 'windowwidth' /*case 'WindowWidth'*/: break; + case 'windowtopx' /*case 'WindowTopX'*/: break; + case 'windowtopy' /*case 'WindowTopY'*/: break; + case 'tabratio' /*case 'TabRatio'*/: break; + case 'protectstructure' /*case 'ProtectStructure'*/: break; + case 'protectwindow' /*case 'ProtectWindow'*/: break; + case 'protectwindows' /*case 'ProtectWindows'*/: break; + case 'activesheet' /*case 'ActiveSheet'*/: break; + case 'displayinknotes' /*case 'DisplayInkNotes'*/: break; + case 'firstvisiblesheet' /*case 'FirstVisibleSheet'*/: break; + case 'supbook' /*case 'SupBook'*/: break; + case 'sheetname' /*case 'SheetName'*/: break; + case 'sheetindex' /*case 'SheetIndex'*/: break; + case 'sheetindexfirst' /*case 'SheetIndexFirst'*/: break; + case 'sheetindexlast' /*case 'SheetIndexLast'*/: break; + case 'dll' /*case 'Dll'*/: break; + case 'acceptlabelsinformulas' /*case 'AcceptLabelsInFormulas'*/: break; + case 'donotsavelinkvalues' /*case 'DoNotSaveLinkValues'*/: break; + case 'iteration' /*case 'Iteration'*/: break; + case 'maxiterations' /*case 'MaxIterations'*/: break; + case 'maxchange' /*case 'MaxChange'*/: break; + case 'path' /*case 'Path'*/: break; + case 'xct' /*case 'Xct'*/: break; + case 'count' /*case 'Count'*/: break; + case 'selectedsheets' /*case 'SelectedSheets'*/: break; + case 'calculation' /*case 'Calculation'*/: break; + case 'uncalced' /*case 'Uncalced'*/: break; + case 'startupprompt' /*case 'StartupPrompt'*/: break; + case 'crn' /*case 'Crn'*/: break; + case 'externname' /*case 'ExternName'*/: break; + case 'formula' /*case 'Formula'*/: break; + case 'colfirst' /*case 'ColFirst'*/: break; + case 'collast' /*case 'ColLast'*/: break; + case 'wantadvise' /*case 'WantAdvise'*/: break; + case 'boolean' /*case 'Boolean'*/: break; + case 'error' /*case 'Error'*/: break; + case 'text' /*case 'Text'*/: break; + case 'ole' /*case 'OLE'*/: break; + case 'noautorecover' /*case 'NoAutoRecover'*/: break; + case 'publishobjects' /*case 'PublishObjects'*/: break; + case 'donotcalculatebeforesave' /*case 'DoNotCalculateBeforeSave'*/: break; + case 'number' /*case 'Number'*/: break; + case 'refmoder1c1' /*case 'RefModeR1C1'*/: break; + case 'embedsavesmarttags' /*case 'EmbedSaveSmartTags'*/: break; + default: seen = false; + } break; + + /* WorkbookOptions */ + case 'workbookoptions' /*case 'WorkbookOptions'*/: switch(Rn[3]) { + case 'owcversion' /*case 'OWCVersion'*/: break; + case 'height' /*case 'Height'*/: break; + case 'width' /*case 'Width'*/: break; + default: seen = false; + } break; + + /* WorksheetOptions */ + case 'worksheetoptions' /*case 'WorksheetOptions'*/: switch(Rn[3]) { + case 'visible' /*case 'Visible'*/: + if(Rn[0].slice(-2) === "/>"){/* empty */} + else if(Rn[1]==="/") switch(str.slice(pidx, Rn.index)) { + case "SheetHidden": wsprops.Hidden = 1; break; + case "SheetVeryHidden": wsprops.Hidden = 2; break; + } + else pidx = Rn.index + Rn[0].length; + break; + case 'header' /*case 'Header'*/: + if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml'); + if(!isNaN(+parsexmltag(Rn[0]).Margin)) cursheet['!margins'].header = +parsexmltag(Rn[0]).Margin; + break; + case 'footer' /*case 'Footer'*/: + if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml'); + if(!isNaN(+parsexmltag(Rn[0]).Margin)) cursheet['!margins'].footer = +parsexmltag(Rn[0]).Margin; + break; + case 'pagemargins' /*case 'PageMargins'*/: + var pagemargins = parsexmltag(Rn[0]); + if(!cursheet['!margins']) default_margins(cursheet['!margins']={},'xlml'); + if(!isNaN(+pagemargins.Top)) cursheet['!margins'].top = +pagemargins.Top; + if(!isNaN(+pagemargins.Left)) cursheet['!margins'].left = +pagemargins.Left; + if(!isNaN(+pagemargins.Right)) cursheet['!margins'].right = +pagemargins.Right; + if(!isNaN(+pagemargins.Bottom)) cursheet['!margins'].bottom = +pagemargins.Bottom; + break; + case 'displayrighttoleft' /*case 'DisplayRightToLeft'*/: + if(!Workbook.Views) Workbook.Views = []; + if(!Workbook.Views[0]) Workbook.Views[0] = {}; + Workbook.Views[0].RTL = true; + break; + + case 'freezepanes' /*case 'FreezePanes'*/: break; + case 'frozennosplit' /*case 'FrozenNoSplit'*/: break; + + case 'splithorizontal' /*case 'SplitHorizontal'*/: + case 'splitvertical' /*case 'SplitVertical'*/: + break; + + case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/: + break; + + case 'activerow' /*case 'ActiveRow'*/: break; + case 'activecol' /*case 'ActiveCol'*/: break; + case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break; + case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break; + + case 'unsynced' /*case 'Unsynced'*/: break; + case 'print' /*case 'Print'*/: break; + case 'printerrors' /*case 'PrintErrors'*/: break; + case 'panes' /*case 'Panes'*/: break; + case 'scale' /*case 'Scale'*/: break; + case 'pane' /*case 'Pane'*/: break; + case 'number' /*case 'Number'*/: break; + case 'layout' /*case 'Layout'*/: break; + case 'pagesetup' /*case 'PageSetup'*/: break; + case 'selected' /*case 'Selected'*/: break; + case 'protectobjects' /*case 'ProtectObjects'*/: break; + case 'enableselection' /*case 'EnableSelection'*/: break; + case 'protectscenarios' /*case 'ProtectScenarios'*/: break; + case 'validprinterinfo' /*case 'ValidPrinterInfo'*/: break; + case 'horizontalresolution' /*case 'HorizontalResolution'*/: break; + case 'verticalresolution' /*case 'VerticalResolution'*/: break; + case 'numberofcopies' /*case 'NumberofCopies'*/: break; + case 'activepane' /*case 'ActivePane'*/: break; + case 'toprowvisible' /*case 'TopRowVisible'*/: break; + case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break; + case 'fittopage' /*case 'FitToPage'*/: break; + case 'rangeselection' /*case 'RangeSelection'*/: break; + case 'papersizeindex' /*case 'PaperSizeIndex'*/: break; + case 'pagelayoutzoom' /*case 'PageLayoutZoom'*/: break; + case 'pagebreakzoom' /*case 'PageBreakZoom'*/: break; + case 'filteron' /*case 'FilterOn'*/: break; + case 'fitwidth' /*case 'FitWidth'*/: break; + case 'fitheight' /*case 'FitHeight'*/: break; + case 'commentslayout' /*case 'CommentsLayout'*/: break; + case 'zoom' /*case 'Zoom'*/: break; + case 'lefttoright' /*case 'LeftToRight'*/: break; + case 'gridlines' /*case 'Gridlines'*/: break; + case 'allowsort' /*case 'AllowSort'*/: break; + case 'allowfilter' /*case 'AllowFilter'*/: break; + case 'allowinsertrows' /*case 'AllowInsertRows'*/: break; + case 'allowdeleterows' /*case 'AllowDeleteRows'*/: break; + case 'allowinsertcols' /*case 'AllowInsertCols'*/: break; + case 'allowdeletecols' /*case 'AllowDeleteCols'*/: break; + case 'allowinserthyperlinks' /*case 'AllowInsertHyperlinks'*/: break; + case 'allowformatcells' /*case 'AllowFormatCells'*/: break; + case 'allowsizecols' /*case 'AllowSizeCols'*/: break; + case 'allowsizerows' /*case 'AllowSizeRows'*/: break; + case 'nosummaryrowsbelowdetail' /*case 'NoSummaryRowsBelowDetail'*/: + if(!cursheet["!outline"]) cursheet["!outline"] = {}; + cursheet["!outline"].above = true; + break; + case 'tabcolorindex' /*case 'TabColorIndex'*/: break; + case 'donotdisplayheadings' /*case 'DoNotDisplayHeadings'*/: break; + case 'showpagelayoutzoom' /*case 'ShowPageLayoutZoom'*/: break; + case 'nosummarycolumnsrightdetail' /*case 'NoSummaryColumnsRightDetail'*/: + if(!cursheet["!outline"]) cursheet["!outline"] = {}; + cursheet["!outline"].left = true; + break; + case 'blackandwhite' /*case 'BlackAndWhite'*/: break; + case 'donotdisplayzeros' /*case 'DoNotDisplayZeros'*/: break; + case 'displaypagebreak' /*case 'DisplayPageBreak'*/: break; + case 'rowcolheadings' /*case 'RowColHeadings'*/: break; + case 'donotdisplayoutline' /*case 'DoNotDisplayOutline'*/: break; + case 'noorientation' /*case 'NoOrientation'*/: break; + case 'allowusepivottables' /*case 'AllowUsePivotTables'*/: break; + case 'zeroheight' /*case 'ZeroHeight'*/: break; + case 'viewablerange' /*case 'ViewableRange'*/: break; + case 'selection' /*case 'Selection'*/: break; + case 'protectcontents' /*case 'ProtectContents'*/: break; + default: seen = false; + } break; + + /* PivotTable */ + case 'pivottable' /*case 'PivotTable'*/: case 'pivotcache' /*case 'PivotCache'*/: switch(Rn[3]) { + case 'immediateitemsondrop' /*case 'ImmediateItemsOnDrop'*/: break; + case 'showpagemultipleitemlabel' /*case 'ShowPageMultipleItemLabel'*/: break; + case 'compactrowindent' /*case 'CompactRowIndent'*/: break; + case 'location' /*case 'Location'*/: break; + case 'pivotfield' /*case 'PivotField'*/: break; + case 'orientation' /*case 'Orientation'*/: break; + case 'layoutform' /*case 'LayoutForm'*/: break; + case 'layoutsubtotallocation' /*case 'LayoutSubtotalLocation'*/: break; + case 'layoutcompactrow' /*case 'LayoutCompactRow'*/: break; + case 'position' /*case 'Position'*/: break; + case 'pivotitem' /*case 'PivotItem'*/: break; + case 'datatype' /*case 'DataType'*/: break; + case 'datafield' /*case 'DataField'*/: break; + case 'sourcename' /*case 'SourceName'*/: break; + case 'parentfield' /*case 'ParentField'*/: break; + case 'ptlineitems' /*case 'PTLineItems'*/: break; + case 'ptlineitem' /*case 'PTLineItem'*/: break; + case 'countofsameitems' /*case 'CountOfSameItems'*/: break; + case 'item' /*case 'Item'*/: break; + case 'itemtype' /*case 'ItemType'*/: break; + case 'ptsource' /*case 'PTSource'*/: break; + case 'cacheindex' /*case 'CacheIndex'*/: break; + case 'consolidationreference' /*case 'ConsolidationReference'*/: break; + case 'filename' /*case 'FileName'*/: break; + case 'reference' /*case 'Reference'*/: break; + case 'nocolumngrand' /*case 'NoColumnGrand'*/: break; + case 'norowgrand' /*case 'NoRowGrand'*/: break; + case 'blanklineafteritems' /*case 'BlankLineAfterItems'*/: break; + case 'hidden' /*case 'Hidden'*/: break; + case 'subtotal' /*case 'Subtotal'*/: break; + case 'basefield' /*case 'BaseField'*/: break; + case 'mapchilditems' /*case 'MapChildItems'*/: break; + case 'function' /*case 'Function'*/: break; + case 'refreshonfileopen' /*case 'RefreshOnFileOpen'*/: break; + case 'printsettitles' /*case 'PrintSetTitles'*/: break; + case 'mergelabels' /*case 'MergeLabels'*/: break; + case 'defaultversion' /*case 'DefaultVersion'*/: break; + case 'refreshname' /*case 'RefreshName'*/: break; + case 'refreshdate' /*case 'RefreshDate'*/: break; + case 'refreshdatecopy' /*case 'RefreshDateCopy'*/: break; + case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break; + case 'versionlastupdate' /*case 'VersionLastUpdate'*/: break; + case 'versionupdateablemin' /*case 'VersionUpdateableMin'*/: break; + case 'versionrefreshablemin' /*case 'VersionRefreshableMin'*/: break; + case 'calculation' /*case 'Calculation'*/: break; + default: seen = false; + } break; + + /* PageBreaks */ + case 'pagebreaks' /*case 'PageBreaks'*/: switch(Rn[3]) { + case 'colbreaks' /*case 'ColBreaks'*/: break; + case 'colbreak' /*case 'ColBreak'*/: break; + case 'rowbreaks' /*case 'RowBreaks'*/: break; + case 'rowbreak' /*case 'RowBreak'*/: break; + case 'colstart' /*case 'ColStart'*/: break; + case 'colend' /*case 'ColEnd'*/: break; + case 'rowend' /*case 'RowEnd'*/: break; + default: seen = false; + } break; + + /* AutoFilter */ + case 'autofilter' /*case 'AutoFilter'*/: switch(Rn[3]) { + case 'autofiltercolumn' /*case 'AutoFilterColumn'*/: break; + case 'autofiltercondition' /*case 'AutoFilterCondition'*/: break; + case 'autofilterand' /*case 'AutoFilterAnd'*/: break; + case 'autofilteror' /*case 'AutoFilterOr'*/: break; + default: seen = false; + } break; + + /* QueryTable */ + case 'querytable' /*case 'QueryTable'*/: switch(Rn[3]) { + case 'id' /*case 'Id'*/: break; + case 'autoformatfont' /*case 'AutoFormatFont'*/: break; + case 'autoformatpattern' /*case 'AutoFormatPattern'*/: break; + case 'querysource' /*case 'QuerySource'*/: break; + case 'querytype' /*case 'QueryType'*/: break; + case 'enableredirections' /*case 'EnableRedirections'*/: break; + case 'refreshedinxl9' /*case 'RefreshedInXl9'*/: break; + case 'urlstring' /*case 'URLString'*/: break; + case 'htmltables' /*case 'HTMLTables'*/: break; + case 'connection' /*case 'Connection'*/: break; + case 'commandtext' /*case 'CommandText'*/: break; + case 'refreshinfo' /*case 'RefreshInfo'*/: break; + case 'notitles' /*case 'NoTitles'*/: break; + case 'nextid' /*case 'NextId'*/: break; + case 'columninfo' /*case 'ColumnInfo'*/: break; + case 'overwritecells' /*case 'OverwriteCells'*/: break; + case 'donotpromptforfile' /*case 'DoNotPromptForFile'*/: break; + case 'textwizardsettings' /*case 'TextWizardSettings'*/: break; + case 'source' /*case 'Source'*/: break; + case 'number' /*case 'Number'*/: break; + case 'decimal' /*case 'Decimal'*/: break; + case 'thousandseparator' /*case 'ThousandSeparator'*/: break; + case 'trailingminusnumbers' /*case 'TrailingMinusNumbers'*/: break; + case 'formatsettings' /*case 'FormatSettings'*/: break; + case 'fieldtype' /*case 'FieldType'*/: break; + case 'delimiters' /*case 'Delimiters'*/: break; + case 'tab' /*case 'Tab'*/: break; + case 'comma' /*case 'Comma'*/: break; + case 'autoformatname' /*case 'AutoFormatName'*/: break; + case 'versionlastedit' /*case 'VersionLastEdit'*/: break; + case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break; + default: seen = false; + } break; + + case 'datavalidation' /*case 'DataValidation'*/: + switch(Rn[3]) { + case 'range' /*case 'Range'*/: break; + + case 'type' /*case 'Type'*/: break; + case 'min' /*case 'Min'*/: break; + case 'max' /*case 'Max'*/: break; + case 'sort' /*case 'Sort'*/: break; + case 'descending' /*case 'Descending'*/: break; + case 'order' /*case 'Order'*/: break; + case 'casesensitive' /*case 'CaseSensitive'*/: break; + case 'value' /*case 'Value'*/: break; + case 'errorstyle' /*case 'ErrorStyle'*/: break; + case 'errormessage' /*case 'ErrorMessage'*/: break; + case 'errortitle' /*case 'ErrorTitle'*/: break; + case 'inputmessage' /*case 'InputMessage'*/: break; + case 'inputtitle' /*case 'InputTitle'*/: break; + case 'combohide' /*case 'ComboHide'*/: break; + case 'inputhide' /*case 'InputHide'*/: break; + case 'condition' /*case 'Condition'*/: break; + case 'qualifier' /*case 'Qualifier'*/: break; + case 'useblank' /*case 'UseBlank'*/: break; + case 'value1' /*case 'Value1'*/: break; + case 'value2' /*case 'Value2'*/: break; + case 'format' /*case 'Format'*/: break; + + case 'cellrangelist' /*case 'CellRangeList'*/: break; + default: seen = false; + } break; + + case 'sorting' /*case 'Sorting'*/: + case 'conditionalformatting' /*case 'ConditionalFormatting'*/: + switch(Rn[3]) { + case 'range' /*case 'Range'*/: break; + case 'type' /*case 'Type'*/: break; + case 'min' /*case 'Min'*/: break; + case 'max' /*case 'Max'*/: break; + case 'sort' /*case 'Sort'*/: break; + case 'descending' /*case 'Descending'*/: break; + case 'order' /*case 'Order'*/: break; + case 'casesensitive' /*case 'CaseSensitive'*/: break; + case 'value' /*case 'Value'*/: break; + case 'errorstyle' /*case 'ErrorStyle'*/: break; + case 'errormessage' /*case 'ErrorMessage'*/: break; + case 'errortitle' /*case 'ErrorTitle'*/: break; + case 'cellrangelist' /*case 'CellRangeList'*/: break; + case 'inputmessage' /*case 'InputMessage'*/: break; + case 'inputtitle' /*case 'InputTitle'*/: break; + case 'combohide' /*case 'ComboHide'*/: break; + case 'inputhide' /*case 'InputHide'*/: break; + case 'condition' /*case 'Condition'*/: break; + case 'qualifier' /*case 'Qualifier'*/: break; + case 'useblank' /*case 'UseBlank'*/: break; + case 'value1' /*case 'Value1'*/: break; + case 'value2' /*case 'Value2'*/: break; + case 'format' /*case 'Format'*/: break; + default: seen = false; + } break; + + /* MapInfo (schema) */ + case 'mapinfo' /*case 'MapInfo'*/: case 'schema' /*case 'Schema'*/: case 'data' /*case 'data'*/: switch(Rn[3]) { + case 'map' /*case 'Map'*/: break; + case 'entry' /*case 'Entry'*/: break; + case 'range' /*case 'Range'*/: break; + case 'xpath' /*case 'XPath'*/: break; + case 'field' /*case 'Field'*/: break; + case 'xsdtype' /*case 'XSDType'*/: break; + case 'filteron' /*case 'FilterOn'*/: break; + case 'aggregate' /*case 'Aggregate'*/: break; + case 'elementtype' /*case 'ElementType'*/: break; + case 'attributetype' /*case 'AttributeType'*/: break; + /* These are from xsd (XML Schema Definition) */ + case 'schema' /*case 'schema'*/: + case 'element' /*case 'element'*/: + case 'complextype' /*case 'complexType'*/: + case 'datatype' /*case 'datatype'*/: + case 'all' /*case 'all'*/: + case 'attribute' /*case 'attribute'*/: + case 'extends' /*case 'extends'*/: break; + + case 'row' /*case 'row'*/: break; + default: seen = false; + } break; + + /* SmartTags (can be anything) */ + case 'smarttags' /*case 'SmartTags'*/: break; + + default: seen = false; break; + } + if(seen) break; + /* CustomDocumentProperties */ + if(Rn[3].match(/!\[CDATA/)) break; + if(!state[state.length-1][1]) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|"); + if(state[state.length-1][0]===/*'CustomDocumentProperties'*/'customdocumentproperties') { + if(Rn[0].slice(-2) === "/>") break; + else if(Rn[1]==="/") xlml_set_custprop(Custprops, raw_Rn3, cp, str.slice(pidx, Rn.index)); + else { cp = Rn; pidx = Rn.index + Rn[0].length; } + break; + } + if(opts.WTF) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|"); + } + var out = ({}/*:any*/); + if(!opts.bookSheets && !opts.bookProps) out.Sheets = sheets; + out.SheetNames = sheetnames; + out.Workbook = Workbook; + out.SSF = dup(table_fmt); + out.Props = Props; + out.Custprops = Custprops; + out.bookType = "xlml"; + return out; +} + +function parse_xlml(data/*:RawBytes|string*/, opts)/*:Workbook*/ { + fix_read_opts(opts=opts||{}); + switch(opts.type||"base64") { + case "base64": return parse_xlml_xml(Base64_decode(data), opts); + case "binary": case "buffer": case "file": return parse_xlml_xml(data, opts); + case "array": return parse_xlml_xml(a2s(data), opts); + } + /*:: throw new Error("unsupported type " + opts.type); */ +} + +/* TODO */ +function write_props_xlml(wb/*:Workbook*/, opts)/*:string*/ { + var o/*:Array*/ = []; + /* DocumentProperties */ + if(wb.Props) o.push(xlml_write_docprops(wb.Props, opts)); + /* CustomDocumentProperties */ + if(wb.Custprops) o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts)); + return o.join(""); +} +/* TODO */ +function write_wb_xlml(wb/*::, opts*/)/*:string*/ { + /* OfficeDocumentSettings */ + /* ExcelWorkbook */ + if((((wb||{}).Workbook||{}).WBProps||{}).date1904) return ''; + return ""; +} +/* TODO */ +function write_sty_xlml(wb, opts)/*:string*/ { + /* Styles */ + var styles/*:Array*/ = ['']; + opts.cellXfs.forEach(function(xf, id) { + var payload/*:Array*/ = []; + payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(table_fmt[xf.numFmtId])})); + + var o = /*::(*/{"ss:ID": "s" + (21+id)}/*:: :any)*/; + styles.push(writextag('Style', payload.join(""), o)); + }); + return writextag("Styles", styles.join("")); +} +function write_name_xlml(n) { return writextag("NamedRange", null, {"ss:Name": n.Name.slice(0,6) == "_xlnm." ? n.Name.slice(6) : n.Name, "ss:RefersTo":"=" + a1_to_rc(n.Ref, {r:0,c:0})}); } +function write_names_xlml(wb/*::, opts*/)/*:string*/ { + if(!((wb||{}).Workbook||{}).Names) return ""; + /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */ + var names/*:Array*/ = wb.Workbook.Names; + var out/*:Array*/ = []; + for(var i = 0; i < names.length; ++i) { + var n = names[i]; + if(n.Sheet != null) continue; + if(n.Name.match(/^_xlfn\./)) continue; + out.push(write_name_xlml(n)); + } + return writextag("Names", out.join("")); +} +function write_ws_xlml_names(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { + if(!ws) return ""; + if(!((wb||{}).Workbook||{}).Names) return ""; + /*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */ + var names/*:Array*/ = wb.Workbook.Names; + var out/*:Array*/ = []; + for(var i = 0; i < names.length; ++i) { + var n = names[i]; + if(n.Sheet != idx) continue; + /*switch(n.Name) { + case "_": continue; + }*/ + if(n.Name.match(/^_xlfn\./)) continue; + out.push(write_name_xlml(n)); + } + return out.join(""); +} +/* WorksheetOptions */ +function write_ws_xlml_wsopts(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { + if(!ws) return ""; + var o/*:Array*/ = []; + /* NOTE: spec technically allows any order, but stick with implied order */ + + /* FitToPage */ + /* DoNotDisplayColHeaders */ + /* DoNotDisplayRowHeaders */ + /* ViewableRange */ + /* Selection */ + /* GridlineColor */ + /* Name */ + /* ExcelWorksheetType */ + /* IntlMacro */ + /* Unsynced */ + /* Selected */ + /* CodeName */ + + if(ws['!margins']) { + o.push(""); + if(ws['!margins'].header) o.push(writextag("Header", null, {'x:Margin':ws['!margins'].header})); + if(ws['!margins'].footer) o.push(writextag("Footer", null, {'x:Margin':ws['!margins'].footer})); + o.push(writextag("PageMargins", null, { + 'x:Bottom': ws['!margins'].bottom || "0.75", + 'x:Left': ws['!margins'].left || "0.7", + 'x:Right': ws['!margins'].right || "0.7", + 'x:Top': ws['!margins'].top || "0.75" + })); + o.push(""); + } + + /* PageSetup */ + /* DisplayPageBreak */ + /* TransitionExpressionEvaluation */ + /* TransitionFormulaEntry */ + /* Print */ + /* Zoom */ + /* PageLayoutZoom */ + /* PageBreakZoom */ + /* ShowPageBreakZoom */ + /* DefaultRowHeight */ + /* DefaultColumnWidth */ + /* StandardWidth */ + + if(wb && wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx]) { + /* Visible */ + if(wb.Workbook.Sheets[idx].Hidden) o.push(writextag("Visible", (wb.Workbook.Sheets[idx].Hidden == 1 ? "SheetHidden" : "SheetVeryHidden"), {})); + else { + /* Selected */ + for(var i = 0; i < idx; ++i) if(wb.Workbook.Sheets[i] && !wb.Workbook.Sheets[i].Hidden) break; + if(i == idx) o.push(""); + } + } + + /* LeftColumnVisible */ + + if(((((wb||{}).Workbook||{}).Views||[])[0]||{}).RTL) o.push(""); + + /* GridlineColorIndex */ + /* DisplayFormulas */ + /* DoNotDisplayGridlines */ + /* DoNotDisplayHeadings */ + /* DoNotDisplayOutline */ + /* ApplyAutomaticOutlineStyles */ + /* NoSummaryRowsBelowDetail */ + /* NoSummaryColumnsRightDetail */ + /* DoNotDisplayZeros */ + /* ActiveRow */ + /* ActiveColumn */ + /* FilterOn */ + /* RangeSelection */ + /* TopRowVisible */ + /* TopRowBottomPane */ + /* LeftColumnRightPane */ + /* ActivePane */ + /* SplitHorizontal */ + /* SplitVertical */ + /* FreezePanes */ + /* FrozenNoSplit */ + /* TabColorIndex */ + /* Panes */ + + /* NOTE: Password not supported in XLML Format */ + if(ws['!protect']) { + o.push(writetag("ProtectContents", "True")); + if(ws['!protect'].objects) o.push(writetag("ProtectObjects", "True")); + if(ws['!protect'].scenarios) o.push(writetag("ProtectScenarios", "True")); + if(ws['!protect'].selectLockedCells != null && !ws['!protect'].selectLockedCells) o.push(writetag("EnableSelection", "NoSelection")); + else if(ws['!protect'].selectUnlockedCells != null && !ws['!protect'].selectUnlockedCells) o.push(writetag("EnableSelection", "UnlockedCells")); + [ + [ "formatCells", "AllowFormatCells" ], + [ "formatColumns", "AllowSizeCols" ], + [ "formatRows", "AllowSizeRows" ], + [ "insertColumns", "AllowInsertCols" ], + [ "insertRows", "AllowInsertRows" ], + [ "insertHyperlinks", "AllowInsertHyperlinks" ], + [ "deleteColumns", "AllowDeleteCols" ], + [ "deleteRows", "AllowDeleteRows" ], + [ "sort", "AllowSort" ], + [ "autoFilter", "AllowFilter" ], + [ "pivotTables", "AllowUsePivotTables" ] + ].forEach(function(x) { if(ws['!protect'][x[0]]) o.push("<"+x[1]+"/>"); }); + } + + if(o.length == 0) return ""; + return writextag("WorksheetOptions", o.join(""), {xmlns:XLMLNS.x}); +} +function write_ws_xlml_comment(comments/*:Array*/)/*:string*/ { + /* TODO: test multiple comments */ + return comments.map(function(c) { + // TODO: formatted text + var t = xlml_unfixstr(c.t||""); + var d =writextag("ss:Data", t, {"xmlns":"http://www.w3.org/TR/REC-html40"}); + var p = {}; + if(c.a) p["ss:Author"] = c.a; + if(!comments.hidden) p["ss:ShowAlways"] = "1"; + return writextag("Comment", d, p); + }).join(""); +} +function write_ws_xlml_cell(cell, ref/*:string*/, ws, opts, idx/*:number*/, wb, addr)/*:string*/{ + if(!cell || (cell.v == undefined && cell.f == undefined)) return ""; + + var attr = {}; + if(cell.f) attr["ss:Formula"] = "=" + escapexml(a1_to_rc(cell.f, addr)); + if(cell.F && cell.F.slice(0, ref.length) == ref) { + var end = decode_cell(cell.F.slice(ref.length + 1)); + attr["ss:ArrayRange"] = "RC:R" + (end.r == addr.r ? "" : "[" + (end.r - addr.r) + "]") + "C" + (end.c == addr.c ? "" : "[" + (end.c - addr.c) + "]"); + } + + if(cell.l && cell.l.Target) { + attr["ss:HRef"] = escapexml(cell.l.Target); + if(cell.l.Tooltip) attr["x:HRefScreenTip"] = escapexml(cell.l.Tooltip); + } + + if(ws['!merges']) { + var marr = ws['!merges']; + for(var mi = 0; mi != marr.length; ++mi) { + if(marr[mi].s.c != addr.c || marr[mi].s.r != addr.r) continue; + if(marr[mi].e.c > marr[mi].s.c) attr['ss:MergeAcross'] = marr[mi].e.c - marr[mi].s.c; + if(marr[mi].e.r > marr[mi].s.r) attr['ss:MergeDown'] = marr[mi].e.r - marr[mi].s.r; + } + } + + var t = "", p = ""; + switch(cell.t) { + case 'z': if(!opts.sheetStubs) return ""; break; + case 'n': t = 'Number'; p = String(cell.v); break; + case 'b': t = 'Boolean'; p = (cell.v ? "1" : "0"); break; + case 'e': t = 'Error'; p = BErr[cell.v]; break; + case 'd': t = 'DateTime'; p = new Date(cell.v).toISOString(); if(cell.z == null) cell.z = cell.z || table_fmt[14]; break; + case 's': t = 'String'; p = escapexlml(cell.v||""); break; + } + /* TODO: cell style */ + var os = get_cell_style(opts.cellXfs, cell, opts); + attr["ss:StyleID"] = "s" + (21+os); + attr["ss:Index"] = addr.c + 1; + var _v = (cell.v != null ? p : ""); + var m = cell.t == 'z' ? "" : ('' + _v + ''); + + if((cell.c||[]).length > 0) m += write_ws_xlml_comment(cell.c); + + return writextag("Cell", m, attr); +} +function write_ws_xlml_row(R/*:number*/, row)/*:string*/ { + var o = ''; +} +/* TODO */ +function write_ws_xlml_table(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ { + if(!ws['!ref']) return ""; + var range/*:Range*/ = safe_decode_range(ws['!ref']); + var marr/*:Array*/ = ws['!merges'] || [], mi = 0; + var o/*:Array*/ = []; + if(ws['!cols']) ws['!cols'].forEach(function(n, i) { + process_col(n); + var w = !!n.width; + var p = col_obj_w(i, n); + var k/*:any*/ = {"ss:Index":i+1}; + if(w) k['ss:Width'] = width2px(p.width); + if(n.hidden) k['ss:Hidden']="1"; + o.push(writextag("Column",null,k)); + }); + var dense = ws["!data"] != null; + for(var R = range.s.r; R <= range.e.r; ++R) { + var row = [write_ws_xlml_row(R, (ws['!rows']||[])[R])]; + for(var C = range.s.c; C <= range.e.c; ++C) { + var skip = false; + for(mi = 0; mi != marr.length; ++mi) { + if(marr[mi].s.c > C) continue; + if(marr[mi].s.r > R) continue; + if(marr[mi].e.c < C) continue; + if(marr[mi].e.r < R) continue; + if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true; + break; + } + if(skip) continue; + var addr = {r:R,c:C}; + var ref = encode_col(C) + encode_row(R), cell = dense ? (ws["!data"][R]||[])[C] : ws[ref]; + row.push(write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr)); + } + row.push(""); + if(row.length > 2) o.push(row.join("")); + } + return o.join(""); +} +function write_ws_xlml(idx/*:number*/, opts, wb/*:Workbook*/)/*:string*/ { + var o/*:Array*/ = []; + var s = wb.SheetNames[idx]; + var ws = wb.Sheets[s]; + + var t/*:string*/ = ws ? write_ws_xlml_names(ws, opts, idx, wb) : ""; + if(t.length > 0) o.push("" + t + ""); + + /* Table */ + t = ws ? write_ws_xlml_table(ws, opts, idx, wb) : ""; + if(t.length > 0) o.push("
" + t + "
"); + + /* WorksheetOptions */ + o.push(write_ws_xlml_wsopts(ws, opts, idx, wb)); + + if(ws["!autofilter"]) o.push(''); + + return o.join(""); +} +function write_xlml(wb, opts)/*:string*/ { + if(!opts) opts = {}; + if(!wb.SSF) wb.SSF = dup(table_fmt); + if(wb.SSF) { + make_ssf(); SSF_load_table(wb.SSF); + // $FlowIgnore + opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0; + opts.ssf = wb.SSF; + opts.cellXfs = []; + get_cell_style(opts.cellXfs, {}, {revssf:{"General":0}}); + } + var d/*:Array*/ = []; + d.push(write_props_xlml(wb, opts)); + d.push(write_wb_xlml(wb, opts)); + d.push(""); + d.push(""); + for(var i = 0; i < wb.SheetNames.length; ++i) + d.push(writextag("Worksheet", write_ws_xlml(i, opts, wb), {"ss:Name":escapexml(wb.SheetNames[i])})); + d[2] = write_sty_xlml(wb, opts); + d[3] = write_names_xlml(wb, opts); + return XML_HEADER + writextag("Workbook", d.join(""), { + 'xmlns': XLMLNS.ss, + 'xmlns:o': XLMLNS.o, + 'xmlns:x': XLMLNS.x, + 'xmlns:ss': XLMLNS.ss, + 'xmlns:dt': XLMLNS.dt, + 'xmlns:html': XLMLNS.html + }); +} +/* [MS-OLEDS] 2.3.8 CompObjStream */ +function parse_compobj(obj/*:CFBEntry*/) { + var v = {}; + var o = obj.content; + /*:: if(o == null) return; */ + + /* [MS-OLEDS] 2.3.7 CompObjHeader -- All fields MUST be ignored */ + o.l = 28; + + v.AnsiUserType = o.read_shift(0, "lpstr-ansi"); + v.AnsiClipboardFormat = parse_ClipboardFormatOrAnsiString(o); + + if(o.length - o.l <= 4) return v; + + var m/*:number*/ = o.read_shift(4); + if(m == 0 || m > 40) return v; + o.l-=4; v.Reserved1 = o.read_shift(0, "lpstr-ansi"); + + if(o.length - o.l <= 4) return v; + m = o.read_shift(4); + if(m !== 0x71b239f4) return v; + v.UnicodeClipboardFormat = parse_ClipboardFormatOrUnicodeString(o); + + m = o.read_shift(4); + if(m == 0 || m > 40) return v; + o.l-=4; v.Reserved2 = o.read_shift(0, "lpwstr"); +} + +/* + Continue logic for: + - 2.4.58 Continue 0x003c + - 2.4.59 ContinueBigName 0x043c + - 2.4.60 ContinueFrt 0x0812 + - 2.4.61 ContinueFrt11 0x0875 + - 2.4.62 ContinueFrt12 0x087f +*/ +var CONTINUE_RT = [ 0x003c, 0x043c, 0x0812, 0x0875, 0x087f ]; +function slurp(RecordType, R, blob, length/*:number*/, opts)/*:any*/ { + var l = length; + var bufs = []; + var d = blob.slice(blob.l,blob.l+l); + if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) { + case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002F /* FilePass */: case 0x0195 /* FileLock */: case 0x00E1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */: + break; + case 0x0085 /* BoundSheet8 */: + break; + default: + opts.enc.insitu(d); + } + bufs.push(d); + blob.l += l; + var nextrt = __readUInt16LE(blob,blob.l), next = XLSRecordEnum[nextrt]; + var start = 0; + while(next != null && CONTINUE_RT.indexOf(nextrt) > -1) { + l = __readUInt16LE(blob,blob.l+2); + start = blob.l + 4; + if(nextrt == 0x0812 /* ContinueFrt */) start += 4; + else if(nextrt == 0x0875 || nextrt == 0x087f) { + start += 12; + } + d = blob.slice(start,blob.l+4+l); + bufs.push(d); + blob.l += 4+l; + next = (XLSRecordEnum[nextrt = __readUInt16LE(blob, blob.l)]); + } + var b = (bconcat(bufs)/*:any*/); + prep_blob(b, 0); + var ll = 0; b.lens = []; + for(var j = 0; j < bufs.length; ++j) { b.lens.push(ll); ll += bufs[j].length; } + if(b.length < length) throw "XLS Record 0x" + RecordType.toString(16) + " Truncated: " + b.length + " < " + length; + return R.f(b, b.length, opts); +} + +function safe_format_xf(p/*:any*/, opts/*:ParseOpts*/, date1904/*:?boolean*/) { + if(p.t === 'z') return; + if(!p.XF) return; + var fmtid = 0; + try { + fmtid = p.z || p.XF.numFmtId || 0; + if(opts.cellNF && p.z == null) p.z = table_fmt[fmtid]; + } catch(e) { if(opts.WTF) throw e; } + if(!opts || opts.cellText !== false) try { + if(p.t === 'e') { p.w = p.w || BErr[p.v]; } + else if(fmtid === 0 || fmtid == "General") { + if(p.t === 'n') { + if((p.v|0) === p.v) p.w = p.v.toString(10); + else p.w = SSF_general_num(p.v); + } + else p.w = SSF_general(p.v); + } + else p.w = SSF_format(fmtid,p.v, {date1904:!!date1904, dateNF: opts && opts.dateNF}); + } catch(e) { if(opts.WTF) throw e; } + if(opts.cellDates && fmtid && p.t == 'n' && fmt_is_date(table_fmt[fmtid] || String(fmtid))) { + var _d = SSF_parse_date_code(p.v + (date1904 ? 1462 : 0)); if(_d) { p.t = 'd'; p.v = new Date(Date.UTC(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u)); } + } +} + +function make_cell(val, ixfe, t)/*:Cell*/ { + return ({v:val, ixfe:ixfe, t:t}/*:any*/); +} + +// 2.3.2 +function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ { + var wb = ({opts:{}}/*:any*/); + var Sheets = {}; + if(DENSE != null && options.dense == null) options.dense = DENSE; + var out/*:Worksheet*/ = ({}/*:any*/); if(options.dense) out["!data"] = []; + var Directory = {}; + var range/*:Range*/ = ({}/*:any*/); + var last_formula = null; + var sst/*:SST*/ = ([]/*:any*/); + var cur_sheet = ""; + var Preamble = {}; + var lastcell, last_cell = "", cc/*:Cell*/, cmnt, rngC, rngR; + var sharedf = {}; + var arrayf/*:Array<[Range, string]>*/ = []; + var temp_val/*:Cell*/; + var country; + var XFs = []; /* XF records */ + var palette/*:Array<[number, number, number]>*/ = []; + var Workbook/*:WBWBProps*/ = ({ Sheets:[], WBProps:{date1904:false}, Views:[{}] }/*:any*/), wsprops = {}; + var biff4w = false; + var get_rgb = function getrgb(icv/*:number*/)/*:[number, number, number]*/ { + if(icv < 8) return XLSIcv[icv]; + if(icv < 64) return palette[icv-8] || XLSIcv[icv]; + return XLSIcv[icv]; + }; + var process_cell_style = function pcs(cell, line/*:any*/, options) { + var xfd = line.XF.data; + if(!xfd || !xfd.patternType || !options || !options.cellStyles) return; + line.s = ({}/*:any*/); + line.s.patternType = xfd.patternType; + var t; + if((t = rgb2Hex(get_rgb(xfd.icvFore)))) { line.s.fgColor = {rgb:t}; } + if((t = rgb2Hex(get_rgb(xfd.icvBack)))) { line.s.bgColor = {rgb:t}; } + }; + var addcell = function addcell(cell/*:any*/, line/*:any*/, options/*:any*/) { + if(!biff4w && file_depth > 1) return; + if(options.sheetRows && cell.r >= options.sheetRows) return; + if(options.cellStyles && line.XF && line.XF.data) process_cell_style(cell, line, options); + delete line.ixfe; delete line.XF; + lastcell = cell; + last_cell = encode_cell(cell); + if(!range || !range.s || !range.e) range = {s:{r:0,c:0},e:{r:0,c:0}}; + if(cell.r < range.s.r) range.s.r = cell.r; + if(cell.c < range.s.c) range.s.c = cell.c; + if(cell.r + 1 > range.e.r) range.e.r = cell.r + 1; + if(cell.c + 1 > range.e.c) range.e.c = cell.c + 1; + if(options.cellFormula && line.f) { + for(var afi = 0; afi < arrayf.length; ++afi) { + if(arrayf[afi][0].s.c > cell.c || arrayf[afi][0].s.r > cell.r) continue; + if(arrayf[afi][0].e.c < cell.c || arrayf[afi][0].e.r < cell.r) continue; + line.F = encode_range(arrayf[afi][0]); + if(arrayf[afi][0].s.c != cell.c || arrayf[afi][0].s.r != cell.r) delete line.f; + if(line.f) line.f = "" + stringify_formula(arrayf[afi][1], range, cell, supbooks, opts); + break; + } + } + { + if(options.dense) { + if(!out["!data"][cell.r]) out["!data"][cell.r] = []; + out["!data"][cell.r][cell.c] = line; + } else out[last_cell] = line; + } + }; + var opts = ({ + enc: false, // encrypted + sbcch: 0, // cch in the preceding SupBook + snames: [], // sheetnames + sharedf: sharedf, // shared formulae by address + arrayf: arrayf, // array formulae array + rrtabid: [], // RRTabId + lastuser: "", // Last User from WriteAccess + biff: 8, // BIFF version + codepage: 0, // CP from CodePage record + winlocked: 0, // fLockWn from WinProtect + cellStyles: !!options && !!options.cellStyles, + WTF: !!options && !!options.wtf + }/*:any*/); + if(options.password) opts.password = options.password; + var themes; + var merges/*:Array*/ = []; + var objects = []; + var colinfo/*:Array*/ = [], rowinfo/*:Array*/ = []; + var seencol = false; + var supbooks = ([]/*:any*/); // 1-indexed, will hold extern names + supbooks.SheetNames = opts.snames; + supbooks.sharedf = opts.sharedf; + supbooks.arrayf = opts.arrayf; + supbooks.names = []; + supbooks.XTI = []; + var last_RT = 0; + var file_depth = 0; /* TODO: make a real stack */ + var BIFF2Fmt = 0, BIFF2FmtTable/*:Array*/ = []; + var FilterDatabases = []; /* TODO: sort out supbooks and process elsewhere */ + var last_lbl/*:?DefinedName*/; + + /* explicit override for some broken writers */ + opts.codepage = 1200; + set_cp(1200); + var seen_codepage = false; + while(blob.l < blob.length - 1) { + var s = blob.l; + var RecordType = blob.read_shift(2); + if(RecordType === 0 && last_RT === 0x000a /* EOF */) break; + var length = (blob.l === blob.length ? 0 : blob.read_shift(2)); + var R = XLSRecordEnum[RecordType]; + if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(RecordType) == -1 /* BOF */) break; + //console.log(RecordType.toString(16), RecordType, R, blob.l, length, blob.length); + //if(!R) console.log(blob.slice(blob.l, blob.l + length)); + if(R && R.f) { + if(options.bookSheets) { + if(last_RT === 0x0085 /* BoundSheet8 */ && RecordType !== 0x0085 /* R.n !== 'BoundSheet8' */) break; + } + last_RT = RecordType; + if(R.r === 2 || R.r == 12) { + var rt = blob.read_shift(2); length -= 2; + if(!opts.enc && rt !== RecordType && (((rt&0xFF)<<8)|(rt>>8)) !== RecordType) throw new Error("rt mismatch: " + rt + "!=" + RecordType); + if(R.r == 12){ + blob.l += 10; length -= 10; + } // skip FRT + } + //console.error(R,blob.l,length,blob.length); + var val/*:any*/ = ({}/*:any*/); + if(RecordType === 0x000a /* EOF */) val = /*::(*/R.f(blob, length, opts)/*:: :any)*/; + else val = /*::(*/slurp(RecordType, R, blob, length, opts)/*:: :any)*/; + /*:: val = (val:any); */ + if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) continue; + switch(RecordType) { + case 0x0022 /* Date1904 */: + /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ + wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break; + case 0x0086 /* WriteProtect */: wb.opts.WriteProtect = true; break; + case 0x002f /* FilePass */: + if(!opts.enc) blob.l = 0; + opts.enc = val; + if(!options.password) throw new Error("File is password-protected"); + if(val.valid == null) throw new Error("Encryption scheme unsupported"); + if(!val.valid) throw new Error("Password is incorrect"); + break; + case 0x005c /* WriteAccess */: opts.lastuser = val; break; + case 0x0042 /* CodePage */: + var cpval = Number(val); + /* overrides based on test cases */ + switch(cpval) { + case 0x5212: cpval = 1200; break; + case 0x8000: cpval = 10000; break; + case 0x8001: cpval = 1252; break; + } + set_cp(opts.codepage = cpval); + seen_codepage = true; + break; + case 0x013d /* RRTabId */: opts.rrtabid = val; break; + case 0x0019 /* WinProtect */: opts.winlocked = val; break; + case 0x01b7 /* RefreshAll */: wb.opts["RefreshAll"] = val; break; + case 0x000c /* CalcCount */: wb.opts["CalcCount"] = val; break; + case 0x0010 /* CalcDelta */: wb.opts["CalcDelta"] = val; break; + case 0x0011 /* CalcIter */: wb.opts["CalcIter"] = val; break; + case 0x000d /* CalcMode */: wb.opts["CalcMode"] = val; break; + case 0x000e /* CalcPrecision */: wb.opts["CalcPrecision"] = val; break; + case 0x005f /* CalcSaveRecalc */: wb.opts["CalcSaveRecalc"] = val; break; + case 0x000f /* CalcRefMode */: opts.CalcRefMode = val; break; // TODO: implement R1C1 + case 0x08a3 /* ForceFullCalculation */: wb.opts.FullCalc = val; break; + case 0x0081 /* WsBool */: + if(val.fDialog) out["!type"] = "dialog"; + if(!val.fBelow) (out["!outline"] || (out["!outline"] = {})).above = true; + if(!val.fRight) (out["!outline"] || (out["!outline"] = {})).left = true; + break; // TODO + case 0x0043: /* BIFF2XF */ case 0x0243: /* BIFF3XF */ case 0x0443: /* BIFF4XF */ + case 0x00e0 /* XF */: + XFs.push(val); break; + case 0x01ae /* SupBook */: + supbooks.push([val]); + supbooks[supbooks.length-1].XTI = []; + break; + case 0x0023: case 0x0223 /* ExternName */: + supbooks[supbooks.length-1].push(val); + break; + case 0x0018: case 0x0218 /* Lbl */: + last_lbl = ({ + Name: val.Name, + Ref: stringify_formula(val.rgce,range,null,supbooks,opts) + }/*:DefinedName*/); + if(val.itab > 0) last_lbl.Sheet = val.itab - 1; + supbooks.names.push(last_lbl); + if(!supbooks[0]) { supbooks[0] = []; supbooks[0].XTI = []; } + supbooks[supbooks.length-1].push(val); + if(val.Name == "_xlnm._FilterDatabase" && val.itab > 0) + if(val.rgce && val.rgce[0] && val.rgce[0][0] && val.rgce[0][0][0] == 'PtgArea3d') + FilterDatabases[val.itab - 1] = { ref: encode_range(val.rgce[0][0][1][2]) }; + break; + case 0x0016 /* ExternCount */: opts.ExternCount = val; break; + case 0x0017 /* ExternSheet */: + if(supbooks.length == 0) { supbooks[0] = []; supbooks[0].XTI = []; } + supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); supbooks.XTI = supbooks.XTI.concat(val); break; + case 0x0894 /* NameCmt */: + /* TODO: search for correct name */ + if(opts.biff < 8) break; + if(last_lbl != null) last_lbl.Comment = val[1]; + break; + case 0x0012 /* Protect */: out["!protect"] = val; break; /* for sheet or book */ + case 0x0013 /* Password */: if(val !== 0 && opts.WTF) console.error("Password verifier: " + val); break; + case 0x0085 /* BoundSheet8 */: { + Directory[opts.biff == 4 ? opts.snames.length : val.pos] = val; + opts.snames.push(val.name); + } break; + case 0x000a /* EOF */: { + if(--file_depth ? !biff4w : biff4w) break; + if(range.e) { + if(range.e.r > 0 && range.e.c > 0) { + range.e.r--; range.e.c--; + out["!ref"] = encode_range(range); + if(options.sheetRows && options.sheetRows <= range.e.r) { + var tmpri = range.e.r; + range.e.r = options.sheetRows - 1; + out["!fullref"] = out["!ref"]; + out["!ref"] = encode_range(range); + range.e.r = tmpri; + } + range.e.r++; range.e.c++; + } + if(merges.length > 0) out["!merges"] = merges; + if(objects.length > 0) out["!objects"] = objects; + if(colinfo.length > 0) out["!cols"] = colinfo; + if(rowinfo.length > 0) out["!rows"] = rowinfo; + Workbook.Sheets.push(wsprops); + } + if(cur_sheet === "") Preamble = out; else Sheets[cur_sheet] = out; + out = ({}/*:any*/); if(options.dense) out["!data"] = []; + } break; + case 0x0009: case 0x0209: case 0x0409: case 0x0809 /* BOF */: { + if(opts.biff === 8) opts.biff = { + /*::[*/0x0009/*::]*/:2, + /*::[*/0x0209/*::]*/:3, + /*::[*/0x0409/*::]*/:4 + }[RecordType] || { + /*::[*/0x0200/*::]*/:2, + /*::[*/0x0300/*::]*/:3, + /*::[*/0x0400/*::]*/:4, + /*::[*/0x0500/*::]*/:5, + /*::[*/0x0600/*::]*/:8, + /*::[*/0x0002/*::]*/:2, + /*::[*/0x0007/*::]*/:2 + }[val.BIFFVer] || 8; + opts.biffguess = val.BIFFVer == 0; + if(val.BIFFVer == 0 && val.dt == 0x1000) { opts.biff = 5; seen_codepage = true; set_cp(opts.codepage = 28591); } + if(opts.biff == 4 && val.dt & 0x100) biff4w = true; + if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2; + if(file_depth++ && !biff4w) break; + out = ({}/*:any*/); if(options.dense) out["!data"] = []; + + if(opts.biff < 8 && !seen_codepage) { seen_codepage = true; set_cp(opts.codepage = options.codepage || 1252); } + if(opts.biff == 4 && biff4w) { + cur_sheet = (Directory[opts.snames.indexOf(cur_sheet)+1] || {name:""}).name; + } else if(opts.biff < 5 || val.BIFFVer == 0 && val.dt == 0x1000) { + if(cur_sheet === "") cur_sheet = "Sheet1"; + range = {s:{r:0,c:0},e:{r:0,c:0}}; + /* fake BoundSheet8 */ + var fakebs8 = {pos: blob.l - length, name:cur_sheet}; + Directory[fakebs8.pos] = fakebs8; + opts.snames.push(cur_sheet); + } + else cur_sheet = (Directory[s] || {name:""}).name; + if(val.dt == 0x20) out["!type"] = "chart"; + if(val.dt == 0x40) out["!type"] = "macro"; + merges = []; + objects = []; + opts.arrayf = arrayf = []; + colinfo = []; rowinfo = []; + seencol = false; + wsprops = {Hidden:(Directory[s]||{hs:0}).hs, name:cur_sheet }; + } break; + case 0x0203 /* Number */: case 0x0003 /* BIFF2NUM */: case 0x0002 /* BIFF2INT */: { + if(out["!type"] == "chart") if(options.dense ? (out["!data"][val.r]||[])[val.c]: out[encode_col(val.c) + encode_row(val.r)]) ++val.c; + temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe]||{}, v:val.val, t:'n'}/*:any*/); + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + } break; + case 0x0005: case 0x0205 /* BoolErr */: { + temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.val, t:val.t}/*:any*/); + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + } break; + case 0x027e /* RK */: { + temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.rknum, t:'n'}/*:any*/); + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + } break; + case 0x00bd /* MulRk */: { + for(var j = val.c; j <= val.C; ++j) { + var ixfe = val.rkrec[j-val.c][0]; + temp_val= ({ixfe:ixfe, XF:XFs[ixfe], v:val.rkrec[j-val.c][1], t:'n'}/*:any*/); + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:j, r:val.r}, temp_val, options); + } + } break; + case 0x0006: case 0x0206: case 0x0406 /* Formula */: { + if(val.val == 'String') { last_formula = val; break; } + temp_val = make_cell(val.val, val.cell.ixfe, val.tt); + temp_val.XF = XFs[temp_val.ixfe]; + if(options.cellFormula) { + var _f = val.formula; + if(_f && _f[0] && _f[0][0] && _f[0][0][0] == 'PtgExp') { + var _fr = _f[0][0][1][0], _fc = _f[0][0][1][1]; + var _fe = encode_cell({r:_fr, c:_fc}); + if(sharedf[_fe]) temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts); + else temp_val.F = ((options.dense ? (out["!data"][_fr]||[])[_fc]: out[_fe]) || {}).F; + } else temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts); + } + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell(val.cell, temp_val, options); + last_formula = val; + } break; + case 0x0007: case 0x0207 /* String */: { + if(last_formula) { /* technically always true */ + last_formula.val = val; + temp_val = make_cell(val, last_formula.cell.ixfe, 's'); + temp_val.XF = XFs[temp_val.ixfe]; + if(options.cellFormula) { + temp_val.f = ""+stringify_formula(last_formula.formula, range, last_formula.cell, supbooks, opts); + } + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell(last_formula.cell, temp_val, options); + last_formula = null; + } else throw new Error("String record expects Formula"); + } break; + case 0x0021: case 0x0221 /* Array */: { + arrayf.push(val); + var _arraystart = encode_cell(val[0].s); + cc = options.dense ? (out["!data"][val[0].s.r]||[])[val[0].s.c] : out[_arraystart]; + if(options.cellFormula && cc) { + if(!last_formula) break; /* technically unreachable */ + if(!_arraystart || !cc) break; + cc.f = ""+stringify_formula(val[1], range, val[0], supbooks, opts); + cc.F = encode_range(val[0]); + } + } break; + case 0x04bc /* ShrFmla */: { + if(!options.cellFormula) break; + if(last_cell) { + /* TODO: capture range */ + if(!last_formula) break; /* technically unreachable */ + sharedf[encode_cell(last_formula.cell)]= val[0]; + cc = options.dense ? (out["!data"][last_formula.cell.r]||[])[last_formula.cell.c] : out[encode_cell(last_formula.cell)]; + (cc||{}).f = ""+stringify_formula(val[0], range, lastcell, supbooks, opts); + } + } break; + case 0x00fd /* LabelSst */: + temp_val=make_cell(sst[val.isst].t, val.ixfe, 's'); + if(sst[val.isst].h) temp_val.h = sst[val.isst].h; + temp_val.XF = XFs[temp_val.ixfe]; + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + break; + case 0x0201 /* Blank */: if(options.sheetStubs) { + temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], t:'z'}/*:any*/); + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + } break; + case 0x00be /* MulBlank */: if(options.sheetStubs) { + for(var _j = val.c; _j <= val.C; ++_j) { + var _ixfe = val.ixfe[_j-val.c]; + temp_val= ({ixfe:_ixfe, XF:XFs[_ixfe], t:'z'}/*:any*/); + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:_j, r:val.r}, temp_val, options); + } + } break; + case 0x00d6 /* RString */: + case 0x0204 /* Label */: case 0x0004 /* BIFF2STR */: + temp_val=make_cell(val.val, val.ixfe, 's'); + temp_val.XF = XFs[temp_val.ixfe]; + if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F]; + safe_format_xf(temp_val, options, wb.opts.Date1904); + addcell({c:val.c, r:val.r}, temp_val, options); + break; + + case 0x0000: case 0x0200 /* Dimensions */: { + if(file_depth === 1) range = val; /* TODO: stack */ + } break; + case 0x00fc /* SST */: { + sst = val; + } break; + case 0x041e /* Format */: { /* val = [id, fmt] */ + if(opts.biff >= 3 && opts.biff <= 4) { + BIFF2FmtTable[BIFF2Fmt++] = val[1]; + for(var b4idx = 0; b4idx < BIFF2Fmt + 163; ++b4idx) if(table_fmt[b4idx] == val[1]) break; + if(b4idx >= 163) SSF__load(val[1], BIFF2Fmt + 163); + } + else SSF__load(val[1], val[0]); + } break; + case 0x001e /* BIFF2FORMAT */: { + BIFF2FmtTable[BIFF2Fmt++] = val; + for(var b2idx = 0; b2idx < BIFF2Fmt + 163; ++b2idx) if(table_fmt[b2idx] == val) break; + if(b2idx >= 163) SSF__load(val, BIFF2Fmt + 163); + } break; + + case 0x00e5 /* MergeCells */: merges = merges.concat(val); break; + + case 0x005d /* Obj */: objects[val.cmo[0]] = opts.lastobj = val; break; + case 0x01b6 /* TxO */: opts.lastobj.TxO = val; break; + case 0x007f /* ImData */: opts.lastobj.ImData = val; break; + + case 0x01b8 /* HLink */: { + for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR) + for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) { + cc = options.dense ? (out["!data"][rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})]; + if(cc) cc.l = val[1]; + } + } break; + case 0x0800 /* HLinkTooltip */: { + for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR) + for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) { + cc = options.dense ? (out["!data"][rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})]; + if(cc && cc.l) cc.l.Tooltip = val[1]; + } + } break; + case 0x001c /* Note */: { + /* TODO: comment continuation (row == -1 / 0xFFFF) */ + cc = options.dense ? (out["!data"][val[0].r]||[])[val[0].c] : out[encode_cell(val[0])]; + if(!cc) { + if(options.dense) { + if(!out["!data"][val[0].r]) out["!data"][val[0].r] = []; + cc = out["!data"][val[0].r][val[0].c] = ({t:"z"}/*:any*/); + } else { + cc = out[encode_cell(val[0])] = ({t:"z"}/*:any*/); + } + range.e.r = Math.max(range.e.r, val[0].r); + range.s.r = Math.min(range.s.r, val[0].r); + range.e.c = Math.max(range.e.c, val[0].c); + range.s.c = Math.min(range.s.c, val[0].c); + } + if(!cc.c) cc.c = []; + if(opts.biff <= 5 && opts.biff >= 2) cmnt = {a:"SheetJ5", t:val[1]}; + else { + var noteobj = objects[val[2]]; + cmnt = {a:val[1],t:noteobj.TxO.t}; + if(val[3] != null && !(val[3] & 0x02)) cc.c.hidden = true; + } + cc.c.push(cmnt); + } break; + case 0x087d /* XFExt */: update_xfext(XFs[val.ixfe], val.ext); break; + case 0x007d /* ColInfo */: { + if(!opts.cellStyles) break; + while(val.e >= val.s) { + colinfo[val.e--] = { width: val.w/256, level: (val.level || 0), hidden: !!(val.flags & 1) }; + if(!seencol) { seencol = true; find_mdw_colw(val.w/256); } + process_col(colinfo[val.e+1]); + } + } break; + case 0x0208 /* Row */: { + var rowobj = {}; + if(val.level != null) { rowinfo[val.r] = rowobj; rowobj.level = val.level; } + if(val.hidden) { rowinfo[val.r] = rowobj; rowobj.hidden = true; } + if(val.hpt) { + rowinfo[val.r] = rowobj; + rowobj.hpt = val.hpt; rowobj.hpx = pt2px(val.hpt); + } + } break; + case 0x0026 /* LeftMargin */: + case 0x0027 /* RightMargin */: + case 0x0028 /* TopMargin */: + case 0x0029 /* BottomMargin */: + if(!out['!margins']) default_margins(out['!margins'] = {}); + out['!margins'][({0x26: "left", 0x27:"right", 0x28:"top", 0x29:"bottom"})[RecordType]] = val; + break; + case 0x00a1 /* Setup */: // TODO + if(!out['!margins']) default_margins(out['!margins'] = {}); + out['!margins'].header = val.header; + out['!margins'].footer = val.footer; + break; + case 0x023e /* Window2 */: // TODO + // $FlowIgnore + if(val.RTL) Workbook.Views[0].RTL = true; + break; + case 0x0092 /* Palette */: palette = val; break; + case 0x0896 /* Theme */: themes = val; break; + case 0x008c /* Country */: country = val; break; + case 0x01ba /* CodeName */: { + /*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */ + if(!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook"; + else wsprops.CodeName = val || wsprops.name; + } break; + } + } else { + if(!R) console.error("Missing Info for XLS Record 0x" + RecordType.toString(16)); + blob.l += length; + } + } + wb.SheetNames=keys(Directory).sort(function(a,b) { return Number(a) - Number(b); }).map(function(x){return Directory[x].name;}); + if(!options.bookSheets) wb.Sheets=Sheets; + if(!wb.SheetNames.length && Preamble["!ref"]) { + wb.SheetNames.push("Sheet1"); + /*jshint -W069 */ + if(wb.Sheets) wb.Sheets["Sheet1"] = Preamble; + /*jshint +W069 */ + } else wb.Preamble=Preamble; + if(wb.Sheets) FilterDatabases.forEach(function(r,i) { wb.Sheets[wb.SheetNames[i]]['!autofilter'] = r; }); + wb.Strings = sst; + wb.SSF = dup(table_fmt); + if(opts.enc) wb.Encryption = opts.enc; + if(themes) wb.Themes = themes; + wb.Metadata = {}; + if(country !== undefined) wb.Metadata.Country = country; + if(supbooks.names.length > 0) Workbook.Names = supbooks.names; + wb.Workbook = Workbook; + return wb; +} + +/* TODO: split props*/ +var PSCLSID = { + SI: "e0859ff2f94f6810ab9108002b27b3d9", + DSI: "02d5cdd59c2e1b10939708002b2cf9ae", + UDI: "05d5cdd59c2e1b10939708002b2cf9ae" +}; +function parse_xls_props(cfb/*:CFBContainer*/, props, o) { + /* [MS-OSHARED] 2.3.3.2.2 Document Summary Information Property Set */ + var DSI = CFB.find(cfb, '/!DocumentSummaryInformation'); + if(DSI && DSI.size > 0) try { + var DocSummary = parse_PropertySetStream(DSI, DocSummaryPIDDSI, PSCLSID.DSI); + for(var d in DocSummary) props[d] = DocSummary[d]; + } catch(e) {if(o.WTF) throw e;/* empty */} + + /* [MS-OSHARED] 2.3.3.2.1 Summary Information Property Set*/ + var SI = CFB.find(cfb, '/!SummaryInformation'); + if(SI && SI.size > 0) try { + var Summary = parse_PropertySetStream(SI, SummaryPIDSI, PSCLSID.SI); + for(var s in Summary) if(props[s] == null) props[s] = Summary[s]; + } catch(e) {if(o.WTF) throw e;/* empty */} + + if(props.HeadingPairs && props.TitlesOfParts) { + load_props_pairs(props.HeadingPairs, props.TitlesOfParts, props, o); + delete props.HeadingPairs; delete props.TitlesOfParts; + } +} +function write_xls_props(wb/*:Workbook*/, cfb/*:CFBContainer*/) { + var DSEntries = [], SEntries = [], CEntries = []; + var i = 0, Keys; + var DocSummaryRE/*:{[key:string]:string}*/ = evert_key(DocSummaryPIDDSI, "n"); + var SummaryRE/*:{[key:string]:string}*/ = evert_key(SummaryPIDSI, "n"); + if(wb.Props) { + Keys = keys(wb.Props); + // $FlowIgnore + for(i = 0; i < Keys.length; ++i) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]); + } + if(wb.Custprops) { + Keys = keys(wb.Custprops); + // $FlowIgnore + for(i = 0; i < Keys.length; ++i) if(!Object.prototype.hasOwnProperty.call((wb.Props||{}), Keys[i])) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]); + } + var CEntries2 = []; + for(i = 0; i < CEntries.length; ++i) { + if(XLSPSSkip.indexOf(CEntries[i][0]) > -1 || PseudoPropsPairs.indexOf(CEntries[i][0]) > -1) continue; + if(CEntries[i][1] == null) continue; + CEntries2.push(CEntries[i]); + } + if(SEntries.length) CFB.utils.cfb_add(cfb, "/\u0005SummaryInformation", write_PropertySetStream(SEntries, PSCLSID.SI, SummaryRE, SummaryPIDSI)); + if(DSEntries.length || CEntries2.length) CFB.utils.cfb_add(cfb, "/\u0005DocumentSummaryInformation", write_PropertySetStream(DSEntries, PSCLSID.DSI, DocSummaryRE, DocSummaryPIDDSI, CEntries2.length ? CEntries2 : null, PSCLSID.UDI)); +} + +function parse_xlscfb(cfb/*:any*/, options/*:?ParseOpts*/)/*:Workbook*/ { +if(!options) options = {}; +fix_read_opts(options); +reset_cp(); +if(options.codepage) set_ansi(options.codepage); +var CompObj/*:?CFBEntry*/, WB/*:?any*/; +if(cfb.FullPaths) { + if(CFB.find(cfb, '/encryption')) throw new Error("File is password-protected"); + CompObj = CFB.find(cfb, '!CompObj'); + WB = CFB.find(cfb, '/Workbook') || CFB.find(cfb, '/Book'); +} else { + switch(options.type) { + case 'base64': cfb = s2a(Base64_decode(cfb)); break; + case 'binary': cfb = s2a(cfb); break; + case 'buffer': break; + case 'array': if(!Array.isArray(cfb)) cfb = Array.prototype.slice.call(cfb); break; + } + prep_blob(cfb, 0); + WB = ({content: cfb}/*:any*/); +} +var /*::CompObjP, */WorkbookP/*:: :Workbook = XLSX.utils.book_new(); */; + +var _data/*:?any*/; +if(CompObj) /*::CompObjP = */parse_compobj(CompObj); +if(options.bookProps && !options.bookSheets) WorkbookP = ({}/*:any*/); +else/*:: if(cfb instanceof CFBContainer) */ { + var T = has_buf ? 'buffer' : 'array'; + if(WB && WB.content) WorkbookP = parse_workbook(WB.content, options); + /* Quattro Pro 7-8 */ + else if((_data=CFB.find(cfb, 'PerfectOffice_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options)); + /* Quattro Pro 9 */ + else if((_data=CFB.find(cfb, 'NativeContent_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options)); + /* Works 4 for Mac */ + else if((_data=CFB.find(cfb, 'MN0')) && _data.content) throw new Error("Unsupported Works 4 for Mac file"); + else throw new Error("Cannot find Workbook stream"); + if(options.bookVBA && cfb.FullPaths && CFB.find(cfb, '/_VBA_PROJECT_CUR/VBA/dir')) WorkbookP.vbaraw = make_vba_xls(cfb); +} + +var props = {}; +if(cfb.FullPaths) parse_xls_props(/*::((*/cfb/*:: :any):CFBContainer)*/, props, options); + +WorkbookP.Props = WorkbookP.Custprops = props; /* TODO: split up properties */ +if(options.bookFiles) WorkbookP.cfb = cfb; +/*WorkbookP.CompObjP = CompObjP; // TODO: storage? */ +return WorkbookP; +} + + +function write_xlscfb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:CFBContainer*/ { + var o = opts || {}; + var cfb = CFB.utils.cfb_new({root:"R"}); + var wbpath = "/Workbook"; + switch(o.bookType || "xls") { + case "xls": o.bookType = "biff8"; + /* falls through */ + case "xla": if(!o.bookType) o.bookType = "xla"; + /* falls through */ + case "biff8": wbpath = "/Workbook"; o.biff = 8; break; + case "biff5": wbpath = "/Book"; o.biff = 5; break; + default: throw new Error("invalid type " + o.bookType + " for XLS CFB"); + } + CFB.utils.cfb_add(cfb, wbpath, write_biff_buf(wb, o)); + if(o.biff == 8 && (wb.Props || wb.Custprops)) write_xls_props(wb, cfb); + // TODO: SI, DSI, CO + if(o.biff == 8 && wb.vbaraw) fill_vba_xls(cfb, CFB.read(wb.vbaraw, {type: typeof wb.vbaraw == "string" ? "binary" : "buffer"})); + return cfb; +} +/* [MS-XLSB] 2.3 Record Enumeration */ +var XLSBRecordEnum = { + /*::[*/0x0000/*::]*/: { /* n:"BrtRowHdr", */ f:parse_BrtRowHdr }, + /*::[*/0x0001/*::]*/: { /* n:"BrtCellBlank", */ f:parse_BrtCellBlank }, + /*::[*/0x0002/*::]*/: { /* n:"BrtCellRk", */ f:parse_BrtCellRk }, + /*::[*/0x0003/*::]*/: { /* n:"BrtCellError", */ f:parse_BrtCellError }, + /*::[*/0x0004/*::]*/: { /* n:"BrtCellBool", */ f:parse_BrtCellBool }, + /*::[*/0x0005/*::]*/: { /* n:"BrtCellReal", */ f:parse_BrtCellReal }, + /*::[*/0x0006/*::]*/: { /* n:"BrtCellSt", */ f:parse_BrtCellSt }, + /*::[*/0x0007/*::]*/: { /* n:"BrtCellIsst", */ f:parse_BrtCellIsst }, + /*::[*/0x0008/*::]*/: { /* n:"BrtFmlaString", */ f:parse_BrtFmlaString }, + /*::[*/0x0009/*::]*/: { /* n:"BrtFmlaNum", */ f:parse_BrtFmlaNum }, + /*::[*/0x000A/*::]*/: { /* n:"BrtFmlaBool", */ f:parse_BrtFmlaBool }, + /*::[*/0x000B/*::]*/: { /* n:"BrtFmlaError", */ f:parse_BrtFmlaError }, + /*::[*/0x000C/*::]*/: { /* n:"BrtShortBlank", */ f:parse_BrtShortBlank }, + /*::[*/0x000D/*::]*/: { /* n:"BrtShortRk", */ f:parse_BrtShortRk }, + /*::[*/0x000E/*::]*/: { /* n:"BrtShortError", */ f:parse_BrtShortError }, + /*::[*/0x000F/*::]*/: { /* n:"BrtShortBool", */ f:parse_BrtShortBool }, + /*::[*/0x0010/*::]*/: { /* n:"BrtShortReal", */ f:parse_BrtShortReal }, + /*::[*/0x0011/*::]*/: { /* n:"BrtShortSt", */ f:parse_BrtShortSt }, + /*::[*/0x0012/*::]*/: { /* n:"BrtShortIsst", */ f:parse_BrtShortIsst }, + /*::[*/0x0013/*::]*/: { /* n:"BrtSSTItem", */ f:parse_RichStr }, + /*::[*/0x0014/*::]*/: { /* n:"BrtPCDIMissing" */ }, + /*::[*/0x0015/*::]*/: { /* n:"BrtPCDINumber" */ }, + /*::[*/0x0016/*::]*/: { /* n:"BrtPCDIBoolean" */ }, + /*::[*/0x0017/*::]*/: { /* n:"BrtPCDIError" */ }, + /*::[*/0x0018/*::]*/: { /* n:"BrtPCDIString" */ }, + /*::[*/0x0019/*::]*/: { /* n:"BrtPCDIDatetime" */ }, + /*::[*/0x001A/*::]*/: { /* n:"BrtPCDIIndex" */ }, + /*::[*/0x001B/*::]*/: { /* n:"BrtPCDIAMissing" */ }, + /*::[*/0x001C/*::]*/: { /* n:"BrtPCDIANumber" */ }, + /*::[*/0x001D/*::]*/: { /* n:"BrtPCDIABoolean" */ }, + /*::[*/0x001E/*::]*/: { /* n:"BrtPCDIAError" */ }, + /*::[*/0x001F/*::]*/: { /* n:"BrtPCDIAString" */ }, + /*::[*/0x0020/*::]*/: { /* n:"BrtPCDIADatetime" */ }, + /*::[*/0x0021/*::]*/: { /* n:"BrtPCRRecord" */ }, + /*::[*/0x0022/*::]*/: { /* n:"BrtPCRRecordDt" */ }, + /*::[*/0x0023/*::]*/: { /* n:"BrtFRTBegin", */ T:1 }, + /*::[*/0x0024/*::]*/: { /* n:"BrtFRTEnd", */ T:-1 }, + /*::[*/0x0025/*::]*/: { /* n:"BrtACBegin", */ T:1 }, + /*::[*/0x0026/*::]*/: { /* n:"BrtACEnd", */ T:-1 }, + /*::[*/0x0027/*::]*/: { /* n:"BrtName", */ f:parse_BrtName }, + /*::[*/0x0028/*::]*/: { /* n:"BrtIndexRowBlock" */ }, + /*::[*/0x002A/*::]*/: { /* n:"BrtIndexBlock" */ }, + /*::[*/0x002B/*::]*/: { /* n:"BrtFont", */ f:parse_BrtFont }, + /*::[*/0x002C/*::]*/: { /* n:"BrtFmt", */ f:parse_BrtFmt }, + /*::[*/0x002D/*::]*/: { /* n:"BrtFill", */ f:parse_BrtFill }, + /*::[*/0x002E/*::]*/: { /* n:"BrtBorder", */ f:parse_BrtBorder }, + /*::[*/0x002F/*::]*/: { /* n:"BrtXF", */ f:parse_BrtXF }, + /*::[*/0x0030/*::]*/: { /* n:"BrtStyle" */ }, + /*::[*/0x0031/*::]*/: { /* n:"BrtCellMeta", */ f:parse_Int32LE }, + /*::[*/0x0032/*::]*/: { /* n:"BrtValueMeta" */ }, + /*::[*/0x0033/*::]*/: { /* n:"BrtMdb" */ f:parse_BrtMdb }, + /*::[*/0x0034/*::]*/: { /* n:"BrtBeginFmd", */ T:1 }, + /*::[*/0x0035/*::]*/: { /* n:"BrtEndFmd", */ T:-1 }, + /*::[*/0x0036/*::]*/: { /* n:"BrtBeginMdx", */ T:1 }, + /*::[*/0x0037/*::]*/: { /* n:"BrtEndMdx", */ T:-1 }, + /*::[*/0x0038/*::]*/: { /* n:"BrtBeginMdxTuple", */ T:1 }, + /*::[*/0x0039/*::]*/: { /* n:"BrtEndMdxTuple", */ T:-1 }, + /*::[*/0x003A/*::]*/: { /* n:"BrtMdxMbrIstr" */ }, + /*::[*/0x003B/*::]*/: { /* n:"BrtStr" */ }, + /*::[*/0x003C/*::]*/: { /* n:"BrtColInfo", */ f:parse_ColInfo }, + /*::[*/0x003E/*::]*/: { /* n:"BrtCellRString", */ f:parse_BrtCellRString }, + /*::[*/0x003F/*::]*/: { /* n:"BrtCalcChainItem$", */ f:parse_BrtCalcChainItem$ }, + /*::[*/0x0040/*::]*/: { /* n:"BrtDVal", */ f:parse_BrtDVal }, + /*::[*/0x0041/*::]*/: { /* n:"BrtSxvcellNum" */ }, + /*::[*/0x0042/*::]*/: { /* n:"BrtSxvcellStr" */ }, + /*::[*/0x0043/*::]*/: { /* n:"BrtSxvcellBool" */ }, + /*::[*/0x0044/*::]*/: { /* n:"BrtSxvcellErr" */ }, + /*::[*/0x0045/*::]*/: { /* n:"BrtSxvcellDate" */ }, + /*::[*/0x0046/*::]*/: { /* n:"BrtSxvcellNil" */ }, + /*::[*/0x0080/*::]*/: { /* n:"BrtFileVersion" */ }, + /*::[*/0x0081/*::]*/: { /* n:"BrtBeginSheet", */ T:1 }, + /*::[*/0x0082/*::]*/: { /* n:"BrtEndSheet", */ T:-1 }, + /*::[*/0x0083/*::]*/: { /* n:"BrtBeginBook", */ T:1, f:parsenoop, p:0 }, + /*::[*/0x0084/*::]*/: { /* n:"BrtEndBook", */ T:-1 }, + /*::[*/0x0085/*::]*/: { /* n:"BrtBeginWsViews", */ T:1 }, + /*::[*/0x0086/*::]*/: { /* n:"BrtEndWsViews", */ T:-1 }, + /*::[*/0x0087/*::]*/: { /* n:"BrtBeginBookViews", */ T:1 }, + /*::[*/0x0088/*::]*/: { /* n:"BrtEndBookViews", */ T:-1 }, + /*::[*/0x0089/*::]*/: { /* n:"BrtBeginWsView", */ T:1, f:parse_BrtBeginWsView }, + /*::[*/0x008A/*::]*/: { /* n:"BrtEndWsView", */ T:-1 }, + /*::[*/0x008B/*::]*/: { /* n:"BrtBeginCsViews", */ T:1 }, + /*::[*/0x008C/*::]*/: { /* n:"BrtEndCsViews", */ T:-1 }, + /*::[*/0x008D/*::]*/: { /* n:"BrtBeginCsView", */ T:1 }, + /*::[*/0x008E/*::]*/: { /* n:"BrtEndCsView", */ T:-1 }, + /*::[*/0x008F/*::]*/: { /* n:"BrtBeginBundleShs", */ T:1 }, + /*::[*/0x0090/*::]*/: { /* n:"BrtEndBundleShs", */ T:-1 }, + /*::[*/0x0091/*::]*/: { /* n:"BrtBeginSheetData", */ T:1 }, + /*::[*/0x0092/*::]*/: { /* n:"BrtEndSheetData", */ T:-1 }, + /*::[*/0x0093/*::]*/: { /* n:"BrtWsProp", */ f:parse_BrtWsProp }, + /*::[*/0x0094/*::]*/: { /* n:"BrtWsDim", */ f:parse_BrtWsDim, p:16 }, + /*::[*/0x0097/*::]*/: { /* n:"BrtPane", */ f:parse_BrtPane }, + /*::[*/0x0098/*::]*/: { /* n:"BrtSel" */ }, + /*::[*/0x0099/*::]*/: { /* n:"BrtWbProp", */ f:parse_BrtWbProp }, + /*::[*/0x009A/*::]*/: { /* n:"BrtWbFactoid" */ }, + /*::[*/0x009B/*::]*/: { /* n:"BrtFileRecover" */ }, + /*::[*/0x009C/*::]*/: { /* n:"BrtBundleSh", */ f:parse_BrtBundleSh }, + /*::[*/0x009D/*::]*/: { /* n:"BrtCalcProp" */ }, + /*::[*/0x009E/*::]*/: { /* n:"BrtBookView" */ }, + /*::[*/0x009F/*::]*/: { /* n:"BrtBeginSst", */ T:1, f:parse_BrtBeginSst }, + /*::[*/0x00A0/*::]*/: { /* n:"BrtEndSst", */ T:-1 }, + /*::[*/0x00A1/*::]*/: { /* n:"BrtBeginAFilter", */ T:1, f:parse_UncheckedRfX }, + /*::[*/0x00A2/*::]*/: { /* n:"BrtEndAFilter", */ T:-1 }, + /*::[*/0x00A3/*::]*/: { /* n:"BrtBeginFilterColumn", */ T:1 }, + /*::[*/0x00A4/*::]*/: { /* n:"BrtEndFilterColumn", */ T:-1 }, + /*::[*/0x00A5/*::]*/: { /* n:"BrtBeginFilters", */ T:1 }, + /*::[*/0x00A6/*::]*/: { /* n:"BrtEndFilters", */ T:-1 }, + /*::[*/0x00A7/*::]*/: { /* n:"BrtFilter" */ }, + /*::[*/0x00A8/*::]*/: { /* n:"BrtColorFilter" */ }, + /*::[*/0x00A9/*::]*/: { /* n:"BrtIconFilter" */ }, + /*::[*/0x00AA/*::]*/: { /* n:"BrtTop10Filter" */ }, + /*::[*/0x00AB/*::]*/: { /* n:"BrtDynamicFilter" */ }, + /*::[*/0x00AC/*::]*/: { /* n:"BrtBeginCustomFilters", */ T:1 }, + /*::[*/0x00AD/*::]*/: { /* n:"BrtEndCustomFilters", */ T:-1 }, + /*::[*/0x00AE/*::]*/: { /* n:"BrtCustomFilter" */ }, + /*::[*/0x00AF/*::]*/: { /* n:"BrtAFilterDateGroupItem" */ }, + /*::[*/0x00B0/*::]*/: { /* n:"BrtMergeCell", */ f:parse_BrtMergeCell }, + /*::[*/0x00B1/*::]*/: { /* n:"BrtBeginMergeCells", */ T:1 }, + /*::[*/0x00B2/*::]*/: { /* n:"BrtEndMergeCells", */ T:-1 }, + /*::[*/0x00B3/*::]*/: { /* n:"BrtBeginPivotCacheDef", */ T:1 }, + /*::[*/0x00B4/*::]*/: { /* n:"BrtEndPivotCacheDef", */ T:-1 }, + /*::[*/0x00B5/*::]*/: { /* n:"BrtBeginPCDFields", */ T:1 }, + /*::[*/0x00B6/*::]*/: { /* n:"BrtEndPCDFields", */ T:-1 }, + /*::[*/0x00B7/*::]*/: { /* n:"BrtBeginPCDField", */ T:1 }, + /*::[*/0x00B8/*::]*/: { /* n:"BrtEndPCDField", */ T:-1 }, + /*::[*/0x00B9/*::]*/: { /* n:"BrtBeginPCDSource", */ T:1 }, + /*::[*/0x00BA/*::]*/: { /* n:"BrtEndPCDSource", */ T:-1 }, + /*::[*/0x00BB/*::]*/: { /* n:"BrtBeginPCDSRange", */ T:1 }, + /*::[*/0x00BC/*::]*/: { /* n:"BrtEndPCDSRange", */ T:-1 }, + /*::[*/0x00BD/*::]*/: { /* n:"BrtBeginPCDFAtbl", */ T:1 }, + /*::[*/0x00BE/*::]*/: { /* n:"BrtEndPCDFAtbl", */ T:-1 }, + /*::[*/0x00BF/*::]*/: { /* n:"BrtBeginPCDIRun", */ T:1 }, + /*::[*/0x00C0/*::]*/: { /* n:"BrtEndPCDIRun", */ T:-1 }, + /*::[*/0x00C1/*::]*/: { /* n:"BrtBeginPivotCacheRecords", */ T:1 }, + /*::[*/0x00C2/*::]*/: { /* n:"BrtEndPivotCacheRecords", */ T:-1 }, + /*::[*/0x00C3/*::]*/: { /* n:"BrtBeginPCDHierarchies", */ T:1 }, + /*::[*/0x00C4/*::]*/: { /* n:"BrtEndPCDHierarchies", */ T:-1 }, + /*::[*/0x00C5/*::]*/: { /* n:"BrtBeginPCDHierarchy", */ T:1 }, + /*::[*/0x00C6/*::]*/: { /* n:"BrtEndPCDHierarchy", */ T:-1 }, + /*::[*/0x00C7/*::]*/: { /* n:"BrtBeginPCDHFieldsUsage", */ T:1 }, + /*::[*/0x00C8/*::]*/: { /* n:"BrtEndPCDHFieldsUsage", */ T:-1 }, + /*::[*/0x00C9/*::]*/: { /* n:"BrtBeginExtConnection", */ T:1 }, + /*::[*/0x00CA/*::]*/: { /* n:"BrtEndExtConnection", */ T:-1 }, + /*::[*/0x00CB/*::]*/: { /* n:"BrtBeginECDbProps", */ T:1 }, + /*::[*/0x00CC/*::]*/: { /* n:"BrtEndECDbProps", */ T:-1 }, + /*::[*/0x00CD/*::]*/: { /* n:"BrtBeginECOlapProps", */ T:1 }, + /*::[*/0x00CE/*::]*/: { /* n:"BrtEndECOlapProps", */ T:-1 }, + /*::[*/0x00CF/*::]*/: { /* n:"BrtBeginPCDSConsol", */ T:1 }, + /*::[*/0x00D0/*::]*/: { /* n:"BrtEndPCDSConsol", */ T:-1 }, + /*::[*/0x00D1/*::]*/: { /* n:"BrtBeginPCDSCPages", */ T:1 }, + /*::[*/0x00D2/*::]*/: { /* n:"BrtEndPCDSCPages", */ T:-1 }, + /*::[*/0x00D3/*::]*/: { /* n:"BrtBeginPCDSCPage", */ T:1 }, + /*::[*/0x00D4/*::]*/: { /* n:"BrtEndPCDSCPage", */ T:-1 }, + /*::[*/0x00D5/*::]*/: { /* n:"BrtBeginPCDSCPItem", */ T:1 }, + /*::[*/0x00D6/*::]*/: { /* n:"BrtEndPCDSCPItem", */ T:-1 }, + /*::[*/0x00D7/*::]*/: { /* n:"BrtBeginPCDSCSets", */ T:1 }, + /*::[*/0x00D8/*::]*/: { /* n:"BrtEndPCDSCSets", */ T:-1 }, + /*::[*/0x00D9/*::]*/: { /* n:"BrtBeginPCDSCSet", */ T:1 }, + /*::[*/0x00DA/*::]*/: { /* n:"BrtEndPCDSCSet", */ T:-1 }, + /*::[*/0x00DB/*::]*/: { /* n:"BrtBeginPCDFGroup", */ T:1 }, + /*::[*/0x00DC/*::]*/: { /* n:"BrtEndPCDFGroup", */ T:-1 }, + /*::[*/0x00DD/*::]*/: { /* n:"BrtBeginPCDFGItems", */ T:1 }, + /*::[*/0x00DE/*::]*/: { /* n:"BrtEndPCDFGItems", */ T:-1 }, + /*::[*/0x00DF/*::]*/: { /* n:"BrtBeginPCDFGRange", */ T:1 }, + /*::[*/0x00E0/*::]*/: { /* n:"BrtEndPCDFGRange", */ T:-1 }, + /*::[*/0x00E1/*::]*/: { /* n:"BrtBeginPCDFGDiscrete", */ T:1 }, + /*::[*/0x00E2/*::]*/: { /* n:"BrtEndPCDFGDiscrete", */ T:-1 }, + /*::[*/0x00E3/*::]*/: { /* n:"BrtBeginPCDSDTupleCache", */ T:1 }, + /*::[*/0x00E4/*::]*/: { /* n:"BrtEndPCDSDTupleCache", */ T:-1 }, + /*::[*/0x00E5/*::]*/: { /* n:"BrtBeginPCDSDTCEntries", */ T:1 }, + /*::[*/0x00E6/*::]*/: { /* n:"BrtEndPCDSDTCEntries", */ T:-1 }, + /*::[*/0x00E7/*::]*/: { /* n:"BrtBeginPCDSDTCEMembers", */ T:1 }, + /*::[*/0x00E8/*::]*/: { /* n:"BrtEndPCDSDTCEMembers", */ T:-1 }, + /*::[*/0x00E9/*::]*/: { /* n:"BrtBeginPCDSDTCEMember", */ T:1 }, + /*::[*/0x00EA/*::]*/: { /* n:"BrtEndPCDSDTCEMember", */ T:-1 }, + /*::[*/0x00EB/*::]*/: { /* n:"BrtBeginPCDSDTCQueries", */ T:1 }, + /*::[*/0x00EC/*::]*/: { /* n:"BrtEndPCDSDTCQueries", */ T:-1 }, + /*::[*/0x00ED/*::]*/: { /* n:"BrtBeginPCDSDTCQuery", */ T:1 }, + /*::[*/0x00EE/*::]*/: { /* n:"BrtEndPCDSDTCQuery", */ T:-1 }, + /*::[*/0x00EF/*::]*/: { /* n:"BrtBeginPCDSDTCSets", */ T:1 }, + /*::[*/0x00F0/*::]*/: { /* n:"BrtEndPCDSDTCSets", */ T:-1 }, + /*::[*/0x00F1/*::]*/: { /* n:"BrtBeginPCDSDTCSet", */ T:1 }, + /*::[*/0x00F2/*::]*/: { /* n:"BrtEndPCDSDTCSet", */ T:-1 }, + /*::[*/0x00F3/*::]*/: { /* n:"BrtBeginPCDCalcItems", */ T:1 }, + /*::[*/0x00F4/*::]*/: { /* n:"BrtEndPCDCalcItems", */ T:-1 }, + /*::[*/0x00F5/*::]*/: { /* n:"BrtBeginPCDCalcItem", */ T:1 }, + /*::[*/0x00F6/*::]*/: { /* n:"BrtEndPCDCalcItem", */ T:-1 }, + /*::[*/0x00F7/*::]*/: { /* n:"BrtBeginPRule", */ T:1 }, + /*::[*/0x00F8/*::]*/: { /* n:"BrtEndPRule", */ T:-1 }, + /*::[*/0x00F9/*::]*/: { /* n:"BrtBeginPRFilters", */ T:1 }, + /*::[*/0x00FA/*::]*/: { /* n:"BrtEndPRFilters", */ T:-1 }, + /*::[*/0x00FB/*::]*/: { /* n:"BrtBeginPRFilter", */ T:1 }, + /*::[*/0x00FC/*::]*/: { /* n:"BrtEndPRFilter", */ T:-1 }, + /*::[*/0x00FD/*::]*/: { /* n:"BrtBeginPNames", */ T:1 }, + /*::[*/0x00FE/*::]*/: { /* n:"BrtEndPNames", */ T:-1 }, + /*::[*/0x00FF/*::]*/: { /* n:"BrtBeginPName", */ T:1 }, + /*::[*/0x0100/*::]*/: { /* n:"BrtEndPName", */ T:-1 }, + /*::[*/0x0101/*::]*/: { /* n:"BrtBeginPNPairs", */ T:1 }, + /*::[*/0x0102/*::]*/: { /* n:"BrtEndPNPairs", */ T:-1 }, + /*::[*/0x0103/*::]*/: { /* n:"BrtBeginPNPair", */ T:1 }, + /*::[*/0x0104/*::]*/: { /* n:"BrtEndPNPair", */ T:-1 }, + /*::[*/0x0105/*::]*/: { /* n:"BrtBeginECWebProps", */ T:1 }, + /*::[*/0x0106/*::]*/: { /* n:"BrtEndECWebProps", */ T:-1 }, + /*::[*/0x0107/*::]*/: { /* n:"BrtBeginEcWpTables", */ T:1 }, + /*::[*/0x0108/*::]*/: { /* n:"BrtEndECWPTables", */ T:-1 }, + /*::[*/0x0109/*::]*/: { /* n:"BrtBeginECParams", */ T:1 }, + /*::[*/0x010A/*::]*/: { /* n:"BrtEndECParams", */ T:-1 }, + /*::[*/0x010B/*::]*/: { /* n:"BrtBeginECParam", */ T:1 }, + /*::[*/0x010C/*::]*/: { /* n:"BrtEndECParam", */ T:-1 }, + /*::[*/0x010D/*::]*/: { /* n:"BrtBeginPCDKPIs", */ T:1 }, + /*::[*/0x010E/*::]*/: { /* n:"BrtEndPCDKPIs", */ T:-1 }, + /*::[*/0x010F/*::]*/: { /* n:"BrtBeginPCDKPI", */ T:1 }, + /*::[*/0x0110/*::]*/: { /* n:"BrtEndPCDKPI", */ T:-1 }, + /*::[*/0x0111/*::]*/: { /* n:"BrtBeginDims", */ T:1 }, + /*::[*/0x0112/*::]*/: { /* n:"BrtEndDims", */ T:-1 }, + /*::[*/0x0113/*::]*/: { /* n:"BrtBeginDim", */ T:1 }, + /*::[*/0x0114/*::]*/: { /* n:"BrtEndDim", */ T:-1 }, + /*::[*/0x0115/*::]*/: { /* n:"BrtIndexPartEnd" */ }, + /*::[*/0x0116/*::]*/: { /* n:"BrtBeginStyleSheet", */ T:1 }, + /*::[*/0x0117/*::]*/: { /* n:"BrtEndStyleSheet", */ T:-1 }, + /*::[*/0x0118/*::]*/: { /* n:"BrtBeginSXView", */ T:1 }, + /*::[*/0x0119/*::]*/: { /* n:"BrtEndSXVI", */ T:-1 }, + /*::[*/0x011A/*::]*/: { /* n:"BrtBeginSXVI", */ T:1 }, + /*::[*/0x011B/*::]*/: { /* n:"BrtBeginSXVIs", */ T:1 }, + /*::[*/0x011C/*::]*/: { /* n:"BrtEndSXVIs", */ T:-1 }, + /*::[*/0x011D/*::]*/: { /* n:"BrtBeginSXVD", */ T:1 }, + /*::[*/0x011E/*::]*/: { /* n:"BrtEndSXVD", */ T:-1 }, + /*::[*/0x011F/*::]*/: { /* n:"BrtBeginSXVDs", */ T:1 }, + /*::[*/0x0120/*::]*/: { /* n:"BrtEndSXVDs", */ T:-1 }, + /*::[*/0x0121/*::]*/: { /* n:"BrtBeginSXPI", */ T:1 }, + /*::[*/0x0122/*::]*/: { /* n:"BrtEndSXPI", */ T:-1 }, + /*::[*/0x0123/*::]*/: { /* n:"BrtBeginSXPIs", */ T:1 }, + /*::[*/0x0124/*::]*/: { /* n:"BrtEndSXPIs", */ T:-1 }, + /*::[*/0x0125/*::]*/: { /* n:"BrtBeginSXDI", */ T:1 }, + /*::[*/0x0126/*::]*/: { /* n:"BrtEndSXDI", */ T:-1 }, + /*::[*/0x0127/*::]*/: { /* n:"BrtBeginSXDIs", */ T:1 }, + /*::[*/0x0128/*::]*/: { /* n:"BrtEndSXDIs", */ T:-1 }, + /*::[*/0x0129/*::]*/: { /* n:"BrtBeginSXLI", */ T:1 }, + /*::[*/0x012A/*::]*/: { /* n:"BrtEndSXLI", */ T:-1 }, + /*::[*/0x012B/*::]*/: { /* n:"BrtBeginSXLIRws", */ T:1 }, + /*::[*/0x012C/*::]*/: { /* n:"BrtEndSXLIRws", */ T:-1 }, + /*::[*/0x012D/*::]*/: { /* n:"BrtBeginSXLICols", */ T:1 }, + /*::[*/0x012E/*::]*/: { /* n:"BrtEndSXLICols", */ T:-1 }, + /*::[*/0x012F/*::]*/: { /* n:"BrtBeginSXFormat", */ T:1 }, + /*::[*/0x0130/*::]*/: { /* n:"BrtEndSXFormat", */ T:-1 }, + /*::[*/0x0131/*::]*/: { /* n:"BrtBeginSXFormats", */ T:1 }, + /*::[*/0x0132/*::]*/: { /* n:"BrtEndSxFormats", */ T:-1 }, + /*::[*/0x0133/*::]*/: { /* n:"BrtBeginSxSelect", */ T:1 }, + /*::[*/0x0134/*::]*/: { /* n:"BrtEndSxSelect", */ T:-1 }, + /*::[*/0x0135/*::]*/: { /* n:"BrtBeginISXVDRws", */ T:1 }, + /*::[*/0x0136/*::]*/: { /* n:"BrtEndISXVDRws", */ T:-1 }, + /*::[*/0x0137/*::]*/: { /* n:"BrtBeginISXVDCols", */ T:1 }, + /*::[*/0x0138/*::]*/: { /* n:"BrtEndISXVDCols", */ T:-1 }, + /*::[*/0x0139/*::]*/: { /* n:"BrtEndSXLocation", */ T:-1 }, + /*::[*/0x013A/*::]*/: { /* n:"BrtBeginSXLocation", */ T:1 }, + /*::[*/0x013B/*::]*/: { /* n:"BrtEndSXView", */ T:-1 }, + /*::[*/0x013C/*::]*/: { /* n:"BrtBeginSXTHs", */ T:1 }, + /*::[*/0x013D/*::]*/: { /* n:"BrtEndSXTHs", */ T:-1 }, + /*::[*/0x013E/*::]*/: { /* n:"BrtBeginSXTH", */ T:1 }, + /*::[*/0x013F/*::]*/: { /* n:"BrtEndSXTH", */ T:-1 }, + /*::[*/0x0140/*::]*/: { /* n:"BrtBeginISXTHRws", */ T:1 }, + /*::[*/0x0141/*::]*/: { /* n:"BrtEndISXTHRws", */ T:-1 }, + /*::[*/0x0142/*::]*/: { /* n:"BrtBeginISXTHCols", */ T:1 }, + /*::[*/0x0143/*::]*/: { /* n:"BrtEndISXTHCols", */ T:-1 }, + /*::[*/0x0144/*::]*/: { /* n:"BrtBeginSXTDMPS", */ T:1 }, + /*::[*/0x0145/*::]*/: { /* n:"BrtEndSXTDMPs", */ T:-1 }, + /*::[*/0x0146/*::]*/: { /* n:"BrtBeginSXTDMP", */ T:1 }, + /*::[*/0x0147/*::]*/: { /* n:"BrtEndSXTDMP", */ T:-1 }, + /*::[*/0x0148/*::]*/: { /* n:"BrtBeginSXTHItems", */ T:1 }, + /*::[*/0x0149/*::]*/: { /* n:"BrtEndSXTHItems", */ T:-1 }, + /*::[*/0x014A/*::]*/: { /* n:"BrtBeginSXTHItem", */ T:1 }, + /*::[*/0x014B/*::]*/: { /* n:"BrtEndSXTHItem", */ T:-1 }, + /*::[*/0x014C/*::]*/: { /* n:"BrtBeginMetadata", */ T:1 }, + /*::[*/0x014D/*::]*/: { /* n:"BrtEndMetadata", */ T:-1 }, + /*::[*/0x014E/*::]*/: { /* n:"BrtBeginEsmdtinfo", */ T:1 }, + /*::[*/0x014F/*::]*/: { /* n:"BrtMdtinfo", */ f:parse_BrtMdtinfo }, + /*::[*/0x0150/*::]*/: { /* n:"BrtEndEsmdtinfo", */ T:-1 }, + /*::[*/0x0151/*::]*/: { /* n:"BrtBeginEsmdb", */ f:parse_BrtBeginEsmdb, T:1 }, + /*::[*/0x0152/*::]*/: { /* n:"BrtEndEsmdb", */ T:-1 }, + /*::[*/0x0153/*::]*/: { /* n:"BrtBeginEsfmd", */ T:1 }, + /*::[*/0x0154/*::]*/: { /* n:"BrtEndEsfmd", */ T:-1 }, + /*::[*/0x0155/*::]*/: { /* n:"BrtBeginSingleCells", */ T:1 }, + /*::[*/0x0156/*::]*/: { /* n:"BrtEndSingleCells", */ T:-1 }, + /*::[*/0x0157/*::]*/: { /* n:"BrtBeginList", */ T:1 }, + /*::[*/0x0158/*::]*/: { /* n:"BrtEndList", */ T:-1 }, + /*::[*/0x0159/*::]*/: { /* n:"BrtBeginListCols", */ T:1 }, + /*::[*/0x015A/*::]*/: { /* n:"BrtEndListCols", */ T:-1 }, + /*::[*/0x015B/*::]*/: { /* n:"BrtBeginListCol", */ T:1 }, + /*::[*/0x015C/*::]*/: { /* n:"BrtEndListCol", */ T:-1 }, + /*::[*/0x015D/*::]*/: { /* n:"BrtBeginListXmlCPr", */ T:1 }, + /*::[*/0x015E/*::]*/: { /* n:"BrtEndListXmlCPr", */ T:-1 }, + /*::[*/0x015F/*::]*/: { /* n:"BrtListCCFmla" */ }, + /*::[*/0x0160/*::]*/: { /* n:"BrtListTrFmla" */ }, + /*::[*/0x0161/*::]*/: { /* n:"BrtBeginExternals", */ T:1 }, + /*::[*/0x0162/*::]*/: { /* n:"BrtEndExternals", */ T:-1 }, + /*::[*/0x0163/*::]*/: { /* n:"BrtSupBookSrc", */ f:parse_RelID}, + /*::[*/0x0165/*::]*/: { /* n:"BrtSupSelf" */ }, + /*::[*/0x0166/*::]*/: { /* n:"BrtSupSame" */ }, + /*::[*/0x0167/*::]*/: { /* n:"BrtSupTabs" */ }, + /*::[*/0x0168/*::]*/: { /* n:"BrtBeginSupBook", */ T:1 }, + /*::[*/0x0169/*::]*/: { /* n:"BrtPlaceholderName" */ }, + /*::[*/0x016A/*::]*/: { /* n:"BrtExternSheet", */ f:parse_ExternSheet }, + /*::[*/0x016B/*::]*/: { /* n:"BrtExternTableStart" */ }, + /*::[*/0x016C/*::]*/: { /* n:"BrtExternTableEnd" */ }, + /*::[*/0x016E/*::]*/: { /* n:"BrtExternRowHdr" */ }, + /*::[*/0x016F/*::]*/: { /* n:"BrtExternCellBlank" */ }, + /*::[*/0x0170/*::]*/: { /* n:"BrtExternCellReal" */ }, + /*::[*/0x0171/*::]*/: { /* n:"BrtExternCellBool" */ }, + /*::[*/0x0172/*::]*/: { /* n:"BrtExternCellError" */ }, + /*::[*/0x0173/*::]*/: { /* n:"BrtExternCellString" */ }, + /*::[*/0x0174/*::]*/: { /* n:"BrtBeginEsmdx", */ T:1 }, + /*::[*/0x0175/*::]*/: { /* n:"BrtEndEsmdx", */ T:-1 }, + /*::[*/0x0176/*::]*/: { /* n:"BrtBeginMdxSet", */ T:1 }, + /*::[*/0x0177/*::]*/: { /* n:"BrtEndMdxSet", */ T:-1 }, + /*::[*/0x0178/*::]*/: { /* n:"BrtBeginMdxMbrProp", */ T:1 }, + /*::[*/0x0179/*::]*/: { /* n:"BrtEndMdxMbrProp", */ T:-1 }, + /*::[*/0x017A/*::]*/: { /* n:"BrtBeginMdxKPI", */ T:1 }, + /*::[*/0x017B/*::]*/: { /* n:"BrtEndMdxKPI", */ T:-1 }, + /*::[*/0x017C/*::]*/: { /* n:"BrtBeginEsstr", */ T:1 }, + /*::[*/0x017D/*::]*/: { /* n:"BrtEndEsstr", */ T:-1 }, + /*::[*/0x017E/*::]*/: { /* n:"BrtBeginPRFItem", */ T:1 }, + /*::[*/0x017F/*::]*/: { /* n:"BrtEndPRFItem", */ T:-1 }, + /*::[*/0x0180/*::]*/: { /* n:"BrtBeginPivotCacheIDs", */ T:1 }, + /*::[*/0x0181/*::]*/: { /* n:"BrtEndPivotCacheIDs", */ T:-1 }, + /*::[*/0x0182/*::]*/: { /* n:"BrtBeginPivotCacheID", */ T:1 }, + /*::[*/0x0183/*::]*/: { /* n:"BrtEndPivotCacheID", */ T:-1 }, + /*::[*/0x0184/*::]*/: { /* n:"BrtBeginISXVIs", */ T:1 }, + /*::[*/0x0185/*::]*/: { /* n:"BrtEndISXVIs", */ T:-1 }, + /*::[*/0x0186/*::]*/: { /* n:"BrtBeginColInfos", */ T:1 }, + /*::[*/0x0187/*::]*/: { /* n:"BrtEndColInfos", */ T:-1 }, + /*::[*/0x0188/*::]*/: { /* n:"BrtBeginRwBrk", */ T:1 }, + /*::[*/0x0189/*::]*/: { /* n:"BrtEndRwBrk", */ T:-1 }, + /*::[*/0x018A/*::]*/: { /* n:"BrtBeginColBrk", */ T:1 }, + /*::[*/0x018B/*::]*/: { /* n:"BrtEndColBrk", */ T:-1 }, + /*::[*/0x018C/*::]*/: { /* n:"BrtBrk" */ }, + /*::[*/0x018D/*::]*/: { /* n:"BrtUserBookView" */ }, + /*::[*/0x018E/*::]*/: { /* n:"BrtInfo" */ }, + /*::[*/0x018F/*::]*/: { /* n:"BrtCUsr" */ }, + /*::[*/0x0190/*::]*/: { /* n:"BrtUsr" */ }, + /*::[*/0x0191/*::]*/: { /* n:"BrtBeginUsers", */ T:1 }, + /*::[*/0x0193/*::]*/: { /* n:"BrtEOF" */ }, + /*::[*/0x0194/*::]*/: { /* n:"BrtUCR" */ }, + /*::[*/0x0195/*::]*/: { /* n:"BrtRRInsDel" */ }, + /*::[*/0x0196/*::]*/: { /* n:"BrtRREndInsDel" */ }, + /*::[*/0x0197/*::]*/: { /* n:"BrtRRMove" */ }, + /*::[*/0x0198/*::]*/: { /* n:"BrtRREndMove" */ }, + /*::[*/0x0199/*::]*/: { /* n:"BrtRRChgCell" */ }, + /*::[*/0x019A/*::]*/: { /* n:"BrtRREndChgCell" */ }, + /*::[*/0x019B/*::]*/: { /* n:"BrtRRHeader" */ }, + /*::[*/0x019C/*::]*/: { /* n:"BrtRRUserView" */ }, + /*::[*/0x019D/*::]*/: { /* n:"BrtRRRenSheet" */ }, + /*::[*/0x019E/*::]*/: { /* n:"BrtRRInsertSh" */ }, + /*::[*/0x019F/*::]*/: { /* n:"BrtRRDefName" */ }, + /*::[*/0x01A0/*::]*/: { /* n:"BrtRRNote" */ }, + /*::[*/0x01A1/*::]*/: { /* n:"BrtRRConflict" */ }, + /*::[*/0x01A2/*::]*/: { /* n:"BrtRRTQSIF" */ }, + /*::[*/0x01A3/*::]*/: { /* n:"BrtRRFormat" */ }, + /*::[*/0x01A4/*::]*/: { /* n:"BrtRREndFormat" */ }, + /*::[*/0x01A5/*::]*/: { /* n:"BrtRRAutoFmt" */ }, + /*::[*/0x01A6/*::]*/: { /* n:"BrtBeginUserShViews", */ T:1 }, + /*::[*/0x01A7/*::]*/: { /* n:"BrtBeginUserShView", */ T:1 }, + /*::[*/0x01A8/*::]*/: { /* n:"BrtEndUserShView", */ T:-1 }, + /*::[*/0x01A9/*::]*/: { /* n:"BrtEndUserShViews", */ T:-1 }, + /*::[*/0x01AA/*::]*/: { /* n:"BrtArrFmla", */ f:parse_BrtArrFmla }, + /*::[*/0x01AB/*::]*/: { /* n:"BrtShrFmla", */ f:parse_BrtShrFmla }, + /*::[*/0x01AC/*::]*/: { /* n:"BrtTable" */ }, + /*::[*/0x01AD/*::]*/: { /* n:"BrtBeginExtConnections", */ T:1 }, + /*::[*/0x01AE/*::]*/: { /* n:"BrtEndExtConnections", */ T:-1 }, + /*::[*/0x01AF/*::]*/: { /* n:"BrtBeginPCDCalcMems", */ T:1 }, + /*::[*/0x01B0/*::]*/: { /* n:"BrtEndPCDCalcMems", */ T:-1 }, + /*::[*/0x01B1/*::]*/: { /* n:"BrtBeginPCDCalcMem", */ T:1 }, + /*::[*/0x01B2/*::]*/: { /* n:"BrtEndPCDCalcMem", */ T:-1 }, + /*::[*/0x01B3/*::]*/: { /* n:"BrtBeginPCDHGLevels", */ T:1 }, + /*::[*/0x01B4/*::]*/: { /* n:"BrtEndPCDHGLevels", */ T:-1 }, + /*::[*/0x01B5/*::]*/: { /* n:"BrtBeginPCDHGLevel", */ T:1 }, + /*::[*/0x01B6/*::]*/: { /* n:"BrtEndPCDHGLevel", */ T:-1 }, + /*::[*/0x01B7/*::]*/: { /* n:"BrtBeginPCDHGLGroups", */ T:1 }, + /*::[*/0x01B8/*::]*/: { /* n:"BrtEndPCDHGLGroups", */ T:-1 }, + /*::[*/0x01B9/*::]*/: { /* n:"BrtBeginPCDHGLGroup", */ T:1 }, + /*::[*/0x01BA/*::]*/: { /* n:"BrtEndPCDHGLGroup", */ T:-1 }, + /*::[*/0x01BB/*::]*/: { /* n:"BrtBeginPCDHGLGMembers", */ T:1 }, + /*::[*/0x01BC/*::]*/: { /* n:"BrtEndPCDHGLGMembers", */ T:-1 }, + /*::[*/0x01BD/*::]*/: { /* n:"BrtBeginPCDHGLGMember", */ T:1 }, + /*::[*/0x01BE/*::]*/: { /* n:"BrtEndPCDHGLGMember", */ T:-1 }, + /*::[*/0x01BF/*::]*/: { /* n:"BrtBeginQSI", */ T:1 }, + /*::[*/0x01C0/*::]*/: { /* n:"BrtEndQSI", */ T:-1 }, + /*::[*/0x01C1/*::]*/: { /* n:"BrtBeginQSIR", */ T:1 }, + /*::[*/0x01C2/*::]*/: { /* n:"BrtEndQSIR", */ T:-1 }, + /*::[*/0x01C3/*::]*/: { /* n:"BrtBeginDeletedNames", */ T:1 }, + /*::[*/0x01C4/*::]*/: { /* n:"BrtEndDeletedNames", */ T:-1 }, + /*::[*/0x01C5/*::]*/: { /* n:"BrtBeginDeletedName", */ T:1 }, + /*::[*/0x01C6/*::]*/: { /* n:"BrtEndDeletedName", */ T:-1 }, + /*::[*/0x01C7/*::]*/: { /* n:"BrtBeginQSIFs", */ T:1 }, + /*::[*/0x01C8/*::]*/: { /* n:"BrtEndQSIFs", */ T:-1 }, + /*::[*/0x01C9/*::]*/: { /* n:"BrtBeginQSIF", */ T:1 }, + /*::[*/0x01CA/*::]*/: { /* n:"BrtEndQSIF", */ T:-1 }, + /*::[*/0x01CB/*::]*/: { /* n:"BrtBeginAutoSortScope", */ T:1 }, + /*::[*/0x01CC/*::]*/: { /* n:"BrtEndAutoSortScope", */ T:-1 }, + /*::[*/0x01CD/*::]*/: { /* n:"BrtBeginConditionalFormatting", */ T:1 }, + /*::[*/0x01CE/*::]*/: { /* n:"BrtEndConditionalFormatting", */ T:-1 }, + /*::[*/0x01CF/*::]*/: { /* n:"BrtBeginCFRule", */ T:1 }, + /*::[*/0x01D0/*::]*/: { /* n:"BrtEndCFRule", */ T:-1 }, + /*::[*/0x01D1/*::]*/: { /* n:"BrtBeginIconSet", */ T:1 }, + /*::[*/0x01D2/*::]*/: { /* n:"BrtEndIconSet", */ T:-1 }, + /*::[*/0x01D3/*::]*/: { /* n:"BrtBeginDatabar", */ T:1 }, + /*::[*/0x01D4/*::]*/: { /* n:"BrtEndDatabar", */ T:-1 }, + /*::[*/0x01D5/*::]*/: { /* n:"BrtBeginColorScale", */ T:1 }, + /*::[*/0x01D6/*::]*/: { /* n:"BrtEndColorScale", */ T:-1 }, + /*::[*/0x01D7/*::]*/: { /* n:"BrtCFVO" */ }, + /*::[*/0x01D8/*::]*/: { /* n:"BrtExternValueMeta" */ }, + /*::[*/0x01D9/*::]*/: { /* n:"BrtBeginColorPalette", */ T:1 }, + /*::[*/0x01DA/*::]*/: { /* n:"BrtEndColorPalette", */ T:-1 }, + /*::[*/0x01DB/*::]*/: { /* n:"BrtIndexedColor" */ }, + /*::[*/0x01DC/*::]*/: { /* n:"BrtMargins", */ f:parse_BrtMargins }, + /*::[*/0x01DD/*::]*/: { /* n:"BrtPrintOptions" */ }, + /*::[*/0x01DE/*::]*/: { /* n:"BrtPageSetup" */ }, + /*::[*/0x01DF/*::]*/: { /* n:"BrtBeginHeaderFooter", */ T:1 }, + /*::[*/0x01E0/*::]*/: { /* n:"BrtEndHeaderFooter", */ T:-1 }, + /*::[*/0x01E1/*::]*/: { /* n:"BrtBeginSXCrtFormat", */ T:1 }, + /*::[*/0x01E2/*::]*/: { /* n:"BrtEndSXCrtFormat", */ T:-1 }, + /*::[*/0x01E3/*::]*/: { /* n:"BrtBeginSXCrtFormats", */ T:1 }, + /*::[*/0x01E4/*::]*/: { /* n:"BrtEndSXCrtFormats", */ T:-1 }, + /*::[*/0x01E5/*::]*/: { /* n:"BrtWsFmtInfo", */ f:parse_BrtWsFmtInfo }, + /*::[*/0x01E6/*::]*/: { /* n:"BrtBeginMgs", */ T:1 }, + /*::[*/0x01E7/*::]*/: { /* n:"BrtEndMGs", */ T:-1 }, + /*::[*/0x01E8/*::]*/: { /* n:"BrtBeginMGMaps", */ T:1 }, + /*::[*/0x01E9/*::]*/: { /* n:"BrtEndMGMaps", */ T:-1 }, + /*::[*/0x01EA/*::]*/: { /* n:"BrtBeginMG", */ T:1 }, + /*::[*/0x01EB/*::]*/: { /* n:"BrtEndMG", */ T:-1 }, + /*::[*/0x01EC/*::]*/: { /* n:"BrtBeginMap", */ T:1 }, + /*::[*/0x01ED/*::]*/: { /* n:"BrtEndMap", */ T:-1 }, + /*::[*/0x01EE/*::]*/: { /* n:"BrtHLink", */ f:parse_BrtHLink }, + /*::[*/0x01EF/*::]*/: { /* n:"BrtBeginDCon", */ T:1 }, + /*::[*/0x01F0/*::]*/: { /* n:"BrtEndDCon", */ T:-1 }, + /*::[*/0x01F1/*::]*/: { /* n:"BrtBeginDRefs", */ T:1 }, + /*::[*/0x01F2/*::]*/: { /* n:"BrtEndDRefs", */ T:-1 }, + /*::[*/0x01F3/*::]*/: { /* n:"BrtDRef" */ }, + /*::[*/0x01F4/*::]*/: { /* n:"BrtBeginScenMan", */ T:1 }, + /*::[*/0x01F5/*::]*/: { /* n:"BrtEndScenMan", */ T:-1 }, + /*::[*/0x01F6/*::]*/: { /* n:"BrtBeginSct", */ T:1 }, + /*::[*/0x01F7/*::]*/: { /* n:"BrtEndSct", */ T:-1 }, + /*::[*/0x01F8/*::]*/: { /* n:"BrtSlc" */ }, + /*::[*/0x01F9/*::]*/: { /* n:"BrtBeginDXFs", */ T:1 }, + /*::[*/0x01FA/*::]*/: { /* n:"BrtEndDXFs", */ T:-1 }, + /*::[*/0x01FB/*::]*/: { /* n:"BrtDXF" */ }, + /*::[*/0x01FC/*::]*/: { /* n:"BrtBeginTableStyles", */ T:1 }, + /*::[*/0x01FD/*::]*/: { /* n:"BrtEndTableStyles", */ T:-1 }, + /*::[*/0x01FE/*::]*/: { /* n:"BrtBeginTableStyle", */ T:1 }, + /*::[*/0x01FF/*::]*/: { /* n:"BrtEndTableStyle", */ T:-1 }, + /*::[*/0x0200/*::]*/: { /* n:"BrtTableStyleElement" */ }, + /*::[*/0x0201/*::]*/: { /* n:"BrtTableStyleClient" */ }, + /*::[*/0x0202/*::]*/: { /* n:"BrtBeginVolDeps", */ T:1 }, + /*::[*/0x0203/*::]*/: { /* n:"BrtEndVolDeps", */ T:-1 }, + /*::[*/0x0204/*::]*/: { /* n:"BrtBeginVolType", */ T:1 }, + /*::[*/0x0205/*::]*/: { /* n:"BrtEndVolType", */ T:-1 }, + /*::[*/0x0206/*::]*/: { /* n:"BrtBeginVolMain", */ T:1 }, + /*::[*/0x0207/*::]*/: { /* n:"BrtEndVolMain", */ T:-1 }, + /*::[*/0x0208/*::]*/: { /* n:"BrtBeginVolTopic", */ T:1 }, + /*::[*/0x0209/*::]*/: { /* n:"BrtEndVolTopic", */ T:-1 }, + /*::[*/0x020A/*::]*/: { /* n:"BrtVolSubtopic" */ }, + /*::[*/0x020B/*::]*/: { /* n:"BrtVolRef" */ }, + /*::[*/0x020C/*::]*/: { /* n:"BrtVolNum" */ }, + /*::[*/0x020D/*::]*/: { /* n:"BrtVolErr" */ }, + /*::[*/0x020E/*::]*/: { /* n:"BrtVolStr" */ }, + /*::[*/0x020F/*::]*/: { /* n:"BrtVolBool" */ }, + /*::[*/0x0210/*::]*/: { /* n:"BrtBeginCalcChain$", */ T:1 }, + /*::[*/0x0211/*::]*/: { /* n:"BrtEndCalcChain$", */ T:-1 }, + /*::[*/0x0212/*::]*/: { /* n:"BrtBeginSortState", */ T:1 }, + /*::[*/0x0213/*::]*/: { /* n:"BrtEndSortState", */ T:-1 }, + /*::[*/0x0214/*::]*/: { /* n:"BrtBeginSortCond", */ T:1 }, + /*::[*/0x0215/*::]*/: { /* n:"BrtEndSortCond", */ T:-1 }, + /*::[*/0x0216/*::]*/: { /* n:"BrtBookProtection" */ }, + /*::[*/0x0217/*::]*/: { /* n:"BrtSheetProtection" */ }, + /*::[*/0x0218/*::]*/: { /* n:"BrtRangeProtection" */ }, + /*::[*/0x0219/*::]*/: { /* n:"BrtPhoneticInfo" */ }, + /*::[*/0x021A/*::]*/: { /* n:"BrtBeginECTxtWiz", */ T:1 }, + /*::[*/0x021B/*::]*/: { /* n:"BrtEndECTxtWiz", */ T:-1 }, + /*::[*/0x021C/*::]*/: { /* n:"BrtBeginECTWFldInfoLst", */ T:1 }, + /*::[*/0x021D/*::]*/: { /* n:"BrtEndECTWFldInfoLst", */ T:-1 }, + /*::[*/0x021E/*::]*/: { /* n:"BrtBeginECTwFldInfo", */ T:1 }, + /*::[*/0x0224/*::]*/: { /* n:"BrtFileSharing" */ }, + /*::[*/0x0225/*::]*/: { /* n:"BrtOleSize" */ }, + /*::[*/0x0226/*::]*/: { /* n:"BrtDrawing", */ f:parse_RelID }, + /*::[*/0x0227/*::]*/: { /* n:"BrtLegacyDrawing", */ f:parse_XLNullableWideString }, + /*::[*/0x0228/*::]*/: { /* n:"BrtLegacyDrawingHF" */ }, + /*::[*/0x0229/*::]*/: { /* n:"BrtWebOpt" */ }, + /*::[*/0x022A/*::]*/: { /* n:"BrtBeginWebPubItems", */ T:1 }, + /*::[*/0x022B/*::]*/: { /* n:"BrtEndWebPubItems", */ T:-1 }, + /*::[*/0x022C/*::]*/: { /* n:"BrtBeginWebPubItem", */ T:1 }, + /*::[*/0x022D/*::]*/: { /* n:"BrtEndWebPubItem", */ T:-1 }, + /*::[*/0x022E/*::]*/: { /* n:"BrtBeginSXCondFmt", */ T:1 }, + /*::[*/0x022F/*::]*/: { /* n:"BrtEndSXCondFmt", */ T:-1 }, + /*::[*/0x0230/*::]*/: { /* n:"BrtBeginSXCondFmts", */ T:1 }, + /*::[*/0x0231/*::]*/: { /* n:"BrtEndSXCondFmts", */ T:-1 }, + /*::[*/0x0232/*::]*/: { /* n:"BrtBkHim" */ }, + /*::[*/0x0234/*::]*/: { /* n:"BrtColor" */ }, + /*::[*/0x0235/*::]*/: { /* n:"BrtBeginIndexedColors", */ T:1 }, + /*::[*/0x0236/*::]*/: { /* n:"BrtEndIndexedColors", */ T:-1 }, + /*::[*/0x0239/*::]*/: { /* n:"BrtBeginMRUColors", */ T:1 }, + /*::[*/0x023A/*::]*/: { /* n:"BrtEndMRUColors", */ T:-1 }, + /*::[*/0x023C/*::]*/: { /* n:"BrtMRUColor" */ }, + /*::[*/0x023D/*::]*/: { /* n:"BrtBeginDVals", */ T:1 }, + /*::[*/0x023E/*::]*/: { /* n:"BrtEndDVals", */ T:-1 }, + /*::[*/0x0241/*::]*/: { /* n:"BrtSupNameStart" */ }, + /*::[*/0x0242/*::]*/: { /* n:"BrtSupNameValueStart" */ }, + /*::[*/0x0243/*::]*/: { /* n:"BrtSupNameValueEnd" */ }, + /*::[*/0x0244/*::]*/: { /* n:"BrtSupNameNum" */ }, + /*::[*/0x0245/*::]*/: { /* n:"BrtSupNameErr" */ }, + /*::[*/0x0246/*::]*/: { /* n:"BrtSupNameSt" */ }, + /*::[*/0x0247/*::]*/: { /* n:"BrtSupNameNil" */ }, + /*::[*/0x0248/*::]*/: { /* n:"BrtSupNameBool" */ }, + /*::[*/0x0249/*::]*/: { /* n:"BrtSupNameFmla" */ }, + /*::[*/0x024A/*::]*/: { /* n:"BrtSupNameBits" */ }, + /*::[*/0x024B/*::]*/: { /* n:"BrtSupNameEnd" */ }, + /*::[*/0x024C/*::]*/: { /* n:"BrtEndSupBook", */ T:-1 }, + /*::[*/0x024D/*::]*/: { /* n:"BrtCellSmartTagProperty" */ }, + /*::[*/0x024E/*::]*/: { /* n:"BrtBeginCellSmartTag", */ T:1 }, + /*::[*/0x024F/*::]*/: { /* n:"BrtEndCellSmartTag", */ T:-1 }, + /*::[*/0x0250/*::]*/: { /* n:"BrtBeginCellSmartTags", */ T:1 }, + /*::[*/0x0251/*::]*/: { /* n:"BrtEndCellSmartTags", */ T:-1 }, + /*::[*/0x0252/*::]*/: { /* n:"BrtBeginSmartTags", */ T:1 }, + /*::[*/0x0253/*::]*/: { /* n:"BrtEndSmartTags", */ T:-1 }, + /*::[*/0x0254/*::]*/: { /* n:"BrtSmartTagType" */ }, + /*::[*/0x0255/*::]*/: { /* n:"BrtBeginSmartTagTypes", */ T:1 }, + /*::[*/0x0256/*::]*/: { /* n:"BrtEndSmartTagTypes", */ T:-1 }, + /*::[*/0x0257/*::]*/: { /* n:"BrtBeginSXFilters", */ T:1 }, + /*::[*/0x0258/*::]*/: { /* n:"BrtEndSXFilters", */ T:-1 }, + /*::[*/0x0259/*::]*/: { /* n:"BrtBeginSXFILTER", */ T:1 }, + /*::[*/0x025A/*::]*/: { /* n:"BrtEndSXFilter", */ T:-1 }, + /*::[*/0x025B/*::]*/: { /* n:"BrtBeginFills", */ T:1 }, + /*::[*/0x025C/*::]*/: { /* n:"BrtEndFills", */ T:-1 }, + /*::[*/0x025D/*::]*/: { /* n:"BrtBeginCellWatches", */ T:1 }, + /*::[*/0x025E/*::]*/: { /* n:"BrtEndCellWatches", */ T:-1 }, + /*::[*/0x025F/*::]*/: { /* n:"BrtCellWatch" */ }, + /*::[*/0x0260/*::]*/: { /* n:"BrtBeginCRErrs", */ T:1 }, + /*::[*/0x0261/*::]*/: { /* n:"BrtEndCRErrs", */ T:-1 }, + /*::[*/0x0262/*::]*/: { /* n:"BrtCrashRecErr" */ }, + /*::[*/0x0263/*::]*/: { /* n:"BrtBeginFonts", */ T:1 }, + /*::[*/0x0264/*::]*/: { /* n:"BrtEndFonts", */ T:-1 }, + /*::[*/0x0265/*::]*/: { /* n:"BrtBeginBorders", */ T:1 }, + /*::[*/0x0266/*::]*/: { /* n:"BrtEndBorders", */ T:-1 }, + /*::[*/0x0267/*::]*/: { /* n:"BrtBeginFmts", */ T:1 }, + /*::[*/0x0268/*::]*/: { /* n:"BrtEndFmts", */ T:-1 }, + /*::[*/0x0269/*::]*/: { /* n:"BrtBeginCellXFs", */ T:1 }, + /*::[*/0x026A/*::]*/: { /* n:"BrtEndCellXFs", */ T:-1 }, + /*::[*/0x026B/*::]*/: { /* n:"BrtBeginStyles", */ T:1 }, + /*::[*/0x026C/*::]*/: { /* n:"BrtEndStyles", */ T:-1 }, + /*::[*/0x0271/*::]*/: { /* n:"BrtBigName" */ }, + /*::[*/0x0272/*::]*/: { /* n:"BrtBeginCellStyleXFs", */ T:1 }, + /*::[*/0x0273/*::]*/: { /* n:"BrtEndCellStyleXFs", */ T:-1 }, + /*::[*/0x0274/*::]*/: { /* n:"BrtBeginComments", */ T:1 }, + /*::[*/0x0275/*::]*/: { /* n:"BrtEndComments", */ T:-1 }, + /*::[*/0x0276/*::]*/: { /* n:"BrtBeginCommentAuthors", */ T:1 }, + /*::[*/0x0277/*::]*/: { /* n:"BrtEndCommentAuthors", */ T:-1 }, + /*::[*/0x0278/*::]*/: { /* n:"BrtCommentAuthor", */ f:parse_BrtCommentAuthor }, + /*::[*/0x0279/*::]*/: { /* n:"BrtBeginCommentList", */ T:1 }, + /*::[*/0x027A/*::]*/: { /* n:"BrtEndCommentList", */ T:-1 }, + /*::[*/0x027B/*::]*/: { /* n:"BrtBeginComment", */ T:1, f:parse_BrtBeginComment}, + /*::[*/0x027C/*::]*/: { /* n:"BrtEndComment", */ T:-1 }, + /*::[*/0x027D/*::]*/: { /* n:"BrtCommentText", */ f:parse_BrtCommentText }, + /*::[*/0x027E/*::]*/: { /* n:"BrtBeginOleObjects", */ T:1 }, + /*::[*/0x027F/*::]*/: { /* n:"BrtOleObject" */ }, + /*::[*/0x0280/*::]*/: { /* n:"BrtEndOleObjects", */ T:-1 }, + /*::[*/0x0281/*::]*/: { /* n:"BrtBeginSxrules", */ T:1 }, + /*::[*/0x0282/*::]*/: { /* n:"BrtEndSxRules", */ T:-1 }, + /*::[*/0x0283/*::]*/: { /* n:"BrtBeginActiveXControls", */ T:1 }, + /*::[*/0x0284/*::]*/: { /* n:"BrtActiveX" */ }, + /*::[*/0x0285/*::]*/: { /* n:"BrtEndActiveXControls", */ T:-1 }, + /*::[*/0x0286/*::]*/: { /* n:"BrtBeginPCDSDTCEMembersSortBy", */ T:1 }, + /*::[*/0x0288/*::]*/: { /* n:"BrtBeginCellIgnoreECs", */ T:1 }, + /*::[*/0x0289/*::]*/: { /* n:"BrtCellIgnoreEC" */ }, + /*::[*/0x028A/*::]*/: { /* n:"BrtEndCellIgnoreECs", */ T:-1 }, + /*::[*/0x028B/*::]*/: { /* n:"BrtCsProp", */ f:parse_BrtCsProp }, + /*::[*/0x028C/*::]*/: { /* n:"BrtCsPageSetup" */ }, + /*::[*/0x028D/*::]*/: { /* n:"BrtBeginUserCsViews", */ T:1 }, + /*::[*/0x028E/*::]*/: { /* n:"BrtEndUserCsViews", */ T:-1 }, + /*::[*/0x028F/*::]*/: { /* n:"BrtBeginUserCsView", */ T:1 }, + /*::[*/0x0290/*::]*/: { /* n:"BrtEndUserCsView", */ T:-1 }, + /*::[*/0x0291/*::]*/: { /* n:"BrtBeginPcdSFCIEntries", */ T:1 }, + /*::[*/0x0292/*::]*/: { /* n:"BrtEndPCDSFCIEntries", */ T:-1 }, + /*::[*/0x0293/*::]*/: { /* n:"BrtPCDSFCIEntry" */ }, + /*::[*/0x0294/*::]*/: { /* n:"BrtBeginListParts", */ T:1 }, + /*::[*/0x0295/*::]*/: { /* n:"BrtListPart" */ }, + /*::[*/0x0296/*::]*/: { /* n:"BrtEndListParts", */ T:-1 }, + /*::[*/0x0297/*::]*/: { /* n:"BrtSheetCalcProp" */ }, + /*::[*/0x0298/*::]*/: { /* n:"BrtBeginFnGroup", */ T:1 }, + /*::[*/0x0299/*::]*/: { /* n:"BrtFnGroup" */ }, + /*::[*/0x029A/*::]*/: { /* n:"BrtEndFnGroup", */ T:-1 }, + /*::[*/0x029B/*::]*/: { /* n:"BrtSupAddin" */ }, + /*::[*/0x029C/*::]*/: { /* n:"BrtSXTDMPOrder" */ }, + /*::[*/0x029D/*::]*/: { /* n:"BrtCsProtection" */ }, + /*::[*/0x029F/*::]*/: { /* n:"BrtBeginWsSortMap", */ T:1 }, + /*::[*/0x02A0/*::]*/: { /* n:"BrtEndWsSortMap", */ T:-1 }, + /*::[*/0x02A1/*::]*/: { /* n:"BrtBeginRRSort", */ T:1 }, + /*::[*/0x02A2/*::]*/: { /* n:"BrtEndRRSort", */ T:-1 }, + /*::[*/0x02A3/*::]*/: { /* n:"BrtRRSortItem" */ }, + /*::[*/0x02A4/*::]*/: { /* n:"BrtFileSharingIso" */ }, + /*::[*/0x02A5/*::]*/: { /* n:"BrtBookProtectionIso" */ }, + /*::[*/0x02A6/*::]*/: { /* n:"BrtSheetProtectionIso" */ }, + /*::[*/0x02A7/*::]*/: { /* n:"BrtCsProtectionIso" */ }, + /*::[*/0x02A8/*::]*/: { /* n:"BrtRangeProtectionIso" */ }, + /*::[*/0x02A9/*::]*/: { /* n:"BrtDValList" */ }, + /*::[*/0x0400/*::]*/: { /* n:"BrtRwDescent" */ }, + /*::[*/0x0401/*::]*/: { /* n:"BrtKnownFonts" */ }, + /*::[*/0x0402/*::]*/: { /* n:"BrtBeginSXTupleSet", */ T:1 }, + /*::[*/0x0403/*::]*/: { /* n:"BrtEndSXTupleSet", */ T:-1 }, + /*::[*/0x0404/*::]*/: { /* n:"BrtBeginSXTupleSetHeader", */ T:1 }, + /*::[*/0x0405/*::]*/: { /* n:"BrtEndSXTupleSetHeader", */ T:-1 }, + /*::[*/0x0406/*::]*/: { /* n:"BrtSXTupleSetHeaderItem" */ }, + /*::[*/0x0407/*::]*/: { /* n:"BrtBeginSXTupleSetData", */ T:1 }, + /*::[*/0x0408/*::]*/: { /* n:"BrtEndSXTupleSetData", */ T:-1 }, + /*::[*/0x0409/*::]*/: { /* n:"BrtBeginSXTupleSetRow", */ T:1 }, + /*::[*/0x040A/*::]*/: { /* n:"BrtEndSXTupleSetRow", */ T:-1 }, + /*::[*/0x040B/*::]*/: { /* n:"BrtSXTupleSetRowItem" */ }, + /*::[*/0x040C/*::]*/: { /* n:"BrtNameExt" */ }, + /*::[*/0x040D/*::]*/: { /* n:"BrtPCDH14" */ }, + /*::[*/0x040E/*::]*/: { /* n:"BrtBeginPCDCalcMem14", */ T:1 }, + /*::[*/0x040F/*::]*/: { /* n:"BrtEndPCDCalcMem14", */ T:-1 }, + /*::[*/0x0410/*::]*/: { /* n:"BrtSXTH14" */ }, + /*::[*/0x0411/*::]*/: { /* n:"BrtBeginSparklineGroup", */ T:1 }, + /*::[*/0x0412/*::]*/: { /* n:"BrtEndSparklineGroup", */ T:-1 }, + /*::[*/0x0413/*::]*/: { /* n:"BrtSparkline" */ }, + /*::[*/0x0414/*::]*/: { /* n:"BrtSXDI14" */ }, + /*::[*/0x0415/*::]*/: { /* n:"BrtWsFmtInfoEx14" */ }, + /*::[*/0x0416/*::]*/: { /* n:"BrtBeginConditionalFormatting14", */ T:1 }, + /*::[*/0x0417/*::]*/: { /* n:"BrtEndConditionalFormatting14", */ T:-1 }, + /*::[*/0x0418/*::]*/: { /* n:"BrtBeginCFRule14", */ T:1 }, + /*::[*/0x0419/*::]*/: { /* n:"BrtEndCFRule14", */ T:-1 }, + /*::[*/0x041A/*::]*/: { /* n:"BrtCFVO14" */ }, + /*::[*/0x041B/*::]*/: { /* n:"BrtBeginDatabar14", */ T:1 }, + /*::[*/0x041C/*::]*/: { /* n:"BrtBeginIconSet14", */ T:1 }, + /*::[*/0x041D/*::]*/: { /* n:"BrtDVal14", */ f: parse_BrtDVal14 }, + /*::[*/0x041E/*::]*/: { /* n:"BrtBeginDVals14", */ T:1 }, + /*::[*/0x041F/*::]*/: { /* n:"BrtColor14" */ }, + /*::[*/0x0420/*::]*/: { /* n:"BrtBeginSparklines", */ T:1 }, + /*::[*/0x0421/*::]*/: { /* n:"BrtEndSparklines", */ T:-1 }, + /*::[*/0x0422/*::]*/: { /* n:"BrtBeginSparklineGroups", */ T:1 }, + /*::[*/0x0423/*::]*/: { /* n:"BrtEndSparklineGroups", */ T:-1 }, + /*::[*/0x0425/*::]*/: { /* n:"BrtSXVD14" */ }, + /*::[*/0x0426/*::]*/: { /* n:"BrtBeginSXView14", */ T:1 }, + /*::[*/0x0427/*::]*/: { /* n:"BrtEndSXView14", */ T:-1 }, + /*::[*/0x0428/*::]*/: { /* n:"BrtBeginSXView16", */ T:1 }, + /*::[*/0x0429/*::]*/: { /* n:"BrtEndSXView16", */ T:-1 }, + /*::[*/0x042A/*::]*/: { /* n:"BrtBeginPCD14", */ T:1 }, + /*::[*/0x042B/*::]*/: { /* n:"BrtEndPCD14", */ T:-1 }, + /*::[*/0x042C/*::]*/: { /* n:"BrtBeginExtConn14", */ T:1 }, + /*::[*/0x042D/*::]*/: { /* n:"BrtEndExtConn14", */ T:-1 }, + /*::[*/0x042E/*::]*/: { /* n:"BrtBeginSlicerCacheIDs", */ T:1 }, + /*::[*/0x042F/*::]*/: { /* n:"BrtEndSlicerCacheIDs", */ T:-1 }, + /*::[*/0x0430/*::]*/: { /* n:"BrtBeginSlicerCacheID", */ T:1 }, + /*::[*/0x0431/*::]*/: { /* n:"BrtEndSlicerCacheID", */ T:-1 }, + /*::[*/0x0433/*::]*/: { /* n:"BrtBeginSlicerCache", */ T:1 }, + /*::[*/0x0434/*::]*/: { /* n:"BrtEndSlicerCache", */ T:-1 }, + /*::[*/0x0435/*::]*/: { /* n:"BrtBeginSlicerCacheDef", */ T:1 }, + /*::[*/0x0436/*::]*/: { /* n:"BrtEndSlicerCacheDef", */ T:-1 }, + /*::[*/0x0437/*::]*/: { /* n:"BrtBeginSlicersEx", */ T:1 }, + /*::[*/0x0438/*::]*/: { /* n:"BrtEndSlicersEx", */ T:-1 }, + /*::[*/0x0439/*::]*/: { /* n:"BrtBeginSlicerEx", */ T:1 }, + /*::[*/0x043A/*::]*/: { /* n:"BrtEndSlicerEx", */ T:-1 }, + /*::[*/0x043B/*::]*/: { /* n:"BrtBeginSlicer", */ T:1 }, + /*::[*/0x043C/*::]*/: { /* n:"BrtEndSlicer", */ T:-1 }, + /*::[*/0x043D/*::]*/: { /* n:"BrtSlicerCachePivotTables" */ }, + /*::[*/0x043E/*::]*/: { /* n:"BrtBeginSlicerCacheOlapImpl", */ T:1 }, + /*::[*/0x043F/*::]*/: { /* n:"BrtEndSlicerCacheOlapImpl", */ T:-1 }, + /*::[*/0x0440/*::]*/: { /* n:"BrtBeginSlicerCacheLevelsData", */ T:1 }, + /*::[*/0x0441/*::]*/: { /* n:"BrtEndSlicerCacheLevelsData", */ T:-1 }, + /*::[*/0x0442/*::]*/: { /* n:"BrtBeginSlicerCacheLevelData", */ T:1 }, + /*::[*/0x0443/*::]*/: { /* n:"BrtEndSlicerCacheLevelData", */ T:-1 }, + /*::[*/0x0444/*::]*/: { /* n:"BrtBeginSlicerCacheSiRanges", */ T:1 }, + /*::[*/0x0445/*::]*/: { /* n:"BrtEndSlicerCacheSiRanges", */ T:-1 }, + /*::[*/0x0446/*::]*/: { /* n:"BrtBeginSlicerCacheSiRange", */ T:1 }, + /*::[*/0x0447/*::]*/: { /* n:"BrtEndSlicerCacheSiRange", */ T:-1 }, + /*::[*/0x0448/*::]*/: { /* n:"BrtSlicerCacheOlapItem" */ }, + /*::[*/0x0449/*::]*/: { /* n:"BrtBeginSlicerCacheSelections", */ T:1 }, + /*::[*/0x044A/*::]*/: { /* n:"BrtSlicerCacheSelection" */ }, + /*::[*/0x044B/*::]*/: { /* n:"BrtEndSlicerCacheSelections", */ T:-1 }, + /*::[*/0x044C/*::]*/: { /* n:"BrtBeginSlicerCacheNative", */ T:1 }, + /*::[*/0x044D/*::]*/: { /* n:"BrtEndSlicerCacheNative", */ T:-1 }, + /*::[*/0x044E/*::]*/: { /* n:"BrtSlicerCacheNativeItem" */ }, + /*::[*/0x044F/*::]*/: { /* n:"BrtRangeProtection14" */ }, + /*::[*/0x0450/*::]*/: { /* n:"BrtRangeProtectionIso14" */ }, + /*::[*/0x0451/*::]*/: { /* n:"BrtCellIgnoreEC14" */ }, + /*::[*/0x0457/*::]*/: { /* n:"BrtList14" */ }, + /*::[*/0x0458/*::]*/: { /* n:"BrtCFIcon" */ }, + /*::[*/0x0459/*::]*/: { /* n:"BrtBeginSlicerCachesPivotCacheIDs", */ T:1 }, + /*::[*/0x045A/*::]*/: { /* n:"BrtEndSlicerCachesPivotCacheIDs", */ T:-1 }, + /*::[*/0x045B/*::]*/: { /* n:"BrtBeginSlicers", */ T:1 }, + /*::[*/0x045C/*::]*/: { /* n:"BrtEndSlicers", */ T:-1 }, + /*::[*/0x045D/*::]*/: { /* n:"BrtWbProp14" */ }, + /*::[*/0x045E/*::]*/: { /* n:"BrtBeginSXEdit", */ T:1 }, + /*::[*/0x045F/*::]*/: { /* n:"BrtEndSXEdit", */ T:-1 }, + /*::[*/0x0460/*::]*/: { /* n:"BrtBeginSXEdits", */ T:1 }, + /*::[*/0x0461/*::]*/: { /* n:"BrtEndSXEdits", */ T:-1 }, + /*::[*/0x0462/*::]*/: { /* n:"BrtBeginSXChange", */ T:1 }, + /*::[*/0x0463/*::]*/: { /* n:"BrtEndSXChange", */ T:-1 }, + /*::[*/0x0464/*::]*/: { /* n:"BrtBeginSXChanges", */ T:1 }, + /*::[*/0x0465/*::]*/: { /* n:"BrtEndSXChanges", */ T:-1 }, + /*::[*/0x0466/*::]*/: { /* n:"BrtSXTupleItems" */ }, + /*::[*/0x0468/*::]*/: { /* n:"BrtBeginSlicerStyle", */ T:1 }, + /*::[*/0x0469/*::]*/: { /* n:"BrtEndSlicerStyle", */ T:-1 }, + /*::[*/0x046A/*::]*/: { /* n:"BrtSlicerStyleElement" */ }, + /*::[*/0x046B/*::]*/: { /* n:"BrtBeginStyleSheetExt14", */ T:1 }, + /*::[*/0x046C/*::]*/: { /* n:"BrtEndStyleSheetExt14", */ T:-1 }, + /*::[*/0x046D/*::]*/: { /* n:"BrtBeginSlicerCachesPivotCacheID", */ T:1 }, + /*::[*/0x046E/*::]*/: { /* n:"BrtEndSlicerCachesPivotCacheID", */ T:-1 }, + /*::[*/0x046F/*::]*/: { /* n:"BrtBeginConditionalFormattings", */ T:1 }, + /*::[*/0x0470/*::]*/: { /* n:"BrtEndConditionalFormattings", */ T:-1 }, + /*::[*/0x0471/*::]*/: { /* n:"BrtBeginPCDCalcMemExt", */ T:1 }, + /*::[*/0x0472/*::]*/: { /* n:"BrtEndPCDCalcMemExt", */ T:-1 }, + /*::[*/0x0473/*::]*/: { /* n:"BrtBeginPCDCalcMemsExt", */ T:1 }, + /*::[*/0x0474/*::]*/: { /* n:"BrtEndPCDCalcMemsExt", */ T:-1 }, + /*::[*/0x0475/*::]*/: { /* n:"BrtPCDField14" */ }, + /*::[*/0x0476/*::]*/: { /* n:"BrtBeginSlicerStyles", */ T:1 }, + /*::[*/0x0477/*::]*/: { /* n:"BrtEndSlicerStyles", */ T:-1 }, + /*::[*/0x0478/*::]*/: { /* n:"BrtBeginSlicerStyleElements", */ T:1 }, + /*::[*/0x0479/*::]*/: { /* n:"BrtEndSlicerStyleElements", */ T:-1 }, + /*::[*/0x047A/*::]*/: { /* n:"BrtCFRuleExt" */ }, + /*::[*/0x047B/*::]*/: { /* n:"BrtBeginSXCondFmt14", */ T:1 }, + /*::[*/0x047C/*::]*/: { /* n:"BrtEndSXCondFmt14", */ T:-1 }, + /*::[*/0x047D/*::]*/: { /* n:"BrtBeginSXCondFmts14", */ T:1 }, + /*::[*/0x047E/*::]*/: { /* n:"BrtEndSXCondFmts14", */ T:-1 }, + /*::[*/0x0480/*::]*/: { /* n:"BrtBeginSortCond14", */ T:1 }, + /*::[*/0x0481/*::]*/: { /* n:"BrtEndSortCond14", */ T:-1 }, + /*::[*/0x0482/*::]*/: { /* n:"BrtEndDVals14", */ T:-1 }, + /*::[*/0x0483/*::]*/: { /* n:"BrtEndIconSet14", */ T:-1 }, + /*::[*/0x0484/*::]*/: { /* n:"BrtEndDatabar14", */ T:-1 }, + /*::[*/0x0485/*::]*/: { /* n:"BrtBeginColorScale14", */ T:1 }, + /*::[*/0x0486/*::]*/: { /* n:"BrtEndColorScale14", */ T:-1 }, + /*::[*/0x0487/*::]*/: { /* n:"BrtBeginSxrules14", */ T:1 }, + /*::[*/0x0488/*::]*/: { /* n:"BrtEndSxrules14", */ T:-1 }, + /*::[*/0x0489/*::]*/: { /* n:"BrtBeginPRule14", */ T:1 }, + /*::[*/0x048A/*::]*/: { /* n:"BrtEndPRule14", */ T:-1 }, + /*::[*/0x048B/*::]*/: { /* n:"BrtBeginPRFilters14", */ T:1 }, + /*::[*/0x048C/*::]*/: { /* n:"BrtEndPRFilters14", */ T:-1 }, + /*::[*/0x048D/*::]*/: { /* n:"BrtBeginPRFilter14", */ T:1 }, + /*::[*/0x048E/*::]*/: { /* n:"BrtEndPRFilter14", */ T:-1 }, + /*::[*/0x048F/*::]*/: { /* n:"BrtBeginPRFItem14", */ T:1 }, + /*::[*/0x0490/*::]*/: { /* n:"BrtEndPRFItem14", */ T:-1 }, + /*::[*/0x0491/*::]*/: { /* n:"BrtBeginCellIgnoreECs14", */ T:1 }, + /*::[*/0x0492/*::]*/: { /* n:"BrtEndCellIgnoreECs14", */ T:-1 }, + /*::[*/0x0493/*::]*/: { /* n:"BrtDxf14" */ }, + /*::[*/0x0494/*::]*/: { /* n:"BrtBeginDxF14s", */ T:1 }, + /*::[*/0x0495/*::]*/: { /* n:"BrtEndDxf14s", */ T:-1 }, + /*::[*/0x0499/*::]*/: { /* n:"BrtFilter14" */ }, + /*::[*/0x049A/*::]*/: { /* n:"BrtBeginCustomFilters14", */ T:1 }, + /*::[*/0x049C/*::]*/: { /* n:"BrtCustomFilter14" */ }, + /*::[*/0x049D/*::]*/: { /* n:"BrtIconFilter14" */ }, + /*::[*/0x049E/*::]*/: { /* n:"BrtPivotCacheConnectionName" */ }, + /*::[*/0x0800/*::]*/: { /* n:"BrtBeginDecoupledPivotCacheIDs", */ T:1 }, + /*::[*/0x0801/*::]*/: { /* n:"BrtEndDecoupledPivotCacheIDs", */ T:-1 }, + /*::[*/0x0802/*::]*/: { /* n:"BrtDecoupledPivotCacheID" */ }, + /*::[*/0x0803/*::]*/: { /* n:"BrtBeginPivotTableRefs", */ T:1 }, + /*::[*/0x0804/*::]*/: { /* n:"BrtEndPivotTableRefs", */ T:-1 }, + /*::[*/0x0805/*::]*/: { /* n:"BrtPivotTableRef" */ }, + /*::[*/0x0806/*::]*/: { /* n:"BrtSlicerCacheBookPivotTables" */ }, + /*::[*/0x0807/*::]*/: { /* n:"BrtBeginSxvcells", */ T:1 }, + /*::[*/0x0808/*::]*/: { /* n:"BrtEndSxvcells", */ T:-1 }, + /*::[*/0x0809/*::]*/: { /* n:"BrtBeginSxRow", */ T:1 }, + /*::[*/0x080A/*::]*/: { /* n:"BrtEndSxRow", */ T:-1 }, + /*::[*/0x080C/*::]*/: { /* n:"BrtPcdCalcMem15" */ }, + /*::[*/0x0813/*::]*/: { /* n:"BrtQsi15" */ }, + /*::[*/0x0814/*::]*/: { /* n:"BrtBeginWebExtensions", */ T:1 }, + /*::[*/0x0815/*::]*/: { /* n:"BrtEndWebExtensions", */ T:-1 }, + /*::[*/0x0816/*::]*/: { /* n:"BrtWebExtension" */ }, + /*::[*/0x0817/*::]*/: { /* n:"BrtAbsPath15" */ }, + /*::[*/0x0818/*::]*/: { /* n:"BrtBeginPivotTableUISettings", */ T:1 }, + /*::[*/0x0819/*::]*/: { /* n:"BrtEndPivotTableUISettings", */ T:-1 }, + /*::[*/0x081B/*::]*/: { /* n:"BrtTableSlicerCacheIDs" */ }, + /*::[*/0x081C/*::]*/: { /* n:"BrtTableSlicerCacheID" */ }, + /*::[*/0x081D/*::]*/: { /* n:"BrtBeginTableSlicerCache", */ T:1 }, + /*::[*/0x081E/*::]*/: { /* n:"BrtEndTableSlicerCache", */ T:-1 }, + /*::[*/0x081F/*::]*/: { /* n:"BrtSxFilter15" */ }, + /*::[*/0x0820/*::]*/: { /* n:"BrtBeginTimelineCachePivotCacheIDs", */ T:1 }, + /*::[*/0x0821/*::]*/: { /* n:"BrtEndTimelineCachePivotCacheIDs", */ T:-1 }, + /*::[*/0x0822/*::]*/: { /* n:"BrtTimelineCachePivotCacheID" */ }, + /*::[*/0x0823/*::]*/: { /* n:"BrtBeginTimelineCacheIDs", */ T:1 }, + /*::[*/0x0824/*::]*/: { /* n:"BrtEndTimelineCacheIDs", */ T:-1 }, + /*::[*/0x0825/*::]*/: { /* n:"BrtBeginTimelineCacheID", */ T:1 }, + /*::[*/0x0826/*::]*/: { /* n:"BrtEndTimelineCacheID", */ T:-1 }, + /*::[*/0x0827/*::]*/: { /* n:"BrtBeginTimelinesEx", */ T:1 }, + /*::[*/0x0828/*::]*/: { /* n:"BrtEndTimelinesEx", */ T:-1 }, + /*::[*/0x0829/*::]*/: { /* n:"BrtBeginTimelineEx", */ T:1 }, + /*::[*/0x082A/*::]*/: { /* n:"BrtEndTimelineEx", */ T:-1 }, + /*::[*/0x082B/*::]*/: { /* n:"BrtWorkBookPr15" */ }, + /*::[*/0x082C/*::]*/: { /* n:"BrtPCDH15" */ }, + /*::[*/0x082D/*::]*/: { /* n:"BrtBeginTimelineStyle", */ T:1 }, + /*::[*/0x082E/*::]*/: { /* n:"BrtEndTimelineStyle", */ T:-1 }, + /*::[*/0x082F/*::]*/: { /* n:"BrtTimelineStyleElement" */ }, + /*::[*/0x0830/*::]*/: { /* n:"BrtBeginTimelineStylesheetExt15", */ T:1 }, + /*::[*/0x0831/*::]*/: { /* n:"BrtEndTimelineStylesheetExt15", */ T:-1 }, + /*::[*/0x0832/*::]*/: { /* n:"BrtBeginTimelineStyles", */ T:1 }, + /*::[*/0x0833/*::]*/: { /* n:"BrtEndTimelineStyles", */ T:-1 }, + /*::[*/0x0834/*::]*/: { /* n:"BrtBeginTimelineStyleElements", */ T:1 }, + /*::[*/0x0835/*::]*/: { /* n:"BrtEndTimelineStyleElements", */ T:-1 }, + /*::[*/0x0836/*::]*/: { /* n:"BrtDxf15" */ }, + /*::[*/0x0837/*::]*/: { /* n:"BrtBeginDxfs15", */ T:1 }, + /*::[*/0x0838/*::]*/: { /* n:"BrtEndDxfs15", */ T:-1 }, + /*::[*/0x0839/*::]*/: { /* n:"BrtSlicerCacheHideItemsWithNoData" */ }, + /*::[*/0x083A/*::]*/: { /* n:"BrtBeginItemUniqueNames", */ T:1 }, + /*::[*/0x083B/*::]*/: { /* n:"BrtEndItemUniqueNames", */ T:-1 }, + /*::[*/0x083C/*::]*/: { /* n:"BrtItemUniqueName" */ }, + /*::[*/0x083D/*::]*/: { /* n:"BrtBeginExtConn15", */ T:1 }, + /*::[*/0x083E/*::]*/: { /* n:"BrtEndExtConn15", */ T:-1 }, + /*::[*/0x083F/*::]*/: { /* n:"BrtBeginOledbPr15", */ T:1 }, + /*::[*/0x0840/*::]*/: { /* n:"BrtEndOledbPr15", */ T:-1 }, + /*::[*/0x0841/*::]*/: { /* n:"BrtBeginDataFeedPr15", */ T:1 }, + /*::[*/0x0842/*::]*/: { /* n:"BrtEndDataFeedPr15", */ T:-1 }, + /*::[*/0x0843/*::]*/: { /* n:"BrtTextPr15" */ }, + /*::[*/0x0844/*::]*/: { /* n:"BrtRangePr15" */ }, + /*::[*/0x0845/*::]*/: { /* n:"BrtDbCommand15" */ }, + /*::[*/0x0846/*::]*/: { /* n:"BrtBeginDbTables15", */ T:1 }, + /*::[*/0x0847/*::]*/: { /* n:"BrtEndDbTables15", */ T:-1 }, + /*::[*/0x0848/*::]*/: { /* n:"BrtDbTable15" */ }, + /*::[*/0x0849/*::]*/: { /* n:"BrtBeginDataModel", */ T:1 }, + /*::[*/0x084A/*::]*/: { /* n:"BrtEndDataModel", */ T:-1 }, + /*::[*/0x084B/*::]*/: { /* n:"BrtBeginModelTables", */ T:1 }, + /*::[*/0x084C/*::]*/: { /* n:"BrtEndModelTables", */ T:-1 }, + /*::[*/0x084D/*::]*/: { /* n:"BrtModelTable" */ }, + /*::[*/0x084E/*::]*/: { /* n:"BrtBeginModelRelationships", */ T:1 }, + /*::[*/0x084F/*::]*/: { /* n:"BrtEndModelRelationships", */ T:-1 }, + /*::[*/0x0850/*::]*/: { /* n:"BrtModelRelationship" */ }, + /*::[*/0x0851/*::]*/: { /* n:"BrtBeginECTxtWiz15", */ T:1 }, + /*::[*/0x0852/*::]*/: { /* n:"BrtEndECTxtWiz15", */ T:-1 }, + /*::[*/0x0853/*::]*/: { /* n:"BrtBeginECTWFldInfoLst15", */ T:1 }, + /*::[*/0x0854/*::]*/: { /* n:"BrtEndECTWFldInfoLst15", */ T:-1 }, + /*::[*/0x0855/*::]*/: { /* n:"BrtBeginECTWFldInfo15", */ T:1 }, + /*::[*/0x0856/*::]*/: { /* n:"BrtFieldListActiveItem" */ }, + /*::[*/0x0857/*::]*/: { /* n:"BrtPivotCacheIdVersion" */ }, + /*::[*/0x0858/*::]*/: { /* n:"BrtSXDI15" */ }, + /*::[*/0x0859/*::]*/: { /* n:"BrtBeginModelTimeGroupings", */ T:1 }, + /*::[*/0x085A/*::]*/: { /* n:"BrtEndModelTimeGroupings", */ T:-1 }, + /*::[*/0x085B/*::]*/: { /* n:"BrtBeginModelTimeGrouping", */ T:1 }, + /*::[*/0x085C/*::]*/: { /* n:"BrtEndModelTimeGrouping", */ T:-1 }, + /*::[*/0x085D/*::]*/: { /* n:"BrtModelTimeGroupingCalcCol" */ }, + /*::[*/0x0C00/*::]*/: { /* n:"BrtUid" */ }, + /*::[*/0x0C01/*::]*/: { /* n:"BrtRevisionPtr" */ }, + /*::[*/0x1000/*::]*/: { /* n:"BrtBeginDynamicArrayPr", */ T:1 }, + /*::[*/0x1001/*::]*/: { /* n:"BrtEndDynamicArrayPr", */ T:-1 }, + /*::[*/0x138A/*::]*/: { /* n:"BrtBeginRichValueBlock", */ T:1 }, + /*::[*/0x138B/*::]*/: { /* n:"BrtEndRichValueBlock", */ T:-1 }, + /*::[*/0x13D9/*::]*/: { /* n:"BrtBeginRichFilters", */ T:1 }, + /*::[*/0x13DA/*::]*/: { /* n:"BrtEndRichFilters", */ T:-1 }, + /*::[*/0x13DB/*::]*/: { /* n:"BrtRichFilter" */ }, + /*::[*/0x13DC/*::]*/: { /* n:"BrtBeginRichFilterColumn", */ T:1 }, + /*::[*/0x13DD/*::]*/: { /* n:"BrtEndRichFilterColumn", */ T:-1 }, + /*::[*/0x13DE/*::]*/: { /* n:"BrtBeginCustomRichFilters", */ T:1 }, + /*::[*/0x13DF/*::]*/: { /* n:"BrtEndCustomRichFilters", */ T:-1 }, + /*::[*/0x13E0/*::]*/: { /* n:"BrtCustomRichFilter" */ }, + /*::[*/0x13E1/*::]*/: { /* n:"BrtTop10RichFilter" */ }, + /*::[*/0x13E2/*::]*/: { /* n:"BrtDynamicRichFilter" */ }, + /*::[*/0x13E4/*::]*/: { /* n:"BrtBeginRichSortCondition", */ T:1 }, + /*::[*/0x13E5/*::]*/: { /* n:"BrtEndRichSortCondition", */ T:-1 }, + /*::[*/0x13E6/*::]*/: { /* n:"BrtRichFilterDateGroupItem" */ }, + /*::[*/0x13E7/*::]*/: { /* n:"BrtBeginCalcFeatures", */ T:1 }, + /*::[*/0x13E8/*::]*/: { /* n:"BrtEndCalcFeatures", */ T:-1 }, + /*::[*/0x13E9/*::]*/: { /* n:"BrtCalcFeature" */ }, + /*::[*/0x13EB/*::]*/: { /* n:"BrtExternalLinksPr" */ }, + /*::[*/0xFFFF/*::]*/: { n:"" } +}; + +/* [MS-XLS] 2.3 Record Enumeration (and other sources) */ +var XLSRecordEnum = { + /* [MS-XLS] 2.3 Record Enumeration 2021-08-17 */ + /*::[*/0x0006/*::]*/: { /* n:"Formula", */ f:parse_Formula }, + /*::[*/0x000a/*::]*/: { /* n:"EOF", */ f:parsenoop2 }, + /*::[*/0x000c/*::]*/: { /* n:"CalcCount", */ f:parseuint16 }, // + /*::[*/0x000d/*::]*/: { /* n:"CalcMode", */ f:parseuint16 }, // + /*::[*/0x000e/*::]*/: { /* n:"CalcPrecision", */ f:parsebool }, // + /*::[*/0x000f/*::]*/: { /* n:"CalcRefMode", */ f:parsebool }, // + /*::[*/0x0010/*::]*/: { /* n:"CalcDelta", */ f:parse_Xnum }, // + /*::[*/0x0011/*::]*/: { /* n:"CalcIter", */ f:parsebool }, // + /*::[*/0x0012/*::]*/: { /* n:"Protect", */ f:parsebool }, + /*::[*/0x0013/*::]*/: { /* n:"Password", */ f:parseuint16 }, + /*::[*/0x0014/*::]*/: { /* n:"Header", */ f:parse_XLHeaderFooter }, + /*::[*/0x0015/*::]*/: { /* n:"Footer", */ f:parse_XLHeaderFooter }, + /*::[*/0x0017/*::]*/: { /* n:"ExternSheet", */ f:parse_ExternSheet }, + /*::[*/0x0018/*::]*/: { /* n:"Lbl", */ f:parse_Lbl }, + /*::[*/0x0019/*::]*/: { /* n:"WinProtect", */ f:parsebool }, + /*::[*/0x001a/*::]*/: { /* n:"VerticalPageBreaks", */ }, + /*::[*/0x001b/*::]*/: { /* n:"HorizontalPageBreaks", */ }, + /*::[*/0x001c/*::]*/: { /* n:"Note", */ f:parse_Note }, + /*::[*/0x001d/*::]*/: { /* n:"Selection", */ }, + /*::[*/0x0022/*::]*/: { /* n:"Date1904", */ f:parsebool }, + /*::[*/0x0023/*::]*/: { /* n:"ExternName", */ f:parse_ExternName }, + /*::[*/0x0026/*::]*/: { /* n:"LeftMargin", */ f:parse_Xnum }, // * + /*::[*/0x0027/*::]*/: { /* n:"RightMargin", */ f:parse_Xnum }, // * + /*::[*/0x0028/*::]*/: { /* n:"TopMargin", */ f:parse_Xnum }, // * + /*::[*/0x0029/*::]*/: { /* n:"BottomMargin", */ f:parse_Xnum }, // * + /*::[*/0x002a/*::]*/: { /* n:"PrintRowCol", */ f:parsebool }, + /*::[*/0x002b/*::]*/: { /* n:"PrintGrid", */ f:parsebool }, + /*::[*/0x002f/*::]*/: { /* n:"FilePass", */ f:parse_FilePass }, + /*::[*/0x0031/*::]*/: { /* n:"Font", */ f:parse_Font }, + /*::[*/0x0033/*::]*/: { /* n:"PrintSize", */ f:parseuint16 }, + /*::[*/0x003c/*::]*/: { /* n:"Continue", */ }, + /*::[*/0x003d/*::]*/: { /* n:"Window1", */ f:parse_Window1 }, + /*::[*/0x0040/*::]*/: { /* n:"Backup", */ f:parsebool }, + /*::[*/0x0041/*::]*/: { /* n:"Pane", */ f:parse_Pane }, + /*::[*/0x0042/*::]*/: { /* n:"CodePage", */ f:parseuint16 }, + /*::[*/0x004d/*::]*/: { /* n:"Pls", */ }, + /*::[*/0x0050/*::]*/: { /* n:"DCon", */ }, + /*::[*/0x0051/*::]*/: { /* n:"DConRef", */ }, + /*::[*/0x0052/*::]*/: { /* n:"DConName", */ }, + /*::[*/0x0055/*::]*/: { /* n:"DefColWidth", */ f:parseuint16 }, + /*::[*/0x0059/*::]*/: { /* n:"XCT", */ }, + /*::[*/0x005a/*::]*/: { /* n:"CRN", */ }, + /*::[*/0x005b/*::]*/: { /* n:"FileSharing", */ }, + /*::[*/0x005c/*::]*/: { /* n:"WriteAccess", */ f:parse_WriteAccess }, + /*::[*/0x005d/*::]*/: { /* n:"Obj", */ f:parse_Obj }, + /*::[*/0x005e/*::]*/: { /* n:"Uncalced", */ }, + /*::[*/0x005f/*::]*/: { /* n:"CalcSaveRecalc", */ f:parsebool }, // + /*::[*/0x0060/*::]*/: { /* n:"Template", */ }, + /*::[*/0x0061/*::]*/: { /* n:"Intl", */ }, + /*::[*/0x0063/*::]*/: { /* n:"ObjProtect", */ f:parsebool }, + /*::[*/0x007d/*::]*/: { /* n:"ColInfo", */ f:parse_ColInfo }, + /*::[*/0x0080/*::]*/: { /* n:"Guts", */ f:parse_Guts }, + /*::[*/0x0081/*::]*/: { /* n:"WsBool", */ f:parse_WsBool }, + /*::[*/0x0082/*::]*/: { /* n:"GridSet", */ f:parseuint16 }, + /*::[*/0x0083/*::]*/: { /* n:"HCenter", */ f:parsebool }, + /*::[*/0x0084/*::]*/: { /* n:"VCenter", */ f:parsebool }, + /*::[*/0x0085/*::]*/: { /* n:"BoundSheet8", */ f:parse_BoundSheet8 }, + /*::[*/0x0086/*::]*/: { /* n:"WriteProtect", */ }, + /*::[*/0x008c/*::]*/: { /* n:"Country", */ f:parse_Country }, + /*::[*/0x008d/*::]*/: { /* n:"HideObj", */ f:parseuint16 }, + /*::[*/0x0090/*::]*/: { /* n:"Sort", */ }, + /*::[*/0x0092/*::]*/: { /* n:"Palette", */ f:parse_Palette }, + /*::[*/0x0097/*::]*/: { /* n:"Sync", */ }, + /*::[*/0x0098/*::]*/: { /* n:"LPr", */ }, + /*::[*/0x0099/*::]*/: { /* n:"DxGCol", */ }, + /*::[*/0x009a/*::]*/: { /* n:"FnGroupName", */ }, + /*::[*/0x009b/*::]*/: { /* n:"FilterMode", */ }, + /*::[*/0x009c/*::]*/: { /* n:"BuiltInFnGroupCount", */ f:parseuint16 }, + /*::[*/0x009d/*::]*/: { /* n:"AutoFilterInfo", */ }, + /*::[*/0x009e/*::]*/: { /* n:"AutoFilter", */ }, + /*::[*/0x00a0/*::]*/: { /* n:"Scl", */ f:parse_Scl }, + /*::[*/0x00a1/*::]*/: { /* n:"Setup", */ f:parse_Setup }, + /*::[*/0x00ae/*::]*/: { /* n:"ScenMan", */ }, + /*::[*/0x00af/*::]*/: { /* n:"SCENARIO", */ }, + /*::[*/0x00b0/*::]*/: { /* n:"SxView", */ }, + /*::[*/0x00b1/*::]*/: { /* n:"Sxvd", */ }, + /*::[*/0x00b2/*::]*/: { /* n:"SXVI", */ }, + /*::[*/0x00b4/*::]*/: { /* n:"SxIvd", */ }, + /*::[*/0x00b5/*::]*/: { /* n:"SXLI", */ }, + /*::[*/0x00b6/*::]*/: { /* n:"SXPI", */ }, + /*::[*/0x00b8/*::]*/: { /* n:"DocRoute", */ }, + /*::[*/0x00b9/*::]*/: { /* n:"RecipName", */ }, + /*::[*/0x00bd/*::]*/: { /* n:"MulRk", */ f:parse_MulRk }, + /*::[*/0x00be/*::]*/: { /* n:"MulBlank", */ f:parse_MulBlank }, + /*::[*/0x00c1/*::]*/: { /* n:"Mms", */ f:parsenoop2 }, + /*::[*/0x00c5/*::]*/: { /* n:"SXDI", */ }, + /*::[*/0x00c6/*::]*/: { /* n:"SXDB", */ }, + /*::[*/0x00c7/*::]*/: { /* n:"SXFDB", */ }, + /*::[*/0x00c8/*::]*/: { /* n:"SXDBB", */ }, + /*::[*/0x00c9/*::]*/: { /* n:"SXNum", */ }, + /*::[*/0x00ca/*::]*/: { /* n:"SxBool", */ f:parsebool }, + /*::[*/0x00cb/*::]*/: { /* n:"SxErr", */ }, + /*::[*/0x00cc/*::]*/: { /* n:"SXInt", */ }, + /*::[*/0x00cd/*::]*/: { /* n:"SXString", */ }, + /*::[*/0x00ce/*::]*/: { /* n:"SXDtr", */ }, + /*::[*/0x00cf/*::]*/: { /* n:"SxNil", */ }, + /*::[*/0x00d0/*::]*/: { /* n:"SXTbl", */ }, + /*::[*/0x00d1/*::]*/: { /* n:"SXTBRGIITM", */ }, + /*::[*/0x00d2/*::]*/: { /* n:"SxTbpg", */ }, + /*::[*/0x00d3/*::]*/: { /* n:"ObProj", */ }, + /*::[*/0x00d5/*::]*/: { /* n:"SXStreamID", */ }, + /*::[*/0x00d7/*::]*/: { /* n:"DBCell", */ }, + /*::[*/0x00d8/*::]*/: { /* n:"SXRng", */ }, + /*::[*/0x00d9/*::]*/: { /* n:"SxIsxoper", */ }, + /*::[*/0x00da/*::]*/: { /* n:"BookBool", */ f:parseuint16 }, + /*::[*/0x00dc/*::]*/: { /* n:"DbOrParamQry", */ }, + /*::[*/0x00dd/*::]*/: { /* n:"ScenarioProtect", */ f:parsebool }, + /*::[*/0x00de/*::]*/: { /* n:"OleObjectSize", */ }, + /*::[*/0x00e0/*::]*/: { /* n:"XF", */ f:parse_XF }, + /*::[*/0x00e1/*::]*/: { /* n:"InterfaceHdr", */ f:parse_InterfaceHdr }, + /*::[*/0x00e2/*::]*/: { /* n:"InterfaceEnd", */ f:parsenoop2 }, + /*::[*/0x00e3/*::]*/: { /* n:"SXVS", */ }, + /*::[*/0x00e5/*::]*/: { /* n:"MergeCells", */ f:parse_MergeCells }, + /*::[*/0x00e9/*::]*/: { /* n:"BkHim", */ }, + /*::[*/0x00eb/*::]*/: { /* n:"MsoDrawingGroup", */ }, + /*::[*/0x00ec/*::]*/: { /* n:"MsoDrawing", */ }, + /*::[*/0x00ed/*::]*/: { /* n:"MsoDrawingSelection", */ }, + /*::[*/0x00ef/*::]*/: { /* n:"PhoneticInfo", */ }, + /*::[*/0x00f0/*::]*/: { /* n:"SxRule", */ }, + /*::[*/0x00f1/*::]*/: { /* n:"SXEx", */ }, + /*::[*/0x00f2/*::]*/: { /* n:"SxFilt", */ }, + /*::[*/0x00f4/*::]*/: { /* n:"SxDXF", */ }, + /*::[*/0x00f5/*::]*/: { /* n:"SxItm", */ }, + /*::[*/0x00f6/*::]*/: { /* n:"SxName", */ }, + /*::[*/0x00f7/*::]*/: { /* n:"SxSelect", */ }, + /*::[*/0x00f8/*::]*/: { /* n:"SXPair", */ }, + /*::[*/0x00f9/*::]*/: { /* n:"SxFmla", */ }, + /*::[*/0x00fb/*::]*/: { /* n:"SxFormat", */ }, + /*::[*/0x00fc/*::]*/: { /* n:"SST", */ f:parse_SST }, + /*::[*/0x00fd/*::]*/: { /* n:"LabelSst", */ f:parse_LabelSst }, + /*::[*/0x00ff/*::]*/: { /* n:"ExtSST", */ f:parse_ExtSST }, + /*::[*/0x0100/*::]*/: { /* n:"SXVDEx", */ }, + /*::[*/0x0103/*::]*/: { /* n:"SXFormula", */ }, + /*::[*/0x0122/*::]*/: { /* n:"SXDBEx", */ }, + /*::[*/0x0137/*::]*/: { /* n:"RRDInsDel", */ }, + /*::[*/0x0138/*::]*/: { /* n:"RRDHead", */ }, + /*::[*/0x013b/*::]*/: { /* n:"RRDChgCell", */ }, + /*::[*/0x013d/*::]*/: { /* n:"RRTabId", */ f:parseuint16a }, + /*::[*/0x013e/*::]*/: { /* n:"RRDRenSheet", */ }, + /*::[*/0x013f/*::]*/: { /* n:"RRSort", */ }, + /*::[*/0x0140/*::]*/: { /* n:"RRDMove", */ }, + /*::[*/0x014a/*::]*/: { /* n:"RRFormat", */ }, + /*::[*/0x014b/*::]*/: { /* n:"RRAutoFmt", */ }, + /*::[*/0x014d/*::]*/: { /* n:"RRInsertSh", */ }, + /*::[*/0x014e/*::]*/: { /* n:"RRDMoveBegin", */ }, + /*::[*/0x014f/*::]*/: { /* n:"RRDMoveEnd", */ }, + /*::[*/0x0150/*::]*/: { /* n:"RRDInsDelBegin", */ }, + /*::[*/0x0151/*::]*/: { /* n:"RRDInsDelEnd", */ }, + /*::[*/0x0152/*::]*/: { /* n:"RRDConflict", */ }, + /*::[*/0x0153/*::]*/: { /* n:"RRDDefName", */ }, + /*::[*/0x0154/*::]*/: { /* n:"RRDRstEtxp", */ }, + /*::[*/0x015f/*::]*/: { /* n:"LRng", */ }, + /*::[*/0x0160/*::]*/: { /* n:"UsesELFs", */ f:parsebool }, + /*::[*/0x0161/*::]*/: { /* n:"DSF", */ f:parsenoop2 }, + /*::[*/0x0191/*::]*/: { /* n:"CUsr", */ }, + /*::[*/0x0192/*::]*/: { /* n:"CbUsr", */ }, + /*::[*/0x0193/*::]*/: { /* n:"UsrInfo", */ }, + /*::[*/0x0194/*::]*/: { /* n:"UsrExcl", */ }, + /*::[*/0x0195/*::]*/: { /* n:"FileLock", */ }, + /*::[*/0x0196/*::]*/: { /* n:"RRDInfo", */ }, + /*::[*/0x0197/*::]*/: { /* n:"BCUsrs", */ }, + /*::[*/0x0198/*::]*/: { /* n:"UsrChk", */ }, + /*::[*/0x01a9/*::]*/: { /* n:"UserBView", */ }, + /*::[*/0x01aa/*::]*/: { /* n:"UserSViewBegin", */ }, + /*::[*/0x01ab/*::]*/: { /* n:"UserSViewEnd", */ }, + /*::[*/0x01ac/*::]*/: { /* n:"RRDUserView", */ }, + /*::[*/0x01ad/*::]*/: { /* n:"Qsi", */ }, + /*::[*/0x01ae/*::]*/: { /* n:"SupBook", */ f:parse_SupBook }, + /*::[*/0x01af/*::]*/: { /* n:"Prot4Rev", */ f:parsebool }, + /*::[*/0x01b0/*::]*/: { /* n:"CondFmt", */ }, + /*::[*/0x01b1/*::]*/: { /* n:"CF", */ }, + /*::[*/0x01b2/*::]*/: { /* n:"DVal", */ }, + /*::[*/0x01b5/*::]*/: { /* n:"DConBin", */ }, + /*::[*/0x01b6/*::]*/: { /* n:"TxO", */ f:parse_TxO }, + /*::[*/0x01b7/*::]*/: { /* n:"RefreshAll", */ f:parsebool }, // + /*::[*/0x01b8/*::]*/: { /* n:"HLink", */ f:parse_HLink }, + /*::[*/0x01b9/*::]*/: { /* n:"Lel", */ }, + /*::[*/0x01ba/*::]*/: { /* n:"CodeName", */ f:parse_XLUnicodeString }, + /*::[*/0x01bb/*::]*/: { /* n:"SXFDBType", */ }, + /*::[*/0x01bc/*::]*/: { /* n:"Prot4RevPass", */ f:parseuint16 }, + /*::[*/0x01bd/*::]*/: { /* n:"ObNoMacros", */ }, + /*::[*/0x01be/*::]*/: { /* n:"Dv", */ }, + /*::[*/0x01c0/*::]*/: { /* n:"Excel9File", */ f:parsenoop2 }, + /*::[*/0x01c1/*::]*/: { /* n:"RecalcId", */ f:parse_RecalcId, r:2}, + /*::[*/0x01c2/*::]*/: { /* n:"EntExU2", */ f:parsenoop2 }, + /*::[*/0x0200/*::]*/: { /* n:"Dimensions", */ f:parse_Dimensions }, + /*::[*/0x0201/*::]*/: { /* n:"Blank", */ f:parse_Blank }, + /*::[*/0x0203/*::]*/: { /* n:"Number", */ f:parse_Number }, + /*::[*/0x0204/*::]*/: { /* n:"Label", */ f:parse_Label }, + /*::[*/0x0205/*::]*/: { /* n:"BoolErr", */ f:parse_BoolErr }, + /*::[*/0x0207/*::]*/: { /* n:"String", */ f:parse_String }, + /*::[*/0x0208/*::]*/: { /* n:"Row", */ f:parse_Row }, + /*::[*/0x020b/*::]*/: { /* n:"Index", */ }, + /*::[*/0x0221/*::]*/: { /* n:"Array", */ f:parse_Array }, + /*::[*/0x0225/*::]*/: { /* n:"DefaultRowHeight", */ f:parse_DefaultRowHeight }, + /*::[*/0x0236/*::]*/: { /* n:"Table", */ }, + /*::[*/0x023e/*::]*/: { /* n:"Window2", */ f:parse_Window2 }, + /*::[*/0x027e/*::]*/: { /* n:"RK", */ f:parse_RK }, + /*::[*/0x0293/*::]*/: { /* n:"Style", */ }, + /*::[*/0x0418/*::]*/: { /* n:"BigName", */ }, + /*::[*/0x041e/*::]*/: { /* n:"Format", */ f:parse_Format }, + /*::[*/0x043c/*::]*/: { /* n:"ContinueBigName", */ }, + /*::[*/0x04bc/*::]*/: { /* n:"ShrFmla", */ f:parse_ShrFmla }, + /*::[*/0x0800/*::]*/: { /* n:"HLinkTooltip", */ f:parse_HLinkTooltip }, + /*::[*/0x0801/*::]*/: { /* n:"WebPub", */ }, + /*::[*/0x0802/*::]*/: { /* n:"QsiSXTag", */ }, + /*::[*/0x0803/*::]*/: { /* n:"DBQueryExt", */ }, + /*::[*/0x0804/*::]*/: { /* n:"ExtString", */ }, + /*::[*/0x0805/*::]*/: { /* n:"TxtQry", */ }, + /*::[*/0x0806/*::]*/: { /* n:"Qsir", */ }, + /*::[*/0x0807/*::]*/: { /* n:"Qsif", */ }, + /*::[*/0x0808/*::]*/: { /* n:"RRDTQSIF", */ }, + /*::[*/0x0809/*::]*/: { /* n:"BOF", */ f:parse_BOF }, + /*::[*/0x080a/*::]*/: { /* n:"OleDbConn", */ }, + /*::[*/0x080b/*::]*/: { /* n:"WOpt", */ }, + /*::[*/0x080c/*::]*/: { /* n:"SXViewEx", */ }, + /*::[*/0x080d/*::]*/: { /* n:"SXTH", */ }, + /*::[*/0x080e/*::]*/: { /* n:"SXPIEx", */ }, + /*::[*/0x080f/*::]*/: { /* n:"SXVDTEx", */ }, + /*::[*/0x0810/*::]*/: { /* n:"SXViewEx9", */ }, + /*::[*/0x0812/*::]*/: { /* n:"ContinueFrt", */ }, + /*::[*/0x0813/*::]*/: { /* n:"RealTimeData", */ }, + /*::[*/0x0850/*::]*/: { /* n:"ChartFrtInfo", */ }, + /*::[*/0x0851/*::]*/: { /* n:"FrtWrapper", */ }, + /*::[*/0x0852/*::]*/: { /* n:"StartBlock", */ }, + /*::[*/0x0853/*::]*/: { /* n:"EndBlock", */ }, + /*::[*/0x0854/*::]*/: { /* n:"StartObject", */ }, + /*::[*/0x0855/*::]*/: { /* n:"EndObject", */ }, + /*::[*/0x0856/*::]*/: { /* n:"CatLab", */ }, + /*::[*/0x0857/*::]*/: { /* n:"YMult", */ }, + /*::[*/0x0858/*::]*/: { /* n:"SXViewLink", */ }, + /*::[*/0x0859/*::]*/: { /* n:"PivotChartBits", */ }, + /*::[*/0x085a/*::]*/: { /* n:"FrtFontList", */ }, + /*::[*/0x0862/*::]*/: { /* n:"SheetExt", */ }, + /*::[*/0x0863/*::]*/: { /* n:"BookExt", */ r:12}, + /*::[*/0x0864/*::]*/: { /* n:"SXAddl", */ }, + /*::[*/0x0865/*::]*/: { /* n:"CrErr", */ }, + /*::[*/0x0866/*::]*/: { /* n:"HFPicture", */ }, + /*::[*/0x0867/*::]*/: { /* n:"FeatHdr", */ f:parsenoop2 }, + /*::[*/0x0868/*::]*/: { /* n:"Feat", */ }, + /*::[*/0x086a/*::]*/: { /* n:"DataLabExt", */ }, + /*::[*/0x086b/*::]*/: { /* n:"DataLabExtContents", */ }, + /*::[*/0x086c/*::]*/: { /* n:"CellWatch", */ }, + /*::[*/0x0871/*::]*/: { /* n:"FeatHdr11", */ }, + /*::[*/0x0872/*::]*/: { /* n:"Feature11", */ }, + /*::[*/0x0874/*::]*/: { /* n:"DropDownObjIds", */ }, + /*::[*/0x0875/*::]*/: { /* n:"ContinueFrt11", */ }, + /*::[*/0x0876/*::]*/: { /* n:"DConn", */ }, + /*::[*/0x0877/*::]*/: { /* n:"List12", */ }, + /*::[*/0x0878/*::]*/: { /* n:"Feature12", */ }, + /*::[*/0x0879/*::]*/: { /* n:"CondFmt12", */ }, + /*::[*/0x087a/*::]*/: { /* n:"CF12", */ }, + /*::[*/0x087b/*::]*/: { /* n:"CFEx", */ }, + /*::[*/0x087c/*::]*/: { /* n:"XFCRC", */ f:parse_XFCRC, r:12 }, + /*::[*/0x087d/*::]*/: { /* n:"XFExt", */ f:parse_XFExt, r:12 }, + /*::[*/0x087e/*::]*/: { /* n:"AutoFilter12", */ }, + /*::[*/0x087f/*::]*/: { /* n:"ContinueFrt12", */ }, + /*::[*/0x0884/*::]*/: { /* n:"MDTInfo", */ }, + /*::[*/0x0885/*::]*/: { /* n:"MDXStr", */ }, + /*::[*/0x0886/*::]*/: { /* n:"MDXTuple", */ }, + /*::[*/0x0887/*::]*/: { /* n:"MDXSet", */ }, + /*::[*/0x0888/*::]*/: { /* n:"MDXProp", */ }, + /*::[*/0x0889/*::]*/: { /* n:"MDXKPI", */ }, + /*::[*/0x088a/*::]*/: { /* n:"MDB", */ }, + /*::[*/0x088b/*::]*/: { /* n:"PLV", */ }, + /*::[*/0x088c/*::]*/: { /* n:"Compat12", */ f:parsebool, r:12 }, + /*::[*/0x088d/*::]*/: { /* n:"DXF", */ }, + /*::[*/0x088e/*::]*/: { /* n:"TableStyles", */ r:12 }, + /*::[*/0x088f/*::]*/: { /* n:"TableStyle", */ }, + /*::[*/0x0890/*::]*/: { /* n:"TableStyleElement", */ }, + /*::[*/0x0892/*::]*/: { /* n:"StyleExt", */ }, + /*::[*/0x0893/*::]*/: { /* n:"NamePublish", */ }, + /*::[*/0x0894/*::]*/: { /* n:"NameCmt", */ f:parse_NameCmt, r:12 }, + /*::[*/0x0895/*::]*/: { /* n:"SortData", */ }, + /*::[*/0x0896/*::]*/: { /* n:"Theme", */ f:parse_Theme, r:12 }, + /*::[*/0x0897/*::]*/: { /* n:"GUIDTypeLib", */ }, + /*::[*/0x0898/*::]*/: { /* n:"FnGrp12", */ }, + /*::[*/0x0899/*::]*/: { /* n:"NameFnGrp12", */ }, + /*::[*/0x089a/*::]*/: { /* n:"MTRSettings", */ f:parse_MTRSettings, r:12 }, + /*::[*/0x089b/*::]*/: { /* n:"CompressPictures", */ f:parsenoop2 }, + /*::[*/0x089c/*::]*/: { /* n:"HeaderFooter", */ }, + /*::[*/0x089d/*::]*/: { /* n:"CrtLayout12", */ }, + /*::[*/0x089e/*::]*/: { /* n:"CrtMlFrt", */ }, + /*::[*/0x089f/*::]*/: { /* n:"CrtMlFrtContinue", */ }, + /*::[*/0x08a3/*::]*/: { /* n:"ForceFullCalculation", */ f:parse_ForceFullCalculation }, + /*::[*/0x08a4/*::]*/: { /* n:"ShapePropsStream", */ }, + /*::[*/0x08a5/*::]*/: { /* n:"TextPropsStream", */ }, + /*::[*/0x08a6/*::]*/: { /* n:"RichTextStream", */ }, + /*::[*/0x08a7/*::]*/: { /* n:"CrtLayout12A", */ }, + /*::[*/0x1001/*::]*/: { /* n:"Units", */ }, + /*::[*/0x1002/*::]*/: { /* n:"Chart", */ }, + /*::[*/0x1003/*::]*/: { /* n:"Series", */ }, + /*::[*/0x1006/*::]*/: { /* n:"DataFormat", */ }, + /*::[*/0x1007/*::]*/: { /* n:"LineFormat", */ }, + /*::[*/0x1009/*::]*/: { /* n:"MarkerFormat", */ }, + /*::[*/0x100a/*::]*/: { /* n:"AreaFormat", */ }, + /*::[*/0x100b/*::]*/: { /* n:"PieFormat", */ }, + /*::[*/0x100c/*::]*/: { /* n:"AttachedLabel", */ }, + /*::[*/0x100d/*::]*/: { /* n:"SeriesText", */ }, + /*::[*/0x1014/*::]*/: { /* n:"ChartFormat", */ }, + /*::[*/0x1015/*::]*/: { /* n:"Legend", */ }, + /*::[*/0x1016/*::]*/: { /* n:"SeriesList", */ }, + /*::[*/0x1017/*::]*/: { /* n:"Bar", */ }, + /*::[*/0x1018/*::]*/: { /* n:"Line", */ }, + /*::[*/0x1019/*::]*/: { /* n:"Pie", */ }, + /*::[*/0x101a/*::]*/: { /* n:"Area", */ }, + /*::[*/0x101b/*::]*/: { /* n:"Scatter", */ }, + /*::[*/0x101c/*::]*/: { /* n:"CrtLine", */ }, + /*::[*/0x101d/*::]*/: { /* n:"Axis", */ }, + /*::[*/0x101e/*::]*/: { /* n:"Tick", */ }, + /*::[*/0x101f/*::]*/: { /* n:"ValueRange", */ }, + /*::[*/0x1020/*::]*/: { /* n:"CatSerRange", */ }, + /*::[*/0x1021/*::]*/: { /* n:"AxisLine", */ }, + /*::[*/0x1022/*::]*/: { /* n:"CrtLink", */ }, + /*::[*/0x1024/*::]*/: { /* n:"DefaultText", */ }, + /*::[*/0x1025/*::]*/: { /* n:"Text", */ }, + /*::[*/0x1026/*::]*/: { /* n:"FontX", */ f:parseuint16 }, + /*::[*/0x1027/*::]*/: { /* n:"ObjectLink", */ }, + /*::[*/0x1032/*::]*/: { /* n:"Frame", */ }, + /*::[*/0x1033/*::]*/: { /* n:"Begin", */ }, + /*::[*/0x1034/*::]*/: { /* n:"End", */ }, + /*::[*/0x1035/*::]*/: { /* n:"PlotArea", */ }, + /*::[*/0x103a/*::]*/: { /* n:"Chart3d", */ }, + /*::[*/0x103c/*::]*/: { /* n:"PicF", */ }, + /*::[*/0x103d/*::]*/: { /* n:"DropBar", */ }, + /*::[*/0x103e/*::]*/: { /* n:"Radar", */ }, + /*::[*/0x103f/*::]*/: { /* n:"Surf", */ }, + /*::[*/0x1040/*::]*/: { /* n:"RadarArea", */ }, + /*::[*/0x1041/*::]*/: { /* n:"AxisParent", */ }, + /*::[*/0x1043/*::]*/: { /* n:"LegendException", */ }, + /*::[*/0x1044/*::]*/: { /* n:"ShtProps", */ f:parse_ShtProps }, + /*::[*/0x1045/*::]*/: { /* n:"SerToCrt", */ }, + /*::[*/0x1046/*::]*/: { /* n:"AxesUsed", */ }, + /*::[*/0x1048/*::]*/: { /* n:"SBaseRef", */ }, + /*::[*/0x104a/*::]*/: { /* n:"SerParent", */ }, + /*::[*/0x104b/*::]*/: { /* n:"SerAuxTrend", */ }, + /*::[*/0x104e/*::]*/: { /* n:"IFmtRecord", */ }, + /*::[*/0x104f/*::]*/: { /* n:"Pos", */ }, + /*::[*/0x1050/*::]*/: { /* n:"AlRuns", */ }, + /*::[*/0x1051/*::]*/: { /* n:"BRAI", */ }, + /*::[*/0x105b/*::]*/: { /* n:"SerAuxErrBar", */ }, + /*::[*/0x105c/*::]*/: { /* n:"ClrtClient", */ f:parse_ClrtClient }, + /*::[*/0x105d/*::]*/: { /* n:"SerFmt", */ }, + /*::[*/0x105f/*::]*/: { /* n:"Chart3DBarShape", */ }, + /*::[*/0x1060/*::]*/: { /* n:"Fbi", */ }, + /*::[*/0x1061/*::]*/: { /* n:"BopPop", */ }, + /*::[*/0x1062/*::]*/: { /* n:"AxcExt", */ }, + /*::[*/0x1063/*::]*/: { /* n:"Dat", */ }, + /*::[*/0x1064/*::]*/: { /* n:"PlotGrowth", */ }, + /*::[*/0x1065/*::]*/: { /* n:"SIIndex", */ }, + /*::[*/0x1066/*::]*/: { /* n:"GelFrame", */ }, + /*::[*/0x1067/*::]*/: { /* n:"BopPopCustom", */ }, + /*::[*/0x1068/*::]*/: { /* n:"Fbi2", */ }, + + /*::[*/0x0000/*::]*/: { /* n:"Dimensions", */ f:parse_Dimensions }, + /*::[*/0x0001/*::]*/: { /* n:"BIFF2BLANK", */ }, + /*::[*/0x0002/*::]*/: { /* n:"BIFF2INT", */ f:parse_BIFF2INT }, + /*::[*/0x0003/*::]*/: { /* n:"BIFF2NUM", */ f:parse_BIFF2NUM }, + /*::[*/0x0004/*::]*/: { /* n:"BIFF2STR", */ f:parse_BIFF2STR }, + /*::[*/0x0005/*::]*/: { /* n:"BIFF2BOOLERR", */ f:parse_BIFF2BOOLERR }, + /*::[*/0x0007/*::]*/: { /* n:"String", */ f:parse_BIFF2STRING }, + /*::[*/0x0008/*::]*/: { /* n:"BIFF2ROW", */ }, + /*::[*/0x0009/*::]*/: { /* n:"BOF", */ f:parse_BOF }, + /*::[*/0x000b/*::]*/: { /* n:"Index", */ }, + /*::[*/0x0016/*::]*/: { /* n:"ExternCount", */ f:parseuint16 }, + /*::[*/0x001e/*::]*/: { /* n:"BIFF2FORMAT", */ f:parse_BIFF2Format }, + /*::[*/0x001f/*::]*/: { /* n:"BIFF2FMTCNT", */ }, /* 16-bit cnt of BIFF2FORMAT records */ + /*::[*/0x0020/*::]*/: { /* n:"BIFF2COLINFO", */ }, + /*::[*/0x0021/*::]*/: { /* n:"Array", */ f:parse_Array }, + /*::[*/0x0024/*::]*/: { /* n:"COLWIDTH", */ }, + /*::[*/0x0025/*::]*/: { /* n:"DefaultRowHeight", */ f:parse_DefaultRowHeight }, + // 0x002c ?? + // 0x002d ?? + // 0x002e ?? + // 0x0030 FONTCOUNT: number of fonts + /*::[*/0x0032/*::]*/: { /* n:"BIFF2FONTXTRA", */ f:parse_BIFF2FONTXTRA }, + // 0x0035: INFOOPTS + // 0x0036: TABLE (BIFF2 only) + // 0x0037: TABLE2 (BIFF2 only) + // 0x0038: WNDESK + // 0x0039 ?? + // 0x003a: BEGINPREF + // 0x003b: ENDPREF + /*::[*/0x003e/*::]*/: { /* n:"BIFF2WINDOW2", */ }, + // 0x003f ?? + // 0x0046: SHOWSCROLL + // 0x0047: SHOWFORMULA + // 0x0048: STATUSBAR + // 0x0049: SHORTMENUS + // 0x004A: + // 0x004B: + // 0x004C: + // 0x004E: + // 0x004F: + // 0x0058: TOOLBAR (BIFF3) + + /* - - - */ + /*::[*/0x0034/*::]*/: { /* n:"DDEObjName", */ }, + /*::[*/0x0043/*::]*/: { /* n:"BIFF2XF", */ f:parse_BIFF2XF }, + /*::[*/0x0044/*::]*/: { /* n:"BIFF2XFINDEX", */ f:parseuint16 }, + /*::[*/0x0045/*::]*/: { /* n:"BIFF2FONTCLR", */ }, + /*::[*/0x0056/*::]*/: { /* n:"BIFF4FMTCNT", */ }, /* 16-bit cnt, similar to BIFF2 */ + /*::[*/0x007e/*::]*/: { /* n:"RK", */ }, /* Not necessarily same as 0x027e */ + /*::[*/0x007f/*::]*/: { /* n:"ImData", */ f:parse_ImData }, + /*::[*/0x0087/*::]*/: { /* n:"Addin", */ }, + /*::[*/0x0088/*::]*/: { /* n:"Edg", */ }, + /*::[*/0x0089/*::]*/: { /* n:"Pub", */ }, + // 0x8A + // 0x8B LH: alternate menu key flag (BIFF3/4) + // 0x8E + /*::[*/0x008F/*::]*/: { /* n:"BIFF4SheetInfo", */ f:parse_BIFF4SheetInfo }, + /*::[*/0x0091/*::]*/: { /* n:"Sub", */ }, + // 0x93 STYLE + /*::[*/0x0094/*::]*/: { /* n:"LHRecord", */ }, + /*::[*/0x0095/*::]*/: { /* n:"LHNGraph", */ }, + /*::[*/0x0096/*::]*/: { /* n:"Sound", */ }, + // 0xA2 FNPROTO: function prototypes (BIFF4) + // 0xA3 + // 0xA8 + /*::[*/0x00a9/*::]*/: { /* n:"CoordList", */ }, + /*::[*/0x00ab/*::]*/: { /* n:"GCW", */ }, + /*::[*/0x00bc/*::]*/: { /* n:"ShrFmla", */ }, /* Not necessarily same as 0x04bc */ + /*::[*/0x00bf/*::]*/: { /* n:"ToolbarHdr", */ }, + /*::[*/0x00c0/*::]*/: { /* n:"ToolbarEnd", */ }, + /*::[*/0x00c2/*::]*/: { /* n:"AddMenu", */ }, + /*::[*/0x00c3/*::]*/: { /* n:"DelMenu", */ }, + /*::[*/0x00d6/*::]*/: { /* n:"RString", */ f:parse_RString }, + /*::[*/0x00df/*::]*/: { /* n:"UDDesc", */ }, + /*::[*/0x00ea/*::]*/: { /* n:"TabIdConf", */ }, + /*::[*/0x0162/*::]*/: { /* n:"XL5Modify", */ }, + /*::[*/0x01a5/*::]*/: { /* n:"FileSharing2", */ }, + /*::[*/0x0206/*::]*/: { /* n:"Formula", */ f:parse_Formula }, + /*::[*/0x0209/*::]*/: { /* n:"BOF", */ f:parse_BOF }, + /*::[*/0x0218/*::]*/: { /* n:"Lbl", */ f:parse_Lbl }, + /*::[*/0x0223/*::]*/: { /* n:"ExternName", */ f:parse_ExternName }, + /*::[*/0x0231/*::]*/: { /* n:"Font", */ }, + /*::[*/0x0243/*::]*/: { /* n:"BIFF3XF", */ f:parse_BIFF3XF }, + /*::[*/0x0406/*::]*/: { /* n:"Formula", */ f:parse_Formula }, + /*::[*/0x0409/*::]*/: { /* n:"BOF", */ f:parse_BOF }, + /*::[*/0x0443/*::]*/: { /* n:"BIFF4XF", */ f:parse_BIFF4XF }, + /*::[*/0x086d/*::]*/: { /* n:"FeatInfo", */ }, + /*::[*/0x0873/*::]*/: { /* n:"FeatInfo11", */ }, + /*::[*/0x0881/*::]*/: { /* n:"SXAddl12", */ }, + /*::[*/0x08c0/*::]*/: { /* n:"AutoWebPub", */ }, + /*::[*/0x08c1/*::]*/: { /* n:"ListObj", */ }, + /*::[*/0x08c2/*::]*/: { /* n:"ListField", */ }, + /*::[*/0x08c3/*::]*/: { /* n:"ListDV", */ }, + /*::[*/0x08c4/*::]*/: { /* n:"ListCondFmt", */ }, + /*::[*/0x08c5/*::]*/: { /* n:"ListCF", */ }, + /*::[*/0x08c6/*::]*/: { /* n:"FMQry", */ }, + /*::[*/0x08c7/*::]*/: { /* n:"FMSQry", */ }, + /*::[*/0x08c8/*::]*/: { /* n:"PLV", */ }, + /*::[*/0x08c9/*::]*/: { /* n:"LnExt", */ }, + /*::[*/0x08ca/*::]*/: { /* n:"MkrExt", */ }, + /*::[*/0x08cb/*::]*/: { /* n:"CrtCoopt", */ }, + /*::[*/0x08d6/*::]*/: { /* n:"FRTArchId$", */ r:12 }, + + /* --- multiplan 4 records --- */ + /*::[*/0x0065/*::]*/: { /* n:"", */ }, // one per window + /*::[*/0x0066/*::]*/: { /* n:"", */ }, // calc settings + /*::[*/0x0069/*::]*/: { /* n:"", */ }, // print header + /*::[*/0x006a/*::]*/: { /* n:"", */ }, // print footer + /*::[*/0x006b/*::]*/: { /* n:"", */ }, // print settings + /*::[*/0x006d/*::]*/: { /* n:"", */ }, // one per window + /*::[*/0x0070/*::]*/: { /* n:"", */ }, // includes default col width + /*::[*/0x0072/*::]*/: { /* n:"", */ }, // includes selected cell + + /*::[*/0x7262/*::]*/: {} +}; + +function write_biff_rec(ba/*:BufArray*/, type/*:number*/, payload, length/*:?number*/)/*:void*/ { + var t/*:number*/ = type; + if(isNaN(t)) return; + var len = length || (payload||[]).length || 0; + var o = ba.next(4); + o.write_shift(2, t); + o.write_shift(2, len); + if(/*:: len != null &&*/len > 0 && is_buf(payload)) ba.push(payload); +} + +function write_biff_continue(ba/*:BufArray*/, type/*:number*/, payload, length/*:?number*/)/*:void*/ { + var len = length || (payload||[]).length || 0; + if(len <= 8224) return write_biff_rec(ba, type, payload, len); + var t = type; + if(isNaN(t)) return; + var parts = payload.parts || [], sidx = 0; + var i = 0, w = 0; + while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; } + var o = ba.next(4); + o.write_shift(2, t); + o.write_shift(2, w); + ba.push(payload.slice(i, i + w)); + i += w; + while(i < len) { + o = ba.next(4); + o.write_shift(2, 0x3c); // TODO: figure out correct continue type + w = 0; + while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; } + o.write_shift(2, w); + ba.push(payload.slice(i, i+w)); i+= w; + } +} + +function write_BIFF2BERR(r/*:number*/, c/*:number*/, val, t/*:string*/) { + var out = new_buf(9); + write_BIFF2Cell(out, r, c); + write_Bes(val, t || 'b', out); + return out; +} + +/* TODO: codepage, large strings */ +function write_BIFF2LABEL(r/*:number*/, c/*:number*/, val) { + var out = new_buf(8 + 2*val.length); + write_BIFF2Cell(out, r, c); + out.write_shift(1, val.length); + out.write_shift(val.length, val, 'sbcs'); + return out.l < out.length ? out.slice(0, out.l) : out; +} + +function write_comments_biff2(ba/*:BufArray*/, comments/*:Array<[Comment[], number, number]>*/) { + comments.forEach(function(data) { + var text = data[0].map(function(cc) { return cc.t; }).join(""); + // TODO: should '\n' be translated to '\r' to correct for Excel 5.0 bug when exporting to BIFF2/3 ? + if(text.length <= 2048) return write_biff_rec(ba, 0x001C, write_NOTE_BIFF2(text, data[1], data[2])); + write_biff_rec(ba, 0x001C, write_NOTE_BIFF2(text.slice(0, 2048), data[1], data[2], text.length)); + for(var i = 2048; i < text.length; i += 2048) + write_biff_rec(ba, 0x001C, write_NOTE_BIFF2(text.slice(i, Math.min(i+2048, text.length)), -1, -1, Math.min(2048, text.length - i))); + }); +} + +/* TODO: BIFF3/4 use different records -- see comments*/ +function write_ws_biff2_cell(ba/*:BufArray*/, cell/*:Cell*/, R/*:number*/, C/*:number*/, opts, date1904/*:boolean*/) { + var ifmt = 0; + if(cell.z != null) { + ifmt = opts._BIFF2FmtTable.indexOf(cell.z); + if(ifmt == -1) { opts._BIFF2FmtTable.push(cell.z); ifmt = opts._BIFF2FmtTable.length - 1; } + } + var ixfe = 0; + if(cell.z != null) { + for(; ixfe < opts.cellXfs.length; ++ixfe) if(opts.cellXfs[ixfe].numFmtId == ifmt) break; + if(ixfe == opts.cellXfs.length) opts.cellXfs.push({numFmtId: ifmt}); + } + if(cell.v != null) switch(cell.t) { + case 'd': case 'n': + var v = cell.t == 'd' ? datenum(parseDate(cell.v, date1904), date1904) : cell.v; + if(opts.biff == 2 && (v == (v|0)) && (v >= 0) && (v < 65536)) + // 0x027E (RK) in BIFF3/4 + write_biff_rec(ba, 0x0002, write_BIFF2INT(R, C, v, ixfe, ifmt)); + else if(isNaN(v)) + // 0x0205 in BIFF3/4 + write_biff_rec(ba, 0x0005, write_BIFF2BERR(R, C, 0x24, "e")); // #NUM! + else if(!isFinite(v)) + // 0x0205 in BIFF3/4 + write_biff_rec(ba, 0x0005, write_BIFF2BERR(R, C, 0x07, "e")); // #DIV/0! + else + // 0x0203 in BIFF3/4 + write_biff_rec(ba, 0x0003, write_BIFF2NUM(R,C, v, ixfe, ifmt)); + return; + case 'b': case 'e': + // 0x0205 in BIFF3/4 + write_biff_rec(ba, 0x0005, write_BIFF2BERR(R, C, cell.v, cell.t)); return; + /* TODO: codepage, sst */ + case 's': case 'str': + // 0x0204 in BIFF3/4 + write_biff_rec(ba, 0x0004, write_BIFF2LABEL(R, C, cell.v == null ? "" : String(cell.v).slice(0,255))); + return; + } + // 0x0201 in BIFF3/4 + write_biff_rec(ba, 0x0001, write_BIFF2Cell(null, R, C)); +} + +function write_ws_biff2(ba/*:BufArray*/, ws/*:Worksheet*/, idx/*:number*/, opts, wb/*:Workbook*/) { + var dense = ws["!data"] != null; + var range = safe_decode_range(ws['!ref'] || "A1"), ref/*:string*/, rr = "", cols/*:Array*/ = []; + if(range.e.c > 0xFF || range.e.r > 0x3FFF) { + if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384"); + range.e.c = Math.min(range.e.c, 0xFF); + range.e.r = Math.min(range.e.c, 0x3FFF); + } + var date1904 = (((wb||{}).Workbook||{}).WBProps||{}).date1904; + var row = [], comments = []; + /* TODO: 0x0000 / 0x0200 dimensions? */ + for(var C = range.s.c; C <= range.e.c; ++C) cols[C] = encode_col(C); + for(var R = range.s.r; R <= range.e.r; ++R) { + if(dense) row = ws["!data"][R] || []; + rr = encode_row(R); + for(C = range.s.c; C <= range.e.c; ++C) { + var cell = dense ? row[C] : ws[cols[C] + rr]; + if(!cell) continue; + /* write cell */ + write_ws_biff2_cell(ba, cell, R, C, opts, date1904); + if(cell.c) comments.push([cell.c, R, C]); + } + } + + /* ... 0x12 0x19 0x13 (Password) */ + write_comments_biff2(ba, comments); + /* 0x3d (Window1) ... */ +} + +/* Based on test files */ +function write_biff2_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { + var o = opts || {}; + + var ba = buf_array(); + var idx = 0; + for(var i=0;i*/ = ["General"]; o._Fonts = []; + var body = buf_array(); + write_ws_biff2(body, wb.Sheets[wb.SheetNames[idx]], idx, o, wb); + + o._BIFF2FmtTable.forEach(function(f) { + if(o.biff <= 3) write_biff_rec(ba, 0x001E, write_BIFF2Format(f)); + else write_biff_rec(ba, 0x041E, write_BIFF4Format(f)); + }); + o.cellXfs.forEach(function(xf) { + switch(o.biff) { + case 2: write_biff_rec(ba, 0x0043, write_BIFF2XF(xf)); break; + case 3: write_biff_rec(ba, 0x0243, write_BIFF3XF(xf)); break; + case 4: write_biff_rec(ba, 0x0443, write_BIFF4XF(xf)); break; + } + }); + delete o._BIFF2FmtTable; delete o.cellXfs; delete o._Fonts; + + ba.push(body.end()); + write_biff_rec(ba, 0x000A); + return ba.end(); +} + +var b8oid = 1, b8ocnts/*:Array<[number, number, number]>*/ = []; +function write_MsoDrawingGroup() { + var buf = new_buf(82 + 8 * b8ocnts.length); + /* [MS-ODRAW] 2.2.12 OfficeArtDggContainer */ + buf.write_shift(2, 0x0F); + buf.write_shift(2, 0xF000); + buf.write_shift(4, 74 + 8 * b8ocnts.length); + /* 2.2.48 OfficeArtFDGGBlock */ + { + buf.write_shift(2, 0); + buf.write_shift(2, 0xF006); + buf.write_shift(4, 16 + 8 * b8ocnts.length); + /* 2.2.47 OfficeArtFDGG */ + { + buf.write_shift(4, b8oid); + buf.write_shift(4, b8ocnts.length+1); + var acc = 0; for(var i = 0; i < b8ocnts.length; ++i) acc += (b8ocnts[i] && b8ocnts[i][1] || 0); buf.write_shift(4, acc); + buf.write_shift(4, b8ocnts.length); + } + /* 2.2.46 OfficeArtIDCL + */ + b8ocnts.forEach(function(b8) { + buf.write_shift(4, b8[0]); + buf.write_shift(4, b8[2]); + }); + } + /* 2.2.9 OfficeArtFOPT */ + { + buf.write_shift(2, 0x33); // 0x03 | (3 << 4) + buf.write_shift(2, 0xF00B); + buf.write_shift(4, 0x12); // 3 * 6 + /* 2.3.21.15 Text Boolean Properties */ + buf.write_shift(2, 0xBF); buf.write_shift(4, 0x00080008); + /* 2.3.7.2 fillColor */ + buf.write_shift(2, 0x0181); buf.write_shift(4, 0x08000041); + /* 2.3.8.1 lineColor */ + buf.write_shift(2, 0x01C0); buf.write_shift(4, 0x08000040); + } + /* 2.2.45 OfficeArtSplitMenuColorContainer */ + { + buf.write_shift(2, 0x40); + buf.write_shift(2, 0xF11E); + buf.write_shift(4, 16); + buf.write_shift(4, 0x0800000D); + buf.write_shift(4, 0x0800000C); + buf.write_shift(4, 0x08000017); + buf.write_shift(4, 0x100000F7); + } + return buf; +} +function write_comments_biff8(ba/*:BufArray*/, comments/*:Array<[Comment[], number, number]>*/) { + var notes/*:Array*/ = [], sz = 0, pl = buf_array(), baseid = b8oid; + var _oasc; + comments.forEach(function(c, ci) { + var author = ""; + var text = c[0].map(function(t) { if(t.a && !author) author = t.a; return t.t; }).join(""); + ++b8oid; + + /* 2.2.14 OfficeArtSpContainer */ + { + var oasc = new_buf(0x96); + oasc.write_shift(2, 0x0F); + oasc.write_shift(2, 0xF004); + oasc.write_shift(4, 0x96); + /* 2.2.40 OfficeArtFSP */ + { + oasc.write_shift(2, 0xca2); // 0x02 | (0xca << 4) + oasc.write_shift(2, 0xF00A); + oasc.write_shift(4, 8); + oasc.write_shift(4, b8oid); + oasc.write_shift(4, 0xA00); + } + /* 2.2.9 OfficeArtFOPT */ + { + oasc.write_shift(2, 0xE3); // 0x03 | (14 << 4) + oasc.write_shift(2, 0xF00B); + oasc.write_shift(4, 0x54); // 14 * 6 + /* 2.3.21.1 ITxid */ + oasc.write_shift(2, 0x80); oasc.write_shift(4, 0); + /* 2.3.21.12 txdir */ + oasc.write_shift(2, 0x8B); oasc.write_shift(4, 0x02); + /* 2.3.21.15 Text Boolean Properties */ + oasc.write_shift(2, 0xBF); oasc.write_shift(4, 0x00080008); + /* 2.3.6.30 cxk */ + oasc.write_shift(2, 0x0158); oasc.l += 4; + /* 2.3.7.2 fillColor */ + oasc.write_shift(2, 0x0181); oasc.write_shift(4, 0x08000050); + /* 2.3.7.4 fillBackColor */ + oasc.write_shift(2, 0x0183); oasc.write_shift(4, 0x08000050); + /* 2.3.7.6 fillCrMod */ + oasc.write_shift(2, 0x0185); oasc.write_shift(4, 0x100000F4); + /* 2.3.7.43 Fill Style Boolean Properties */ + oasc.write_shift(2, 0x01BF); oasc.write_shift(4, 0x00100010); + /* 2.3.8.1 lineColor */ + oasc.write_shift(2, 0x01C0); oasc.write_shift(4, 0x08000051); + /* 2.3.8.4 lineCrMod */ + oasc.write_shift(2, 0x01C3); oasc.write_shift(4, 0x100000F4); + /* 2.3.13.2 shadowColor */ + oasc.write_shift(2, 0x0201); oasc.write_shift(4, 0x08000051); + /* 2.3.13.4 shadowCrMod */ + oasc.write_shift(2, 0x0203); oasc.write_shift(4, 0x100000F4); + /* 2.3.13.23 Shadow Style Boolean Properties */ + oasc.write_shift(2, 0x023F); oasc.write_shift(4, 0x00030001); + /* 2.3.4.44 Group Shape Boolean Properties */ + oasc.write_shift(2, 0x03BF); oasc.write_shift(4, 0x00020000 | (c[0].hidden ? 2 : 0)); + } + /* [MS-XLS] 2.5.193 OfficeArtClientAnchorSheet */ + { + oasc.l += 2; + oasc.write_shift(2, 0xF010); + oasc.write_shift(4, 0x12); + oasc.write_shift(2, 0x3); // do not move or size with cells + oasc.write_shift(2, c[2] + 2); oasc.l += 2; + oasc.write_shift(2, c[1] + 1); oasc.l += 2; + oasc.write_shift(2, c[2] + 4); oasc.l += 2; + oasc.write_shift(2, c[1] + 5); oasc.l += 2; + } + /* [MS-XLS] 2.5.194 OfficeArtClientData */ + { + oasc.l += 2; + oasc.write_shift(2, 0xF011); + oasc.l += 4; + } + oasc.l = 0x96; + if(ci == 0) /* write_biff_rec(pl, 0x003C, oasc); */ _oasc = oasc; + else write_biff_rec(pl, 0x00EC, oasc); + } + sz += 0x96; + + /* [MS-XLS] 2.4.181 Obj */ + { + var obj = new_buf(52); // 22 + 26 + 4 + /* [MS-XLS] 2.5.143 FtCmo */ + obj.write_shift(2, 0x15); + obj.write_shift(2, 0x12); + obj.write_shift(2, 0x19); + obj.write_shift(2, b8oid); + obj.write_shift(2, 0); + obj.l = 22; + /* [MS-XLS] 2.5.149 FtNts */ + obj.write_shift(2, 0x0D); + obj.write_shift(2, 0x16); + obj.write_shift(4, 0x62726272); + obj.write_shift(4, 0x95374305); + obj.write_shift(4, 0x80301328); + obj.write_shift(4, 0x69696904 + b8oid*256); + obj.write_shift(2,0); + obj.write_shift(4,0); + // reserved + obj.l += 4; + write_biff_rec(pl, 0x005D, obj); + } + + /* [MS-XLS] 2.5.195 OfficeArtClientTextbox */ + { + var oact = new_buf(8); + oact.l += 2; + oact.write_shift(2, 0xF00D); + oact.l += 4; + write_biff_rec(pl, 0x00EC, oact); + } + sz += 8; + + /* [MS-XLS] 2.4.329 TxO */ + { + var txo = new_buf(18); + txo.write_shift(2, 0x12); + txo.l += 8; + txo.write_shift(2, text.length); + txo.write_shift(2, 0x10); + txo.l += 4; + write_biff_rec(pl, 0x01b6, txo); + /* text continue record TODO: switch to wide strings */ + { + var cont = new_buf(1 + text.length); + cont.write_shift(1, 0); + cont.write_shift(text.length, text, "sbcs"); + write_biff_rec(pl, 0x003C, cont); + } + /* formatting continue records */ + { + var conf = new_buf(0x10); + conf.l += 8; + conf.write_shift(2, text.length); + conf.l += 6; + write_biff_rec(pl, 0x003C, conf); + } + } + + /* 2.4.179 Note */ + { + var notesh = new_buf(12 + author.length); + notesh.write_shift(2, c[1]); + notesh.write_shift(2, c[2]); + notesh.write_shift(2, 0 | (c[0].hidden ? 0 : 2)); + notesh.write_shift(2, b8oid); + notesh.write_shift(2, author.length); + notesh.write_shift(1, 0); + notesh.write_shift(author.length, author, "sbcs"); + notesh.l ++; + notes.push(notesh); + } + }); + /* [MS-ODRAW] 2.2.13 OfficeArtDgContainer */ + { + var hdr = new_buf(80); + hdr.write_shift(2, 0x0F); + hdr.write_shift(2, 0xF002); + hdr.write_shift(4, sz + hdr.length - 8); + /* [MS-ODRAW] 2.2.49 OfficeArtFDG */ + { + hdr.write_shift(2, 0x10); + hdr.write_shift(2, 0xF008); + hdr.write_shift(4, 0x08); + hdr.write_shift(4, comments.length + 1); + hdr.write_shift(4, b8oid); + } + /* [MS-ODRAW] 2.2.16 OfficeArtSpgrContainer */ + { + hdr.write_shift(2, 0x0f); + hdr.write_shift(2, 0xF003); + hdr.write_shift(4, sz + 0x30); + /* [MS-ODRAW] 2.2.14 OfficeArtSpContainer */ + { + hdr.write_shift(2, 0x0f); + hdr.write_shift(2, 0xF004); + hdr.write_shift(4, 0x28); + /* [MS-ODRAW] 2.2.38 OfficeArtFSPGR */ + { + hdr.write_shift(2, 0x01); + hdr.write_shift(2, 0xF009); + hdr.write_shift(4, 0x10); + hdr.l += 16; + } + /* [MS-ODRAW] 2.2.40 OfficeArtFSP */ + { + hdr.write_shift(2, 0x02); + hdr.write_shift(2, 0xF00A); + hdr.write_shift(4, 0x08); + hdr.write_shift(4, baseid); + hdr.write_shift(4, 0x05); + } + } + } + write_biff_rec(ba, 0x00EC, /* hdr */ _oasc ? bconcat([hdr, _oasc]) : hdr); + } + ba.push(pl.end()); + notes.forEach(function(n) { write_biff_rec(ba, 0x001C, n); }); + b8ocnts.push([baseid, comments.length + 1, b8oid]); + ++b8oid; +} + +function write_FONTS_biff8(ba, data, opts) { + write_biff_rec(ba, 0x0031 /* Font */, write_Font({ + sz:12, + color: {theme:1}, + name: "Arial", + family: 2, + scheme: "minor" + }, opts)); +} + + +function write_FMTS_biff8(ba, NF/*:?SSFTable*/, opts) { + if(!NF) return; + [[5,8],[23,26],[41,44],[/*63*/50,/*66],[164,*/392]].forEach(function(r) { + /*:: if(!NF) return; */ + for(var i = r[0]; i <= r[1]; ++i) if(NF[i] != null) write_biff_rec(ba, 0x041E /* Format */, write_Format(i, NF[i], opts)); + }); +} + +function write_FEAT(ba, ws) { + /* [MS-XLS] 2.4.112 */ + var o = new_buf(19); + o.write_shift(4, 0x867); o.write_shift(4, 0); o.write_shift(4, 0); + o.write_shift(2, 3); o.write_shift(1, 1); o.write_shift(4, 0); + write_biff_rec(ba, 0x0867 /* FeatHdr */, o); + /* [MS-XLS] 2.4.111 */ + o = new_buf(39); + o.write_shift(4, 0x868); o.write_shift(4, 0); o.write_shift(4, 0); + o.write_shift(2, 3); o.write_shift(1, 0); o.write_shift(4, 0); + o.write_shift(2, 1); o.write_shift(4, 4); o.write_shift(2, 0); + write_Ref8U(safe_decode_range(ws['!ref']||"A1"), o); + o.write_shift(4, 4); + write_biff_rec(ba, 0x0868 /* Feat */, o); +} + +function write_CELLXFS_biff8(ba, opts) { + for(var i = 0; i < 16; ++i) write_biff_rec(ba, 0x00e0 /* XF */, write_XF({numFmtId:0, style:true}, 0, opts)); + opts.cellXfs.forEach(function(c) { + write_biff_rec(ba, 0x00e0 /* XF */, write_XF(c, 0, opts)); + }); +} + +function write_ws_biff8_hlinks(ba/*:BufArray*/, ws) { + for(var R=0; R*/ = []; + var range = safe_decode_range(ws['!ref'] || "A1"); + var MAX_ROWS = b8 ? 65536 : 16384; + if(range.e.c > 0xFF || range.e.r >= MAX_ROWS) { + if(opts.WTF) throw new Error("Range " + (ws['!ref'] || "A1") + " exceeds format limit A1:IV16384"); + range.e.c = Math.min(range.e.c, 0xFF); + range.e.r = Math.min(range.e.c, MAX_ROWS-1); + } + + write_biff_rec(ba, 0x0809, write_BOF(wb, 0x10, opts)); + /* [Uncalced] Index */ + write_biff_rec(ba, 0x000d /* CalcMode */, writeuint16(1)); + write_biff_rec(ba, 0x000c /* CalcCount */, writeuint16(100)); + write_biff_rec(ba, 0x000f /* CalcRefMode */, writebool(true)); + write_biff_rec(ba, 0x0011 /* CalcIter */, writebool(false)); + write_biff_rec(ba, 0x0010 /* CalcDelta */, write_Xnum(0.001)); + write_biff_rec(ba, 0x005f /* CalcSaveRecalc */, writebool(true)); + write_biff_rec(ba, 0x002a /* PrintRowCol */, writebool(false)); + write_biff_rec(ba, 0x002b /* PrintGrid */, writebool(false)); + write_biff_rec(ba, 0x0082 /* GridSet */, writeuint16(1)); + write_biff_rec(ba, 0x0080 /* Guts */, write_Guts([0,0])); + /* DefaultRowHeight WsBool [Sync] [LPr] [HorizontalPageBreaks] [VerticalPageBreaks] */ + /* Header (string) */ + /* Footer (string) */ + write_biff_rec(ba, 0x0083 /* HCenter */, writebool(false)); + write_biff_rec(ba, 0x0084 /* VCenter */, writebool(false)); + /* ... */ + if(b8) write_ws_cols_biff8(ba, ws["!cols"]); + /* ... */ + write_biff_rec(ba, 0x0200 /* Dimensions */, write_Dimensions(range, opts)); + /* ... */ + + var date1904 = (((wb||{}).Workbook||{}).WBProps||{}).date1904; + if(b8) ws['!links'] = []; + var comments = []; + var row = []; + for(var C = range.s.c; C <= range.e.c; ++C) cols[C] = encode_col(C); + for(var R = range.s.r; R <= range.e.r; ++R) { + if(dense) row = ws["!data"][R] || []; + rr = encode_row(R); + for(C = range.s.c; C <= range.e.c; ++C) { + ref = cols[C] + rr; + var cell = dense ? row[C] : ws[ref]; + if(!cell) continue; + /* write cell */ + write_ws_biff8_cell(ba, cell, R, C, opts, date1904); + if(b8 && cell.l) ws['!links'].push([ref, cell.l]); + if(cell.c) comments.push([cell.c, R, C]); + } + } + var cname/*:string*/ = _sheet.CodeName || _sheet.name || s; + /* ... */ + if(b8) write_comments_biff8(ba, comments); else write_comments_biff2(ba, comments); + /* ... */ + if(b8) write_biff_rec(ba, 0x023e /* Window2 */, write_Window2((_WB.Views||[])[0])); + /* ... */ + if(b8 && (ws['!merges']||[]).length) write_biff_rec(ba, 0x00e5 /* MergeCells */, write_MergeCells(ws['!merges'])); + /* [LRng] *QUERYTABLE [PHONETICINFO] CONDFMTS */ + if(b8) write_ws_biff8_hlinks(ba, ws); + /* [DVAL] */ + write_biff_rec(ba, 0x01ba /* CodeName */, write_XLUnicodeString(cname, opts)); + /* *WebPub *CellWatch [SheetExt] */ + if(b8) write_FEAT(ba, ws); + /* *FEAT11 *RECORD12 */ + write_biff_rec(ba, 0x000a /* EOF */); + return ba.end(); +} + +/* [MS-XLS] 2.1.7.20.3 */ +function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) { + var A = buf_array(); + var _WB/*:WBWBProps*/ = ((wb||{}).Workbook||{}/*:any*/); + var _sheets/*:Array*/ = (_WB.Sheets||[]); + var _wb/*:WBProps*/ = /*::((*/_WB.WBProps||{/*::CodeName:"ThisWorkbook"*/}/*:: ):any)*/; + var b8 = opts.biff == 8, b5 = opts.biff == 5; + write_biff_rec(A, 0x0809, write_BOF(wb, 0x05, opts)); + if(opts.bookType == "xla") write_biff_rec(A, 0x0087 /* Addin */); + write_biff_rec(A, 0x00e1 /* InterfaceHdr */, b8 ? writeuint16(0x04b0) : null); + write_biff_rec(A, 0x00c1 /* Mms */, writezeroes(2)); + if(b5) write_biff_rec(A, 0x00bf /* ToolbarHdr */); + if(b5) write_biff_rec(A, 0x00c0 /* ToolbarEnd */); + write_biff_rec(A, 0x00e2 /* InterfaceEnd */); + write_biff_rec(A, 0x005c /* WriteAccess */, write_WriteAccess("SheetJS", opts)); + /* [FileSharing] */ + write_biff_rec(A, 0x0042 /* CodePage */, writeuint16(b8 ? 0x04b0 : 0x04E4)); + /* *2047 Lel */ + if(b8) write_biff_rec(A, 0x0161 /* DSF */, writeuint16(0)); + if(b8) write_biff_rec(A, 0x01c0 /* Excel9File */); + write_biff_rec(A, 0x013d /* RRTabId */, write_RRTabId(wb.SheetNames.length)); + if(b8 && wb.vbaraw) write_biff_rec(A, 0x00d3 /* ObProj */); + /* [ObNoMacros] */ + if(b8 && wb.vbaraw) { + var cname/*:string*/ = _wb.CodeName || "ThisWorkbook"; + write_biff_rec(A, 0x01ba /* CodeName */, write_XLUnicodeString(cname, opts)); + } + write_biff_rec(A, 0x009c /* BuiltInFnGroupCount */, writeuint16(0x11)); + /* *FnGroupName *FnGrp12 */ + /* *Lbl */ + /* [OleObjectSize] */ + write_biff_rec(A, 0x0019 /* WinProtect */, writebool(false)); + write_biff_rec(A, 0x0012 /* Protect */, writebool(false)); + write_biff_rec(A, 0x0013 /* Password */, writeuint16(0)); + if(b8) write_biff_rec(A, 0x01af /* Prot4Rev */, writebool(false)); + if(b8) write_biff_rec(A, 0x01bc /* Prot4RevPass */, writeuint16(0)); + write_biff_rec(A, 0x003d /* Window1 */, write_Window1(opts)); + write_biff_rec(A, 0x0040 /* Backup */, writebool(false)); + write_biff_rec(A, 0x008d /* HideObj */, writeuint16(0)); + write_biff_rec(A, 0x0022 /* Date1904 */, writebool(safe1904(wb)=="true")); + write_biff_rec(A, 0x000e /* CalcPrecision */, writebool(true)); + if(b8) write_biff_rec(A, 0x01b7 /* RefreshAll */, writebool(false)); + write_biff_rec(A, 0x00DA /* BookBool */, writeuint16(0)); + /* ... */ + write_FONTS_biff8(A, wb, opts); + write_FMTS_biff8(A, wb.SSF, opts); + write_CELLXFS_biff8(A, opts); + /* ... */ + if(b8) write_biff_rec(A, 0x0160 /* UsesELFs */, writebool(false)); + var a = A.end(); + + var C = buf_array(); + /* METADATA [MTRSettings] [ForceFullCalculation] */ + if(b8) write_biff_rec(C, 0x008C /* Country */, write_Country()); + /* *SUPBOOK *LBL *RTD [RecalcId] *HFPicture */ + + /* BIFF8: MsoDrawingGroup [*Continue] */ + if(b8 && b8ocnts.length) write_biff_rec(C, 0x00EB /* MsoDrawingGroup */, write_MsoDrawingGroup()); + /* BIFF8: [SST *Continue] ExtSST */ + if(b8 && opts.Strings) write_biff_continue(C, 0x00FC /* SST */, write_SST(opts.Strings, opts)); + + /* *WebPub [WOpt] [CrErr] [BookExt] *FeatHdr *DConn [THEME] [CompressPictures] [Compat12] [GUIDTypeLib] */ + write_biff_rec(C, 0x000A /* EOF */); + var c = C.end(); + + var B = buf_array(); + var blen = 0, j = 0; + for(j = 0; j < wb.SheetNames.length; ++j) blen += (b8 ? 12 : 11) + (b8 ? 2 : 1) * wb.SheetNames[j].length; + var start = a.length + blen + c.length; + for(j = 0; j < wb.SheetNames.length; ++j) { + var _sheet/*:WBWSProp*/ = _sheets[j] || ({}/*:any*/); + write_biff_rec(B, 0x0085 /* BoundSheet8 */, write_BoundSheet8({pos:start, hs:_sheet.Hidden||0, dt:0, name:wb.SheetNames[j]}, opts)); + start += bufs[j].length; + } + /* 1*BoundSheet8 */ + var b = B.end(); + if(blen != b.length) throw new Error("BS8 " + blen + " != " + b.length); + + var out = []; + if(a.length) out.push(a); + if(b.length) out.push(b); + if(c.length) out.push(c); + return bconcat(out); +} + +/* [MS-XLS] 2.1.7.20 Workbook Stream */ +function write_biff8_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { + var o = opts || {}; + var bufs = []; + + if(wb && !wb.SSF) { + wb.SSF = dup(table_fmt); + } + if(wb && wb.SSF) { + make_ssf(); SSF_load_table(wb.SSF); + // $FlowIgnore + o.revssf = evert_num(wb.SSF); o.revssf[wb.SSF[65535]] = 0; + o.ssf = wb.SSF; + } + + b8oid = 1; b8ocnts = []; + o.Strings = /*::((*/[]/*:: :any):SST)*/; o.Strings.Count = 0; o.Strings.Unique = 0; + fix_write_opts(o); + + o.cellXfs = []; + get_cell_style(o.cellXfs, {}, {revssf:{"General":0}}); + + if(!wb.Props) wb.Props = {}; + + for(var i = 0; i < wb.SheetNames.length; ++i) bufs[bufs.length] = write_ws_biff8(i, o, wb); + bufs.unshift(write_biff8_global(wb, bufs, o)); + return bconcat(bufs); +} + +function write_biff_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) { + for(var i = 0; i <= wb.SheetNames.length; ++i) { + var ws = wb.Sheets[wb.SheetNames[i]]; + if(!ws || !ws["!ref"]) continue; + var range = decode_range(ws["!ref"]); + if(range.e.c > 255) { // note: 255 is IV + if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost."); + } + } + + var o = opts || {}; + switch(o.biff || 2) { + case 8: case 5: return write_biff8_buf(wb, opts); + case 4: case 3: case 2: return write_biff2_buf(wb, opts); + } + throw new Error("invalid type " + o.bookType + " for BIFF"); +} +/* note: browser DOM element cannot see mso- style attrs, must parse */ +function html_to_sheet(str/*:string*/, _opts)/*:Workbook*/ { + var opts = _opts || {}; + var dense = (opts.dense != null) ? opts.dense : DENSE; + var ws/*:Worksheet*/ = ({}/*:any*/); if(dense) ws["!data"] = []; + str = str.replace(//g, ""); + var mtch/*:any*/ = str.match(/"); + var mtch2/*:any*/ = str.match(/<\/table/i); + var i/*:number*/ = mtch.index, j/*:number*/ = mtch2 && mtch2.index || str.length; + var rows = split_regex(str.slice(i, j), /(:?]*>)/i, ""); + var R = -1, C = 0, RS = 0, CS = 0; + var range/*:Range*/ = {s:{r:10000000, c:10000000},e:{r:0,c:0}}; + var merges/*:Array*/ = []; + for(i = 0; i < rows.length; ++i) { + var row = rows[i].trim(); + var hd = row.slice(0,3).toLowerCase(); + if(hd == "/i); + for(j = 0; j < cells.length; ++j) { + var cell = cells[j].trim(); + if(!cell.match(/")) > -1) m = m.slice(cc+1); + for(var midx = 0; midx < merges.length; ++midx) { + var _merge/*:Range*/ = merges[midx]; + if(_merge.s.c == C && _merge.s.r < R && R <= _merge.e.r) { C = _merge.e.c + 1; midx = -1; } + } + var tag = parsexmltag(cell.slice(0, cell.indexOf(">"))); + CS = tag.colspan ? +tag.colspan : 1; + if((RS = +tag.rowspan)>1 || CS>1) merges.push({s:{r:R,c:C},e:{r:R + (RS||1) - 1, c:C + CS - 1}}); + var _t/*:string*/ = tag.t || tag["data-t"] || ""; + /* TODO: generate stub cells */ + if(!m.length) { C += CS; continue; } + m = htmldecode(m); + if(range.s.r > R) range.s.r = R; if(range.e.r < R) range.e.r = R; + if(range.s.c > C) range.s.c = C; if(range.e.c < C) range.e.c = C; + if(!m.length) { C += CS; continue; } + var o/*:Cell*/ = {t:'s', v:m}; + if(opts.raw || !m.trim().length || _t == 's'){} + else if(m === 'TRUE') o = {t:'b', v:true}; + else if(m === 'FALSE') o = {t:'b', v:false}; + else if(!isNaN(fuzzynum(m))) o = {t:'n', v:fuzzynum(m)}; + else if(!isNaN(fuzzydate(m).getDate())) { + o = ({t:'d', v:parseDate(m)}/*:any*/); + if(opts.UTC === false) o.v = utc_to_local(o.v); + if(!opts.cellDates) o = ({t:'n', v:datenum(o.v)}/*:any*/); + o.z = opts.dateNF || table_fmt[14]; + } + if(o.cellText !== false) o.w = m; + if(dense) { if(!ws["!data"][R]) ws["!data"][R] = []; ws["!data"][R][C] = o; } + else ws[encode_cell({r:R, c:C})] = o; + C += CS; + } + } + ws['!ref'] = encode_range(range); + if(merges.length) ws["!merges"] = merges; + return ws; +} +function make_html_row(ws/*:Worksheet*/, r/*:Range*/, R/*:number*/, o/*:Sheet2HTMLOpts*/)/*:string*/ { + var M/*:Array*/ = (ws['!merges'] ||[]); + var oo/*:Array*/ = []; + var sp = ({}/*:any*/); + var dense = ws["!data"] != null; + for(var C = r.s.c; C <= r.e.c; ++C) { + var RS = 0, CS = 0; + for(var j = 0; j < M.length; ++j) { + if(M[j].s.r > R || M[j].s.c > C) continue; + if(M[j].e.r < R || M[j].e.c < C) continue; + if(M[j].s.r < R || M[j].s.c < C) { RS = -1; break; } + RS = M[j].e.r - M[j].s.r + 1; CS = M[j].e.c - M[j].s.c + 1; break; + } + if(RS < 0) continue; + var coord = encode_col(C) + encode_row(R); + var cell = dense ? (ws["!data"][R]||[])[C] : ws[coord]; + /* TODO: html entities */ + var w = (cell && cell.v != null) && (cell.h || escapehtml(cell.w || (format_cell(cell), cell.w) || "")) || ""; + sp = ({}/*:any*/); + if(RS > 1) sp.rowspan = RS; + if(CS > 1) sp.colspan = CS; + if(o.editable) w = '' + w + ''; + else if(cell) { + sp["data-t"] = cell && cell.t || 'z'; + // note: data-v is unaffected by the timezone interpretation + if(cell.v != null) sp["data-v"] = cell.v instanceof Date ? cell.v.toISOString() : cell.v; + if(cell.z != null) sp["data-z"] = cell.z; + if(cell.l && (cell.l.Target || "#").charAt(0) != "#") w = '' + w + ''; + } + sp.id = (o.id || "sjs") + "-" + coord; + oo.push(writextag('td', w, sp)); + } + var preamble = ""; + return preamble + oo.join("") + ""; +} + +var HTML_BEGIN = 'SheetJS Table Export'; +var HTML_END = ''; + +function html_to_workbook(str/*:string*/, opts)/*:Workbook*/ { + var mtch = str.match(/[\s\S]*?<\/table>/gi); + if(!mtch || mtch.length == 0) throw new Error("Invalid HTML: could not find
"); + if(mtch.length == 1) { + var w = sheet_to_workbook(html_to_sheet(mtch[0], opts), opts); + w.bookType = "html"; + return w; + } + var wb = book_new(); + mtch.forEach(function(s, idx) { book_append_sheet(wb, html_to_sheet(s, opts), "Sheet" + (idx+1)); }); + wb.bookType = "html"; + return wb; +} + +function make_html_preamble(ws/*:Worksheet*/, R/*:Range*/, o/*:Sheet2HTMLOpts*/)/*:string*/ { + var out/*:Array*/ = []; + return out.join("") + ''; +} + +function sheet_to_html(ws/*:Worksheet*/, opts/*:?Sheet2HTMLOpts*//*, wb:?Workbook*/)/*:string*/ { + var o = opts || {}; + var header = o.header != null ? o.header : HTML_BEGIN; + var footer = o.footer != null ? o.footer : HTML_END; + var out/*:Array*/ = [header]; + var r = decode_range(ws['!ref']); + out.push(make_html_preamble(ws, r, o)); + for(var R = r.s.r; R <= r.e.r; ++R) out.push(make_html_row(ws, r, R, o)); + out.push("
" + footer); + return out.join(""); +} + +function sheet_add_dom(ws/*:Worksheet*/, table/*:HTMLElement*/, _opts/*:?any*/)/*:Worksheet*/ { + var rows/*:HTMLCollection*/ = table.rows; + if(!rows) { + /* not an HTML TABLE */ + throw "Unsupported origin when " + table.tagName + " is not a TABLE"; + } + + var opts = _opts || {}; + var dense = ws["!data"] != null; + var or_R = 0, or_C = 0; + if(opts.origin != null) { + if(typeof opts.origin == 'number') or_R = opts.origin; + else { + var _origin/*:CellAddress*/ = typeof opts.origin == "string" ? decode_cell(opts.origin) : opts.origin; + or_R = _origin.r; or_C = _origin.c; + } + } + + var sheetRows = Math.min(opts.sheetRows||10000000, rows.length); + var range/*:Range*/ = {s:{r:0,c:0},e:{r:or_R,c:or_C}}; + if(ws["!ref"]) { + var _range/*:Range*/ = decode_range(ws["!ref"]); + range.s.r = Math.min(range.s.r, _range.s.r); + range.s.c = Math.min(range.s.c, _range.s.c); + range.e.r = Math.max(range.e.r, _range.e.r); + range.e.c = Math.max(range.e.c, _range.e.c); + if(or_R == -1) range.e.r = or_R = _range.e.r + 1; + } + var merges/*:Array*/ = [], midx = 0; + var rowinfo/*:Array*/ = ws["!rows"] || (ws["!rows"] = []); + var _R = 0, R = 0, _C = 0, C = 0, RS = 0, CS = 0; + if(!ws["!cols"]) ws['!cols'] = []; + for(; _R < rows.length && R < sheetRows; ++_R) { + var row/*:HTMLTableRowElement*/ = rows[_R]; + if (is_dom_element_hidden(row)) { + if (opts.display) continue; + rowinfo[R] = {hidden: true}; + } + var elts/*:HTMLCollection*/ = (row.cells); + for(_C = C = 0; _C < elts.length; ++_C) { + var elt/*:HTMLTableCellElement*/ = elts[_C]; + if (opts.display && is_dom_element_hidden(elt)) continue; + var v/*:?string*/ = elt.hasAttribute('data-v') ? elt.getAttribute('data-v') : elt.hasAttribute('v') ? elt.getAttribute('v') : htmldecode(elt.innerHTML); + var z/*:?string*/ = elt.getAttribute('data-z') || elt.getAttribute('z'); + for(midx = 0; midx < merges.length; ++midx) { + var m/*:Range*/ = merges[midx]; + if(m.s.c == C + or_C && m.s.r < R + or_R && R + or_R <= m.e.r) { C = m.e.c+1 - or_C; midx = -1; } + } + /* TODO: figure out how to extract nonstandard mso- style */ + CS = +elt.getAttribute("colspan") || 1; + if( ((RS = (+elt.getAttribute("rowspan") || 1)))>1 || CS>1) merges.push({s:{r:R + or_R,c:C + or_C},e:{r:R + or_R + (RS||1) - 1, c:C + or_C + (CS||1) - 1}}); + var o/*:Cell*/ = {t:'s', v:v}; + var _t/*:string*/ = elt.getAttribute("data-t") || elt.getAttribute("t") || ""; + if(v != null) { + if(v.length == 0) o.t = _t || 'z'; + else if(opts.raw || v.trim().length == 0 || _t == "s"){} + else if(v === 'TRUE') o = {t:'b', v:true}; + else if(v === 'FALSE') o = {t:'b', v:false}; + else if(!isNaN(fuzzynum(v))) o = {t:'n', v:fuzzynum(v)}; + else if(!isNaN(fuzzydate(v).getDate())) { + o = ({t:'d', v:parseDate(v)}/*:any*/); + if(opts.UTC) o.v = local_to_utc(o.v); + if(!opts.cellDates) o = ({t:'n', v:datenum(o.v)}/*:any*/); + o.z = opts.dateNF || table_fmt[14]; + } + } + if(o.z === undefined && z != null) o.z = z; + /* The first link is used. Links are assumed to be fully specified. + * TODO: The right way to process relative links is to make a new */ + var l = "", Aelts = elt.getElementsByTagName("A"); + if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAttribute("href")) { + l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break; + } + if(l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') o.l = ({ Target: l }); + if(dense) { if(!ws["!data"][R + or_R]) ws["!data"][R + or_R] = []; ws["!data"][R + or_R][C + or_C] = o; } + else ws[encode_cell({c:C + or_C, r:R + or_R})] = o; + if(range.e.c < C + or_C) range.e.c = C + or_C; + C += CS; + } + ++R; + } + if(merges.length) ws['!merges'] = (ws["!merges"] || []).concat(merges); + range.e.r = Math.max(range.e.r, R - 1 + or_R); + ws['!ref'] = encode_range(range); + if(R >= sheetRows) ws['!fullref'] = encode_range((range.e.r = rows.length-_R+R-1 + or_R,range)); // We can count the real number of rows to parse but we don't to improve the performance + return ws; +} + +function parse_dom_table(table/*:HTMLElement*/, _opts/*:?any*/)/*:Worksheet*/ { + var opts = _opts || {}; + var ws/*:Worksheet*/ = ({}/*:any*/); if(opts.dense) ws["!data"] = []; + return sheet_add_dom(ws, table, _opts); +} + +function table_to_book(table/*:HTMLElement*/, opts/*:?any*/)/*:Workbook*/ { + var o = sheet_to_workbook(parse_dom_table(table, opts), opts); + //o.bookType = "dom"; // TODO: define a type for this + return o; +} + +function is_dom_element_hidden(element/*:HTMLElement*/)/*:boolean*/ { + var display/*:string*/ = ''; + var get_computed_style/*:?function*/ = get_get_computed_style_function(element); + if(get_computed_style) display = get_computed_style(element).getPropertyValue('display'); + if(!display) display = element.style && element.style.display; + return display === 'none'; +} + +/* global getComputedStyle */ +function get_get_computed_style_function(element/*:HTMLElement*/)/*:?function*/ { + // The proper getComputedStyle implementation is the one defined in the element window + if(element.ownerDocument.defaultView && typeof element.ownerDocument.defaultView.getComputedStyle === 'function') return element.ownerDocument.defaultView.getComputedStyle; + // If it is not available, try to get one from the global namespace + if(typeof getComputedStyle === 'function') return getComputedStyle; + return null; +} +/* OpenDocument */ +function parse_text_p(text/*:string*//*::, tag*/)/*:Array*/ { + /* 6.1.2 White Space Characters */ + var fixed = text + .replace(/[\t\r\n]/g, " ").trim().replace(/ +/g, " ") + .replace(//g," ") + .replace(//g, function($$,$1) { return Array(parseInt($1,10)+1).join(" "); }) + .replace(/]*\/>/g,"\t") + .replace(//g,"\n"); + var v = unescapexml(fixed.replace(/<[^>]*>/g,"")); + + return [v]; +} + +/* Note: ODS can stick styles in content.xml or styles.xml, FODS blurs lines */ +function parse_ods_styles(d/*:string*/, _opts, _nfm) { + var number_format_map = _nfm || {}; + var str = xlml_normalize(d); + xlmlregex.lastIndex = 0; + str = str.replace(//mg,"").replace(//gm,""); + var Rn, NFtag, NF = "", tNF = "", y, etpos = 0, tidx = -1, infmt = false, payload = ""; + while((Rn = xlmlregex.exec(str))) { + switch((Rn[3]=Rn[3].replace(/_.*$/,""))) { + /* Number Format Definitions */ + case 'number-style': // 16.29.2 + case 'currency-style': // 16.29.8 + case 'percentage-style': // 16.29.10 + case 'date-style': // 16.29.11 + case 'time-style': // 16.29.19 + case 'text-style': // 16.29.26 + if(Rn[1]==='/') { + infmt = false; + if(NFtag['truncate-on-overflow'] == "false") { + if(NF.match(/h/)) NF = NF.replace(/h+/, "[$&]"); + else if(NF.match(/m/)) NF = NF.replace(/m+/, "[$&]"); + else if(NF.match(/s/)) NF = NF.replace(/s+/, "[$&]"); + } + number_format_map[NFtag.name] = NF; + NF = ""; + } else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + infmt = true; + NF = ""; + NFtag = parsexmltag(Rn[0], false); + } break; + + // LibreOffice bug https://bugs.documentfoundation.org/show_bug.cgi?id=149484 + case 'boolean-style': // 16.29.24 + if(Rn[1]==='/') { + infmt = false; + number_format_map[NFtag.name] = "General"; + NF = ""; + } else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + infmt = true; + NF = ""; + NFtag = parsexmltag(Rn[0], false); + } break; + + /* Number Format Elements */ + case 'boolean': // 16.29.25 + NF += "General"; // ODF spec is unfortunately underspecified here + break; + + case 'text': // 16.29.27 + if(Rn[1]==='/') { + payload = str.slice(tidx, xlmlregex.lastIndex - Rn[0].length); + // NOTE: Excel has a different interpretation of "%%" and friends + if(payload == "%" && NFtag[0] == ' 16.29.12 + y = parsexmltag(Rn[0], false); + switch(y["style"]) { + case "short": NF += "d"; break; + case "long": NF += "dd"; break; + default: NF += "dd"; break; // TODO: error condition + } + } break; + + case 'day-of-week': { // 16.29.16 + y = parsexmltag(Rn[0], false); + switch(y["style"]) { + case "short": NF += "ddd"; break; + case "long": NF += "dddd"; break; + default: NF += "ddd"; break; + } + } break; + + case 'era': { // 16.29.15 TODO: proper mapping + y = parsexmltag(Rn[0], false); + switch(y["style"]) { + case "short": NF += "ee"; break; + case "long": NF += "eeee"; break; + default: NF += "eeee"; break; // TODO: error condition + } + } break; + + case 'hours': { // 16.29.20 + y = parsexmltag(Rn[0], false); + switch(y["style"]) { + case "short": NF += "h"; break; + case "long": NF += "hh"; break; + default: NF += "hh"; break; // TODO: error condition + } + } break; + + case 'minutes': { // 16.29.21 + y = parsexmltag(Rn[0], false); + switch(y["style"]) { + case "short": NF += "m"; break; + case "long": NF += "mm"; break; + default: NF += "mm"; break; // TODO: error condition + } + } break; + + case 'month': { // 16.29.13 + y = parsexmltag(Rn[0], false); + if(y["textual"]) NF += "mm"; + switch(y["style"]) { + case "short": NF += "m"; break; + case "long": NF += "mm"; break; + default: NF += "m"; break; + } + } break; + + case 'seconds': { // 16.29.22 + y = parsexmltag(Rn[0], false); + switch(y["style"]) { + case "short": NF += "s"; break; + case "long": NF += "ss"; break; + default: NF += "ss"; break; // TODO: error condition + } + if(y["decimal-places"]) NF += "." + fill("0", +y["decimal-places"]); + } break; + + case 'year': { // 16.29.14 + y = parsexmltag(Rn[0], false); + switch(y["style"]) { + case "short": NF += "yy"; break; + case "long": NF += "yyyy"; break; + default: NF += "yy"; break; // TODO: error condition + } + } break; + + case 'am-pm': // 16.29.23 + NF += "AM/PM"; // LO autocorrects A/P -> AM/PM + break; + + case 'week-of-year': // 16.29.17 + case 'quarter': // 16.29.18 + console.error("Excel does not support ODS format token " + Rn[3]); + break; + + case 'fill-character': // 16.29.5 + if(Rn[1]==='/') { + payload = str.slice(tidx, xlmlregex.lastIndex - Rn[0].length); + // NOTE: Excel has a different interpretation of "%%" and friends + NF += '"' + payload.replace(/"/g, '""') + '"*'; + } else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + tidx = xlmlregex.lastIndex; + } break; + + case 'scientific-number': // 16.29.6 + // TODO: find a mapping for all parameters + y = parsexmltag(Rn[0], false); + NF += "0." + fill("0", +y["min-decimal-places"] || +y["decimal-places"] || 2) + fill("?", +y["decimal-places"] - +y["min-decimal-places"] || 0) + "E" + (parsexmlbool(y["forced-exponent-sign"]) ? "+" : "") + fill("0", +y["min-exponent-digits"] || 2); + break; + + case 'fraction': // 16.29.7 + // TODO: find a mapping for all parameters + y = parsexmltag(Rn[0], false); + if(!+y["min-integer-digits"]) NF += "#"; + else NF += fill("0", +y["min-integer-digits"]); + NF += " "; + NF += fill("?", +y["min-numerator-digits"] || 1); + NF += "/"; + if(+y["denominator-value"]) NF += y["denominator-value"]; + else NF += fill("?", +y["min-denominator-digits"] || 1); + break; + + case 'currency-symbol': // 16.29.9 + // TODO: localization with [$-...] + if(Rn[1]==='/') { + NF += '"' + str.slice(tidx, xlmlregex.lastIndex - Rn[0].length).replace(/"/g, '""') + '"'; + } else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + tidx = xlmlregex.lastIndex; + } else NF += "$"; + break; + + case 'text-properties': // 16.29.29 + y = parsexmltag(Rn[0], false); + switch((y["color"]||"").toLowerCase().replace("#", "")) { + case "ff0000": case "red": NF = "[Red]" + NF; break; + } + break; + + case 'text-content': // 16.29.28 + NF += "@"; + break; + + case 'map': // 16.3 + // TODO: handle more complex maps + y = parsexmltag(Rn[0], false); + if(unescapexml(y["condition"]) == "value()>=0") NF = number_format_map[y["apply-style-name"]] + ";" + NF; + else console.error("ODS number format may be incorrect: " + y["condition"]); + break; + + case 'number': // 16.29.3 + // TODO: handle all the attributes + if(Rn[1]==='/') break; + y = parsexmltag(Rn[0], false); + tNF = ""; + tNF += fill("0", +y["min-integer-digits"] || 1); + if(parsexmlbool(y["grouping"])) tNF = commaify(fill("#", Math.max(0, 4 - tNF.length)) + tNF); + if(+y["min-decimal-places"] || +y["decimal-places"]) tNF += "."; + if(+y["min-decimal-places"]) tNF += fill("0", +y["min-decimal-places"] || 1); + if(+y["decimal-places"] - (+y["min-decimal-places"]||0)) tNF += fill("0", +y["decimal-places"] - (+y["min-decimal-places"]||0)); // TODO: should this be "#" ? + NF += tNF; + break; + + case 'embedded-text': // 16.29.4 + // TODO: verify interplay with grouping et al + if(Rn[1]==='/') { + if(etpos == 0) NF += '"' + str.slice(tidx, xlmlregex.lastIndex - Rn[0].length).replace(/"/g, '""') + '"'; + else NF = NF.slice(0, etpos) + '"' + str.slice(tidx, xlmlregex.lastIndex - Rn[0].length).replace(/"/g, '""') + '"' + NF.slice(etpos); + } else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + tidx = xlmlregex.lastIndex; + etpos = -+parsexmltag(Rn[0], false)["position"] || 0; + } break; + + }} + return number_format_map; +} + +function parse_content_xml(d/*:string*/, _opts, _nfm)/*:Workbook*/ { + var opts = _opts || {}; + if(DENSE != null && opts.dense == null) opts.dense = DENSE; + var str = xlml_normalize(d); + var state/*:Array*/ = [], tmp; + var tag/*:: = {}*/; + var nfidx, NF = "", pidx = 0; + var sheetag/*:: = {name:"", '名称':""}*/; + var rowtag/*:: = {'行号':""}*/; + var Sheets = {}, SheetNames/*:Array*/ = []; + var ws = ({}/*:any*/); if(opts.dense) ws["!data"] = []; + var Rn, q/*:: :any = ({t:"", v:null, z:null, w:"",c:[],}:any)*/; + var ctag = ({value:""}/*:any*/); + var textp = "", textpidx = 0, textptag/*:: = {}*/, oldtextp = "", oldtextpidx = 0; + var textR = [], oldtextR = []; + var R = -1, C = -1, range = {s: {r:1000000,c:10000000}, e: {r:0, c:0}}; + var row_ol = 0; + var number_format_map = _nfm || {}, styles = {}; + var merges/*:Array*/ = [], mrange = {}, mR = 0, mC = 0; + var rowinfo/*:Array*/ = [], rowpeat = 1, colpeat = 1; + var arrayf/*:Array<[Range, string]>*/ = []; + var WB = {Names:[], WBProps:{}}; + var atag = ({}/*:any*/); + var _Ref/*:[string, string]*/ = ["", ""]; + var comments/*:Array*/ = [], comment/*:Comment*/ = ({}/*:any*/); + var creator = "", creatoridx = 0; + var isstub = false, intable = false; + var i = 0; + xlmlregex.lastIndex = 0; + str = str.replace(//mg,"").replace(//gm,""); + while((Rn = xlmlregex.exec(str))) switch((Rn[3]=Rn[3].replace(/_.*$/,""))) { + + case 'table': case '工作表': // 9.1.2 + if(Rn[1]==='/') { + if(range.e.c >= range.s.c && range.e.r >= range.s.r) ws['!ref'] = encode_range(range); + else ws['!ref'] = "A1:A1"; + if(opts.sheetRows > 0 && opts.sheetRows <= range.e.r) { + ws['!fullref'] = ws['!ref']; + range.e.r = opts.sheetRows - 1; + ws['!ref'] = encode_range(range); + } + if(merges.length) ws['!merges'] = merges; + if(rowinfo.length) ws["!rows"] = rowinfo; + sheetag.name = sheetag['名称'] || sheetag.name; + if(typeof JSON !== 'undefined') JSON.stringify(sheetag); + SheetNames.push(sheetag.name); + Sheets[sheetag.name] = ws; + intable = false; + } + else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + sheetag = parsexmltag(Rn[0], false); + R = C = -1; + range.s.r = range.s.c = 10000000; range.e.r = range.e.c = 0; + ws = ({}/*:any*/); if(opts.dense) ws["!data"] = []; merges = []; + rowinfo = []; + intable = true; + } + break; + + case 'table-row-group': // 9.1.9 + if(Rn[1] === "/") --row_ol; else ++row_ol; + break; + case 'table-row': case 'è¡Œ': // 9.1.3 + if(Rn[1] === '/') { R+=rowpeat; rowpeat = 1; break; } + rowtag = parsexmltag(Rn[0], false); + if(rowtag['行号']) R = rowtag['行号'] - 1; else if(R == -1) R = 0; + rowpeat = +rowtag['number-rows-repeated'] || 1; + /* TODO: remove magic */ + if(rowpeat < 10) for(i = 0; i < rowpeat; ++i) if(row_ol > 0) rowinfo[R + i] = {level: row_ol}; + C = -1; break; + case 'covered-table-cell': // 9.1.5 + if(Rn[1] !== '/') ++C; + if(opts.sheetStubs) { + if(opts.dense) { if(!ws["!data"][R]) ws["!data"][R] = []; ws["!data"][R][C] = {t:'z'}; } + else ws[encode_cell({r:R,c:C})] = {t:'z'}; + } + textp = ""; textR = []; + break; /* stub */ + case 'table-cell': case '数据': + if(Rn[0].charAt(Rn[0].length-2) === '/') { + ++C; + ctag = parsexmltag(Rn[0], false); + colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); + q = ({t:'z', v:null/*:: , z:null, w:"",c:[]*/}/*:any*/); + if(ctag.formula && opts.cellFormula != false) q.f = ods_to_csf_formula(unescapexml(ctag.formula)); + if(ctag["style-name"] && styles[ctag["style-name"]]) q.z = styles[ctag["style-name"]]; + if((ctag['数据类型'] || ctag['value-type']) == "string") { + q.t = "s"; q.v = unescapexml(ctag['string-value'] || ""); + if(opts.dense) { + if(!ws["!data"][R]) ws["!data"][R] = []; + ws["!data"][R][C] = q; + } else { + ws[encode_col(C) + encode_row(R)] = q; + } + } + C+= colpeat-1; + } else if(Rn[1]!=='/') { + ++C; + textp = oldtextp = ""; textpidx = oldtextpidx = 0; textR = []; oldtextR = []; + colpeat = 1; + var rptR = rowpeat ? R + rowpeat - 1 : R; + if(C > range.e.c) range.e.c = C; + if(C < range.s.c) range.s.c = C; + if(R < range.s.r) range.s.r = R; + if(rptR > range.e.r) range.e.r = rptR; + ctag = parsexmltag(Rn[0], false); + comments = []; comment = ({}/*:any*/); + q = ({t:ctag['数据类型'] || ctag['value-type'], v:null/*:: , z:null, w:"",c:[]*/}/*:any*/); + if(ctag["style-name"] && styles[ctag["style-name"]]) q.z = styles[ctag["style-name"]]; + if(opts.cellFormula) { + if(ctag.formula) ctag.formula = unescapexml(ctag.formula); + if(ctag['number-matrix-columns-spanned'] && ctag['number-matrix-rows-spanned']) { + mR = parseInt(ctag['number-matrix-rows-spanned'],10) || 0; + mC = parseInt(ctag['number-matrix-columns-spanned'],10) || 0; + mrange = {s: {r:R,c:C}, e:{r:R + mR-1,c:C + mC-1}}; + q.F = encode_range(mrange); + arrayf.push([mrange, q.F]); + } + if(ctag.formula) q.f = ods_to_csf_formula(ctag.formula); + else for(i = 0; i < arrayf.length; ++i) + if(R >= arrayf[i][0].s.r && R <= arrayf[i][0].e.r) + if(C >= arrayf[i][0].s.c && C <= arrayf[i][0].e.c) + q.F = arrayf[i][1]; + } + if(ctag['number-columns-spanned'] || ctag['number-rows-spanned']) { + mR = parseInt(ctag['number-rows-spanned'],10) || 0; + mC = parseInt(ctag['number-columns-spanned'],10) || 0; + mrange = {s: {r:R,c:C}, e:{r:R + mR-1,c:C + mC-1}}; + merges.push(mrange); + } + + /* 19.675.2 table:number-columns-repeated */ + if(ctag['number-columns-repeated']) colpeat = parseInt(ctag['number-columns-repeated'], 10); + + /* 19.385 office:value-type TODO: verify ODS and UOS */ + switch(q.t) { + case 'boolean': q.t = 'b'; q.v = parsexmlbool(ctag['boolean-value']) || (+ctag['boolean-value'] >= 1); break; + case 'float': q.t = 'n'; q.v = parseFloat(ctag.value); + if(opts.cellDates && q.z && fmt_is_date(q.z)) { q.v = numdate(q.v + (WB.WBProps.date1904 ? 1462 : 0)); q.t = typeof q.v == "number" ? 'n' : 'd'; } + break; + case 'percentage': q.t = 'n'; q.v = parseFloat(ctag.value); break; + case 'currency': q.t = 'n'; q.v = parseFloat(ctag.value); break; + case 'date': q.t = 'd'; q.v = parseDate(ctag['date-value'], WB.WBProps.date1904); + if(!opts.cellDates) { q.t = 'n'; q.v = datenum(q.v, WB.WBProps.date1904); } + if(!q.z) q.z = 'm/d/yy'; break; + /* NOTE: for `time`, Excel ODS export incorrectly uses durations relative to 1900 epoch even if 1904 is specified */ + case 'time': q.t = 'n'; q.v = parse_isodur(ctag['time-value'])/86400; + if(opts.cellDates) { q.v = numdate(q.v); q.t = typeof q.v == "number" ? 'n' : 'd'; } + if(!q.z) q.z = 'HH:MM:SS'; break; + case 'number': q.t = 'n'; q.v = parseFloat(ctag['数据数值']); + break; + default: + if(q.t === 'string' || q.t === 'text' || !q.t) { + q.t = 's'; + if(ctag['string-value'] != null) { textp = unescapexml(ctag['string-value']); textR = []; } + } else throw new Error('Unsupported value type ' + q.t); + } + } else { + isstub = false; + if(q.t === 's') { + q.v = textp || ''; + if(textR.length) q.R = textR; + isstub = textpidx == 0; + } + if(atag.Target) q.l = atag; + if(comments.length > 0) { q.c = comments; comments = []; } + if(textp && opts.cellText !== false) q.w = textp; + if(isstub) { q.t = "z"; delete q.v; } + if(!isstub || opts.sheetStubs) { + if(!(opts.sheetRows && opts.sheetRows <= R)) { + for(var rpt = 0; rpt < rowpeat; ++rpt) { + colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); + if(opts.dense) { + if(!ws["!data"][R + rpt]) ws["!data"][R + rpt] = []; + ws["!data"][R + rpt][C] = rpt == 0 ? q : dup(q); + while(--colpeat > 0) ws["!data"][R + rpt][C + colpeat] = dup(q); + } else { + ws[encode_cell({r:R + rpt,c:C})] = q; + while(--colpeat > 0) ws[encode_cell({r:R + rpt,c:C + colpeat})] = dup(q); + } + if(range.e.c <= C) range.e.c = C; + } + } + } + colpeat = parseInt(ctag['number-columns-repeated']||"1", 10); + C += colpeat-1; colpeat = 0; + q = {/*:: t:"", v:null, z:null, w:"",c:[]*/}; + textp = ""; textR = []; + } + atag = ({}/*:any*/); + break; // 9.1.4 + + /* pure state */ + case 'document': // TODO: is the root for FODS + case 'document-content': case 'ç”µå­è¡¨æ ¼æ–‡æ¡£': // 3.1.3.2 + case 'spreadsheet': case '主体': // 3.7 + case 'scripts': // 3.12 + case 'styles': // TODO + case 'font-face-decls': // 3.14 + case 'master-styles': // 3.15.4 -- relevant for FODS + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]); + break; + + case 'annotation': // 14.1 + if(Rn[1]==='/'){ + if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp; + comment.t = textp; + if(textR.length) /*::(*/comment/*:: :any)*/.R = textR; + comment.a = creator; + comments.push(comment); + textp = oldtextp; textpidx = oldtextpidx; textR = oldtextR; + } + else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + state.push([Rn[3], false]); + var annotag = parsexmltag(Rn[0], true); + /* office:display TODO: check if there is a global override */ + if(!(annotag["display"] && parsexmlbool(annotag["display"]))) comments.hidden = true; + oldtextp = textp; oldtextpidx = textpidx; oldtextR = textR; + textp = ""; textpidx = 0; textR = []; + } + creator = ""; creatoridx = 0; + break; + + case 'creator': // 4.3.2.7 + if(Rn[1]==='/') { creator = str.slice(creatoridx,Rn.index); } + else creatoridx = Rn.index + Rn[0].length; + break; + + /* ignore state */ + case 'meta': case '元数据': // TODO: FODS/UOF + case 'settings': // TODO: + case 'config-item-set': // TODO: + case 'config-item-map-indexed': // TODO: + case 'config-item-map-entry': // TODO: + case 'config-item-map-named': // TODO: + case 'shapes': // 9.2.8 + case 'frame': // 10.4.2 + case 'text-box': // 10.4.3 + case 'image': // 10.4.4 + case 'data-pilot-tables': // 9.6.2 + case 'list-style': // 16.30 + case 'form': // 13.13 + case 'dde-links': // 9.8 + case 'event-listeners': // TODO + case 'chart': // TODO + if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw "Bad state: "+tmp;} + else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], false]); + textp = ""; textpidx = 0; textR = []; + break; + + case 'scientific-number': // + case 'currency-symbol': // + case 'fill-character': // 16.29.5 + break; + + case 'text-style': // 16.27.25 + case 'boolean-style': // 16.27.23 + case 'number-style': // 16.27.2 + case 'currency-style': // 16.29.8 + case 'percentage-style': // 16.27.9 + case 'date-style': // 16.27.10 + case 'time-style': // 16.27.18 + if(Rn[1]==='/'){ + var xlmlidx = xlmlregex.lastIndex; + parse_ods_styles(str.slice(nfidx, xlmlregex.lastIndex), _opts, number_format_map); + xlmlregex.lastIndex = xlmlidx; + } else if(Rn[0].charAt(Rn[0].length-2) !== '/') { + nfidx = xlmlregex.lastIndex - Rn[0].length; + } break; + + case 'script': break; // 3.13 + case 'libraries': break; // TODO: + case 'automatic-styles': break; // 3.15.3 + + case 'default-style': // TODO: + case 'page-layout': break; // TODO: + case 'style': { // 16.2 + var styletag = parsexmltag(Rn[0], false); + if(styletag["family"] == "table-cell" && number_format_map[styletag["data-style-name"]]) styles[styletag["name"]] = number_format_map[styletag["data-style-name"]]; + } break; + case 'map': break; // 16.3 + case 'font-face': break; // 16.21 + + case 'paragraph-properties': break; // 17.6 + case 'table-properties': break; // 17.15 + case 'table-column-properties': break; // 17.16 + case 'table-row-properties': break; // 17.17 + case 'table-cell-properties': break; // 17.18 + + case 'number': // 16.27.3 + break; + + case 'fraction': break; // TODO 16.27.6 + + case 'day': // 16.27.11 + case 'month': // 16.27.12 + case 'year': // 16.27.13 + case 'era': // 16.27.14 + case 'day-of-week': // 16.27.15 + case 'week-of-year': // 16.27.16 + case 'quarter': // 16.27.17 + case 'hours': // 16.27.19 + case 'minutes': // 16.27.20 + case 'seconds': // 16.27.21 + case 'am-pm': // 16.27.22 + break; + + case 'boolean': break; // 16.27.24 + case 'text': // 16.27.26 + if(Rn[0].slice(-2) === "/>") break; + else if(Rn[1]==="/") switch(state[state.length-1][0]) { + case 'number-style': + case 'date-style': + case 'time-style': + NF += str.slice(pidx, Rn.index); + break; + } + else pidx = Rn.index + Rn[0].length; + break; + + case 'named-range': // 9.4.12 + tag = parsexmltag(Rn[0], false); + _Ref = ods_to_csf_3D(tag['cell-range-address']); + var nrange = ({Name:tag.name, Ref:_Ref[0] + '!' + _Ref[1]}/*:any*/); + if(intable) nrange.Sheet = SheetNames.length; + WB.Names.push(nrange); + break; + + case 'text-content': break; // 16.27.27 + case 'text-properties': break; // 16.27.27 + case 'embedded-text': break; // 16.27.4 + + case 'body': case 'ç”µå­è¡¨æ ¼': break; // 3.3 16.9.6 19.726.3 + + case 'forms': break; // 12.25.2 13.2 + case 'table-column': break; // 9.1.6 + case 'table-header-rows': break; // 9.1.7 + case 'table-rows': break; // 9.1.12 + /* TODO: outline levels */ + case 'table-column-group': break; // 9.1.10 + case 'table-header-columns': break; // 9.1.11 + case 'table-columns': break; // 9.1.12 + + case 'null-date': // 9.4.2 + tag = parsexmltag(Rn[0], false); + switch(tag["date-value"]) { + case "1904-01-01": WB.WBProps.date1904 = true; break; + } + break; + + case 'graphic-properties': break; // 17.21 + case 'calculation-settings': break; // 9.4.1 + case 'named-expressions': break; // 9.4.11 + case 'label-range': break; // 9.4.9 + case 'label-ranges': break; // 9.4.10 + case 'named-expression': break; // 9.4.13 + case 'sort': break; // 9.4.19 + case 'sort-by': break; // 9.4.20 + case 'sort-groups': break; // 9.4.22 + + case 'tab': break; // 6.1.4 + case 'line-break': break; // 6.1.5 + case 'span': break; // 6.1.7 + case 'p': case '文本串': // 5.1.3 + if(['master-styles'].indexOf(state[state.length-1][0]) > -1) break; + if(Rn[1]==='/' && (!ctag || !ctag['string-value'])) { + var ptp = parse_text_p(str.slice(textpidx,Rn.index), textptag); + textp = (textp.length > 0 ? textp + "\n" : "") + ptp[0]; + } else if(Rn[0].slice(-2) == "/>") { + /* TODO: is self-closing 文本串 valid? */ + textp += "\n"; + } else { textptag = parsexmltag(Rn[0], false); textpidx = Rn.index + Rn[0].length; } + break; // + case 's': break; // + + case 'database-range': // 9.4.15 + if(Rn[1]==='/') break; + try { + _Ref = ods_to_csf_3D(parsexmltag(Rn[0])['target-range-address']); + Sheets[_Ref[0]]['!autofilter'] = { ref:_Ref[1] }; + } catch(e) {/* empty */} + break; + + case 'date': break; // <*:date> + + case 'object': break; // 10.4.6.2 + case 'title': case 'æ ‡é¢˜': break; // <*:title> OR + case 'desc': break; // <*:desc> + case 'binary-data': break; // 10.4.5 TODO: b64 blob + + /* 9.2 Advanced Tables */ + case 'table-source': break; // 9.2.6 + case 'scenario': break; // 9.2.6 + + case 'iteration': break; // 9.4.3 + case 'content-validations': break; // 9.4.4 + case 'filter': break; // 9.5.2 + case 'filter-and': break; // 9.5.3 + case 'filter-or': break; // 9.5.4 + case 'filter-condition': break; // 9.5.5 + + case 'list-level-style-bullet': break; // 16.31 + case 'page-count': break; // TODO + case 'time': break; // TODO + + /* 9.3 Advanced Table Cells */ + case 'cell-range-source': break; // 9.3.1 + case 'property': break; // 13.8 + + case 'a': // 6.1.8 hyperlink + if(Rn[1]!== '/') { + atag = parsexmltag(Rn[0], false); + if(!atag.href) break; + atag.Target = unescapexml(atag.href); delete atag.href; + if(atag.Target.charAt(0) == "#" && atag.Target.indexOf(".") > -1) { + _Ref = ods_to_csf_3D(atag.Target.slice(1)); + atag.Target = "#" + _Ref[0] + "!" + _Ref[1]; + } else if(atag.Target.match(/^\.\.[\\\/]/)) atag.Target = atag.Target.slice(3); + } + break; + + /* non-standard */ + case 'table-protection': break; + case 'data-pilot-grand-total': break; // ', + '', + '', + '', + '', + '', + '', + '' + ].join(""); + + var payload = '' + master_styles + ''; + + return function wso(/*::wb, opts*/) { + return XML_HEADER + payload; + }; +})(); + +// TODO: find out if anyone actually read the spec. LO has some wild errors +function write_number_format_ods(nf/*:string*/, nfidx/*:string*/)/*:string*/ { + var type = "number", payload = "", nopts = { "style:name": nfidx }, c = "", i = 0; + nf = nf.replace(/"[$]"/g, "$"); + /* TODO: replace with an actual parser based on a real grammar */ + j: { + // TODO: support style maps + if(nf.indexOf(";") > -1) { + console.error("Unsupported ODS Style Map exported. Using first branch of " + nf); + nf = nf.slice(0, nf.indexOf(";")); + } + + if(nf == "@") { type = "text"; payload = ""; break j; } + + /* currency flag */ + if(nf.indexOf(/\$/) > -1) { type = "currency"; } + + /* opening string literal */ + if(nf[i] == '"') { + c = ""; + while(nf[++i] != '"' || nf[++i] == '"') c += nf[i]; --i; + if(nf[i+1] == "*") { + i++; + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } else { + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } + nf = nf.slice(i+1); i = 0; + } + + /* fractions */ + var t = nf.match(/# (\?+)\/(\?+)/); + if(t) { payload += writextag("number:fraction", null, {"number:min-integer-digits":0, "number:min-numerator-digits": t[1].length, "number:max-denominator-value": Math.max(+(t[1].replace(/./g, "9")), +(t[2].replace(/./g, "9"))) }); break j; } + if((t=nf.match(/# (\?+)\/(\d+)/))) { payload += writextag("number:fraction", null, {"number:min-integer-digits":0, "number:min-numerator-digits": t[1].length, "number:denominator-value": +t[2]}); break j; } + + /* percentages */ + if((t=nf.match(/(\d+)(|\.\d+)%/))) { type = "percentage"; payload += writextag("number:number", null, {"number:decimal-places": t[2] && t.length - 1 || 0, "number:min-decimal-places": t[2] && t.length - 1 || 0, "number:min-integer-digits": t[1].length }) + "%"; break j; } + + /* datetime */ + var has_time = false; + if(["y","m","d"].indexOf(nf[0]) > -1) { + type = "date"; + k: for(; i < nf.length; ++i) switch((c = nf[i].toLowerCase())) { + case "h": case "s": has_time = true; --i; break k; + case "m": + l: for(var h = i+1; h < nf.length; ++h) switch(nf[h]) { + case "y": case "d": break l; + case "h": case "s": has_time = true; --i; break k; + } + /* falls through */ + case "y": case "d": + while((nf[++i]||"").toLowerCase() == c[0]) c += c[0]; --i; + switch(c) { + case "y": case "yy": payload += ""; break; + case "yyy": case "yyyy": payload += ''; break; + case "mmmmm": console.error("ODS has no equivalent of format |mmmmm|"); + /* falls through */ + case "m": case "mm": case "mmm": case "mmmm": + payload += ''; + break; + case "d": case "dd": payload += ''; break; + case "ddd": case "dddd": payload += ''; break; + } + break; + case '"': + while(nf[++i] != '"' || nf[++i] == '"') c += nf[i]; --i; + payload += '' + escapexml(c.slice(1).replace(/""/g, '"')) + ''; + break; + case '\\': c = nf[++i]; + payload += '' + escapexml(c) + ''; break; + case '/': case ':': payload += '' + escapexml(c) + ''; break; + default: console.error("unrecognized character " + c + " in ODF format " + nf); + } + if(!has_time) break j; + nf = nf.slice(i+1); i = 0; + } + if(nf.match(/^\[?[hms]/)) { + if(type == "number") type = "time"; + if(nf.match(/\[/)) { + nf = nf.replace(/[\[\]]/g, ""); + nopts['number:truncate-on-overflow'] = "false"; + } + for(; i < nf.length; ++i) switch((c = nf[i].toLowerCase())) { + case "h": case "m": case "s": + while((nf[++i]||"").toLowerCase() == c[0]) c += c[0]; --i; + switch(c) { + case "h": case "hh": payload += ''; break; + case "m": case "mm": payload += ''; break; + case "s": case "ss": + if(nf[i+1] == ".") do { c += nf[i+1]; ++i; } while(nf[i+1] == "0"); + payload += ''; break; + } + break; + case '"': + while(nf[++i] != '"' || nf[++i] == '"') c += nf[i]; --i; + payload += '' + escapexml(c.slice(1).replace(/""/g, '"')) + ''; + break; + case '/': case ':': payload += '' + escapexml(c) + ''; break; + case "a": + if(nf.slice(i, i+3).toLowerCase() == "a/p") { payload += ''; i += 2; break; } // Note: ODF does not support A/P + if(nf.slice(i, i+5).toLowerCase() == "am/pm") { payload += ''; i += 4; break; } + /* falls through */ + default: console.error("unrecognized character " + c + " in ODF format " + nf); + } + break j; + } + + /* currency flag */ + if(nf.indexOf(/\$/) > -1) { type = "currency"; } + + /* should be in a char loop */ + if(nf[0] == "$") { payload += '$'; nf = nf.slice(1); i = 0; } + i = 0; if(nf[i] == '"') { + while(nf[++i] != '"' || nf[++i] == '"') c += nf[i]; --i; + if(nf[i+1] == "*") { + i++; + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } else { + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } + nf = nf.slice(i+1); i = 0; + } + + /* number TODO: interstitial text e.g. 000)000-0000 */ + var np = nf.match(/([#0][0#,]*)(\.[0#]*|)(E[+]?0*|)/i); + if(!np || !np[0]) console.error("Could not find numeric part of " + nf); + else { + var base = np[1].replace(/,/g, ""); + payload += ' -1 ? ' number:grouping="true"' : "") + + (np[2] && ' number:decimal-places="' + (np[2].length - 1) + '"' || ' number:decimal-places="0"') + + (np[3] && np[3].indexOf("+") > -1 ? ' number:forced-exponent-sign="true"' : "" ) + + (np[3] ? ' number:min-exponent-digits="' + np[3].match(/0+/)[0].length + '"' : "" ) + + '>' + + /* TODO: interstitial text placeholders */ + ''; + i = np.index + np[0].length; + } + + /* residual text */ + if(nf[i] == '"') { + c = ""; + while(nf[++i] != '"' || nf[++i] == '"') c += nf[i]; --i; + payload += '' + escapexml(c.replace(/""/g, '"')) + ''; + } + } + + if(!payload) { console.error("Could not generate ODS number format for |" + nf + "|"); return ""; } + return writextag("number:" + type + "-style", payload, nopts); +} + +function write_names_ods(Names, SheetNames, idx) { + //var scoped = Names.filter(function(name) { return name.Sheet == (idx == -1 ? null : idx); }); + var scoped = []; for(var namei = 0; namei < Names.length; ++namei) { + var name = Names[namei]; + if(!name) continue; + if(name.Sheet == (idx == -1 ? null : idx)) scoped.push(name); + } + if(!scoped.length) return ""; + return " \n" + scoped.map(function(name) { + var odsref = (idx == -1 ? "$" : "") + csf_to_ods_3D(name.Ref); + return " " + writextag("table:named-range", null, { + "table:name": name.Name, + "table:cell-range-address": odsref, + "table:base-cell-address": odsref.replace(/[\.]?[^\.]*$/, ".$A$1") + }); + }).join("\n") + "\n \n"; +} +var write_content_ods/*:{(wb:any, opts:any):string}*/ = /* @__PURE__ */(function() { + /* 6.1.2 White Space Characters */ + var write_text_p = function(text/*:string*/)/*:string*/ { + return escapexml(text) + .replace(/ +/g, function($$){return '';}) + .replace(/\t/g, "") + .replace(/\n/g, "") + .replace(/^ /, "").replace(/ $/, ""); + }; + + var null_cell_xml = ' \n'; + var write_ws = function(ws, wb/*:Workbook*/, i/*:number*/, opts, nfs, date1904)/*:string*/ { + /* Section 9 Tables */ + var o/*:Array*/ = []; + o.push(' \n'); + var R=0,C=0, range = decode_range(ws['!ref']||"A1"); + var marr/*:Array*/ = ws['!merges'] || [], mi = 0; + var dense = ws["!data"] != null; + if(ws["!cols"]) { + for(C = 0; C <= range.e.c; ++C) o.push(' \n'); + } + var H = "", ROWS = ws["!rows"]||[]; + for(R = 0; R < range.s.r; ++R) { + H = ROWS[R] ? ' table:style-name="ro' + ROWS[R].ods + '"' : ""; + o.push(' \n'); + } + for(; R <= range.e.r; ++R) { + H = ROWS[R] ? ' table:style-name="ro' + ROWS[R].ods + '"' : ""; + o.push(' \n'); + for(C=0; C < range.s.c; ++C) o.push(null_cell_xml); + for(; C <= range.e.c; ++C) { + var skip = false, ct = {}, textp = ""; + for(mi = 0; mi != marr.length; ++mi) { + if(marr[mi].s.c > C) continue; + if(marr[mi].s.r > R) continue; + if(marr[mi].e.c < C) continue; + if(marr[mi].e.r < R) continue; + if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true; + ct['table:number-columns-spanned'] = (marr[mi].e.c - marr[mi].s.c + 1); + ct['table:number-rows-spanned'] = (marr[mi].e.r - marr[mi].s.r + 1); + break; + } + if(skip) { o.push(' \n'); continue; } + var ref = encode_cell({r:R, c:C}), cell = dense ? (ws["!data"][R]||[])[C]: ws[ref]; + if(cell && cell.f) { + ct['table:formula'] = escapexml(csf_to_ods_formula(cell.f)); + if(cell.F) { + if(cell.F.slice(0, ref.length) == ref) { + var _Fref = decode_range(cell.F); + ct['table:number-matrix-columns-spanned'] = (_Fref.e.c - _Fref.s.c + 1); + ct['table:number-matrix-rows-spanned'] = (_Fref.e.r - _Fref.s.r + 1); + } + } + } + if(!cell) { o.push(null_cell_xml); continue; } + switch(cell.t) { + case 'b': + textp = (cell.v ? 'TRUE' : 'FALSE'); + ct['office:value-type'] = "boolean"; + ct['office:boolean-value'] = (cell.v ? 'true' : 'false'); + break; + case 'n': + textp = (cell.w||String(cell.v||0)); + ct['office:value-type'] = "float"; + ct['office:value'] = (cell.v||0); + break; + case 's': case 'str': + textp = cell.v == null ? "" : cell.v; + ct['office:value-type'] = "string"; + break; + case 'd': + textp = (cell.w||(parseDate(cell.v, date1904).toISOString())); + ct['office:value-type'] = "date"; + ct['office:date-value'] = (parseDate(cell.v, date1904).toISOString()); + ct['table:style-name'] = "ce1"; + break; + //case 'e': // TODO: translate to ODS errors + default: o.push(null_cell_xml); continue; // TODO: empty cell with comments + } + var text_p = write_text_p(textp); + if(cell.l && cell.l.Target) { + var _tgt = cell.l.Target; + _tgt = _tgt.charAt(0) == "#" ? "#" + csf_to_ods_3D(_tgt.slice(1)) : _tgt; + // TODO: choose correct parent path format based on link delimiters + if(_tgt.charAt(0) != "#" && !_tgt.match(/^\w+:/)) _tgt = '../' + _tgt; + text_p = writextag('text:a', text_p, {'xlink:href': _tgt.replace(/&/g, "&")}); + } + if(nfs[cell.z]) ct["table:style-name"] = "ce" + nfs[cell.z].slice(1); + var payload = writextag('text:p', text_p, {}); + if(cell.c) { + var acreator = "", apayload = "", aprops = {}; + for(var ci = 0; ci < cell.c.length; ++ci) { + if(!acreator && cell.c[ci].a) acreator = cell.c[ci].a; + apayload += "" + write_text_p(cell.c[ci].t) + ""; + } + if(!cell.c.hidden) aprops["office:display"] = true; + payload = writextag('office:annotation', apayload, aprops) + payload; + } + o.push(' ' + writextag('table:table-cell', payload, ct) + '\n'); + } + o.push(' \n'); + } + if((wb.Workbook||{}).Names) o.push(write_names_ods(wb.Workbook.Names, wb.SheetNames, i)); + o.push(' \n'); + return o.join(""); + }; + + var write_automatic_styles_ods = function(o/*:Array*/, wb) { + o.push(' \n'); + + /* column styles */ + var cidx = 0; + wb.SheetNames.map(function(n) { return wb.Sheets[n]; }).forEach(function(ws) { + if(!ws) return; + if(ws["!cols"]) { + for(var C = 0; C < ws["!cols"].length; ++C) if(ws["!cols"][C]) { + var colobj = ws["!cols"][C]; + if(colobj.width == null && colobj.wpx == null && colobj.wch == null) continue; + process_col(colobj); + colobj.ods = cidx; + var w = ws["!cols"][C].wpx + "px"; + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + ++cidx; + } + } + }); + + /* row styles */ + var ridx = 0; + wb.SheetNames.map(function(n) { return wb.Sheets[n]; }).forEach(function(ws) { + if(!ws) return; + if(ws["!rows"]) { + for(var R = 0; R < ws["!rows"].length; ++R) if(ws["!rows"][R]) { + ws["!rows"][R].ods = ridx; + var h = ws["!rows"][R].hpx + "px"; + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + ++ridx; + } + } + }); + + /* table */ + o.push(' \n'); + o.push(' \n'); + o.push(' \n'); + + o.push(' \n'); + o.push(' \n'); + o.push(' /\n'); + o.push(' \n'); + o.push(' /\n'); + o.push(' \n'); + o.push(' \n'); + + /* number formats, table cells, text */ + var nfs = {}; + var nfi = 69; + wb.SheetNames.map(function(n) { return wb.Sheets[n]; }).forEach(function(ws) { + if(!ws) return; + var dense = (ws["!data"] != null); + var range = decode_range(ws["!ref"]); + for(var R = 0; R <= range.e.r; ++R) for(var C = 0; C <= range.e.c; ++C) { + var c = dense ? (ws["!data"][R]||[])[C] : ws[encode_cell({r:R,c:C})]; + if(!c || !c.z || c.z.toLowerCase() == "general") continue; + if(!nfs[c.z]) { + var out = write_number_format_ods(c.z, "N" + nfi); + if(out) { nfs[c.z] = "N" + nfi; ++nfi; o.push(out + "\n"); } + } + } + }); + o.push(' \n'); + keys(nfs).forEach(function(nf) { + o.push('\n'); + }); + + /* page-layout */ + + o.push(' \n'); + return nfs; + }; + + return function wcx(wb, opts) { + var o = [XML_HEADER]; + /* 3.1.3.2 */ + var attr = wxt_helper({ + 'xmlns:office': "urn:oasis:names:tc:opendocument:xmlns:office:1.0", + 'xmlns:table': "urn:oasis:names:tc:opendocument:xmlns:table:1.0", + 'xmlns:style': "urn:oasis:names:tc:opendocument:xmlns:style:1.0", + 'xmlns:text': "urn:oasis:names:tc:opendocument:xmlns:text:1.0", + 'xmlns:draw': "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", + 'xmlns:fo': "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", + 'xmlns:xlink': "http://www.w3.org/1999/xlink", + 'xmlns:dc': "http://purl.org/dc/elements/1.1/", + 'xmlns:meta': "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", + 'xmlns:number': "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", + 'xmlns:presentation': "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", + 'xmlns:svg': "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", + 'xmlns:chart': "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", + 'xmlns:dr3d': "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", + 'xmlns:math': "http://www.w3.org/1998/Math/MathML", + 'xmlns:form': "urn:oasis:names:tc:opendocument:xmlns:form:1.0", + 'xmlns:script': "urn:oasis:names:tc:opendocument:xmlns:script:1.0", + 'xmlns:ooo': "http://openoffice.org/2004/office", + 'xmlns:ooow': "http://openoffice.org/2004/writer", + 'xmlns:oooc': "http://openoffice.org/2004/calc", + 'xmlns:dom': "http://www.w3.org/2001/xml-events", + 'xmlns:xforms': "http://www.w3.org/2002/xforms", + 'xmlns:xsd': "http://www.w3.org/2001/XMLSchema", + 'xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance", + 'xmlns:sheet': "urn:oasis:names:tc:opendocument:sh33tjs:1.0", + 'xmlns:rpt': "http://openoffice.org/2005/report", + 'xmlns:of': "urn:oasis:names:tc:opendocument:xmlns:of:1.2", + 'xmlns:xhtml': "http://www.w3.org/1999/xhtml", + 'xmlns:grddl': "http://www.w3.org/2003/g/data-view#", + 'xmlns:tableooo': "http://openoffice.org/2009/table", + 'xmlns:drawooo': "http://openoffice.org/2010/draw", + 'xmlns:calcext': "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0", + 'xmlns:loext': "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", + 'xmlns:field': "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", + 'xmlns:formx': "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0", + 'xmlns:css3t': "http://www.w3.org/TR/css3-text/", + 'office:version': "1.2" + }); + + var fods = wxt_helper({ + 'xmlns:config': "urn:oasis:names:tc:opendocument:xmlns:config:1.0", + 'office:mimetype': "application/vnd.oasis.opendocument.spreadsheet" + }); + + if(opts.bookType == "fods") { + o.push('\n'); + o.push(write_meta_ods().replace(//, "").replace(/<\/office:document-meta>/, "") + "\n"); + // TODO: settings (equiv of settings.xml for ODS) + } else o.push('\n'); + // o.push(' \n'); + var nfs = write_automatic_styles_ods(o, wb); + o.push(' \n'); + o.push(' \n'); + if(((wb.Workbook||{}).WBProps||{}).date1904) o.push(' \n \n \n'); + for(var i = 0; i != wb.SheetNames.length; ++i) o.push(write_ws(wb.Sheets[wb.SheetNames[i]], wb, i, opts, nfs, ((wb.Workbook||{}).WBProps||{}).date1904)); + if((wb.Workbook||{}).Names) o.push(write_names_ods(wb.Workbook.Names, wb.SheetNames, -1)); + o.push(' \n'); + o.push(' \n'); + if(opts.bookType == "fods") o.push(''); + else o.push(''); + return o.join(""); + }; +})(); + +function write_ods(wb/*:any*/, opts/*:any*/) { + if(opts.bookType == "fods") return write_content_ods(wb, opts); + + var zip = zip_new(); + var f = ""; + + var manifest/*:Array >*/ = []; + var rdf/*:Array<[string, string]>*/ = []; + + /* Part 3 Section 3.3 MIME Media Type */ + f = "mimetype"; + zip_add_file(zip, f, "application/vnd.oasis.opendocument.spreadsheet"); + + /* Part 1 Section 2.2 Documents */ + f = "content.xml"; + zip_add_file(zip, f, write_content_ods(wb, opts)); + manifest.push([f, "text/xml"]); + rdf.push([f, "ContentFile"]); + + /* TODO: these are hard-coded styles to satiate excel */ + f = "styles.xml"; + zip_add_file(zip, f, write_styles_ods(wb, opts)); + manifest.push([f, "text/xml"]); + rdf.push([f, "StylesFile"]); + + /* TODO: this is hard-coded to satiate excel */ + f = "meta.xml"; + zip_add_file(zip, f, XML_HEADER + write_meta_ods(/*::wb, opts*/)); + manifest.push([f, "text/xml"]); + rdf.push([f, "MetadataFile"]); + + /* Part 3 Section 6 Metadata Manifest File */ + f = "manifest.rdf"; + zip_add_file(zip, f, write_rdf(rdf/*, opts*/)); + manifest.push([f, "application/rdf+xml"]); + + /* Part 3 Section 4 Manifest File */ + f = "META-INF/manifest.xml"; + zip_add_file(zip, f, write_manifest(manifest/*, opts*/)); + + return zip; +} + +/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */ +var subarray = function() { + try { + if (typeof Uint8Array == "undefined") + return "slice"; + if (typeof Uint8Array.prototype.subarray == "undefined") + return "slice"; + if (typeof Buffer !== "undefined") { + if (typeof Buffer.prototype.subarray == "undefined") + return "slice"; + if ((typeof Buffer.from == "function" ? Buffer.from([72, 62]) : new Buffer([72, 62])) instanceof Uint8Array) + return "subarray"; + return "slice"; + } + return "subarray"; + } catch (e) { + return "slice"; + } +}(); +function u8_to_dataview(array) { + return new DataView(array.buffer, array.byteOffset, array.byteLength); +} +function u8str(u8) { + return typeof TextDecoder != "undefined" ? new TextDecoder().decode(u8) : utf8read(a2s(u8)); +} +function stru8(str) { + return typeof TextEncoder != "undefined" ? new TextEncoder().encode(str) : s2a(utf8write(str)); +} +function u8concat(u8a) { + var len = 0; + for (var i = 0; i < u8a.length; ++i) + len += u8a[i].length; + var out = new Uint8Array(len); + var off = 0; + for (i = 0; i < u8a.length; ++i) { + var u8 = u8a[i], L = u8.length; + if (L < 250) { + for (var j = 0; j < L; ++j) + out[off++] = u8[j]; + } else { + out.set(u8, off); + off += L; + } + } + return out; +} +function popcnt(x) { + x -= x >> 1 & 1431655765; + x = (x & 858993459) + (x >> 2 & 858993459); + return (x + (x >> 4) & 252645135) * 16843009 >>> 24; +} +function readDecimal128LE(buf, offset) { + var exp = (buf[offset + 15] & 127) << 7 | buf[offset + 14] >> 1; + var mantissa = buf[offset + 14] & 1; + for (var j = offset + 13; j >= offset; --j) + mantissa = mantissa * 256 + buf[j]; + return (buf[offset + 15] & 128 ? -mantissa : mantissa) * Math.pow(10, exp - 6176); +} +function writeDecimal128LE(buf, offset, value) { + var exp = Math.floor(value == 0 ? 0 : Math.LOG10E * Math.log(Math.abs(value))) + 6176 - 16; + var mantissa = value / Math.pow(10, exp - 6176); + buf[offset + 15] |= exp >> 7; + buf[offset + 14] |= (exp & 127) << 1; + for (var i = 0; mantissa >= 1; ++i, mantissa /= 256) + buf[offset + i] = mantissa & 255; + buf[offset + 15] |= value >= 0 ? 0 : 128; +} +function parse_varint49(buf, ptr) { + var l = ptr.l; + var usz = buf[l] & 127; + varint: + if (buf[l++] >= 128) { + usz |= (buf[l] & 127) << 7; + if (buf[l++] < 128) + break varint; + usz |= (buf[l] & 127) << 14; + if (buf[l++] < 128) + break varint; + usz |= (buf[l] & 127) << 21; + if (buf[l++] < 128) + break varint; + usz += (buf[l] & 127) * Math.pow(2, 28); + ++l; + if (buf[l++] < 128) + break varint; + usz += (buf[l] & 127) * Math.pow(2, 35); + ++l; + if (buf[l++] < 128) + break varint; + usz += (buf[l] & 127) * Math.pow(2, 42); + ++l; + if (buf[l++] < 128) + break varint; + } + ptr.l = l; + return usz; +} +function write_varint49(v) { + var usz = new Uint8Array(7); + usz[0] = v & 127; + var L = 1; + sz: + if (v > 127) { + usz[L - 1] |= 128; + usz[L] = v >> 7 & 127; + ++L; + if (v <= 16383) + break sz; + usz[L - 1] |= 128; + usz[L] = v >> 14 & 127; + ++L; + if (v <= 2097151) + break sz; + usz[L - 1] |= 128; + usz[L] = v >> 21 & 127; + ++L; + if (v <= 268435455) + break sz; + usz[L - 1] |= 128; + usz[L] = v / 256 >>> 21 & 127; + ++L; + if (v <= 34359738367) + break sz; + usz[L - 1] |= 128; + usz[L] = v / 65536 >>> 21 & 127; + ++L; + if (v <= 4398046511103) + break sz; + usz[L - 1] |= 128; + usz[L] = v / 16777216 >>> 21 & 127; + ++L; + } + return usz[subarray](0, L); +} +function parse_packed_varints(buf) { + var ptr = { l: 0 }; + var out = []; + while (ptr.l < buf.length) + out.push(parse_varint49(buf, ptr)); + return out; +} +function write_packed_varints(nums) { + return u8concat(nums.map(function(x) { + return write_varint49(x); + })); +} +function varint_to_i32(buf) { + var l = 0, i32 = buf[l] & 127; + if (buf[l++] < 128) + return i32; + i32 |= (buf[l] & 127) << 7; + if (buf[l++] < 128) + return i32; + i32 |= (buf[l] & 127) << 14; + if (buf[l++] < 128) + return i32; + i32 |= (buf[l] & 127) << 21; + if (buf[l++] < 128) + return i32; + i32 |= (buf[l] & 15) << 28; + return i32; +} +function varint_to_u64(buf) { + var l = 0, lo = buf[l] & 127, hi = 0; + varint: + if (buf[l++] >= 128) { + lo |= (buf[l] & 127) << 7; + if (buf[l++] < 128) + break varint; + lo |= (buf[l] & 127) << 14; + if (buf[l++] < 128) + break varint; + lo |= (buf[l] & 127) << 21; + if (buf[l++] < 128) + break varint; + lo |= (buf[l] & 127) << 28; + hi = buf[l] >> 4 & 7; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 3; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 10; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 17; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 24; + if (buf[l++] < 128) + break varint; + hi |= (buf[l] & 127) << 31; + } + return [lo >>> 0, hi >>> 0]; +} +function parse_shallow(buf) { + var out = [], ptr = { l: 0 }; + while (ptr.l < buf.length) { + var off = ptr.l; + var num = parse_varint49(buf, ptr); + var type = num & 7; + num = num / 8 | 0; + var data; + var l = ptr.l; + switch (type) { + case 0: + { + while (buf[l++] >= 128) + ; + data = buf[subarray](ptr.l, l); + ptr.l = l; + } + break; + case 1: + { + data = buf[subarray](l, l + 8); + ptr.l = l + 8; + } + break; + case 2: + { + var len = parse_varint49(buf, ptr); + data = buf[subarray](ptr.l, ptr.l + len); + ptr.l += len; + } + break; + case 5: + { + data = buf[subarray](l, l + 4); + ptr.l = l + 4; + } + break; + default: + throw new Error("PB Type ".concat(type, " for Field ").concat(num, " at offset ").concat(off)); + } + var v = { data: data, type: type }; + if (out[num] == null) + out[num] = []; + out[num].push(v); + } + return out; +} +function write_shallow(proto) { + var out = []; + proto.forEach(function(field, idx) { + if (idx == 0) + return; + field.forEach(function(item) { + if (!item.data) + return; + out.push(write_varint49(idx * 8 + item.type)); + if (item.type == 2) + out.push(write_varint49(item.data.length)); + out.push(item.data); + }); + }); + return u8concat(out); +} +function mappa(data, cb) { + return (data == null ? void 0 : data.map(function(d) { + return cb(d.data); + })) || []; +} +function parse_iwa_file(buf) { + var _a; + var out = [], ptr = { l: 0 }; + while (ptr.l < buf.length) { + var len = parse_varint49(buf, ptr); + var ai = parse_shallow(buf[subarray](ptr.l, ptr.l + len)); + ptr.l += len; + var res = { + id: varint_to_i32(ai[1][0].data), + messages: [] + }; + ai[2].forEach(function(b) { + var mi = parse_shallow(b.data); + var fl = varint_to_i32(mi[3][0].data); + res.messages.push({ + meta: mi, + data: buf[subarray](ptr.l, ptr.l + fl) + }); + ptr.l += fl; + }); + if ((_a = ai[3]) == null ? void 0 : _a[0]) + res.merge = varint_to_i32(ai[3][0].data) >>> 0 > 0; + out.push(res); + } + return out; +} +function write_iwa_file(ias) { + var bufs = []; + ias.forEach(function(ia) { + var ai = [ + [], + [{ data: write_varint49(ia.id), type: 0 }], + [] + ]; + if (ia.merge != null) + ai[3] = [{ data: write_varint49(+!!ia.merge), type: 0 }]; + var midata = []; + ia.messages.forEach(function(mi) { + midata.push(mi.data); + mi.meta[3] = [{ type: 0, data: write_varint49(mi.data.length) }]; + ai[2].push({ data: write_shallow(mi.meta), type: 2 }); + }); + var aipayload = write_shallow(ai); + bufs.push(write_varint49(aipayload.length)); + bufs.push(aipayload); + midata.forEach(function(mid) { + return bufs.push(mid); + }); + }); + return u8concat(bufs); +} +function parse_snappy_chunk(type, buf) { + if (type != 0) + throw new Error("Unexpected Snappy chunk type ".concat(type)); + var ptr = { l: 0 }; + var usz = parse_varint49(buf, ptr); + var chunks = []; + var l = ptr.l; + while (l < buf.length) { + var tag = buf[l] & 3; + if (tag == 0) { + var len = buf[l++] >> 2; + if (len < 60) + ++len; + else { + var c = len - 59; + len = buf[l]; + if (c > 1) + len |= buf[l + 1] << 8; + if (c > 2) + len |= buf[l + 2] << 16; + if (c > 3) + len |= buf[l + 3] << 24; + len >>>= 0; + len++; + l += c; + } + chunks.push(buf[subarray](l, l + len)); + l += len; + continue; + } else { + var offset = 0, length = 0; + if (tag == 1) { + length = (buf[l] >> 2 & 7) + 4; + offset = (buf[l++] & 224) << 3; + offset |= buf[l++]; + } else { + length = (buf[l++] >> 2) + 1; + if (tag == 2) { + offset = buf[l] | buf[l + 1] << 8; + l += 2; + } else { + offset = (buf[l] | buf[l + 1] << 8 | buf[l + 2] << 16 | buf[l + 3] << 24) >>> 0; + l += 4; + } + } + if (offset == 0) + throw new Error("Invalid offset 0"); + var j = chunks.length - 1, off = offset; + while (j >= 0 && off >= chunks[j].length) { + off -= chunks[j].length; + --j; + } + if (j < 0) { + if (off == 0) + off = chunks[j = 0].length; + else + throw new Error("Invalid offset beyond length"); + } + if (length < off) + chunks.push(chunks[j][subarray](chunks[j].length - off, chunks[j].length - off + length)); + else { + if (off > 0) { + chunks.push(chunks[j][subarray](chunks[j].length - off)); + length -= off; + } + ++j; + while (length >= chunks[j].length) { + chunks.push(chunks[j]); + length -= chunks[j].length; + ++j; + } + if (length) + chunks.push(chunks[j][subarray](0, length)); + } + if (chunks.length > 25) + chunks = [u8concat(chunks)]; + } + } + var clen = 0; + for (var u8i = 0; u8i < chunks.length; ++u8i) + clen += chunks[u8i].length; + if (clen != usz) + throw new Error("Unexpected length: ".concat(clen, " != ").concat(usz)); + return chunks; +} +function decompress_iwa_file(buf) { + if (Array.isArray(buf)) + buf = new Uint8Array(buf); + var out = []; + var l = 0; + while (l < buf.length) { + var t = buf[l++]; + var len = buf[l] | buf[l + 1] << 8 | buf[l + 2] << 16; + l += 3; + out.push.apply(out, parse_snappy_chunk(t, buf[subarray](l, l + len))); + l += len; + } + if (l !== buf.length) + throw new Error("data is not a valid framed stream!"); + return out.length == 1 ? out[0] : u8concat(out); +} +function compress_iwa_file(buf) { + var out = []; + var l = 0; + while (l < buf.length) { + var c = Math.min(buf.length - l, 268435455); + var frame = new Uint8Array(4); + out.push(frame); + var usz = write_varint49(c); + var L = usz.length; + out.push(usz); + if (c <= 60) { + L++; + out.push(new Uint8Array([c - 1 << 2])); + } else if (c <= 256) { + L += 2; + out.push(new Uint8Array([240, c - 1 & 255])); + } else if (c <= 65536) { + L += 3; + out.push(new Uint8Array([244, c - 1 & 255, c - 1 >> 8 & 255])); + } else if (c <= 16777216) { + L += 4; + out.push(new Uint8Array([248, c - 1 & 255, c - 1 >> 8 & 255, c - 1 >> 16 & 255])); + } else if (c <= 4294967296) { + L += 5; + out.push(new Uint8Array([252, c - 1 & 255, c - 1 >> 8 & 255, c - 1 >> 16 & 255, c - 1 >>> 24 & 255])); + } + out.push(buf[subarray](l, l + c)); + L += c; + frame[0] = 0; + frame[1] = L & 255; + frame[2] = L >> 8 & 255; + frame[3] = L >> 16 & 255; + l += c; + } + return u8concat(out); +} +var numbers_lut_new = function() { + return { sst: [], rsst: [], ofmt: [], nfmt: [], fmla: [], ferr: [], cmnt: [] }; +}; +function numbers_format_cell(cell, t, flags, ofmt, nfmt) { + var _a, _b, _c, _d; + var ctype = t & 255, ver = t >> 8; + var fmt = ver >= 5 ? nfmt : ofmt; + dur: + if (flags & (ver > 4 ? 8 : 4) && cell.t == "n" && ctype == 7) { + var dstyle = ((_a = fmt[7]) == null ? void 0 : _a[0]) ? varint_to_i32(fmt[7][0].data) : -1; + if (dstyle == -1) + break dur; + var dmin = ((_b = fmt[15]) == null ? void 0 : _b[0]) ? varint_to_i32(fmt[15][0].data) : -1; + var dmax = ((_c = fmt[16]) == null ? void 0 : _c[0]) ? varint_to_i32(fmt[16][0].data) : -1; + var auto = ((_d = fmt[40]) == null ? void 0 : _d[0]) ? varint_to_i32(fmt[40][0].data) : -1; + var d = cell.v, dd = d; + autodur: + if (auto) { + if (d == 0) { + dmin = dmax = 2; + break autodur; + } + if (d >= 604800) + dmin = 1; + else if (d >= 86400) + dmin = 2; + else if (d >= 3600) + dmin = 4; + else if (d >= 60) + dmin = 8; + else if (d >= 1) + dmin = 16; + else + dmin = 32; + if (Math.floor(d) != d) + dmax = 32; + else if (d % 60) + dmax = 16; + else if (d % 3600) + dmax = 8; + else if (d % 86400) + dmax = 4; + else if (d % 604800) + dmax = 2; + if (dmax < dmin) + dmax = dmin; + } + if (dmin == -1 || dmax == -1) + break dur; + var dstr = [], zstr = []; + if (dmin == 1) { + dd = d / 604800; + if (dmax == 1) { + zstr.push('d"d"'); + } else { + dd |= 0; + d -= 604800 * dd; + } + dstr.push(dd + (dstyle == 2 ? " week" + (dd == 1 ? "" : "s") : dstyle == 1 ? "w" : "")); + } + if (dmin <= 2 && dmax >= 2) { + dd = d / 86400; + if (dmax > 2) { + dd |= 0; + d -= 86400 * dd; + } + zstr.push('d"d"'); + dstr.push(dd + (dstyle == 2 ? " day" + (dd == 1 ? "" : "s") : dstyle == 1 ? "d" : "")); + } + if (dmin <= 4 && dmax >= 4) { + dd = d / 3600; + if (dmax > 4) { + dd |= 0; + d -= 3600 * dd; + } + zstr.push((dmin >= 4 ? "[h]" : "h") + '"h"'); + dstr.push(dd + (dstyle == 2 ? " hour" + (dd == 1 ? "" : "s") : dstyle == 1 ? "h" : "")); + } + if (dmin <= 8 && dmax >= 8) { + dd = d / 60; + if (dmax > 8) { + dd |= 0; + d -= 60 * dd; + } + zstr.push((dmin >= 8 ? "[m]" : "m") + '"m"'); + if (dstyle == 0) + dstr.push((dmin == 8 && dmax == 8 || dd >= 10 ? "" : "0") + dd); + else + dstr.push(dd + (dstyle == 2 ? " minute" + (dd == 1 ? "" : "s") : dstyle == 1 ? "m" : "")); + } + if (dmin <= 16 && dmax >= 16) { + dd = d; + if (dmax > 16) { + dd |= 0; + d -= dd; + } + zstr.push((dmin >= 16 ? "[s]" : "s") + '"s"'); + if (dstyle == 0) + dstr.push((dmax == 16 && dmin == 16 || dd >= 10 ? "" : "0") + dd); + else + dstr.push(dd + (dstyle == 2 ? " second" + (dd == 1 ? "" : "s") : dstyle == 1 ? "s" : "")); + } + if (dmax >= 32) { + dd = Math.round(1e3 * d); + if (dmin < 32) + zstr.push('.000"ms"'); + if (dstyle == 0) + dstr.push((dd >= 100 ? "" : dd >= 10 ? "0" : "00") + dd); + else + dstr.push(dd + (dstyle == 2 ? " millisecond" + (dd == 1 ? "" : "s") : dstyle == 1 ? "ms" : "")); + } + cell.w = dstr.join(dstyle == 0 ? ":" : " "); + cell.z = zstr.join(dstyle == 0 ? '":"' : " "); + if (dstyle == 0) + cell.w = cell.w.replace(/:(\d\d\d)$/, ".$1"); + } +} +function parse_old_storage(buf, lut, v, opts) { + var dv = u8_to_dataview(buf); + var flags = dv.getUint32(4, true); + var ridx = -1, sidx = -1, zidx = -1, ieee = NaN, dc = 0, dt = new Date(Date.UTC(2001, 0, 1)); + var doff = v > 1 ? 12 : 8; + if (flags & 2) { + zidx = dv.getUint32(doff, true); + doff += 4; + } + doff += popcnt(flags & (v > 1 ? 3468 : 396)) * 4; + if (flags & 512) { + ridx = dv.getUint32(doff, true); + doff += 4; + } + doff += popcnt(flags & (v > 1 ? 12288 : 4096)) * 4; + if (flags & 16) { + sidx = dv.getUint32(doff, true); + doff += 4; + } + if (flags & 32) { + ieee = dv.getFloat64(doff, true); + doff += 8; + } + if (flags & 64) { + dt.setTime(dt.getTime() + (dc = dv.getFloat64(doff, true)) * 1e3); + doff += 8; + } + if (v > 1) { + flags = dv.getUint32(8, true) >>> 16; + if (flags & 255) { + if (zidx == -1) + zidx = dv.getUint32(doff, true); + doff += 4; + } + } + var ret; + var t = buf[v >= 4 ? 1 : 2]; + switch (t) { + case 0: + return void 0; + case 2: + ret = { t: "n", v: ieee }; + break; + case 3: + ret = { t: "s", v: lut.sst[sidx] }; + break; + case 5: + { + if (opts == null ? void 0 : opts.cellDates) + ret = { t: "d", v: dt }; + else + ret = { t: "n", v: dc / 86400 + 35430, z: table_fmt[14] }; + } + break; + case 6: + ret = { t: "b", v: ieee > 0 }; + break; + case 7: + ret = { t: "n", v: ieee }; + break; + case 8: + ret = { t: "e", v: 0 }; + break; + case 9: + { + if (ridx > -1) { + var rts = lut.rsst[ridx]; + ret = { t: "s", v: rts.v }; + if (rts.l) + ret.l = { Target: rts.l }; + } else + throw new Error("Unsupported cell type ".concat(buf[subarray](0, 4))); + } + break; + default: + throw new Error("Unsupported cell type ".concat(buf[subarray](0, 4))); + } + if (zidx > -1) + numbers_format_cell(ret, t | v << 8, flags, lut.ofmt[zidx], lut.nfmt[zidx]); + if (t == 7) + ret.v /= 86400; + return ret; +} +function parse_new_storage(buf, lut, opts) { + var dv = u8_to_dataview(buf); + var flags = dv.getUint32(4, true); + var fields = dv.getUint32(8, true); + var doff = 12; + var ridx = -1, sidx = -1, zidx = -1, d128 = NaN, ieee = NaN, dc = 0, dt = new Date(Date.UTC(2001, 0, 1)), eidx = -1, fidx = -1; + if (fields & 1) { + d128 = readDecimal128LE(buf, doff); + doff += 16; + } + if (fields & 2) { + ieee = dv.getFloat64(doff, true); + doff += 8; + } + if (fields & 4) { + dt.setTime(dt.getTime() + (dc = dv.getFloat64(doff, true)) * 1e3); + doff += 8; + } + if (fields & 8) { + sidx = dv.getUint32(doff, true); + doff += 4; + } + if (fields & 16) { + ridx = dv.getUint32(doff, true); + doff += 4; + } + doff += popcnt(fields & 480) * 4; + if (fields & 512) { + fidx = dv.getUint32(doff, true); + doff += 4; + } + doff += popcnt(fields & 1024) * 4; + if (fields & 2048) { + eidx = dv.getUint32(doff, true); + doff += 4; + } + var ret; + var t = buf[1]; + switch (t) { + case 0: + ret = { t: "z" }; + break; + case 2: + ret = { t: "n", v: d128 }; + break; + case 3: + ret = { t: "s", v: lut.sst[sidx] }; + break; + case 5: + { + if (opts == null ? void 0 : opts.cellDates) + ret = { t: "d", v: dt }; + else + ret = { t: "n", v: dc / 86400 + 35430, z: table_fmt[14] }; + } + break; + case 6: + ret = { t: "b", v: ieee > 0 }; + break; + case 7: + ret = { t: "n", v: ieee }; + break; + case 8: + ret = { t: "e", v: 0 }; + break; + case 9: + { + if (ridx > -1) { + var rts = lut.rsst[ridx]; + ret = { t: "s", v: rts.v }; + if (rts.l) + ret.l = { Target: rts.l }; + } else + throw new Error("Unsupported cell type ".concat(buf[1], " : ").concat(fields & 31, " : ").concat(buf[subarray](0, 4))); + } + break; + case 10: + ret = { t: "n", v: d128 }; + break; + default: + throw new Error("Unsupported cell type ".concat(buf[1], " : ").concat(fields & 31, " : ").concat(buf[subarray](0, 4))); + } + doff += popcnt(fields & 4096) * 4; + if (fields & 516096) { + if (zidx == -1) + zidx = dv.getUint32(doff, true); + doff += 4; + } + if (fields & 524288) { + var cmntidx = dv.getUint32(doff, true); + doff += 4; + if (lut.cmnt[cmntidx]) + ret.c = iwa_to_s5s_comment(lut.cmnt[cmntidx]); + } + if (zidx > -1) + numbers_format_cell(ret, t | 5 << 8, fields >> 13, lut.ofmt[zidx], lut.nfmt[zidx]); + if (t == 7) + ret.v /= 86400; + return ret; +} +function write_new_storage(cell, lut) { + var out = new Uint8Array(32), dv = u8_to_dataview(out), l = 12, fields = 0; + out[0] = 5; + switch (cell.t) { + case "n": + if (cell.z && fmt_is_date(cell.z)) { + out[1] = 5; + dv.setFloat64(l, (numdate(cell.v + 1462).getTime() - Date.UTC(2001, 0, 1)) / 1e3, true); + fields |= 4; + l += 8; + break; + } else { + out[1] = 2; + writeDecimal128LE(out, l, cell.v); + fields |= 1; + l += 16; + } + break; + case "b": + out[1] = 6; + dv.setFloat64(l, cell.v ? 1 : 0, true); + fields |= 2; + l += 8; + break; + case "s": + { + var s = cell.v == null ? "" : String(cell.v); + if (cell.l) { + var irsst = lut.rsst.findIndex(function(v) { + var _a; + return v.v == s && v.l == ((_a = cell.l) == null ? void 0 : _a.Target); + }); + if (irsst == -1) + lut.rsst[irsst = lut.rsst.length] = { v: s, l: cell.l.Target }; + out[1] = 9; + dv.setUint32(l, irsst, true); + fields |= 16; + l += 4; + } else { + var isst = lut.sst.indexOf(s); + if (isst == -1) + lut.sst[isst = lut.sst.length] = s; + out[1] = 3; + dv.setUint32(l, isst, true); + fields |= 8; + l += 4; + } + } + break; + case "d": + out[1] = 5; + dv.setFloat64(l, (cell.v.getTime() - Date.UTC(2001, 0, 1)) / 1e3, true); + fields |= 4; + l += 8; + break; + case "z": + out[1] = 0; + break; + default: + throw "unsupported cell type " + cell.t; + } + if (cell.c) { + lut.cmnt.push(s5s_to_iwa_comment(cell.c)); + dv.setUint32(l, lut.cmnt.length - 1, true); + fields |= 524288; + l += 4; + } + dv.setUint32(8, fields, true); + return out[subarray](0, l); +} +function write_old_storage(cell, lut) { + var out = new Uint8Array(32), dv = u8_to_dataview(out), l = 12, fields = 0, s = ""; + out[0] = 4; + switch (cell.t) { + case "n": + break; + case "b": + break; + case "s": + { + s = cell.v == null ? "" : String(cell.v); + if (cell.l) { + var irsst = lut.rsst.findIndex(function(v) { + var _a; + return v.v == s && v.l == ((_a = cell.l) == null ? void 0 : _a.Target); + }); + if (irsst == -1) + lut.rsst[irsst = lut.rsst.length] = { v: s, l: cell.l.Target }; + out[1] = 9; + dv.setUint32(l, irsst, true); + fields |= 512; + l += 4; + } else { + } + } + break; + case "d": + break; + case "e": + break; + case "z": + break; + default: + throw "unsupported cell type " + cell.t; + } + if (cell.c) { + dv.setUint32(l, lut.cmnt.length - 1, true); + fields |= 4096; + l += 4; + } + switch (cell.t) { + case "n": + out[1] = 2; + dv.setFloat64(l, cell.v, true); + fields |= 32; + l += 8; + break; + case "b": + out[1] = 6; + dv.setFloat64(l, cell.v ? 1 : 0, true); + fields |= 32; + l += 8; + break; + case "s": + { + s = cell.v == null ? "" : String(cell.v); + if (cell.l) { + } else { + var isst = lut.sst.indexOf(s); + if (isst == -1) + lut.sst[isst = lut.sst.length] = s; + out[1] = 3; + dv.setUint32(l, isst, true); + fields |= 16; + l += 4; + } + } + break; + case "d": + out[1] = 5; + dv.setFloat64(l, (cell.v.getTime() - Date.UTC(2001, 0, 1)) / 1e3, true); + fields |= 64; + l += 8; + break; + case "z": + out[1] = 0; + break; + default: + throw "unsupported cell type " + cell.t; + } + dv.setUint32(8, fields, true); + return out[subarray](0, l); +} +function parse_cell_storage(buf, lut, opts) { + switch (buf[0]) { + case 0: + case 1: + case 2: + case 3: + case 4: + return parse_old_storage(buf, lut, buf[0], opts); + case 5: + return parse_new_storage(buf, lut, opts); + default: + throw new Error("Unsupported payload version ".concat(buf[0])); + } +} +function parse_TSP_Reference(buf) { + var pb = parse_shallow(buf); + return varint_to_i32(pb[1][0].data); +} +function write_TSP_Reference(idx) { + return write_shallow([ + [], + [{ type: 0, data: write_varint49(idx) }] + ]); +} +function numbers_add_oref(iwa, ref) { + var _a; + var orefs = ((_a = iwa.messages[0].meta[5]) == null ? void 0 : _a[0]) ? parse_packed_varints(iwa.messages[0].meta[5][0].data) : []; + var orefidx = orefs.indexOf(ref); + if (orefidx == -1) { + orefs.push(ref); + iwa.messages[0].meta[5] = [{ type: 2, data: write_packed_varints(orefs) }]; + } +} +function numbers_del_oref(iwa, ref) { + var _a; + var orefs = ((_a = iwa.messages[0].meta[5]) == null ? void 0 : _a[0]) ? parse_packed_varints(iwa.messages[0].meta[5][0].data) : []; + iwa.messages[0].meta[5] = [{ type: 2, data: write_packed_varints(orefs.filter(function(r) { + return r != ref; + })) }]; +} +function parse_TST_TableDataList(M, root) { + var pb = parse_shallow(root.data); + var type = varint_to_i32(pb[1][0].data); + var entries = pb[3]; + var data = []; + (entries || []).forEach(function(entry) { + var _a, _b; + var le = parse_shallow(entry.data); + if (!le[1]) + return; + var key = varint_to_i32(le[1][0].data) >>> 0; + switch (type) { + case 1: + data[key] = u8str(le[3][0].data); + break; + case 8: + { + var rt = M[parse_TSP_Reference(le[9][0].data)][0]; + var rtp = parse_shallow(rt.data); + var rtpref = M[parse_TSP_Reference(rtp[1][0].data)][0]; + var mtype = varint_to_i32(rtpref.meta[1][0].data); + if (mtype != 2001) + throw new Error("2000 unexpected reference to ".concat(mtype)); + var tswpsa = parse_shallow(rtpref.data); + var richtext = { v: tswpsa[3].map(function(x) { + return u8str(x.data); + }).join("") }; + data[key] = richtext; + sfields: + if ((_a = tswpsa == null ? void 0 : tswpsa[11]) == null ? void 0 : _a[0]) { + var smartfields = (_b = parse_shallow(tswpsa[11][0].data)) == null ? void 0 : _b[1]; + if (!smartfields) + break sfields; + smartfields.forEach(function(sf) { + var _a2, _b2, _c; + var attr = parse_shallow(sf.data); + if ((_a2 = attr[2]) == null ? void 0 : _a2[0]) { + var obj = M[parse_TSP_Reference((_b2 = attr[2]) == null ? void 0 : _b2[0].data)][0]; + var objtype = varint_to_i32(obj.meta[1][0].data); + switch (objtype) { + case 2032: + var hlink = parse_shallow(obj.data); + if (((_c = hlink == null ? void 0 : hlink[2]) == null ? void 0 : _c[0]) && !richtext.l) + richtext.l = u8str(hlink[2][0].data); + break; + case 2039: + break; + default: + console.log("unrecognized ObjectAttribute type ".concat(objtype)); + } + } + }); + } + } + break; + case 2: + data[key] = parse_shallow(le[6][0].data); + break; + case 3: + data[key] = parse_shallow(le[5][0].data); + break; + case 10: + { + var cs = M[parse_TSP_Reference(le[10][0].data)][0]; + data[key] = parse_TSD_CommentStorageArchive(M, cs.data); + } + break; + default: + throw type; + } + }); + return data; +} +function parse_TST_TileRowInfo(u8, type) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n; + var pb = parse_shallow(u8); + var R = varint_to_i32(pb[1][0].data) >>> 0; + var cnt = varint_to_i32(pb[2][0].data) >>> 0; + var wide_offsets = ((_b = (_a = pb[8]) == null ? void 0 : _a[0]) == null ? void 0 : _b.data) && varint_to_i32(pb[8][0].data) > 0 || false; + var used_storage_u8, used_storage; + if (((_d = (_c = pb[7]) == null ? void 0 : _c[0]) == null ? void 0 : _d.data) && type != 0) { + used_storage_u8 = (_f = (_e = pb[7]) == null ? void 0 : _e[0]) == null ? void 0 : _f.data; + used_storage = (_h = (_g = pb[6]) == null ? void 0 : _g[0]) == null ? void 0 : _h.data; + } else if (((_j = (_i = pb[4]) == null ? void 0 : _i[0]) == null ? void 0 : _j.data) && type != 1) { + used_storage_u8 = (_l = (_k = pb[4]) == null ? void 0 : _k[0]) == null ? void 0 : _l.data; + used_storage = (_n = (_m = pb[3]) == null ? void 0 : _m[0]) == null ? void 0 : _n.data; + } else + throw "NUMBERS Tile missing ".concat(type, " cell storage"); + var width = wide_offsets ? 4 : 1; + var used_storage_offsets = u8_to_dataview(used_storage_u8); + var offsets = []; + for (var C = 0; C < used_storage_u8.length / 2; ++C) { + var off = used_storage_offsets.getUint16(C * 2, true); + if (off < 65535) + offsets.push([C, off]); + } + if (offsets.length != cnt) + throw "Expected ".concat(cnt, " cells, found ").concat(offsets.length); + var cells = []; + for (C = 0; C < offsets.length - 1; ++C) + cells[offsets[C][0]] = used_storage[subarray](offsets[C][1] * width, offsets[C + 1][1] * width); + if (offsets.length >= 1) + cells[offsets[offsets.length - 1][0]] = used_storage[subarray](offsets[offsets.length - 1][1] * width); + return { R: R, cells: cells }; +} +function parse_TST_Tile(M, root) { + var _a; + var pb = parse_shallow(root.data); + var storage = -1; + if ((_a = pb == null ? void 0 : pb[7]) == null ? void 0 : _a[0]) { + if (varint_to_i32(pb[7][0].data) >>> 0) + storage = 1; + else + storage = 0; + } + var ri = mappa(pb[5], function(u8) { + return parse_TST_TileRowInfo(u8, storage); + }); + return { + nrows: varint_to_i32(pb[4][0].data) >>> 0, + data: ri.reduce(function(acc, x) { + if (!acc[x.R]) + acc[x.R] = []; + x.cells.forEach(function(cell, C) { + if (acc[x.R][C]) + throw new Error("Duplicate cell r=".concat(x.R, " c=").concat(C)); + acc[x.R][C] = cell; + }); + return acc; + }, []) + }; +} +function parse_TSD_CommentStorageArchive(M, data) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; + var out = { t: "", a: "" }; + var csp = parse_shallow(data); + if ((_b = (_a = csp == null ? void 0 : csp[1]) == null ? void 0 : _a[0]) == null ? void 0 : _b.data) + out.t = u8str((_d = (_c = csp == null ? void 0 : csp[1]) == null ? void 0 : _c[0]) == null ? void 0 : _d.data) || ""; + if ((_f = (_e = csp == null ? void 0 : csp[3]) == null ? void 0 : _e[0]) == null ? void 0 : _f.data) { + var as = M[parse_TSP_Reference((_h = (_g = csp == null ? void 0 : csp[3]) == null ? void 0 : _g[0]) == null ? void 0 : _h.data)][0]; + var asp = parse_shallow(as.data); + if ((_j = (_i = asp[1]) == null ? void 0 : _i[0]) == null ? void 0 : _j.data) + out.a = u8str(asp[1][0].data); + } + if (csp == null ? void 0 : csp[4]) { + out.replies = []; + csp[4].forEach(function(pi) { + var cs = M[parse_TSP_Reference(pi.data)][0]; + out.replies.push(parse_TSD_CommentStorageArchive(M, cs.data)); + }); + } + return out; +} +function iwa_to_s5s_comment(iwa) { + var out = []; + out.push({ t: iwa.t || "", a: iwa.a, T: iwa.replies && iwa.replies.length > 0 }); + if (iwa.replies) + iwa.replies.forEach(function(reply) { + out.push({ t: reply.t || "", a: reply.a, T: true }); + }); + return out; +} +function s5s_to_iwa_comment(s5s) { + var out = { a: "", t: "", replies: [] }; + for (var i = 0; i < s5s.length; ++i) { + if (i == 0) { + out.a = s5s[i].a; + out.t = s5s[i].t; + } else { + out.replies.push({ a: s5s[i].a, t: s5s[i].t }); + } + } + return out; +} +function parse_TST_TableModelArchive(M, root, ws, opts) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i; + var pb = parse_shallow(root.data); + var range = { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }; + range.e.r = (varint_to_i32(pb[6][0].data) >>> 0) - 1; + if (range.e.r < 0) + throw new Error("Invalid row varint ".concat(pb[6][0].data)); + range.e.c = (varint_to_i32(pb[7][0].data) >>> 0) - 1; + if (range.e.c < 0) + throw new Error("Invalid col varint ".concat(pb[7][0].data)); + ws["!ref"] = encode_range(range); + var dense = ws["!data"] != null, dws = ws; + var store = parse_shallow(pb[4][0].data); + var lut = numbers_lut_new(); + if ((_a = store[4]) == null ? void 0 : _a[0]) + lut.sst = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[4][0].data)][0]); + if ((_b = store[6]) == null ? void 0 : _b[0]) + lut.fmla = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[6][0].data)][0]); + if ((_c = store[11]) == null ? void 0 : _c[0]) + lut.ofmt = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[11][0].data)][0]); + if ((_d = store[12]) == null ? void 0 : _d[0]) + lut.ferr = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[12][0].data)][0]); + if ((_e = store[17]) == null ? void 0 : _e[0]) + lut.rsst = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[17][0].data)][0]); + if ((_f = store[19]) == null ? void 0 : _f[0]) + lut.cmnt = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[19][0].data)][0]); + if ((_g = store[22]) == null ? void 0 : _g[0]) + lut.nfmt = parse_TST_TableDataList(M, M[parse_TSP_Reference(store[22][0].data)][0]); + var tile = parse_shallow(store[3][0].data); + var _R = 0; + tile[1].forEach(function(t) { + var tl = parse_shallow(t.data); + var ref2 = M[parse_TSP_Reference(tl[2][0].data)][0]; + var mtype2 = varint_to_i32(ref2.meta[1][0].data); + if (mtype2 != 6002) + throw new Error("6001 unexpected reference to ".concat(mtype2)); + var _tile = parse_TST_Tile(M, ref2); + _tile.data.forEach(function(row, R) { + row.forEach(function(buf, C) { + var res = parse_cell_storage(buf, lut, opts); + if (res) { + if (dense) { + if (!dws["!data"][_R + R]) + dws["!data"][_R + R] = []; + dws["!data"][_R + R][C] = res; + } else { + ws[encode_col(C) + encode_row(_R + R)] = res; + } + } + }); + }); + _R += _tile.nrows; + }); + if ((_h = store[13]) == null ? void 0 : _h[0]) { + var ref = M[parse_TSP_Reference(store[13][0].data)][0]; + var mtype = varint_to_i32(ref.meta[1][0].data); + if (mtype != 6144) + throw new Error("Expected merge type 6144, found ".concat(mtype)); + ws["!merges"] = (_i = parse_shallow(ref.data)) == null ? void 0 : _i[1].map(function(pi) { + var merge = parse_shallow(pi.data); + var origin = u8_to_dataview(parse_shallow(merge[1][0].data)[1][0].data), size = u8_to_dataview(parse_shallow(merge[2][0].data)[1][0].data); + return { + s: { r: origin.getUint16(0, true), c: origin.getUint16(2, true) }, + e: { + r: origin.getUint16(0, true) + size.getUint16(0, true) - 1, + c: origin.getUint16(2, true) + size.getUint16(2, true) - 1 + } + }; + }); + } +} +function parse_TST_TableInfoArchive(M, root, opts) { + var pb = parse_shallow(root.data); + var out = { "!ref": "A1" }; + if (opts == null ? void 0 : opts.dense) + out["!data"] = []; + var tableref = M[parse_TSP_Reference(pb[2][0].data)]; + var mtype = varint_to_i32(tableref[0].meta[1][0].data); + if (mtype != 6001) + throw new Error("6000 unexpected reference to ".concat(mtype)); + parse_TST_TableModelArchive(M, tableref[0], out, opts); + return out; +} +function parse_TN_SheetArchive(M, root, opts) { + var _a; + var pb = parse_shallow(root.data); + var out = { + name: ((_a = pb[1]) == null ? void 0 : _a[0]) ? u8str(pb[1][0].data) : "", + sheets: [] + }; + var shapeoffs = mappa(pb[2], parse_TSP_Reference); + shapeoffs.forEach(function(off) { + M[off].forEach(function(m) { + var mtype = varint_to_i32(m.meta[1][0].data); + if (mtype == 6e3) + out.sheets.push(parse_TST_TableInfoArchive(M, m, opts)); + }); + }); + return out; +} +function parse_TN_DocumentArchive(M, root, opts) { + var _a; + var out = book_new(); + out.Workbook = { WBProps: { date1904: true } }; + var pb = parse_shallow(root.data); + if ((_a = pb[2]) == null ? void 0 : _a[0]) + throw new Error("Keynote presentations are not supported"); + var sheetoffs = mappa(pb[1], parse_TSP_Reference); + sheetoffs.forEach(function(off) { + M[off].forEach(function(m) { + var mtype = varint_to_i32(m.meta[1][0].data); + if (mtype == 2) { + var root2 = parse_TN_SheetArchive(M, m, opts); + root2.sheets.forEach(function(sheet, idx) { + book_append_sheet(out, sheet, idx == 0 ? root2.name : root2.name + "_" + idx, true); + }); + } + }); + }); + if (out.SheetNames.length == 0) + throw new Error("Empty NUMBERS file"); + out.bookType = "numbers"; + return out; +} +function parse_numbers_iwa(cfb, opts) { + var _a, _b, _c, _d, _e, _f, _g; + var M = {}, indices = []; + cfb.FullPaths.forEach(function(p) { + if (p.match(/\.iwpv2/)) + throw new Error("Unsupported password protection"); + }); + cfb.FileIndex.forEach(function(s) { + if (!s.name.match(/\.iwa$/)) + return; + if (s.content[0] != 0) + return; + var o; + try { + o = decompress_iwa_file(s.content); + } catch (e) { + return console.log("?? " + s.content.length + " " + (e.message || e)); + } + var packets; + try { + packets = parse_iwa_file(o); + } catch (e) { + return console.log("## " + (e.message || e)); + } + packets.forEach(function(packet) { + M[packet.id] = packet.messages; + indices.push(packet.id); + }); + }); + if (!indices.length) + throw new Error("File has no messages"); + if (((_c = (_b = (_a = M == null ? void 0 : M[1]) == null ? void 0 : _a[0].meta) == null ? void 0 : _b[1]) == null ? void 0 : _c[0].data) && varint_to_i32(M[1][0].meta[1][0].data) == 1e4) + throw new Error("Pages documents are not supported"); + var docroot = ((_g = (_f = (_e = (_d = M == null ? void 0 : M[1]) == null ? void 0 : _d[0]) == null ? void 0 : _e.meta) == null ? void 0 : _f[1]) == null ? void 0 : _g[0].data) && varint_to_i32(M[1][0].meta[1][0].data) == 1 && M[1][0]; + if (!docroot) + indices.forEach(function(idx) { + M[idx].forEach(function(iwam) { + var mtype = varint_to_i32(iwam.meta[1][0].data) >>> 0; + if (mtype == 1) { + if (!docroot) + docroot = iwam; + else + throw new Error("Document has multiple roots"); + } + }); + }); + if (!docroot) + throw new Error("Cannot find Document root"); + return parse_TN_DocumentArchive(M, docroot, opts); +} +function write_TST_TileRowInfo(data, lut, wide) { + var _a, _b, _c; + var tri = [ + [], + [{ type: 0, data: write_varint49(0) }], + [{ type: 0, data: write_varint49(0) }], + [{ type: 2, data: new Uint8Array([]) }], + [{ type: 2, data: new Uint8Array(Array.from({ length: 510 }, function() { + return 255; + })) }], + [{ type: 0, data: write_varint49(5) }], + [{ type: 2, data: new Uint8Array([]) }], + [{ type: 2, data: new Uint8Array(Array.from({ length: 510 }, function() { + return 255; + })) }], + [{ type: 0, data: write_varint49(1) }] + ]; + if (!((_a = tri[6]) == null ? void 0 : _a[0]) || !((_b = tri[7]) == null ? void 0 : _b[0])) + throw "Mutation only works on post-BNC storages!"; + var cnt = 0; + if (tri[7][0].data.length < 2 * data.length) { + var new_7 = new Uint8Array(2 * data.length); + new_7.set(tri[7][0].data); + tri[7][0].data = new_7; + } + if (tri[4][0].data.length < 2 * data.length) { + var new_4 = new Uint8Array(2 * data.length); + new_4.set(tri[4][0].data); + tri[4][0].data = new_4; + } + var dv = u8_to_dataview(tri[7][0].data), last_offset = 0, cell_storage = []; + var _dv = u8_to_dataview(tri[4][0].data), _last_offset = 0, _cell_storage = []; + var width = wide ? 4 : 1; + for (var C = 0; C < data.length; ++C) { + if (data[C] == null || data[C].t == "z" && !((_c = data[C].c) == null ? void 0 : _c.length) || data[C].t == "e") { + dv.setUint16(C * 2, 65535, true); + _dv.setUint16(C * 2, 65535); + continue; + } + dv.setUint16(C * 2, last_offset / width, true); + _dv.setUint16(C * 2, _last_offset / width, true); + var celload, _celload; + switch (data[C].t) { + case "d": + if (data[C].v instanceof Date) { + celload = write_new_storage(data[C], lut); + _celload = write_old_storage(data[C], lut); + break; + } + celload = write_new_storage(data[C], lut); + _celload = write_old_storage(data[C], lut); + break; + case "s": + case "n": + case "b": + case "z": + celload = write_new_storage(data[C], lut); + _celload = write_old_storage(data[C], lut); + break; + default: + throw new Error("Unsupported value " + data[C]); + } + cell_storage.push(celload); + last_offset += celload.length; + { + _cell_storage.push(_celload); + _last_offset += _celload.length; + } + ++cnt; + } + tri[2][0].data = write_varint49(cnt); + tri[5][0].data = write_varint49(5); + for (; C < tri[7][0].data.length / 2; ++C) { + dv.setUint16(C * 2, 65535, true); + _dv.setUint16(C * 2, 65535, true); + } + tri[6][0].data = u8concat(cell_storage); + tri[3][0].data = u8concat(_cell_storage); + tri[8] = [{ type: 0, data: write_varint49(wide ? 1 : 0) }]; + return tri; +} +function write_iwam(type, payload) { + return { + meta: [ + [], + [{ type: 0, data: write_varint49(type) }] + ], + data: payload + }; +} +function get_unique_msgid(dep, dependents) { + if (!dependents.last) + dependents.last = 927262; + for (var i = dependents.last; i < 2e6; ++i) + if (!dependents[i]) { + dependents[dependents.last = i] = dep; + return i; + } + throw new Error("Too many messages"); +} +function build_numbers_deps(cfb) { + var dependents = {}; + var indices = []; + cfb.FileIndex.map(function(fi, idx) { + return [fi, cfb.FullPaths[idx]]; + }).forEach(function(row) { + var fi = row[0], fp = row[1]; + if (fi.type != 2) + return; + if (!fi.name.match(/\.iwa/)) + return; + if (fi.content[0] != 0) + return; + parse_iwa_file(decompress_iwa_file(fi.content)).forEach(function(packet) { + indices.push(packet.id); + dependents[packet.id] = { deps: [], location: fp, type: varint_to_i32(packet.messages[0].meta[1][0].data) }; + }); + }); + cfb.FileIndex.forEach(function(fi) { + if (!fi.name.match(/\.iwa/)) + return; + if (fi.content[0] != 0) + return; + parse_iwa_file(decompress_iwa_file(fi.content)).forEach(function(ia) { + ia.messages.forEach(function(mess) { + [5, 6].forEach(function(f) { + if (!mess.meta[f]) + return; + mess.meta[f].forEach(function(x) { + dependents[ia.id].deps.push(varint_to_i32(x.data)); + }); + }); + }); + }); + }); + return dependents; +} +function write_TSP_Color_RGB(r, g, b) { + return write_shallow([ + [], + [{ type: 0, data: write_varint49(1) }], + [], + [{ type: 5, data: new Uint8Array(Float32Array.from([r / 255]).buffer) }], + [{ type: 5, data: new Uint8Array(Float32Array.from([g / 255]).buffer) }], + [{ type: 5, data: new Uint8Array(Float32Array.from([b / 255]).buffer) }], + [{ type: 5, data: new Uint8Array(Float32Array.from([1]).buffer) }], + [], + [], + [], + [], + [], + [{ type: 0, data: write_varint49(1) }] + ]); +} +function get_author_color(n) { + switch (n) { + case 0: + return write_TSP_Color_RGB(99, 222, 171); + case 1: + return write_TSP_Color_RGB(162, 197, 240); + case 2: + return write_TSP_Color_RGB(255, 189, 189); + } + return write_TSP_Color_RGB(Math.random() * 255, Math.random() * 255, Math.random() * 255); +} +function write_numbers_iwa(wb, opts) { + if (!opts || !opts.numbers) + throw new Error("Must pass a `numbers` option -- check the README"); + var cfb = CFB.read(opts.numbers, { type: "base64" }); + var deps = build_numbers_deps(cfb); + var docroot = numbers_iwa_find(cfb, deps, 1); + if (docroot == null) + throw "Could not find message ".concat(1, " in Numbers template"); + var sheetrefs = mappa(parse_shallow(docroot.messages[0].data)[1], parse_TSP_Reference); + if (sheetrefs.length > 1) + throw new Error("Template NUMBERS file must have exactly one sheet"); + wb.SheetNames.forEach(function(name, idx) { + if (idx >= 1) { + numbers_add_ws(cfb, deps, idx + 1); + docroot = numbers_iwa_find(cfb, deps, 1); + sheetrefs = mappa(parse_shallow(docroot.messages[0].data)[1], parse_TSP_Reference); + } + write_numbers_ws(cfb, deps, wb.Sheets[name], name, idx, sheetrefs[idx]); + }); + return cfb; +} +function numbers_iwa_doit(cfb, deps, id, cb) { + var entry = CFB.find(cfb, deps[id].location); + if (!entry) + throw "Could not find ".concat(deps[id].location, " in Numbers template"); + var x = parse_iwa_file(decompress_iwa_file(entry.content)); + var ainfo = x.find(function(packet) { + return packet.id == id; + }); + cb(ainfo, x); + entry.content = compress_iwa_file(write_iwa_file(x)); + entry.size = entry.content.length; +} +function numbers_iwa_find(cfb, deps, id) { + var entry = CFB.find(cfb, deps[id].location); + if (!entry) + throw "Could not find ".concat(deps[id].location, " in Numbers template"); + var x = parse_iwa_file(decompress_iwa_file(entry.content)); + var ainfo = x.find(function(packet) { + return packet.id == id; + }); + return ainfo; +} +function numbers_add_meta(mlist, newid, newloc) { + mlist[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(newid) }], + [{ type: 2, data: stru8(newloc.replace(/-.*$/, "")) }], + [{ type: 2, data: stru8(newloc) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [], + [], + [], + [], + [{ type: 0, data: write_varint49(0) }], + [], + [{ type: 0, data: write_varint49(0) }] + ]) }); + mlist[1] = [{ type: 0, data: write_varint49(Math.max(newid + 1, varint_to_i32(mlist[1][0].data))) }]; +} +function numbers_add_msg(cfb, type, msg, path, deps, id) { + if (!id) + id = get_unique_msgid({ deps: [], location: "", type: type }, deps); + var loc = "".concat(path, "-").concat(id, ".iwa"); + deps[id].location = "Root Entry" + loc; + CFB.utils.cfb_add(cfb, loc, compress_iwa_file(write_iwa_file([{ + id: id, + messages: [write_iwam(type, write_shallow(msg))] + }]))); + var newloc = loc.replace(/^[\/]/, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_add_meta(mlist, id || 0, newloc); + ai.messages[0].data = write_shallow(mlist); + }); + return id; +} +function numbers_meta_add_dep(mlist, deps, id, dep) { + var loc = deps[id].location.replace(/^Root Entry\//, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + var parentidx = mlist[3].findIndex(function(m) { + var _a, _b; + var mm = parse_shallow(m.data); + if ((_a = mm[3]) == null ? void 0 : _a[0]) + return u8str(mm[3][0].data) == loc; + if (((_b = mm[2]) == null ? void 0 : _b[0]) && u8str(mm[2][0].data) == loc) + return true; + return false; + }); + var parent = parse_shallow(mlist[3][parentidx].data); + if (!parent[6]) + parent[6] = []; + (Array.isArray(dep) ? dep : [dep]).forEach(function(dep2) { + parent[6].push({ + type: 2, + data: write_shallow([ + [], + [{ type: 0, data: write_varint49(dep2) }] + ]) + }); + }); + mlist[3][parentidx].data = write_shallow(parent); +} +function numbers_meta_del_dep(mlist, deps, id, dep) { + var loc = deps[id].location.replace(/^Root Entry\//, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + var parentidx = mlist[3].findIndex(function(m) { + var _a, _b; + var mm = parse_shallow(m.data); + if ((_a = mm[3]) == null ? void 0 : _a[0]) + return u8str(mm[3][0].data) == loc; + if (((_b = mm[2]) == null ? void 0 : _b[0]) && u8str(mm[2][0].data) == loc) + return true; + return false; + }); + var parent = parse_shallow(mlist[3][parentidx].data); + if (!parent[6]) + parent[6] = []; + parent[6] = parent[6].filter(function(m) { + return varint_to_i32(parse_shallow(m.data)[1][0].data) != dep; + }); + mlist[3][parentidx].data = write_shallow(parent); +} +function numbers_add_ws(cfb, deps, wsidx) { + var sheetref = -1, newsheetref = -1; + var remap = {}; + numbers_iwa_doit(cfb, deps, 1, function(docroot, arch) { + var doc = parse_shallow(docroot.messages[0].data); + sheetref = parse_TSP_Reference(parse_shallow(docroot.messages[0].data)[1][0].data); + newsheetref = get_unique_msgid({ deps: [1], location: deps[sheetref].location, type: 2 }, deps); + remap[sheetref] = newsheetref; + numbers_add_oref(docroot, newsheetref); + doc[1].push({ type: 2, data: write_TSP_Reference(newsheetref) }); + var sheet = numbers_iwa_find(cfb, deps, sheetref); + sheet.id = newsheetref; + if (deps[1].location == deps[newsheetref].location) + arch.push(sheet); + else + numbers_iwa_doit(cfb, deps, newsheetref, function(_, x) { + return x.push(sheet); + }); + docroot.messages[0].data = write_shallow(doc); + }); + var tiaref = -1; + numbers_iwa_doit(cfb, deps, newsheetref, function(sheetroot, arch) { + var sa = parse_shallow(sheetroot.messages[0].data); + for (var i = 3; i <= 69; ++i) + delete sa[i]; + var drawables = mappa(sa[2], parse_TSP_Reference); + drawables.forEach(function(n) { + return numbers_del_oref(sheetroot, n); + }); + tiaref = get_unique_msgid({ deps: [newsheetref], location: deps[drawables[0]].location, type: deps[drawables[0]].type }, deps); + numbers_add_oref(sheetroot, tiaref); + remap[drawables[0]] = tiaref; + sa[2] = [{ type: 2, data: write_TSP_Reference(tiaref) }]; + var tia = numbers_iwa_find(cfb, deps, drawables[0]); + tia.id = tiaref; + if (deps[drawables[0]].location == deps[newsheetref].location) + arch.push(tia); + else { + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, newsheetref, tiaref); + ai.messages[0].data = write_shallow(mlist); + }); + numbers_iwa_doit(cfb, deps, tiaref, function(_, x) { + return x.push(tia); + }); + } + sheetroot.messages[0].data = write_shallow(sa); + }); + var tmaref = -1; + numbers_iwa_doit(cfb, deps, tiaref, function(tiaroot, arch) { + var tia = parse_shallow(tiaroot.messages[0].data); + var da = parse_shallow(tia[1][0].data); + for (var i = 3; i <= 69; ++i) + delete da[i]; + var dap = parse_TSP_Reference(da[2][0].data); + da[2][0].data = write_TSP_Reference(remap[dap]); + tia[1][0].data = write_shallow(da); + var oldtmaref = parse_TSP_Reference(tia[2][0].data); + numbers_del_oref(tiaroot, oldtmaref); + tmaref = get_unique_msgid({ deps: [tiaref], location: deps[oldtmaref].location, type: deps[oldtmaref].type }, deps); + numbers_add_oref(tiaroot, tmaref); + remap[oldtmaref] = tmaref; + tia[2][0].data = write_TSP_Reference(tmaref); + var tma = numbers_iwa_find(cfb, deps, oldtmaref); + tma.id = tmaref; + if (deps[tiaref].location == deps[tmaref].location) + arch.push(tma); + else + numbers_iwa_doit(cfb, deps, tmaref, function(_, x) { + return x.push(tma); + }); + tiaroot.messages[0].data = write_shallow(tia); + }); + numbers_iwa_doit(cfb, deps, tmaref, function(tmaroot, arch) { + var _a, _b; + var tma = parse_shallow(tmaroot.messages[0].data); + var uuid = u8str(tma[1][0].data), new_uuid = uuid.replace(/-[A-Z0-9]*/, "-".concat(("0000" + wsidx.toString(16)).slice(-4))); + tma[1][0].data = stru8(new_uuid); + [12, 13, 29, 31, 32, 33, 39, 44, 47, 81, 82, 84].forEach(function(n) { + return delete tma[n]; + }); + if (tma[45]) { + var srrta = parse_shallow(tma[45][0].data); + var ref = parse_TSP_Reference(srrta[1][0].data); + numbers_del_oref(tmaroot, ref); + delete tma[45]; + } + if (tma[70]) { + var hsoa = parse_shallow(tma[70][0].data); + (_a = hsoa[2]) == null ? void 0 : _a.forEach(function(item) { + var hsa = parse_shallow(item.data); + [2, 3].map(function(n) { + return hsa[n][0]; + }).forEach(function(hseadata) { + var hsea = parse_shallow(hseadata.data); + if (!hsea[8]) + return; + var ref2 = parse_TSP_Reference(hsea[8][0].data); + numbers_del_oref(tmaroot, ref2); + }); + }); + delete tma[70]; + } + [ + 46, + 30, + 34, + 35, + 36, + 38, + 48, + 49, + 60, + 61, + 62, + 63, + 64, + 71, + 72, + 73, + 74, + 75, + 85, + 86, + 87, + 88, + 89 + ].forEach(function(n) { + if (!tma[n]) + return; + var ref2 = parse_TSP_Reference(tma[n][0].data); + delete tma[n]; + numbers_del_oref(tmaroot, ref2); + }); + var store = parse_shallow(tma[4][0].data); + { + [2, 4, 5, 6, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22].forEach(function(n) { + var _a2; + if (!((_a2 = store[n]) == null ? void 0 : _a2[0])) + return; + var oldref = parse_TSP_Reference(store[n][0].data); + var newref = get_unique_msgid({ deps: [tmaref], location: deps[oldref].location, type: deps[oldref].type }, deps); + numbers_del_oref(tmaroot, oldref); + numbers_add_oref(tmaroot, newref); + remap[oldref] = newref; + var msg = numbers_iwa_find(cfb, deps, oldref); + msg.id = newref; + if (deps[oldref].location == deps[tmaref].location) + arch.push(msg); + else { + deps[newref].location = deps[oldref].location.replace(oldref.toString(), newref.toString()); + if (deps[newref].location == deps[oldref].location) + deps[newref].location = deps[newref].location.replace(/\.iwa/, "-".concat(newref, ".iwa")); + CFB.utils.cfb_add(cfb, deps[newref].location, compress_iwa_file(write_iwa_file([msg]))); + var newloc = deps[newref].location.replace(/^Root Entry\//, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_add_meta(mlist, newref, newloc); + numbers_meta_add_dep(mlist, deps, tmaref, newref); + ai.messages[0].data = write_shallow(mlist); + }); + } + store[n][0].data = write_TSP_Reference(newref); + }); + var row_headers = parse_shallow(store[1][0].data); + { + (_b = row_headers[2]) == null ? void 0 : _b.forEach(function(tspref) { + var oldref = parse_TSP_Reference(tspref.data); + var newref = get_unique_msgid({ deps: [tmaref], location: deps[oldref].location, type: deps[oldref].type }, deps); + numbers_del_oref(tmaroot, oldref); + numbers_add_oref(tmaroot, newref); + remap[oldref] = newref; + var msg = numbers_iwa_find(cfb, deps, oldref); + msg.id = newref; + if (deps[oldref].location == deps[tmaref].location) { + arch.push(msg); + } else { + deps[newref].location = deps[oldref].location.replace(oldref.toString(), newref.toString()); + if (deps[newref].location == deps[oldref].location) + deps[newref].location = deps[newref].location.replace(/\.iwa/, "-".concat(newref, ".iwa")); + CFB.utils.cfb_add(cfb, deps[newref].location, compress_iwa_file(write_iwa_file([msg]))); + var newloc = deps[newref].location.replace(/^Root Entry\//, "").replace(/^Index\//, "").replace(/\.iwa$/, ""); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_add_meta(mlist, newref, newloc); + numbers_meta_add_dep(mlist, deps, tmaref, newref); + ai.messages[0].data = write_shallow(mlist); + }); + } + tspref.data = write_TSP_Reference(newref); + }); + } + store[1][0].data = write_shallow(row_headers); + var tiles = parse_shallow(store[3][0].data); + { + tiles[1].forEach(function(t) { + var tst = parse_shallow(t.data); + var oldtileref = parse_TSP_Reference(tst[2][0].data); + var newtileref = remap[oldtileref]; + if (!remap[oldtileref]) { + newtileref = get_unique_msgid({ deps: [tmaref], location: "", type: deps[oldtileref].type }, deps); + deps[newtileref].location = "Root Entry/Index/Tables/Tile-".concat(newtileref, ".iwa"); + remap[oldtileref] = newtileref; + var oldtile = numbers_iwa_find(cfb, deps, oldtileref); + oldtile.id = newtileref; + numbers_del_oref(tmaroot, oldtileref); + numbers_add_oref(tmaroot, newtileref); + CFB.utils.cfb_add(cfb, "/Index/Tables/Tile-".concat(newtileref, ".iwa"), compress_iwa_file(write_iwa_file([oldtile]))); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + mlist[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(newtileref) }], + [{ type: 2, data: stru8("Tables/Tile") }], + [{ type: 2, data: stru8("Tables/Tile-".concat(newtileref)) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [], + [], + [], + [], + [{ type: 0, data: write_varint49(0) }], + [], + [{ type: 0, data: write_varint49(0) }] + ]) }); + mlist[1] = [{ type: 0, data: write_varint49(Math.max(newtileref + 1, varint_to_i32(mlist[1][0].data))) }]; + numbers_meta_add_dep(mlist, deps, tmaref, newtileref); + ai.messages[0].data = write_shallow(mlist); + }); + } + tst[2][0].data = write_TSP_Reference(newtileref); + t.data = write_shallow(tst); + }); + } + store[3][0].data = write_shallow(tiles); + } + tma[4][0].data = write_shallow(store); + tmaroot.messages[0].data = write_shallow(tma); + }); +} +function write_numbers_ws(cfb, deps, ws, wsname, sheetidx, rootref) { + var drawables = []; + numbers_iwa_doit(cfb, deps, rootref, function(docroot) { + var sheetref = parse_shallow(docroot.messages[0].data); + { + sheetref[1] = [{ type: 2, data: stru8(wsname) }]; + drawables = mappa(sheetref[2], parse_TSP_Reference); + } + docroot.messages[0].data = write_shallow(sheetref); + }); + var tia = numbers_iwa_find(cfb, deps, drawables[0]); + var tmaref = parse_TSP_Reference(parse_shallow(tia.messages[0].data)[2][0].data); + numbers_iwa_doit(cfb, deps, tmaref, function(docroot, x) { + return write_numbers_tma(cfb, deps, ws, docroot, x, tmaref); + }); +} +var USE_WIDE_ROWS = true; +function write_numbers_tma(cfb, deps, ws, tmaroot, tmafile, tmaref) { + var range = decode_range(ws["!ref"]); + range.s.r = range.s.c = 0; + var trunc = false; + if (range.e.c > 999) { + trunc = true; + range.e.c = 999; + } + if (range.e.r > 999999) { + trunc = true; + range.e.r = 999999; + } + if (trunc) + console.error("Truncating to ".concat(encode_range(range))); + var data = []; + if (ws["!data"]) + data = ws["!data"]; + else { + var colstr = []; + for (var _C = 0; _C <= range.e.c; ++_C) + colstr[_C] = encode_col(_C); + for (var R_ = 0; R_ <= range.e.r; ++R_) { + data[R_] = []; + var _R = "" + (R_ + 1); + for (_C = 0; _C <= range.e.c; ++_C) { + var _cell = ws[colstr[_C] + _R]; + if (!_cell) + continue; + data[R_][_C] = _cell; + } + } + } + var LUT = { + cmnt: [{ a: "~54ee77S~", t: "... the people who are crazy enough to think they can change the world, are the ones who do." }], + ferr: [], + fmla: [], + nfmt: [], + ofmt: [], + rsst: [{ v: "~54ee77S~", l: "https://sheetjs.com/" }], + sst: ["~Sh33tJ5~"] + }; + var pb = parse_shallow(tmaroot.messages[0].data); + { + pb[6][0].data = write_varint49(range.e.r + 1); + pb[7][0].data = write_varint49(range.e.c + 1); + delete pb[46]; + var store = parse_shallow(pb[4][0].data); + { + var row_header_ref = parse_TSP_Reference(parse_shallow(store[1][0].data)[2][0].data); + numbers_iwa_doit(cfb, deps, row_header_ref, function(rowhead, _x) { + var _a; + var base_bucket = parse_shallow(rowhead.messages[0].data); + if ((_a = base_bucket == null ? void 0 : base_bucket[2]) == null ? void 0 : _a[0]) + for (var R2 = 0; R2 < data.length; ++R2) { + var _bucket = parse_shallow(base_bucket[2][0].data); + _bucket[1][0].data = write_varint49(R2); + _bucket[4][0].data = write_varint49(data[R2].length); + base_bucket[2][R2] = { type: base_bucket[2][0].type, data: write_shallow(_bucket) }; + } + rowhead.messages[0].data = write_shallow(base_bucket); + }); + var col_header_ref = parse_TSP_Reference(store[2][0].data); + numbers_iwa_doit(cfb, deps, col_header_ref, function(colhead, _x) { + var base_bucket = parse_shallow(colhead.messages[0].data); + for (var C = 0; C <= range.e.c; ++C) { + var _bucket = parse_shallow(base_bucket[2][0].data); + _bucket[1][0].data = write_varint49(C); + _bucket[4][0].data = write_varint49(range.e.r + 1); + base_bucket[2][C] = { type: base_bucket[2][0].type, data: write_shallow(_bucket) }; + } + colhead.messages[0].data = write_shallow(base_bucket); + }); + var rbtree = parse_shallow(store[9][0].data); + rbtree[1] = []; + var tilestore = parse_shallow(store[3][0].data); + { + var tstride = 256; + tilestore[2] = [{ type: 0, data: write_varint49(tstride) }]; + var tileref = parse_TSP_Reference(parse_shallow(tilestore[1][0].data)[2][0].data); + var save_token = function() { + var metadata = numbers_iwa_find(cfb, deps, 2); + var mlist = parse_shallow(metadata.messages[0].data); + var mlst = mlist[3].filter(function(m) { + return varint_to_i32(parse_shallow(m.data)[1][0].data) == tileref; + }); + return (mlst == null ? void 0 : mlst.length) ? varint_to_i32(parse_shallow(mlst[0].data)[12][0].data) : 0; + }(); + { + CFB.utils.cfb_del(cfb, deps[tileref].location); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + mlist[3] = mlist[3].filter(function(m) { + return varint_to_i32(parse_shallow(m.data)[1][0].data) != tileref; + }); + numbers_meta_del_dep(mlist, deps, tmaref, tileref); + ai.messages[0].data = write_shallow(mlist); + }); + numbers_del_oref(tmaroot, tileref); + } + tilestore[1] = []; + var ntiles = Math.ceil((range.e.r + 1) / tstride); + for (var tidx = 0; tidx < ntiles; ++tidx) { + var newtileid = get_unique_msgid({ + deps: [], + location: "", + type: 6002 + }, deps); + deps[newtileid].location = "Root Entry/Index/Tables/Tile-".concat(newtileid, ".iwa"); + var tiledata = [ + [], + [{ type: 0, data: write_varint49(0) }], + [{ type: 0, data: write_varint49(Math.min(range.e.r + 1, (tidx + 1) * tstride)) }], + [{ type: 0, data: write_varint49(0) }], + [{ type: 0, data: write_varint49(Math.min((tidx + 1) * tstride, range.e.r + 1) - tidx * tstride) }], + [], + [{ type: 0, data: write_varint49(5) }], + [{ type: 0, data: write_varint49(1) }], + [{ type: 0, data: write_varint49(USE_WIDE_ROWS ? 1 : 0) }] + ]; + for (var R = tidx * tstride; R <= Math.min(range.e.r, (tidx + 1) * tstride - 1); ++R) { + var tilerow = write_TST_TileRowInfo(data[R], LUT, USE_WIDE_ROWS); + tilerow[1][0].data = write_varint49(R - tidx * tstride); + tiledata[5].push({ data: write_shallow(tilerow), type: 2 }); + } + tilestore[1].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(tidx) }], + [{ type: 2, data: write_TSP_Reference(newtileid) }] + ]) }); + var newtile = { + id: newtileid, + messages: [write_iwam(6002, write_shallow(tiledata))] + }; + var tilecontent = compress_iwa_file(write_iwa_file([newtile])); + CFB.utils.cfb_add(cfb, "/Index/Tables/Tile-".concat(newtileid, ".iwa"), tilecontent); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + mlist[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(newtileid) }], + [{ type: 2, data: stru8("Tables/Tile") }], + [{ type: 2, data: stru8("Tables/Tile-".concat(newtileid)) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [{ type: 2, data: new Uint8Array([2, 0, 0]) }], + [], + [], + [], + [], + [{ type: 0, data: write_varint49(0) }], + [], + [{ type: 0, data: write_varint49(save_token) }] + ]) }); + mlist[1] = [{ type: 0, data: write_varint49(Math.max(newtileid + 1, varint_to_i32(mlist[1][0].data))) }]; + numbers_meta_add_dep(mlist, deps, tmaref, newtileid); + ai.messages[0].data = write_shallow(mlist); + }); + numbers_add_oref(tmaroot, newtileid); + rbtree[1].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(tidx * tstride) }], + [{ type: 0, data: write_varint49(tidx) }] + ]) }); + } + } + store[3][0].data = write_shallow(tilestore); + store[9][0].data = write_shallow(rbtree); + store[10] = [{ type: 2, data: new Uint8Array([]) }]; + if (ws["!merges"]) { + var mergeid = get_unique_msgid({ + type: 6144, + deps: [tmaref], + location: deps[tmaref].location + }, deps); + tmafile.push({ + id: mergeid, + messages: [write_iwam(6144, write_shallow([ + [], + ws["!merges"].map(function(m) { + return { type: 2, data: write_shallow([ + [], + [{ type: 2, data: write_shallow([ + [], + [{ type: 5, data: new Uint8Array(new Uint16Array([m.s.r, m.s.c]).buffer) }] + ]) }], + [{ type: 2, data: write_shallow([ + [], + [{ type: 5, data: new Uint8Array(new Uint16Array([m.e.r - m.s.r + 1, m.e.c - m.s.c + 1]).buffer) }] + ]) }] + ]) }; + }) + ]))] + }); + store[13] = [{ type: 2, data: write_TSP_Reference(mergeid) }]; + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, tmaref, mergeid); + ai.messages[0].data = write_shallow(mlist); + }); + numbers_add_oref(tmaroot, mergeid); + } else + delete store[13]; + var sstref = parse_TSP_Reference(store[4][0].data); + numbers_iwa_doit(cfb, deps, sstref, function(sstroot) { + var sstdata = parse_shallow(sstroot.messages[0].data); + { + sstdata[3] = []; + LUT.sst.forEach(function(str, i) { + if (i == 0) + return; + sstdata[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(i) }], + [{ type: 0, data: write_varint49(1) }], + [{ type: 2, data: stru8(str) }] + ]) }); + }); + } + sstroot.messages[0].data = write_shallow(sstdata); + }); + var rsstref = parse_TSP_Reference(store[17][0].data); + numbers_iwa_doit(cfb, deps, rsstref, function(rsstroot) { + var rsstdata = parse_shallow(rsstroot.messages[0].data); + rsstdata[3] = []; + var style_indices = [ + 904980, + 903835, + 903815, + 903845 + ]; + LUT.rsst.forEach(function(rsst, i) { + if (i == 0) + return; + var tswpsa = [ + [], + [{ type: 0, data: new Uint8Array([5]) }], + [], + [{ type: 2, data: stru8(rsst.v) }] + ]; + tswpsa[10] = [{ type: 0, data: new Uint8Array([1]) }]; + tswpsa[19] = [{ type: 2, data: new Uint8Array([10, 6, 8, 0, 18, 2, 101, 110]) }]; + tswpsa[5] = [{ type: 2, data: new Uint8Array([10, 8, 8, 0, 18, 4, 8, 155, 149, 55]) }]; + tswpsa[2] = [{ type: 2, data: new Uint8Array([8, 148, 158, 55]) }]; + tswpsa[6] = [{ type: 2, data: new Uint8Array([10, 6, 8, 0, 16, 0, 24, 0]) }]; + tswpsa[7] = [{ type: 2, data: new Uint8Array([10, 8, 8, 0, 18, 4, 8, 135, 149, 55]) }]; + tswpsa[8] = [{ type: 2, data: new Uint8Array([10, 8, 8, 0, 18, 4, 8, 165, 149, 55]) }]; + tswpsa[14] = [{ type: 2, data: new Uint8Array([10, 6, 8, 0, 16, 0, 24, 0]) }]; + tswpsa[24] = [{ type: 2, data: new Uint8Array([10, 6, 8, 0, 16, 0, 24, 0]) }]; + var tswpsaid = get_unique_msgid({ deps: [], location: "", type: 2001 }, deps); + var tswpsarefs = []; + if (rsst.l) { + var newhlinkid = numbers_add_msg(cfb, 2032, [ + [], + [], + [{ type: 2, data: stru8(rsst.l) }] + ], "/Index/Tables/DataList", deps); + tswpsa[11] = []; + var smartfield = [[], []]; + if (!smartfield[1]) + smartfield[1] = []; + smartfield[1].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(0) }], + [{ type: 2, data: write_TSP_Reference(newhlinkid) }] + ]) }); + tswpsa[11][0] = { type: 2, data: write_shallow(smartfield) }; + tswpsarefs.push(newhlinkid); + } + numbers_add_msg(cfb, 2001, tswpsa, "/Index/Tables/DataList", deps, tswpsaid); + numbers_iwa_doit(cfb, deps, tswpsaid, function(iwa) { + style_indices.forEach(function(ref) { + return numbers_add_oref(iwa, ref); + }); + tswpsarefs.forEach(function(ref) { + return numbers_add_oref(iwa, ref); + }); + }); + var rtpaid = numbers_add_msg(cfb, 6218, [ + [], + [{ type: 2, data: write_TSP_Reference(tswpsaid) }], + [], + [{ type: 2, data: new Uint8Array([13, 255, 255, 255, 0, 18, 10, 16, 255, 255, 1, 24, 255, 255, 255, 255, 7]) }] + ], "/Index/Tables/DataList", deps); + numbers_iwa_doit(cfb, deps, rtpaid, function(iwa) { + return numbers_add_oref(iwa, tswpsaid); + }); + rsstdata[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(i) }], + [{ type: 0, data: write_varint49(1) }], + [], + [], + [], + [], + [], + [], + [{ type: 2, data: write_TSP_Reference(rtpaid) }] + ]) }); + numbers_add_oref(rsstroot, rtpaid); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, rsstref, rtpaid); + numbers_meta_add_dep(mlist, deps, rtpaid, tswpsaid); + numbers_meta_add_dep(mlist, deps, tswpsaid, tswpsarefs); + numbers_meta_add_dep(mlist, deps, tswpsaid, style_indices); + ai.messages[0].data = write_shallow(mlist); + }); + }); + rsstroot.messages[0].data = write_shallow(rsstdata); + }); + if (LUT.cmnt.length > 1) { + var cmntref = parse_TSP_Reference(store[19][0].data); + var authors = {}, iauthor = 0; + numbers_iwa_doit(cfb, deps, cmntref, function(cmntroot) { + var cmntdata = parse_shallow(cmntroot.messages[0].data); + { + cmntdata[3] = []; + LUT.cmnt.forEach(function(cc, i) { + if (i == 0) + return; + var replies = []; + if (cc.replies) + cc.replies.forEach(function(c) { + if (!authors[c.a || ""]) + authors[c.a || ""] = numbers_add_msg(cfb, 212, [ + [], + [{ type: 2, data: stru8(c.a || "") }], + [{ type: 2, data: get_author_color(++iauthor) }], + [], + [{ type: 0, data: write_varint49(0) }] + ], "/Index/Tables/DataList", deps); + var aaaid2 = authors[c.a || ""]; + var csaid2 = numbers_add_msg(cfb, 3056, [ + [], + [{ type: 2, data: stru8(c.t || "") }], + [{ type: 2, data: write_shallow([ + [], + [{ type: 1, data: new Uint8Array([0, 0, 0, 128, 116, 109, 182, 65]) }] + ]) }], + [{ type: 2, data: write_TSP_Reference(aaaid2) }] + ], "/Index/Tables/DataList", deps); + numbers_iwa_doit(cfb, deps, csaid2, function(iwa) { + return numbers_add_oref(iwa, aaaid2); + }); + replies.push(csaid2); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, csaid2, aaaid2); + ai.messages[0].data = write_shallow(mlist); + }); + }); + if (!authors[cc.a || ""]) + authors[cc.a || ""] = numbers_add_msg(cfb, 212, [ + [], + [{ type: 2, data: stru8(cc.a || "") }], + [{ type: 2, data: get_author_color(++iauthor) }], + [], + [{ type: 0, data: write_varint49(0) }] + ], "/Index/Tables/DataList", deps); + var aaaid = authors[cc.a || ""]; + var csaid = numbers_add_msg(cfb, 3056, [ + [], + [{ type: 2, data: stru8(cc.t || "") }], + [{ type: 2, data: write_shallow([ + [], + [{ type: 1, data: new Uint8Array([0, 0, 0, 128, 116, 109, 182, 65]) }] + ]) }], + [{ type: 2, data: write_TSP_Reference(aaaid) }], + replies.map(function(r) { + return { type: 2, data: write_TSP_Reference(r) }; + }), + [{ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(i) }], + [{ type: 0, data: write_varint49(0) }] + ]) }] + ], "/Index/Tables/DataList", deps); + numbers_iwa_doit(cfb, deps, csaid, function(iwa) { + numbers_add_oref(iwa, aaaid); + replies.forEach(function(r) { + return numbers_add_oref(iwa, r); + }); + }); + cmntdata[3].push({ type: 2, data: write_shallow([ + [], + [{ type: 0, data: write_varint49(i) }], + [{ type: 0, data: write_varint49(1) }], + [], + [], + [], + [], + [], + [], + [], + [{ type: 2, data: write_TSP_Reference(csaid) }] + ]) }); + numbers_add_oref(cmntroot, csaid); + numbers_iwa_doit(cfb, deps, 2, function(ai) { + var mlist = parse_shallow(ai.messages[0].data); + numbers_meta_add_dep(mlist, deps, cmntref, csaid); + numbers_meta_add_dep(mlist, deps, csaid, aaaid); + if (replies.length) + numbers_meta_add_dep(mlist, deps, csaid, replies); + ai.messages[0].data = write_shallow(mlist); + }); + }); + } + cmntdata[2][0].data = write_varint49(LUT.cmnt.length + 1); + cmntroot.messages[0].data = write_shallow(cmntdata); + }); + } + } + pb[4][0].data = write_shallow(store); + } + tmaroot.messages[0].data = write_shallow(pb); +} +function fix_opts_func(defaults/*:Array >*/)/*:{(o:any):void}*/ { + return function fix_opts(opts) { + for(var i = 0; i != defaults.length; ++i) { + var d = defaults[i]; + if(opts[d[0]] === undefined) opts[d[0]] = d[1]; + if(d[2] === 'n') opts[d[0]] = Number(opts[d[0]]); + } + }; +} + +function fix_read_opts(opts) { +fix_opts_func([ + ['cellNF', false], /* emit cell number format string as .z */ + ['cellHTML', true], /* emit html string as .h */ + ['cellFormula', true], /* emit formulae as .f */ + ['cellStyles', false], /* emits style/theme as .s */ + ['cellText', true], /* emit formatted text as .w */ + ['cellDates', false], /* emit date cells with type `d` */ + + ['sheetStubs', false], /* emit empty cells */ + ['sheetRows', 0, 'n'], /* read n rows (0 = read all rows) */ + + ['bookDeps', false], /* parse calculation chains */ + ['bookSheets', false], /* only try to get sheet names (no Sheets) */ + ['bookProps', false], /* only try to get properties (no Sheets) */ + ['bookFiles', false], /* include raw file structure (keys, files, cfb) */ + ['bookVBA', false], /* include vba raw data (vbaraw) */ + + ['password',''], /* password */ + ['WTF', false] /* WTF mode (throws errors) */ +])(opts); +} + +function fix_write_opts(opts) { +fix_opts_func([ + ['cellDates', false], /* write date cells with type `d` */ + + ['bookSST', false], /* Generate Shared String Table */ + + ['bookType', 'xlsx'], /* Type of workbook (xlsx/m/b) */ + + ['compression', false], /* Use file compression */ + + ['WTF', false] /* WTF mode (throws errors) */ +])(opts); +} +function get_sheet_type(n/*:string*/)/*:string*/ { + if(RELS.WS.indexOf(n) > -1) return "sheet"; + if(RELS.CS && n == RELS.CS) return "chart"; + if(RELS.DS && n == RELS.DS) return "dialog"; + if(RELS.MS && n == RELS.MS) return "macro"; + return (n && n.length) ? n : "sheet"; +} +function safe_parse_wbrels(wbrels, sheets) { + if(!wbrels) return 0; + try { + wbrels = sheets.map(function pwbr(w) { if(!w.id) w.id = w.strRelID; return [w.name, wbrels['!id'][w.id].Target, get_sheet_type(wbrels['!id'][w.id].Type)]; }); + } catch(e) { return null; } + return !wbrels || wbrels.length === 0 ? null : wbrels; +} + +function parse_sheet_legacy_drawing(sheet, type, zip, path, idx, opts, wb, comments) { + if(!sheet || !sheet['!legdrawel']) return; + var dfile = resolve_path(sheet['!legdrawel'].Target, path); + var draw = getzipstr(zip, dfile, true); + if(draw) parse_vml(utf8read(draw), sheet, comments||[]); +} + +function safe_parse_sheet(zip, path/*:string*/, relsPath/*:string*/, sheet, idx/*:number*/, sheetRels, sheets, stype/*:string*/, opts, wb, themes, styles) { + try { + sheetRels[sheet]=parse_rels(getzipstr(zip, relsPath, true), path); + var data = getzipdata(zip, path); + var _ws; + switch(stype) { + case 'sheet': _ws = parse_ws(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; + case 'chart': _ws = parse_cs(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); + if(!_ws || !_ws['!drawel']) break; + var dfile = resolve_path(_ws['!drawel'].Target, path); + var drelsp = get_rels_path(dfile); + var draw = parse_drawing(getzipstr(zip, dfile, true), parse_rels(getzipstr(zip, drelsp, true), dfile)); + var chartp = resolve_path(draw, dfile); + var crelsp = get_rels_path(chartp); + _ws = parse_chart(getzipstr(zip, chartp, true), chartp, opts, parse_rels(getzipstr(zip, crelsp, true), chartp), wb, _ws); + break; + case 'macro': _ws = parse_ms(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; + case 'dialog': _ws = parse_ds(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break; + default: throw new Error("Unrecognized sheet type " + stype); + } + sheets[sheet] = _ws; + + /* scan rels for comments and threaded comments */ + var comments = [], tcomments = []; + if(sheetRels && sheetRels[sheet]) keys(sheetRels[sheet]).forEach(function(n) { + var dfile = ""; + if(sheetRels[sheet][n].Type == RELS.CMNT) { + dfile = resolve_path(sheetRels[sheet][n].Target, path); + comments = parse_cmnt(getzipdata(zip, dfile, true), dfile, opts); + if(!comments || !comments.length) return; + sheet_insert_comments(_ws, comments, false); + } + if(sheetRels[sheet][n].Type == RELS.TCMNT) { + dfile = resolve_path(sheetRels[sheet][n].Target, path); + tcomments = tcomments.concat(parse_tcmnt_xml(getzipdata(zip, dfile, true), opts)); + } + }); + if(tcomments && tcomments.length) sheet_insert_comments(_ws, tcomments, true, opts.people || []); + parse_sheet_legacy_drawing(_ws, stype, zip, path, idx, opts, wb, comments); + } catch(e) { if(opts.WTF) throw e; } +} + +function strip_front_slash(x/*:string*/)/*:string*/ { return x.charAt(0) == '/' ? x.slice(1) : x; } + +function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ { + make_ssf(); + opts = opts || {}; + fix_read_opts(opts); + + /* OpenDocument Part 3 Section 2.2.1 OpenDocument Package */ + if(safegetzipfile(zip, 'META-INF/manifest.xml')) return parse_ods(zip, opts); + /* UOC */ + if(safegetzipfile(zip, 'objectdata.xml')) return parse_ods(zip, opts); + /* Numbers */ + if(safegetzipfile(zip, 'Index/Document.iwa')) { + if(typeof Uint8Array == "undefined") throw new Error('NUMBERS file parsing requires Uint8Array support'); + if(typeof parse_numbers_iwa != "undefined") { + if(zip.FileIndex) return parse_numbers_iwa(zip, opts); + var _zip = CFB.utils.cfb_new(); + zipentries(zip).forEach(function(e) { zip_add_file(_zip, e, getzipbin(zip, e)); }); + return parse_numbers_iwa(_zip, opts); + } + throw new Error('Unsupported NUMBERS file'); + } + if(!safegetzipfile(zip, '[Content_Types].xml')) { + if(safegetzipfile(zip, 'index.xml.gz')) throw new Error('Unsupported NUMBERS 08 file'); + if(safegetzipfile(zip, 'index.xml')) throw new Error('Unsupported NUMBERS 09 file'); + var index_zip = CFB.find(zip, 'Index.zip'); + if(index_zip) { + opts = dup(opts); + delete opts.type; + if(typeof index_zip.content == "string") opts.type = "binary"; + // TODO: Bun buffer bug + if(typeof Bun !== "undefined" && Buffer.isBuffer(index_zip.content)) return readSync(new Uint8Array(index_zip.content), opts); + return readSync(index_zip.content, opts); + } + throw new Error('Unsupported ZIP file'); + } + + var entries = zipentries(zip); + var dir = parse_ct((getzipstr(zip, '[Content_Types].xml')/*:?any*/)); + var xlsb = false; + var sheets, binname; + if(dir.workbooks.length === 0) { + binname = "xl/workbook.xml"; + if(getzipdata(zip,binname, true)) dir.workbooks.push(binname); + } + if(dir.workbooks.length === 0) { + binname = "xl/workbook.bin"; + if(!getzipdata(zip,binname,true)) throw new Error("Could not find workbook"); + dir.workbooks.push(binname); + xlsb = true; + } + if(dir.workbooks[0].slice(-3) == "bin") xlsb = true; + + var themes = ({}/*:any*/); + var styles = ({}/*:any*/); + if(!opts.bookSheets && !opts.bookProps) { + strs = []; + if(dir.sst) try { strs=parse_sst(getzipdata(zip, strip_front_slash(dir.sst)), dir.sst, opts); } catch(e) { if(opts.WTF) throw e; } + + if(opts.cellStyles && dir.themes.length) themes = parse_theme_xml(getzipstr(zip, dir.themes[0].replace(/^\//,''), true)||"", opts); + + if(dir.style) styles = parse_sty(getzipdata(zip, strip_front_slash(dir.style)), dir.style, themes, opts); + } + + /*var externbooks = */dir.links.map(function(link) { + try { + var rels = parse_rels(getzipstr(zip, get_rels_path(strip_front_slash(link))), link); + return parse_xlink(getzipdata(zip, strip_front_slash(link)), rels, link, opts); + } catch(e) {} + }); + + var wb = parse_wb(getzipdata(zip, strip_front_slash(dir.workbooks[0])), dir.workbooks[0], opts); + + var props = {}, propdata = ""; + + if(dir.coreprops.length) { + propdata = getzipdata(zip, strip_front_slash(dir.coreprops[0]), true); + if(propdata) props = parse_core_props(propdata); + if(dir.extprops.length !== 0) { + propdata = getzipdata(zip, strip_front_slash(dir.extprops[0]), true); + if(propdata) parse_ext_props(propdata, props, opts); + } + } + + var custprops = {}; + if(!opts.bookSheets || opts.bookProps) { + if (dir.custprops.length !== 0) { + propdata = getzipstr(zip, strip_front_slash(dir.custprops[0]), true); + if(propdata) custprops = parse_cust_props(propdata, opts); + } + } + + var out = ({}/*:any*/); + if(opts.bookSheets || opts.bookProps) { + if(wb.Sheets) sheets = wb.Sheets.map(function pluck(x){ return x.name; }); + else if(props.Worksheets && props.SheetNames.length > 0) sheets=props.SheetNames; + if(opts.bookProps) { out.Props = props; out.Custprops = custprops; } + if(opts.bookSheets && typeof sheets !== 'undefined') out.SheetNames = sheets; + if(opts.bookSheets ? out.SheetNames : opts.bookProps) return out; + } + sheets = {}; + + var deps = {}; + if(opts.bookDeps && dir.calcchain) deps=parse_cc(getzipdata(zip, strip_front_slash(dir.calcchain)),dir.calcchain,opts); + + var i=0; + var sheetRels = ({}/*:any*/); + var path, relsPath; + + { + var wbsheets = wb.Sheets; + props.Worksheets = wbsheets.length; + props.SheetNames = []; + for(var j = 0; j != wbsheets.length; ++j) { + props.SheetNames[j] = wbsheets[j].name; + } + } + + var wbext = xlsb ? "bin" : "xml"; + var wbrelsi = dir.workbooks[0].lastIndexOf("/"); + var wbrelsfile = (dir.workbooks[0].slice(0, wbrelsi+1) + "_rels/" + dir.workbooks[0].slice(wbrelsi+1) + ".rels").replace(/^\//,""); + if(!safegetzipfile(zip, wbrelsfile)) wbrelsfile = 'xl/_rels/workbook.' + wbext + '.rels'; + var wbrels = parse_rels(getzipstr(zip, wbrelsfile, true), wbrelsfile.replace(/_rels.*/, "s5s")); + + if((dir.metadata || []).length >= 1) { + /* TODO: MDX and other types of metadata */ + opts.xlmeta = parse_xlmeta(getzipdata(zip, strip_front_slash(dir.metadata[0])),dir.metadata[0],opts); + } + + if((dir.people || []).length >= 1) { + opts.people = parse_people_xml(getzipdata(zip, strip_front_slash(dir.people[0])),opts); + } + + if(wbrels) wbrels = safe_parse_wbrels(wbrels, wb.Sheets); + + /* Numbers iOS hack */ + var nmode = (getzipdata(zip,"xl/worksheets/sheet.xml",true))?1:0; + wsloop: for(i = 0; i != props.Worksheets; ++i) { + var stype = "sheet"; + if(wbrels && wbrels[i]) { + path = 'xl/' + (wbrels[i][1]).replace(/[\/]?xl\//, ""); + if(!safegetzipfile(zip, path)) path = wbrels[i][1]; + if(!safegetzipfile(zip, path)) path = wbrelsfile.replace(/_rels\/.*$/,"") + wbrels[i][1]; + stype = wbrels[i][2]; + } else { + path = 'xl/worksheets/sheet'+(i+1-nmode)+"." + wbext; + path = path.replace(/sheet0\./,"sheet."); + } + relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels"); + if(opts && opts.sheets != null) switch(typeof opts.sheets) { + case "number": if(i != opts.sheets) continue wsloop; break; + case "string": if(props.SheetNames[i].toLowerCase() != opts.sheets.toLowerCase()) continue wsloop; break; + default: if(Array.isArray && Array.isArray(opts.sheets)) { + var snjseen = false; + for(var snj = 0; snj != opts.sheets.length; ++snj) { + if(typeof opts.sheets[snj] == "number" && opts.sheets[snj] == i) snjseen=1; + if(typeof opts.sheets[snj] == "string" && opts.sheets[snj].toLowerCase() == props.SheetNames[i].toLowerCase()) snjseen = 1; + } + if(!snjseen) continue wsloop; + } + } + safe_parse_sheet(zip, path, relsPath, props.SheetNames[i], i, sheetRels, sheets, stype, opts, wb, themes, styles); + } + + out = ({ + Directory: dir, + Workbook: wb, + Props: props, + Custprops: custprops, + Deps: deps, + Sheets: sheets, + SheetNames: props.SheetNames, + Strings: strs, + Styles: styles, + Themes: themes, + SSF: dup(table_fmt) + }/*:any*/); + if(opts && opts.bookFiles) { + if(zip.files) { + out.keys = entries; + out.files = zip.files; + } else { + out.keys = []; + out.files = {}; + zip.FullPaths.forEach(function(p, idx) { + p = p.replace(/^Root Entry[\/]/, ""); + out.keys.push(p); + out.files[p] = zip.FileIndex[idx]; + }); + } + } + if(opts && opts.bookVBA) { + if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true); + else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin',true); + } + // TODO: pass back content types metdata for xlsm/xlsx resolution + out.bookType = xlsb ? "xlsb" : "xlsx"; + return out; +} + +/* [MS-OFFCRYPTO] 2.1.1 */ +function parse_xlsxcfb(cfb, _opts/*:?ParseOpts*/)/*:Workbook*/ { + var opts = _opts || {}; + var f = 'Workbook', data = CFB.find(cfb, f); + try { + f = '/!DataSpaces/Version'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + /*var version = */parse_DataSpaceVersionInfo(data.content); + + /* 2.3.4.1 */ + f = '/!DataSpaces/DataSpaceMap'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + var dsm = parse_DataSpaceMap(data.content); + if(dsm.length !== 1 || dsm[0].comps.length !== 1 || dsm[0].comps[0].t !== 0 || dsm[0].name !== "StrongEncryptionDataSpace" || dsm[0].comps[0].v !== "EncryptedPackage") + throw new Error("ECMA-376 Encrypted file bad " + f); + + /* 2.3.4.2 */ + f = '/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + var seds = parse_DataSpaceDefinition(data.content); + if(seds.length != 1 || seds[0] != "StrongEncryptionTransform") + throw new Error("ECMA-376 Encrypted file bad " + f); + + /* 2.3.4.3 */ + f = '/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + /*var hdr = */parse_Primary(data.content); + } catch(e) {} + + f = '/EncryptionInfo'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + var einfo = parse_EncryptionInfo(data.content); + + /* 2.3.4.4 */ + f = '/EncryptedPackage'; + data = CFB.find(cfb, f); if(!data || !data.content) throw new Error("ECMA-376 Encrypted file missing " + f); + +/*global decrypt_agile */ +/*:: declare var decrypt_agile:any; */ + if(einfo[0] == 0x04 && typeof decrypt_agile !== 'undefined') return decrypt_agile(einfo[1], data.content, opts.password || "", opts); +/*global decrypt_std76 */ +/*:: declare var decrypt_std76:any; */ + if(einfo[0] == 0x02 && typeof decrypt_std76 !== 'undefined') return decrypt_std76(einfo[1], data.content, opts.password || "", opts); + throw new Error("File is password-protected"); +} + +function write_zip_xlsb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ { + if(wb && !wb.SSF) { + wb.SSF = dup(table_fmt); + } + if(wb && wb.SSF) { + make_ssf(); SSF_load_table(wb.SSF); + // $FlowIgnore + opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0; + opts.ssf = wb.SSF; + } + opts.rels = {}; opts.wbrels = {}; + opts.Strings = /*::((*/[]/*:: :any):SST)*/; opts.Strings.Count = 0; opts.Strings.Unique = 0; + if(browser_has_Map) opts.revStrings = new Map(); + else { opts.revStrings = {}; opts.revStrings.foo = []; delete opts.revStrings.foo; } + var wbext = "bin"; + var vbafmt = true; + var ct = new_ct(); + fix_write_opts(opts = opts || {}); + var zip = zip_new(); + var f = "", rId = 0; + + opts.cellXfs = []; + get_cell_style(opts.cellXfs, {}, {revssf:{"General":0}}); + + if(!wb.Props) wb.Props = {}; + + f = "docProps/core.xml"; + zip_add_file(zip, f, write_core_props(wb.Props, opts)); + ct.coreprops.push(f); + add_rels(opts.rels, 2, f, RELS.CORE_PROPS); + + /*::if(!wb.Props) throw "unreachable"; */ + f = "docProps/app.xml"; + if(wb.Props && wb.Props.SheetNames){/* empty */} + else if(!wb.Workbook || !wb.Workbook.Sheets) wb.Props.SheetNames = wb.SheetNames; + else { + var _sn = []; + for(var _i = 0; _i < wb.SheetNames.length; ++_i) + if((wb.Workbook.Sheets[_i]||{}).Hidden != 2) _sn.push(wb.SheetNames[_i]); + wb.Props.SheetNames = _sn; + } + wb.Props.Worksheets = wb.Props.SheetNames.length; + zip_add_file(zip, f, write_ext_props(wb.Props, opts)); + ct.extprops.push(f); + add_rels(opts.rels, 3, f, RELS.EXT_PROPS); + + if(wb.Custprops !== wb.Props && keys(wb.Custprops||{}).length > 0) { + f = "docProps/custom.xml"; + zip_add_file(zip, f, write_cust_props(wb.Custprops, opts)); + ct.custprops.push(f); + add_rels(opts.rels, 4, f, RELS.CUST_PROPS); + } + + var people = ["SheetJ5"]; + opts.tcid = 0; + + for(rId=1;rId <= wb.SheetNames.length; ++rId) { + var wsrels = {'!id':{}}; + var ws = wb.Sheets[wb.SheetNames[rId-1]]; + var _type = (ws || {})["!type"] || "sheet"; + switch(_type) { + case "chart": + /* falls through */ + default: + f = "xl/worksheets/sheet" + rId + "." + wbext; + zip_add_file(zip, f, write_ws_bin(rId-1, opts, wb, wsrels)); + ct.sheets.push(f); + add_rels(opts.wbrels, -1, "worksheets/sheet" + rId + "." + wbext, RELS.WS[0]); + } + + if(ws) { + var comments = ws['!comments']; + var need_vml = false; + var cf = ""; + if(comments && comments.length > 0) { + var needtc = false; + comments.forEach(function(carr) { + carr[1].forEach(function(c) { if(c.T == true) needtc = true; }); + }); + if(needtc) { + cf = "xl/threadedComments/threadedComment" + rId + ".xml"; + zip_add_file(zip, cf, write_tcmnt_xml(comments, people, opts)); + ct.threadedcomments.push(cf); + add_rels(wsrels, -1, "../threadedComments/threadedComment" + rId + ".xml", RELS.TCMNT); + } + + cf = "xl/comments" + rId + "." + wbext; + zip_add_file(zip, cf, write_comments_bin(comments, opts)); + ct.comments.push(cf); + add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT); + need_vml = true; + } + if(ws['!legacy']) { + if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments'])); + } + delete ws['!comments']; + delete ws['!legacy']; + } + + if(wsrels['!id'].rId1) zip_add_file(zip, get_rels_path(f), write_rels(wsrels)); + } + + if(opts.Strings != null && opts.Strings.length > 0) { + f = "xl/sharedStrings." + wbext; + zip_add_file(zip, f, write_sst_bin(opts.Strings, opts)); + ct.strs.push(f); + add_rels(opts.wbrels, -1, "sharedStrings." + wbext, RELS.SST); + } + + f = "xl/workbook." + wbext; + zip_add_file(zip, f, write_wb_bin(wb, opts)); + ct.workbooks.push(f); + add_rels(opts.rels, 1, f, RELS.WB); + + /* TODO: something more intelligent with themes */ + + f = "xl/theme/theme1.xml"; + var ww = write_theme(wb.Themes, opts); + zip_add_file(zip, f, ww); + ct.themes.push(f); + add_rels(opts.wbrels, -1, "theme/theme1.xml", RELS.THEME); + + /* TODO: something more intelligent with styles */ + + f = "xl/styles." + wbext; + zip_add_file(zip, f, write_sty_bin(wb, opts)); + ct.styles.push(f); + add_rels(opts.wbrels, -1, "styles." + wbext, RELS.STY); + + if(wb.vbaraw && vbafmt) { + f = "xl/vbaProject.bin"; + zip_add_file(zip, f, wb.vbaraw); + ct.vba.push(f); + add_rels(opts.wbrels, -1, "vbaProject.bin", RELS.VBA); + } + + f = "xl/metadata." + wbext; + zip_add_file(zip, f, write_xlmeta_bin()); + ct.metadata.push(f); + add_rels(opts.wbrels, -1, "metadata." + wbext, RELS.XLMETA); + + if(people.length > 1) { + f = "xl/persons/person.xml"; + zip_add_file(zip, f, write_people_xml(people, opts)); + ct.people.push(f); + add_rels(opts.wbrels, -1, "persons/person.xml", RELS.PEOPLE); + } + + zip_add_file(zip, "[Content_Types].xml", write_ct(ct, opts)); + zip_add_file(zip, '_rels/.rels', write_rels(opts.rels)); + zip_add_file(zip, 'xl/_rels/workbook.' + wbext + '.rels', write_rels(opts.wbrels)); + + delete opts.revssf; delete opts.ssf; + return zip; +} + +function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ { + if(wb && !wb.SSF) { + wb.SSF = dup(table_fmt); + } + if(wb && wb.SSF) { + make_ssf(); SSF_load_table(wb.SSF); + // $FlowIgnore + opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0; + opts.ssf = wb.SSF; + } + opts.rels = {}; opts.wbrels = {}; + opts.Strings = /*::((*/[]/*:: :any):SST)*/; opts.Strings.Count = 0; opts.Strings.Unique = 0; + if(browser_has_Map) opts.revStrings = new Map(); + else { opts.revStrings = {}; opts.revStrings.foo = []; delete opts.revStrings.foo; } + var wbext = "xml"; + var vbafmt = VBAFMTS.indexOf(opts.bookType) > -1; + var ct = new_ct(); + fix_write_opts(opts = opts || {}); + var zip = zip_new(); + var f = "", rId = 0; + + opts.cellXfs = []; + get_cell_style(opts.cellXfs, {}, {revssf:{"General":0}}); + + if(!wb.Props) wb.Props = {}; + + f = "docProps/core.xml"; + zip_add_file(zip, f, write_core_props(wb.Props, opts)); + ct.coreprops.push(f); + add_rels(opts.rels, 2, f, RELS.CORE_PROPS); + + /*::if(!wb.Props) throw "unreachable"; */ + f = "docProps/app.xml"; + if(wb.Props && wb.Props.SheetNames){/* empty */} + else if(!wb.Workbook || !wb.Workbook.Sheets) wb.Props.SheetNames = wb.SheetNames; + else { + var _sn = []; + for(var _i = 0; _i < wb.SheetNames.length; ++_i) + if((wb.Workbook.Sheets[_i]||{}).Hidden != 2) _sn.push(wb.SheetNames[_i]); + wb.Props.SheetNames = _sn; + } + wb.Props.Worksheets = wb.Props.SheetNames.length; + zip_add_file(zip, f, write_ext_props(wb.Props, opts)); + ct.extprops.push(f); + add_rels(opts.rels, 3, f, RELS.EXT_PROPS); + + if(wb.Custprops !== wb.Props && keys(wb.Custprops||{}).length > 0) { + f = "docProps/custom.xml"; + zip_add_file(zip, f, write_cust_props(wb.Custprops, opts)); + ct.custprops.push(f); + add_rels(opts.rels, 4, f, RELS.CUST_PROPS); + } + + var people = ["SheetJ5"]; + opts.tcid = 0; + + for(rId=1;rId <= wb.SheetNames.length; ++rId) { + var wsrels = {'!id':{}}; + var ws = wb.Sheets[wb.SheetNames[rId-1]]; + var _type = (ws || {})["!type"] || "sheet"; + switch(_type) { + case "chart": + /* falls through */ + default: + f = "xl/worksheets/sheet" + rId + "." + wbext; + zip_add_file(zip, f, write_ws_xml(rId-1, opts, wb, wsrels)); + ct.sheets.push(f); + add_rels(opts.wbrels, -1, "worksheets/sheet" + rId + "." + wbext, RELS.WS[0]); + } + + if(ws) { + var comments = ws['!comments']; + var need_vml = false; + var cf = ""; + if(comments && comments.length > 0) { + var needtc = false; + comments.forEach(function(carr) { + carr[1].forEach(function(c) { if(c.T == true) needtc = true; }); + }); + if(needtc) { + cf = "xl/threadedComments/threadedComment" + rId + ".xml"; + zip_add_file(zip, cf, write_tcmnt_xml(comments, people, opts)); + ct.threadedcomments.push(cf); + add_rels(wsrels, -1, "../threadedComments/threadedComment" + rId + ".xml", RELS.TCMNT); + } + + cf = "xl/comments" + rId + "." + wbext; + zip_add_file(zip, cf, write_comments_xml(comments, opts)); + ct.comments.push(cf); + add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT); + need_vml = true; + } + if(ws['!legacy']) { + if(need_vml) zip_add_file(zip, "xl/drawings/vmlDrawing" + (rId) + ".vml", write_vml(rId, ws['!comments'])); + } + delete ws['!comments']; + delete ws['!legacy']; + } + + if(wsrels['!id'].rId1) zip_add_file(zip, get_rels_path(f), write_rels(wsrels)); + } + + if(opts.Strings != null && opts.Strings.length > 0) { + f = "xl/sharedStrings." + wbext; + zip_add_file(zip, f, write_sst_xml(opts.Strings, opts)); + ct.strs.push(f); + add_rels(opts.wbrels, -1, "sharedStrings." + wbext, RELS.SST); + } + + f = "xl/workbook." + wbext; + zip_add_file(zip, f, write_wb_xml(wb, opts)); + ct.workbooks.push(f); + add_rels(opts.rels, 1, f, RELS.WB); + + /* TODO: something more intelligent with themes */ + + f = "xl/theme/theme1.xml"; + zip_add_file(zip, f, write_theme(wb.Themes, opts)); + ct.themes.push(f); + add_rels(opts.wbrels, -1, "theme/theme1.xml", RELS.THEME); + + /* TODO: something more intelligent with styles */ + + f = "xl/styles." + wbext; + zip_add_file(zip, f, write_sty_xml(wb, opts)); + ct.styles.push(f); + add_rels(opts.wbrels, -1, "styles." + wbext, RELS.STY); + + if(wb.vbaraw && vbafmt) { + f = "xl/vbaProject.bin"; + zip_add_file(zip, f, wb.vbaraw); + ct.vba.push(f); + add_rels(opts.wbrels, -1, "vbaProject.bin", RELS.VBA); + } + + f = "xl/metadata." + wbext; + zip_add_file(zip, f, write_xlmeta_xml()); + ct.metadata.push(f); + add_rels(opts.wbrels, -1, "metadata." + wbext, RELS.XLMETA); + + if(people.length > 1) { + f = "xl/persons/person.xml"; + zip_add_file(zip, f, write_people_xml(people, opts)); + ct.people.push(f); + add_rels(opts.wbrels, -1, "persons/person.xml", RELS.PEOPLE); + } + + zip_add_file(zip, "[Content_Types].xml", write_ct(ct, opts)); + zip_add_file(zip, '_rels/.rels', write_rels(opts.rels)); + zip_add_file(zip, 'xl/_rels/workbook.' + wbext + '.rels', write_rels(opts.wbrels)); + + delete opts.revssf; delete opts.ssf; + return zip; +} + +function firstbyte(f/*:RawData*/,o/*:?TypeOpts*/)/*:Array*/ { + var x = ""; + switch((o||{}).type || "base64") { + case 'buffer': return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]]; + case 'base64': x = Base64_decode(f.slice(0,12)); break; + case 'binary': x = f; break; + case 'array': return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]]; + default: throw new Error("Unrecognized type " + (o && o.type || "undefined")); + } + return [x.charCodeAt(0), x.charCodeAt(1), x.charCodeAt(2), x.charCodeAt(3), x.charCodeAt(4), x.charCodeAt(5), x.charCodeAt(6), x.charCodeAt(7)]; +} + +function read_cfb(cfb/*:CFBContainer*/, opts/*:?ParseOpts*/)/*:Workbook*/ { + if(CFB.find(cfb, "EncryptedPackage")) return parse_xlsxcfb(cfb, opts); + return parse_xlscfb(cfb, opts); +} + +function read_zip(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ { + var zip, d = data; + var o = opts||{}; + if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; + zip = zip_read(d, o); + return parse_zip(zip, o); +} + +function read_plaintext(data/*:string*/, o/*:ParseOpts*/)/*:Workbook*/ { + var i = 0; + main: while(i < data.length) switch(data.charCodeAt(i)) { + case 0x0A: case 0x0D: case 0x20: ++i; break; + case 0x3C: return parse_xlml(data.slice(i),o); + default: break main; + } + return PRN.to_workbook(data, o); +} + +function read_plaintext_raw(data/*:RawData*/, o/*:ParseOpts*/)/*:Workbook*/ { + var str = "", bytes = firstbyte(data, o); + switch(o.type) { + case 'base64': str = Base64_decode(data); break; + case 'binary': str = data; break; + case 'buffer': str = data.toString('binary'); break; + case 'array': str = cc2str(data); break; + default: throw new Error("Unrecognized type " + o.type); + } + if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str); + o.type = "binary"; + return read_plaintext(str, o); +} + +function read_utf16(data/*:RawData*/, o/*:ParseOpts*/)/*:Workbook*/ { + var d = data; + if(o.type == 'base64') d = Base64_decode(d); + if(typeof ArrayBuffer !== "undefined" && data instanceof ArrayBuffer) d = new Uint8Array(data); + d = typeof $cptable !== "undefined" ? $cptable.utils.decode(1200, d.slice(2), 'str') : ( + (has_buf && Buffer.isBuffer(data)) ? data.slice(2).toString("utf16le") : + (typeof Uint8Array !== "undefined" && d instanceof Uint8Array) ? ( + typeof TextDecoder !== "undefined" ? new TextDecoder("utf-16le").decode(d.slice(2)) : utf16lereadu(d.slice(2)) + ) : utf16leread(d.slice(2)) + ); + o.type = "binary"; + return read_plaintext(d, o); +} + +function bstrify(data/*:string*/)/*:string*/ { + return !data.match(/[^\x00-\x7F]/) ? data : utf8write(data); +} + +function read_prn(data, d, o, str) { + if(str) { o.type = "string"; return PRN.to_workbook(data, o); } + return PRN.to_workbook(d, o); +} + +function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ { + reset_cp(); + var o = opts||{}; + if(o.codepage && typeof $cptable === "undefined") console.error("Codepage tables are not loaded. Non-ASCII characters may not give expected results"); + if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), (o = dup(o), o.type = "array", o)); + if(typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && !o.type) o.type = typeof Deno !== "undefined" ? "buffer" : "array"; + var d = data, n = [0,0,0,0], str = false; + if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; } + _ssfopts = {}; + if(o.dateNF) _ssfopts.dateNF = o.dateNF; + if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64"; + if(o.type == "file") { o.type = has_buf ? "buffer" : "binary"; d = read_binary(data); if(typeof Uint8Array !== 'undefined' && !has_buf) o.type = "array"; } + if(o.type == "string") { str = true; o.type = "binary"; o.codepage = 65001; d = bstrify(data); } + if(o.type == 'array' && typeof Uint8Array !== 'undefined' && data instanceof Uint8Array && typeof ArrayBuffer !== 'undefined') { + // $FlowIgnore + var ab=new ArrayBuffer(3), vu=new Uint8Array(ab); vu.foo="bar"; + // $FlowIgnore + if(!vu.foo) {o=dup(o); o.type='array'; return readSync(ab2a(d), o);} + } + switch((n = firstbyte(d, o))[0]) { + case 0xD0: if(n[1] === 0xCF && n[2] === 0x11 && n[3] === 0xE0 && n[4] === 0xA1 && n[5] === 0xB1 && n[6] === 0x1A && n[7] === 0xE1) return read_cfb(CFB.read(d, o), o); break; + case 0x09: if(n[1] <= 0x08) return parse_xlscfb(d, o); break; + case 0x3C: return parse_xlml(d, o); + case 0x49: + if(n[1] === 0x49 && n[2] === 0x2a && n[3] === 0x00) throw new Error("TIFF Image File is not a spreadsheet"); + if(n[1] === 0x44) return read_wb_ID(d, o); + break; + case 0x54: if(n[1] === 0x41 && n[2] === 0x42 && n[3] === 0x4C) return DIF.to_workbook(d, o); break; + case 0x50: return (n[1] === 0x4B && n[2] < 0x09 && n[3] < 0x09) ? read_zip(d, o) : read_prn(data, d, o, str); + case 0xEF: return n[3] === 0x3C ? parse_xlml(d, o) : read_prn(data, d, o, str); + case 0xFF: + if(n[1] === 0xFE) { return read_utf16(d, o); } + else if(n[1] === 0x00 && n[2] === 0x02 && n[3] === 0x00) return WK_.to_workbook(d, o); + break; + case 0x00: + if(n[1] === 0x00) { + if(n[2] >= 0x02 && n[3] === 0x00) return WK_.to_workbook(d, o); + if(n[2] === 0x00 && (n[3] === 0x08 || n[3] === 0x09)) return WK_.to_workbook(d, o); + } + break; + case 0x03: case 0x83: case 0x8B: case 0x8C: return DBF.to_workbook(d, o); + case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return rtf_to_workbook(d, o); break; + case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o); + case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break; + case 0x08: if(n[1] === 0xE7) throw new Error("Unsupported Multiplan 1.x file!"); break; + case 0x0C: + if(n[1] === 0xEC) throw new Error("Unsupported Multiplan 2.x file!"); + if(n[1] === 0xED) throw new Error("Unsupported Multiplan 3.x file!"); + break; + } + if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o); + return read_prn(data, d, o, str); +} + +function readFileSync(filename/*:string*/, opts/*:?ParseOpts*/)/*:Workbook*/ { + var o = opts||{}; o.type = 'file'; + return readSync(filename, o); +} +function write_cfb_ctr(cfb/*:CFBContainer*/, o/*:WriteOpts*/)/*:any*/ { + switch(o.type) { + case "base64": case "binary": break; + case "buffer": case "array": o.type = ""; break; + case "file": return write_dl(o.file, CFB.write(cfb, {type:has_buf ? 'buffer' : ""})); + case "string": throw new Error("'string' output type invalid for '" + o.bookType + "' files"); + default: throw new Error("Unrecognized type " + o.type); + } + return CFB.write(cfb, o); +} + +function write_zip(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ { + switch(opts.bookType) { + case "ods": return write_ods(wb, opts); + case "numbers": return write_numbers_iwa(wb, opts); + case "xlsb": return write_zip_xlsb(wb, opts); + default: return write_zip_xlsx(wb, opts); + } +} + +/*:: declare var encrypt_agile:any; */ +function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { + var o = dup(opts||{}); + var z = write_zip(wb, o); + return write_zip_denouement(z, o); +} +function write_zip_typeXLSX(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { + var o = dup(opts||{}); + var z = write_zip_xlsx(wb, o); + return write_zip_denouement(z, o); +} +function write_zip_denouement(z/*:any*/, o/*:?WriteOpts*/)/*:any*/ { + var oopts = {}; + var ftype = has_buf ? "nodebuffer" : (typeof Uint8Array !== "undefined" ? "array" : "string"); + if(o.compression) oopts.compression = 'DEFLATE'; + if(o.password) oopts.type = ftype; + else switch(o.type) { + case "base64": oopts.type = "base64"; break; + case "binary": oopts.type = "string"; break; + case "string": throw new Error("'string' output type invalid for '" + o.bookType + "' files"); + case "buffer": + case "file": oopts.type = ftype; break; + default: throw new Error("Unrecognized type " + o.type); + } + var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type, compression: !!o.compression}) : z.generate(oopts); + if(typeof Deno !== "undefined") { + if(typeof out == "string") { + if(o.type == "binary" || o.type == "base64") return out; + out = new Uint8Array(s2ab(out)); + } + } +/*jshint -W083 */ + if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef +/*jshint +W083 */ + if(o.type === "file") return write_dl(o.file, out); + return o.type == "string" ? utf8read(/*::(*/out/*:: :any)*/) : out; +} + +function write_cfb_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ { + var o = opts||{}; + var cfb/*:CFBContainer*/ = write_xlscfb(wb, o); + return write_cfb_ctr(cfb, o); +} + +function write_string_type(out/*:string*/, opts/*:WriteOpts*/, bom/*:?string*/)/*:any*/ { + if(!bom) bom = ""; + var o = bom + out; + switch(opts.type) { + case "base64": return Base64_encode(utf8write(o)); + case "binary": return utf8write(o); + case "string": return out; + case "file": return write_dl(opts.file, o, 'utf8'); + case "buffer": { + if(has_buf) return Buffer_from(o, 'utf8'); + else if(typeof TextEncoder !== "undefined") return new TextEncoder().encode(o); + else return write_string_type(o, {type:'binary'}).split("").map(function(c) { return c.charCodeAt(0); }); + } + } + throw new Error("Unrecognized type " + opts.type); +} + +function write_stxt_type(out/*:string*/, opts/*:WriteOpts*/)/*:any*/ { + switch(opts.type) { + case "base64": return Base64_encode_pass(out); + case "binary": return out; + case "string": return out; /* override in sheet_to_txt */ + case "file": return write_dl(opts.file, out, 'binary'); + case "buffer": { + if(has_buf) return Buffer_from(out, 'binary'); + else return out.split("").map(function(c) { return c.charCodeAt(0); }); + } + } + throw new Error("Unrecognized type " + opts.type); +} + +/* TODO: test consistency */ +function write_binary_type(out, opts/*:WriteOpts*/)/*:any*/ { + switch(opts.type) { + case "string": + case "base64": + case "binary": + var bstr = ""; + // $FlowIgnore + for(var i = 0; i < out.length; ++i) bstr += String.fromCharCode(out[i]); + return opts.type == 'base64' ? Base64_encode(bstr) : opts.type == 'string' ? utf8read(bstr) : bstr; + case "file": return write_dl(opts.file, out); + case "buffer": return out; + default: throw new Error("Unrecognized type " + opts.type); + } +} + +function writeSyncXLSX(wb/*:Workbook*/, opts/*:?WriteOpts*/) { + reset_cp(); + check_wb(wb); + var o = dup(opts||{}); + if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; } + if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSyncXLSX(wb, o)/*:any*/); o.type = "array"; return s2ab(out); } + return write_zip_typeXLSX(wb, o); +} + +function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) { + reset_cp(); + check_wb(wb); + var o = dup(opts||{}); + if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; } + if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type = "array"; return s2ab(out); } + var idx = 0; + if(o.sheet) { + if(typeof o.sheet == "number") idx = o.sheet; + else idx = wb.SheetNames.indexOf(o.sheet); + if(!wb.SheetNames[idx]) throw new Error("Sheet not found: " + o.sheet + " : " + (typeof o.sheet)); + } + switch(o.bookType || 'xlsb') { + case 'xml': + case 'xlml': return write_string_type(write_xlml(wb, o), o); + case 'slk': + case 'sylk': return write_string_type(SYLK.from_sheet(wb.Sheets[wb.SheetNames[idx]], o, wb), o); + case 'htm': + case 'html': return write_string_type(sheet_to_html(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'txt': return write_stxt_type(sheet_to_txt(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'csv': return write_string_type(sheet_to_csv(wb.Sheets[wb.SheetNames[idx]], o), o, "\ufeff"); + case 'dif': return write_string_type(DIF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'dbf': return write_binary_type(DBF.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'prn': return write_string_type(PRN.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'rtf': return write_string_type(sheet_to_rtf(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'eth': return write_string_type(ETH.from_sheet(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'fods': return write_string_type(write_ods(wb, o), o); + case 'wk1': return write_binary_type(WK_.sheet_to_wk1(wb.Sheets[wb.SheetNames[idx]], o), o); + case 'wk3': return write_binary_type(WK_.book_to_wk3(wb, o), o); + case 'biff2': if(!o.biff) o.biff = 2; /* falls through */ + case 'biff3': if(!o.biff) o.biff = 3; /* falls through */ + case 'biff4': if(!o.biff) o.biff = 4; return write_binary_type(write_biff_buf(wb, o), o); + case 'biff5': if(!o.biff) o.biff = 5; /* falls through */ + case 'biff8': + case 'xla': + case 'xls': if(!o.biff) o.biff = 8; return write_cfb_type(wb, o); + case 'xlsx': + case 'xlsm': + case 'xlam': + case 'xlsb': + case 'numbers': + case 'ods': return write_zip_type(wb, o); + default: throw new Error ("Unrecognized bookType |" + o.bookType + "|"); + } +} + +function resolve_book_type(o/*:WriteFileOpts*/) { + if(o.bookType) return; + var _BT = { + "xls": "biff8", + "htm": "html", + "slk": "sylk", + "socialcalc": "eth", + "Sh33tJS": "WTF" + }; + var ext = o.file.slice(o.file.lastIndexOf(".")).toLowerCase(); + if(ext.match(/^\.[a-z]+$/)) o.bookType = ext.slice(1); + o.bookType = _BT[o.bookType] || o.bookType; +} + +function writeFileSync(wb/*:Workbook*/, filename/*:string*/, opts/*:?WriteFileOpts*/) { + var o = opts||{}; o.type = 'file'; + o.file = filename; + resolve_book_type(o); + return writeSync(wb, o); +} + +function writeFileSyncXLSX(wb/*:Workbook*/, filename/*:string*/, opts/*:?WriteFileOpts*/) { + var o = opts||{}; o.type = 'file'; + o.file = filename; + resolve_book_type(o); + return writeSyncXLSX(wb, o); +} + + +function writeFileAsync(filename/*:string*/, wb/*:Workbook*/, opts/*:?WriteFileOpts*/, cb/*:?(e?:ErrnoError)=>void*/) { + var o = opts||{}; o.type = 'file'; + o.file = filename; + resolve_book_type(o); + o.type = 'buffer'; + var _cb = cb; if(!(_cb instanceof Function)) _cb = (opts/*:any*/); + return _fs.writeFile(filename, writeSync(wb, o), _cb); +} +/*:: +type MJRObject = { + row: any; + isempty: boolean; +}; +*/ +function make_json_row(sheet/*:Worksheet*/, r/*:Range*/, R/*:number*/, cols/*:Array*/, header/*:number*/, hdr/*:Array*/, o/*:Sheet2JSONOpts*/)/*:MJRObject*/ { + var rr = encode_row(R); + var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw"); + var isempty = true, dense = (sheet["!data"] != null); + var row/*:any*/ = (header === 1) ? [] : {}; + if(header !== 1) { + if(Object.defineProperty) try { Object.defineProperty(row, '__rowNum__', {value:R, enumerable:false}); } catch(e) { row.__rowNum__ = R; } + else row.__rowNum__ = R; + } + if(!dense || sheet["!data"][R]) for (var C = r.s.c; C <= r.e.c; ++C) { + var val = dense ? (sheet["!data"][R]||[])[C] : sheet[cols[C] + rr]; + if(val == null || val.t === undefined) { + if(defval === undefined) continue; + if(hdr[C] != null) { row[hdr[C]] = defval; } + continue; + } + var v = val.v; + switch(val.t){ + case 'z': if(v == null) break; continue; + case 'e': v = (v == 0 ? null : void 0); break; + case 's': case 'b': + case 'n': if(!val.z || !fmt_is_date(val.z)) break; + v = numdate(v); // TODO: date1904 setting should also be stored in worksheet object + if(typeof v == "number") break; + /* falls through */ + case 'd': if(!(o && o.UTC)) v = utc_to_local(v); break; + default: throw new Error('unrecognized type ' + val.t); + } + if(hdr[C] != null) { + if(v == null) { + if(val.t == "e" && v === null) row[hdr[C]] = null; + else if(defval !== undefined) row[hdr[C]] = defval; + else if(raw && v === null) row[hdr[C]] = null; + else continue; + } else { + row[hdr[C]] = raw && (val.t !== "n" || (val.t === "n" && o.rawNumbers !== false)) ? v : format_cell(val,v,o); + } + if(v != null) isempty = false; + } + } + return { row: row, isempty: isempty }; +} + + +function sheet_to_json(sheet/*:Worksheet*/, opts/*:?Sheet2JSONOpts*/) { + if(sheet == null || sheet["!ref"] == null) return []; + var val = {t:'n',v:0}, header = 0, offset = 1, hdr/*:Array*/ = [], v=0, vv=""; + var r = {s:{r:0,c:0},e:{r:0,c:0}}; + var o = opts || {}; + var range = o.range != null ? o.range : sheet["!ref"]; + if(o.header === 1) header = 1; + else if(o.header === "A") header = 2; + else if(Array.isArray(o.header)) header = 3; + else if(o.header == null) header = 0; + switch(typeof range) { + case 'string': r = safe_decode_range(range); break; + case 'number': r = safe_decode_range(sheet["!ref"]); r.s.r = range; break; + default: r = range; + } + if(header > 0) offset = 0; + var rr = encode_row(r.s.r); + var cols/*:Array*/ = []; + var out/*:Array*/ = []; + var outi = 0, counter = 0; + var dense = sheet["!data"] != null; + var R = r.s.r, C = 0; + var header_cnt = {}; + if(dense && !sheet["!data"][R]) sheet["!data"][R] = []; + var colinfo/*:Array*/ = o.skipHidden && sheet["!cols"] || []; + var rowinfo/*:Array*/ = o.skipHidden && sheet["!rows"] || []; + for(C = r.s.c; C <= r.e.c; ++C) { + if(((colinfo[C]||{}).hidden)) continue; + cols[C] = encode_col(C); + val = dense ? sheet["!data"][R][C] : sheet[cols[C] + rr]; + switch(header) { + case 1: hdr[C] = C - r.s.c; break; + case 2: hdr[C] = cols[C]; break; + case 3: hdr[C] = o.header[C - r.s.c]; break; + default: + if(val == null) val = {w: "__EMPTY", t: "s"}; + vv = v = format_cell(val, null, o); + counter = header_cnt[v] || 0; + if(!counter) header_cnt[v] = 1; + else { + do { vv = v + "_" + (counter++); } while(header_cnt[vv]); header_cnt[v] = counter; + header_cnt[vv] = 1; + } + hdr[C] = vv; + } + } + for (R = r.s.r + offset; R <= r.e.r; ++R) { + if ((rowinfo[R]||{}).hidden) continue; + var row = make_json_row(sheet, r, R, cols, header, hdr, o); + if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) out[outi++] = row.row; + } + out.length = outi; + return out; +} + +var qreg = /"/g; +function make_csv_row(sheet/*:Worksheet*/, r/*:Range*/, R/*:number*/, cols/*:Array*/, fs/*:number*/, rs/*:number*/, FS/*:string*/, o/*:Sheet2CSVOpts*/)/*:?string*/ { + var isempty = true; + var row/*:Array*/ = [], txt = "", rr = encode_row(R); + var dense = sheet["!data"] != null; + var datarow = dense && sheet["!data"][R] || []; + for(var C = r.s.c; C <= r.e.c; ++C) { + if (!cols[C]) continue; + var val = dense ? datarow[C]: sheet[cols[C] + rr]; + if(val == null) txt = ""; + else if(val.v != null) { + isempty = false; + txt = ''+(o.rawNumbers && val.t == "n" ? val.v : format_cell(val, null, o)); + for(var i = 0, cc = 0; i !== txt.length; ++i) if((cc = txt.charCodeAt(i)) === fs || cc === rs || cc === 34 || o.forceQuotes) {txt = "\"" + txt.replace(qreg, '""') + "\""; break; } + if(txt == "ID") txt = '"ID"'; + } else if(val.f != null && !val.F) { + isempty = false; + txt = '=' + val.f; if(txt.indexOf(",") >= 0) txt = '"' + txt.replace(qreg, '""') + '"'; + } else txt = ""; + /* NOTE: Excel CSV does not support array formulae */ + row.push(txt); + } + if(o.blankrows === false && isempty) return null; + return row.join(FS); +} + +function sheet_to_csv(sheet/*:Worksheet*/, opts/*:?Sheet2CSVOpts*/)/*:string*/ { + var out/*:Array*/ = []; + var o = opts == null ? {} : opts; + if(sheet == null || sheet["!ref"] == null) return ""; + var r = safe_decode_range(sheet["!ref"]); + var FS = o.FS !== undefined ? o.FS : ",", fs = FS.charCodeAt(0); + var RS = o.RS !== undefined ? o.RS : "\n", rs = RS.charCodeAt(0); + var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$"); + var row = "", cols/*:Array*/ = []; + var colinfo/*:Array*/ = o.skipHidden && sheet["!cols"] || []; + var rowinfo/*:Array*/ = o.skipHidden && sheet["!rows"] || []; + for(var C = r.s.c; C <= r.e.c; ++C) if (!((colinfo[C]||{}).hidden)) cols[C] = encode_col(C); + var w = 0; + for(var R = r.s.r; R <= r.e.r; ++R) { + if ((rowinfo[R]||{}).hidden) continue; + row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o); + if(row == null) { continue; } + if(o.strip) row = row.replace(endregex,""); + if(row || (o.blankrows !== false)) out.push((w++ ? RS : "") + row); + } + return out.join(""); +} + +function sheet_to_txt(sheet/*:Worksheet*/, opts/*:?Sheet2CSVOpts*/) { + if(!opts) opts = {}; opts.FS = "\t"; opts.RS = "\n"; + var s = sheet_to_csv(sheet, opts); + if(typeof $cptable == 'undefined' || opts.type == 'string') return s; + var o = $cptable.utils.encode(1200, s, 'str'); + return String.fromCharCode(255) + String.fromCharCode(254) + o; +} + +function sheet_to_formulae(sheet/*:Worksheet*/)/*:Array*/ { + var y = "", x, val=""; + if(sheet == null || sheet["!ref"] == null) return []; + var r = safe_decode_range(sheet['!ref']), rr = "", cols/*:Array*/ = [], C; + var cmds/*:Array*/ = []; + var dense = sheet["!data"] != null; + for(C = r.s.c; C <= r.e.c; ++C) cols[C] = encode_col(C); + for(var R = r.s.r; R <= r.e.r; ++R) { + rr = encode_row(R); + for(C = r.s.c; C <= r.e.c; ++C) { + y = cols[C] + rr; + x = dense ? (sheet["!data"][R]||[])[C] : sheet[y]; + val = ""; + if(x === undefined) continue; + else if(x.F != null) { + y = x.F; + if(!x.f) continue; + val = x.f; + if(y.indexOf(":") == -1) y = y + ":" + y; + } + if(x.f != null) val = x.f; + else if(x.t == 'z') continue; + else if(x.t == 'n' && x.v != null) val = "" + x.v; + else if(x.t == 'b') val = x.v ? "TRUE" : "FALSE"; + else if(x.w !== undefined) val = "'" + x.w; + else if(x.v === undefined) continue; + else if(x.t == 's') val = "'" + x.v; + else val = ""+x.v; + cmds[cmds.length] = y + "=" + val; + } + } + return cmds; +} + +function sheet_add_json(_ws/*:?Worksheet*/, js/*:Array*/, opts)/*:Worksheet*/ { + var o = opts || {}; + var dense = _ws ? (_ws["!data"] != null) : o.dense; + if(DENSE != null && dense == null) dense = DENSE; + var offset = +!o.skipHeader; + var ws/*:Worksheet*/ = _ws || ({}); + if(!_ws && dense) ws["!data"] = []; + var _R = 0, _C = 0; + if(ws && o.origin != null) { + if(typeof o.origin == 'number') _R = o.origin; + else { + var _origin/*:CellAddress*/ = typeof o.origin == "string" ? decode_cell(o.origin) : o.origin; + _R = _origin.r; _C = _origin.c; + } + } + var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:_C, r:_R + js.length - 1 + offset}}/*:any*/); + if(ws['!ref']) { + var _range = safe_decode_range(ws['!ref']); + range.e.c = Math.max(range.e.c, _range.e.c); + range.e.r = Math.max(range.e.r, _range.e.r); + if(_R == -1) { _R = _range.e.r + 1; range.e.r = _R + js.length - 1 + offset; } + } else { + if(_R == -1) { _R = 0; range.e.r = js.length - 1 + offset; } + } + var hdr/*:Array*/ = o.header || [], C = 0; + var ROW = []; + js.forEach(function (JS, R/*:number*/) { + if(dense && !ws["!data"][_R + R + offset]) ws["!data"][_R + R + offset] = []; + if(dense) ROW = ws["!data"][_R + R + offset]; + keys(JS).forEach(function(k) { + if((C=hdr.indexOf(k)) == -1) hdr[C=hdr.length] = k; + var v = JS[k]; + var t = 'z'; + var z = ""; + var ref = dense ? "" : (encode_col(_C + C) + encode_row(_R + R + offset)); + var cell/*:Cell*/ = dense ? ROW[_C + C] : ws[ref]; + if(v && typeof v === 'object' && !(v instanceof Date)){ + if(dense) ROW[_C + C] = v; + else ws[ref] = v; + } else { + if(typeof v == 'number') t = 'n'; + else if(typeof v == 'boolean') t = 'b'; + else if(typeof v == 'string') t = 's'; + else if(v instanceof Date) { + t = 'd'; + if(!o.UTC) v = local_to_utc(v); + if(!o.cellDates) { t = 'n'; v = datenum(v); } + z = (cell != null && cell.z && fmt_is_date(cell.z)) ? cell.z : (o.dateNF || table_fmt[14]); + } + else if(v === null && o.nullError) { t = 'e'; v = 0; } + if(!cell) { + if(!dense) ws[ref] = cell = ({t:t, v:v}/*:any*/); + else ROW[_C + C] = cell = ({t:t, v:v}/*:any*/); + } else { + cell.t = t; cell.v = v; + delete cell.w; delete cell.R; + if(z) cell.z = z; + } + if(z) cell.z = z; + } + }); + }); + range.e.c = Math.max(range.e.c, _C + hdr.length - 1); + var __R = encode_row(_R); + if(dense && !ws["!data"][_R]) ws["!data"][_R] = []; + if(offset) for(C = 0; C < hdr.length; ++C) { + if(dense) ws["!data"][_R][C + _C] = {t:'s', v:hdr[C]}; + else ws[encode_col(C + _C) + __R] = {t:'s', v:hdr[C]}; + } + ws['!ref'] = encode_range(range); + return ws; +} +function json_to_sheet(js/*:Array*/, opts)/*:Worksheet*/ { return sheet_add_json(null, js, opts); } + +/* get cell, creating a stub if necessary */ +function ws_get_cell_stub(ws/*:Worksheet*/, R, C/*:?number*/)/*:Cell*/ { + /* A1 cell address */ + if(typeof R == "string") { + if(ws["!data"] != null) { + var RC = decode_cell(R); + if(!ws["!data"][RC.r]) ws["!data"][RC.r] = []; + return ws["!data"][RC.r][RC.c] || (ws["!data"][RC.r][RC.c] = {t:'z'}); + } + return ws[R] || (ws[R] = {t:'z'}); + } + /* cell address object */ + if(typeof R != "number") return ws_get_cell_stub(ws, encode_cell(R)); + /* R and C are 0-based indices */ + return ws_get_cell_stub(ws, encode_col(C||0) + encode_row(R)); +} + +/* find sheet index for given name / validate index */ +function wb_sheet_idx(wb/*:Workbook*/, sh/*:number|string*/) { + if(typeof sh == "number") { + if(sh >= 0 && wb.SheetNames.length > sh) return sh; + throw new Error("Cannot find sheet # " + sh); + } else if(typeof sh == "string") { + var idx = wb.SheetNames.indexOf(sh); + if(idx > -1) return idx; + throw new Error("Cannot find sheet name |" + sh + "|"); + } else throw new Error("Cannot find sheet |" + sh + "|"); +} + +/* simple blank workbook object */ +function book_new()/*:Workbook*/ { + return { SheetNames: [], Sheets: {} }; +} + +/* add a worksheet to the end of a given workbook */ +function book_append_sheet(wb/*:Workbook*/, ws/*:Worksheet*/, name/*:?string*/, roll/*:?boolean*/)/*:string*/ { + var i = 1; + if(!name) for(; i <= 0xFFFF; ++i, name = undefined) if(wb.SheetNames.indexOf(name = "Sheet" + i) == -1) break; + if(!name || wb.SheetNames.length >= 0xFFFF) throw new Error("Too many worksheets"); + if(roll && wb.SheetNames.indexOf(name) >= 0) { + var m = name.match(/(^.*?)(\d+)$/); + i = m && +m[2] || 0; + var root = m && m[1] || name; + for(++i; i <= 0xFFFF; ++i) if(wb.SheetNames.indexOf(name = root + i) == -1) break; + } + check_ws_name(name); + if(wb.SheetNames.indexOf(name) >= 0) throw new Error("Worksheet with name |" + name + "| already exists!"); + + wb.SheetNames.push(name); + wb.Sheets[name] = ws; + return name; +} + +/* set sheet visibility (visible/hidden/very hidden) */ +function book_set_sheet_visibility(wb/*:Workbook*/, sh/*:number|string*/, vis/*:number*/) { + if(!wb.Workbook) wb.Workbook = {}; + if(!wb.Workbook.Sheets) wb.Workbook.Sheets = []; + + var idx = wb_sheet_idx(wb, sh); + // $FlowIgnore + if(!wb.Workbook.Sheets[idx]) wb.Workbook.Sheets[idx] = {}; + + switch(vis) { + case 0: case 1: case 2: break; + default: throw new Error("Bad sheet visibility setting " + vis); + } + // $FlowIgnore + wb.Workbook.Sheets[idx].Hidden = vis; +} + +/* set number format */ +function cell_set_number_format(cell/*:Cell*/, fmt/*:string|number*/) { + cell.z = fmt; + return cell; +} + +/* set cell hyperlink */ +function cell_set_hyperlink(cell/*:Cell*/, target/*:string*/, tooltip/*:?string*/) { + if(!target) { + delete cell.l; + } else { + cell.l = ({ Target: target }/*:Hyperlink*/); + if(tooltip) cell.l.Tooltip = tooltip; + } + return cell; +} +function cell_set_internal_link(cell/*:Cell*/, range/*:string*/, tooltip/*:?string*/) { return cell_set_hyperlink(cell, "#" + range, tooltip); } + +/* add to cell comments */ +function cell_add_comment(cell/*:Cell*/, text/*:string*/, author/*:?string*/) { + if(!cell.c) cell.c = []; + cell.c.push({t:text, a:author||"SheetJS"}); +} + +/* set array formula and flush related cells */ +function sheet_set_array_formula(ws/*:Worksheet*/, range, formula/*:string*/, dynamic/*:boolean*/) { + var rng = typeof range != "string" ? range : safe_decode_range(range); + var rngstr = typeof range == "string" ? range : encode_range(range); + for(var R = rng.s.r; R <= rng.e.r; ++R) for(var C = rng.s.c; C <= rng.e.c; ++C) { + var cell = ws_get_cell_stub(ws, R, C); + cell.t = 'n'; + cell.F = rngstr; + delete cell.v; + if(R == rng.s.r && C == rng.s.c) { + cell.f = formula; + if(dynamic) cell.D = true; + } + } + var wsr = decode_range(ws["!ref"]); + if(wsr.s.r > rng.s.r) wsr.s.r = rng.s.r; + if(wsr.s.c > rng.s.c) wsr.s.c = rng.s.c; + if(wsr.e.r < rng.e.r) wsr.e.r = rng.e.r; + if(wsr.e.c < rng.e.c) wsr.e.c = rng.e.c; + ws["!ref"] = encode_range(wsr); + return ws; +} + +var utils/*:any*/ = { + encode_col: encode_col, + encode_row: encode_row, + encode_cell: encode_cell, + encode_range: encode_range, + decode_col: decode_col, + decode_row: decode_row, + split_cell: split_cell, + decode_cell: decode_cell, + decode_range: decode_range, + format_cell: format_cell, + sheet_add_aoa: sheet_add_aoa, + sheet_add_json: sheet_add_json, + sheet_add_dom: sheet_add_dom, + aoa_to_sheet: aoa_to_sheet, + json_to_sheet: json_to_sheet, + table_to_sheet: parse_dom_table, + table_to_book: table_to_book, + sheet_to_csv: sheet_to_csv, + sheet_to_txt: sheet_to_txt, + sheet_to_json: sheet_to_json, + sheet_to_html: sheet_to_html, + sheet_to_formulae: sheet_to_formulae, + sheet_to_row_object_array: sheet_to_json, + sheet_get_cell: ws_get_cell_stub, + book_new: book_new, + book_append_sheet: book_append_sheet, + book_set_sheet_visibility: book_set_sheet_visibility, + cell_set_number_format: cell_set_number_format, + cell_set_hyperlink: cell_set_hyperlink, + cell_set_internal_link: cell_set_internal_link, + cell_add_comment: cell_add_comment, + sheet_set_array_formula: sheet_set_array_formula, + consts: { + SHEET_VISIBLE: 0, + SHEET_HIDDEN: 1, + SHEET_VERY_HIDDEN: 2 + } +}; + +var _Readable; +function set_readable(R) { _Readable = R; } + +function write_csv_stream(sheet/*:Worksheet*/, opts/*:?Sheet2CSVOpts*/) { + var stream = _Readable(); + var o = opts == null ? {} : opts; + if(sheet == null || sheet["!ref"] == null) { stream.push(null); return stream; } + var r = safe_decode_range(sheet["!ref"]); + var FS = o.FS !== undefined ? o.FS : ",", fs = FS.charCodeAt(0); + var RS = o.RS !== undefined ? o.RS : "\n", rs = RS.charCodeAt(0); + var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$"); + var row/*:?string*/ = "", cols/*:Array*/ = []; + var colinfo/*:Array*/ = o.skipHidden && sheet["!cols"] || []; + var rowinfo/*:Array*/ = o.skipHidden && sheet["!rows"] || []; + for(var C = r.s.c; C <= r.e.c; ++C) if (!((colinfo[C]||{}).hidden)) cols[C] = encode_col(C); + var R = r.s.r; + var BOM = false, w = 0; + stream._read = function() { + if(!BOM) { BOM = true; return stream.push("\uFEFF"); } + while(R <= r.e.r) { + ++R; + if ((rowinfo[R-1]||{}).hidden) continue; + row = make_csv_row(sheet, r, R-1, cols, fs, rs, FS, o); + if(row != null) { + if(o.strip) row = row.replace(endregex,""); + if(row || (o.blankrows !== false)) return stream.push((w++ ? RS : "") + row); + } + } + return stream.push(null); + }; + return stream; +} + +function write_html_stream(ws/*:Worksheet*/, opts/*:?Sheet2HTMLOpts*/) { + var stream = _Readable(); + + var o = opts || {}; + var header = o.header != null ? o.header : HTML_BEGIN; + var footer = o.footer != null ? o.footer : HTML_END; + stream.push(header); + var r = decode_range(ws['!ref']); + stream.push(make_html_preamble(ws, r, o)); + var R = r.s.r; + var end = false; + stream._read = function() { + if(R > r.e.r) { + if(!end) { end = true; stream.push("" + footer); } + return stream.push(null); + } + while(R <= r.e.r) { + stream.push(make_html_row(ws, r, R, o)); + ++R; + break; + } + }; + return stream; +} + +function write_json_stream(sheet/*:Worksheet*/, opts/*:?Sheet2CSVOpts*/) { + var stream = _Readable({objectMode:true}); + + if(sheet == null || sheet["!ref"] == null) { stream.push(null); return stream; } + var val = {t:'n',v:0}, header = 0, offset = 1, hdr/*:Array*/ = [], v=0, vv=""; + var r = {s:{r:0,c:0},e:{r:0,c:0}}; + var o = opts || {}; + var range = o.range != null ? o.range : sheet["!ref"]; + if(o.header === 1) header = 1; + else if(o.header === "A") header = 2; + else if(Array.isArray(o.header)) header = 3; + switch(typeof range) { + case 'string': r = safe_decode_range(range); break; + case 'number': r = safe_decode_range(sheet["!ref"]); r.s.r = range; break; + default: r = range; + } + if(header > 0) offset = 0; + var rr = encode_row(r.s.r); + var cols/*:Array*/ = []; + var counter = 0; + var dense = sheet["!data"] != null; + var R = r.s.r, C = 0; + var header_cnt = {}; + if(dense && !sheet["!data"][R]) sheet["!data"][R] = []; + var colinfo/*:Array*/ = o.skipHidden && sheet["!cols"] || []; + var rowinfo/*:Array*/ = o.skipHidden && sheet["!rows"] || []; + for(C = r.s.c; C <= r.e.c; ++C) { + if(((colinfo[C]||{}).hidden)) continue; + cols[C] = encode_col(C); + val = dense ? sheet["!data"][R][C] : sheet[cols[C] + rr]; + switch(header) { + case 1: hdr[C] = C - r.s.c; break; + case 2: hdr[C] = cols[C]; break; + case 3: hdr[C] = o.header[C - r.s.c]; break; + default: + if(val == null) val = {w: "__EMPTY", t: "s"}; + vv = v = format_cell(val, null, o); + counter = header_cnt[v] || 0; + if(!counter) header_cnt[v] = 1; + else { + do { vv = v + "_" + (counter++); } while(header_cnt[vv]); header_cnt[v] = counter; + header_cnt[vv] = 1; + } + hdr[C] = vv; + } + } + R = r.s.r + offset; + stream._read = function() { + while(R <= r.e.r) { + if ((rowinfo[R-1]||{}).hidden) continue; + var row = make_json_row(sheet, r, R, cols, header, hdr, o); + ++R; + if((row.isempty === false) || (header === 1 ? o.blankrows !== false : !!o.blankrows)) { + stream.push(row.row); + return; + } + } + return stream.push(null); + }; + return stream; +} + +var __stream = { + to_json: write_json_stream, + to_html: write_html_stream, + to_csv: write_csv_stream, + set_readable: set_readable +}; +export const version = XLSX.version; +export { + parse_xlscfb, + parse_zip, + readSync as read, + readFileSync as readFile, + readFileSync, + writeSync as write, + writeFileSync as writeFile, + writeFileSync, + writeFileAsync, + writeSyncXLSX as writeXLSX, + writeFileSyncXLSX as writeFileXLSX, + utils, + set_fs, + set_cptable, + __stream as stream, + SSF, + CFB +}; +export default { + parse_xlscfb, + parse_zip, + read: readSync, + readFile: readFileSync, + readFileSync, + write: writeSync, + writeFile: writeFileSync, + writeFileSync, + writeFileAsync, + writeXLSX: writeSyncXLSX, + writeFileXLSX: writeFileSyncXLSX, + utils, + set_fs, + set_cptable, + stream: __stream, + SSF, + CFB +} \ No newline at end of file diff --git a/PWA/src/FetchEventHandlers/BeneficiaryDataUploadHandler.ts b/PWA/src/FetchEventHandlers/BeneficiaryDataUploadHandler.ts new file mode 100644 index 0000000..79f7dd9 --- /dev/null +++ b/PWA/src/FetchEventHandlers/BeneficiaryDataUploadHandler.ts @@ -0,0 +1,23 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { Database } from "../Services/Database.js"; +import { BenificiarySpreadSheetRowsDeserializationService } from "../Services/BenificiarySpreadSheetRowsDeserializationService.js"; + +export class BeneficiaryDataUploadHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith("/uploader"); + } + + async handleEvent(event: FetchEvent): Promise { + try { + const beneficiaries = await BenificiarySpreadSheetRowsDeserializationService.deserializeFormDataFromRequest(event.request) + await beneficiaries.forEach(async (benificiary) => await Database.instance.addBenificiary(benificiary)) + ; + } catch(error) { + console.log("something went wrong " + error); + return fetch(RouteEvents.home); + } + return fetch(RouteEvents.home); + } +} diff --git a/PWA/src/FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.ts b/PWA/src/FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.ts new file mode 100644 index 0000000..3abea2e --- /dev/null +++ b/PWA/src/FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.ts @@ -0,0 +1,14 @@ +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { RouteEvents } from "../RouteEvents.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; + +export class ChooseBenificiaryCodeInputMethodHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith(RouteEvents.chooseBenificiaryCodeInputMethod); + } + + async handleEvent(event: FetchEvent): Promise { + return ResponseTools.wrapInHtmlTemplate(RouteEvents.chooseBenificiaryCodeInputMethodPage) + } + } \ No newline at end of file diff --git a/PWA/src/FetchEventHandlers/CreateDistributionRequestHandler.ts b/PWA/src/FetchEventHandlers/CreateDistributionRequestHandler.ts new file mode 100644 index 0000000..bfafe44 --- /dev/null +++ b/PWA/src/FetchEventHandlers/CreateDistributionRequestHandler.ts @@ -0,0 +1,48 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { Distribution } from "../Models/Distribution.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; +import { DeserialisationService } from "../Services/DeserialisationService.js"; +import { BenificiaryInfoService } from "../Services/BenificiaryInfoService.js"; + +export class CreateDistributionRequestHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith(RouteEvents.postCreateDistribution); + } + + async handleEvent(event: FetchEvent): Promise { + const distribution: Distribution = await DeserialisationService.deserializeFormDataFromRequest(event.request) + + try { + await Database.instance.addDistribution(distribution) + } catch { + console.log("something went wrong") + } + + if ( + !this.isFilled(distribution.distrib_name) || + !this.isFilled(distribution.distrib_place) || + !this.isFilled(distribution.distrib_date) + ) { + return ResponseTools.replaceTemplateKeysWithValues( + await caches.match(RouteEvents.nameDistribution) as Response, + { errorMessages: ["Specify the name, location and date of the distribution."] } + ) + } else { + return await ResponseTools.replaceTemplateKeysWithValues( + await fetch(RouteEvents.distributionsHome), { + "distrib_name": distribution.distrib_name, + "distrib_place": distribution.distrib_place, + "distrib_date": distribution.distrib_date, + beneficiary_info: await BenificiaryInfoService.benificiaryInfoTextFromDistribution(distribution) + } + ) + } + } + + isFilled(field: String): Boolean { + return field.length != 0; + } +} \ No newline at end of file diff --git a/PWA/src/FetchEventHandlers/DeleteDistributionPostHandler.ts b/PWA/src/FetchEventHandlers/DeleteDistributionPostHandler.ts new file mode 100644 index 0000000..e48b194 --- /dev/null +++ b/PWA/src/FetchEventHandlers/DeleteDistributionPostHandler.ts @@ -0,0 +1,21 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { Database } from "../Services/Database.js"; +import { DeserialisationService } from "../Services/DeserialisationService.js"; +import { DeleteDistributionPost } from "../Models/DeleteDistributionPost.js"; + +export class DeleteDistributionPostHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith(RouteEvents.postDeleteDistribution); + } + + async handleEvent(event: FetchEvent): Promise { + const post: DeleteDistributionPost = await DeserialisationService.deserializeFormDataFromRequest(event.request) + const distributionToDelete = (await Database.instance.distributionsWithName(post.distrib_id))[0] + + await Database.instance.deleteDistributionWithName(distributionToDelete.distrib_name) + + return fetch(RouteEvents.home) + } +} diff --git a/PWA/src/FetchEventHandlers/DeleteDistributionRequestHandler.ts b/PWA/src/FetchEventHandlers/DeleteDistributionRequestHandler.ts new file mode 100644 index 0000000..2bccf6e --- /dev/null +++ b/PWA/src/FetchEventHandlers/DeleteDistributionRequestHandler.ts @@ -0,0 +1,27 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { Distribution } from "../Models/Distribution.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; + +export class DeleteDistributionRequestHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith(RouteEvents.deleteDistribution); + } + + async handleEvent(event: FetchEvent): Promise { + try { + const distributions: [Distribution] = await Database.instance.readDistributions() + console.log(distributions) + return ResponseTools.replaceTemplateKeysWithValues( + await fetch(RouteEvents.deleteDistribution), { + columns: Distribution.colums, + rows: distributions + }) + } catch { + console.log("something went wrong") + } + return fetch(RouteEvents.home) + } +} diff --git a/PWA/src/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/FetchEventHandlers/FetchEventHandlers.ts new file mode 100644 index 0000000..2d33586 --- /dev/null +++ b/PWA/src/FetchEventHandlers/FetchEventHandlers.ts @@ -0,0 +1,38 @@ +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { CreateDistributionRequestHandler } from "./CreateDistributionRequestHandler.js"; +import { NameDistributionRequestHandler } from "./NameDistributionRequestHandler.js"; +import { ListDistributionRequestHandler } from "./ListDistributionRequestHandler.js"; +import { SelectDistributionRequestHandler } from "./SelectDistributionRequestHandler.js"; +import { DeleteDistributionRequestHandler } from "./DeleteDistributionRequestHandler.js"; +import { UploadDataHandler } from "./UploadDataHandler.js"; +import { BeneficiaryDataUploadHandler } from "./BeneficiaryDataUploadHandler.js" +import { DeleteDistributionPostHandler } from "./DeleteDistributionPostHandler.js"; +import { ChooseBenificiaryCodeInputMethodHandler } from "./ChooseBenificiaryCodeInputMethodHandler.js"; + +export class FetchEventHandlers implements FetchEventHandler { + all: FetchEventHandler[] = [ + new CreateDistributionRequestHandler(), + new NameDistributionRequestHandler(), + new ListDistributionRequestHandler(), + new SelectDistributionRequestHandler(), + new DeleteDistributionRequestHandler(), + new DeleteDistributionPostHandler(), + new UploadDataHandler(), + new BeneficiaryDataUploadHandler(), + new ChooseBenificiaryCodeInputMethodHandler() + ]; + + handlersForEvent(event: FetchEvent): FetchEventHandler[] { + return this.all.filter((handler) => handler.canHandleEvent(event)); + } + + canHandleEvent(event: FetchEvent): boolean { + return this.handlersForEvent(event).length > 0; + } + + handleEvent(event: FetchEvent): Promise { + console.log("Will handle " + event.request.url) + return this.handlersForEvent(event)?.[0].handleEvent(event); + } +} diff --git a/PWA/src/FetchEventHandlers/ListDistributionRequestHandler.ts b/PWA/src/FetchEventHandlers/ListDistributionRequestHandler.ts new file mode 100644 index 0000000..ad49fa6 --- /dev/null +++ b/PWA/src/FetchEventHandlers/ListDistributionRequestHandler.ts @@ -0,0 +1,28 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { Distribution } from "../Models/Distribution.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database, ObjectStoreName } from "../Services/Database.js"; + +export class ListDistributionRequestHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + const url = event.request.url + return url.endsWith(RouteEvents.listDistributions) || url.endsWith(RouteEvents.listDistributionsFormAction) + } + + async handleEvent(event: FetchEvent): Promise { + try { + const distributions: [Distribution] = await Database.instance.readDistributions() + console.log(distributions) + return ResponseTools.replaceTemplateKeysWithValues( + await fetch(RouteEvents.listDistributions), { + columns: Distribution.colums, + rows: distributions + }) + } catch { + console.log("something went wrong") + } + return fetch(RouteEvents.home) + } +} diff --git a/PWA/src/FetchEventHandlers/NameDistributionRequestHandler.ts b/PWA/src/FetchEventHandlers/NameDistributionRequestHandler.ts new file mode 100644 index 0000000..fe237b2 --- /dev/null +++ b/PWA/src/FetchEventHandlers/NameDistributionRequestHandler.ts @@ -0,0 +1,17 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; + +export class NameDistributionRequestHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith(RouteEvents.nameDistribution); + } + + async handleEvent(event: FetchEvent): Promise { + return ResponseTools.replaceTemplateKeysWithValues( + await caches.match(event.request) as Response, + { errorMessages: [] } + ) + } +} \ No newline at end of file diff --git a/PWA/src/FetchEventHandlers/SelectDistributionRequestHandler.ts b/PWA/src/FetchEventHandlers/SelectDistributionRequestHandler.ts new file mode 100644 index 0000000..7e34ce1 --- /dev/null +++ b/PWA/src/FetchEventHandlers/SelectDistributionRequestHandler.ts @@ -0,0 +1,32 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; +import { SelectDistributionPost } from "../Models/SelectDistributionPost.js"; +import { ResponseTools } from "../Services/ResponseTools.js"; +import { Database } from "../Services/Database.js"; +import { DeserialisationService } from "../Services/DeserialisationService.js"; +import { BenificiaryInfoService } from "../Services/BenificiaryInfoService.js"; + +export class SelectDistributionRequestHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith(RouteEvents.postSelectDistribution); + } + + async handleEvent(event: FetchEvent): Promise { + const post: SelectDistributionPost = await DeserialisationService.deserializeFormDataFromRequest(event.request) + const selectedDistribution = (await Database.instance.distributionsWithName(post.distrib_name))[0] + + return await ResponseTools.replaceTemplateKeysWithValues( + await fetch(RouteEvents.distributionsHome), { + "distrib_name": selectedDistribution.distrib_name, + "distrib_place": selectedDistribution.distrib_place, + "distrib_date": selectedDistribution.distrib_date, + beneficiary_info: await BenificiaryInfoService.benificiaryInfoTextFromDistribution(selectedDistribution) + } + ) + } + + isFilled(field: String): Boolean { + return field.length != 0; + } +} diff --git a/PWA/src/FetchEventHandlers/UploadDataHandler.ts b/PWA/src/FetchEventHandlers/UploadDataHandler.ts new file mode 100644 index 0000000..a43ea32 --- /dev/null +++ b/PWA/src/FetchEventHandlers/UploadDataHandler.ts @@ -0,0 +1,13 @@ +import { RouteEvents } from "../RouteEvents.js"; +import { FetchEvent } from "../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../Interfaces/FetchEventHandler.js"; + +export class UploadDataHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith("/upload_data?"); + } + + async handleEvent(event: FetchEvent): Promise { + return fetch(RouteEvents.uploadData) + } +} diff --git a/PWA/src/Interfaces/FetchEvent.ts b/PWA/src/Interfaces/FetchEvent.ts new file mode 100644 index 0000000..3b9e783 --- /dev/null +++ b/PWA/src/Interfaces/FetchEvent.ts @@ -0,0 +1,4 @@ +export interface FetchEvent { + request: Request; + respondWith(response: any): void; +} diff --git a/PWA/src/Interfaces/FetchEventHandler.ts b/PWA/src/Interfaces/FetchEventHandler.ts new file mode 100644 index 0000000..74020cd --- /dev/null +++ b/PWA/src/Interfaces/FetchEventHandler.ts @@ -0,0 +1,6 @@ +import { FetchEvent } from "./FetchEvent.js"; + +export interface FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean; + handleEvent(event: FetchEvent): Promise; +} diff --git a/PWA/src/Models/BenificiarySpreadSheetRow.ts b/PWA/src/Models/BenificiarySpreadSheetRow.ts new file mode 100644 index 0000000..c4fb13d --- /dev/null +++ b/PWA/src/Models/BenificiarySpreadSheetRow.ts @@ -0,0 +1,10 @@ +export class BenificiarySpreadSheetRow { + comma_separated_cells: string + + constructor( + comma_separated_cells: string + ) { + this.comma_separated_cells = comma_separated_cells + } +} + \ No newline at end of file diff --git a/PWA/src/Models/DeleteDistributionPost.ts b/PWA/src/Models/DeleteDistributionPost.ts new file mode 100644 index 0000000..871cf7c --- /dev/null +++ b/PWA/src/Models/DeleteDistributionPost.ts @@ -0,0 +1,9 @@ +export class DeleteDistributionPost { + distrib_id: string + + constructor( + distrib_id: string + ) { + this.distrib_id = distrib_id + } +} \ No newline at end of file diff --git a/PWA/src/Models/Distribution.ts b/PWA/src/Models/Distribution.ts new file mode 100644 index 0000000..8cfd0a8 --- /dev/null +++ b/PWA/src/Models/Distribution.ts @@ -0,0 +1,26 @@ +export class Distribution { + distrib_items: string; + distrib_date: string; + distrib_place: string; + distrib_name: string; + + constructor( + distrib_items: string, + distrib_date: string, + distrib_place: string, + distrib_name: string + ) { + this.distrib_date = distrib_date + this.distrib_items = distrib_items + this.distrib_place = distrib_place + this.distrib_name = distrib_name + } + + static colums: string[] = [ + "Name", + "Location", + "Date", + "Items Distributed", + "Donor", + ] +} \ No newline at end of file diff --git a/PWA/src/Models/SelectDistributionPost.ts b/PWA/src/Models/SelectDistributionPost.ts new file mode 100644 index 0000000..31b75d5 --- /dev/null +++ b/PWA/src/Models/SelectDistributionPost.ts @@ -0,0 +1,9 @@ +export class SelectDistributionPost { + distrib_name: string + + constructor( + distrib_name: string + ) { + this.distrib_name = distrib_name + } +} \ No newline at end of file diff --git a/PWA/src/RouteEvents.ts b/PWA/src/RouteEvents.ts new file mode 100644 index 0000000..38a0603 --- /dev/null +++ b/PWA/src/RouteEvents.ts @@ -0,0 +1,18 @@ +export class RouteEvents { + static home = "/index.html" + static distributionsHome = "/distrib.html" + static nameDistribution = "/name_distrib.html" + static listDistributions = "/list_distrib.html" + static deleteDistribution = "/list_distrib_delete.html" + static uploadData = "/upload_data.html" + static uploadDataError = "/upload_error.html" + static template = "/template.html" + static chooseBenificiaryCodeInputMethodPage = "/choose_input_method.html" + + //Non page route events + static postCreateDistribution = "/create_distrib" + static postSelectDistribution = "/select_distrib" + static postDeleteDistribution = "/delete_distrib_confirm" + static listDistributionsFormAction = "/distrib?" + static chooseBenificiaryCodeInputMethod = "/choose_input_method" + } \ No newline at end of file diff --git a/PWA/src/Services/BenificiaryInfoService.ts b/PWA/src/Services/BenificiaryInfoService.ts new file mode 100644 index 0000000..9b1ba9f --- /dev/null +++ b/PWA/src/Services/BenificiaryInfoService.ts @@ -0,0 +1,15 @@ +import { BenificiarySpreadSheetRow } from "../Models/BenificiarySpreadSheetRow.js" +import { Distribution } from "../Models/Distribution.js" + +export class BenificiaryInfoService { + static async benificiaryInfoTextFromDistribution(distribution: Distribution): Promise { + const benificiaries: BenificiarySpreadSheetRow[] = [new BenificiarySpreadSheetRow("one, two")] //await Database.instance.benificiariesForDistribution(distribution) + const numberOfServedBenificiaries = 42 //TODO: implement proper calculation + if(benificiaries.length > 0) { + //Beneficiaries served: {{ number_recipients }} / {{ number_beneficiaries }} + return "Beneficiaries served: " + numberOfServedBenificiaries + } else { + return "No beneficiary data found" + } + } + } \ No newline at end of file diff --git a/PWA/src/Services/BenificiaryJsonValidator.ts b/PWA/src/Services/BenificiaryJsonValidator.ts new file mode 100644 index 0000000..a3722ef --- /dev/null +++ b/PWA/src/Services/BenificiaryJsonValidator.ts @@ -0,0 +1,24 @@ +export class BenificiaryJsonValidator { + static isValidBenificiaryJson(json: any): boolean { + const rows = this.rowsFromJson(json) + if(rows.length == 0) { + console.log("Expected more than zero rows of data") + return false + } + //All table rows have same keys, therefore only checking first + if(!this.rowHasCodeColumn(rows[0])) { + console.log("Expected row to have column named code") + return false + } + return true + } + + static rowsFromJson(json: any): any[] { + return Object.values(json) + } + + static rowHasCodeColumn(jsonRow: any): boolean { + return Object.keys(jsonRow) + .indexOf("code") > -1 + } + } \ No newline at end of file diff --git a/PWA/src/Services/BenificiarySpreadSheetRowsDeserializationService.ts b/PWA/src/Services/BenificiarySpreadSheetRowsDeserializationService.ts new file mode 100644 index 0000000..ea8b397 --- /dev/null +++ b/PWA/src/Services/BenificiarySpreadSheetRowsDeserializationService.ts @@ -0,0 +1,46 @@ +import { BenificiarySpreadSheetRow } from "../Models/BenificiarySpreadSheetRow.js"; +import { BenificiaryJsonValidator } from "./BenificiaryJsonValidator.js"; +import { FormParser } from "./FormParser.js"; +import { SpreadSheetFileParser } from "./SpreadSheetFileParser.js"; + +export class BenificiarySpreadSheetRowsDeserializationService { + static async deserializeFormDataFromRequest( + request: Request + ): Promise { + return new Promise(async (resolve, reject) => { + const possibleFile = FormParser.firstFileFromFormData(await request.formData()); + if (possibleFile instanceof File) { + const json = await SpreadSheetFileParser.jsonFromSpreadSheetFile( + possibleFile + ); + if (BenificiaryJsonValidator.isValidBenificiaryJson(json)) { + const rows: BenificiarySpreadSheetRow[] = this.rowsFromJson(json) + .map((row: any) => this.commaSeparatedValuesFromJsonRow(row)) + .map((commaSeparatedRowValues: string) => { + return new BenificiarySpreadSheetRow(commaSeparatedRowValues) + } + ) + return resolve(rows) + } else { + return reject("Invalid format for benificiary rows"); + } + } else { + return reject("Expected upload item of file type") + } + }); + } + + private static rowsFromJson(json: any): any[][] { + return Object.values(json) + } + + private static commaSeparatedValuesFromJsonRow(json: any) { + return Object.keys(json) + .map((key: string) => { + return json[key] + }) + .reduce((previousValue: string, currentValue: string, currentIndex: number, array: string[]) => { + return previousValue + "," + currentValue + }) + } +} diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts new file mode 100644 index 0000000..3610992 --- /dev/null +++ b/PWA/src/Services/CacheFilePathService.ts @@ -0,0 +1,121 @@ +import { BeneficiaryDataUploadHandler } from "../FetchEventHandlers/BeneficiaryDataUploadHandler.js"; +import { ChooseBenificiaryCodeInputMethodHandler } from "../FetchEventHandlers/ChooseBenificiaryCodeInputMethodHandler.js"; +import { CreateDistributionRequestHandler } from "../FetchEventHandlers/CreateDistributionRequestHandler.js"; +import { DeleteDistributionPostHandler } from "../FetchEventHandlers/DeleteDistributionPostHandler.js"; +import { FetchEventHandlers } from "../FetchEventHandlers/FetchEventHandlers.js"; +import { ListDistributionRequestHandler } from "../FetchEventHandlers/ListDistributionRequestHandler.js"; +import { NameDistributionRequestHandler } from "../FetchEventHandlers/NameDistributionRequestHandler.js"; +import { SelectDistributionRequestHandler } from "../FetchEventHandlers/SelectDistributionRequestHandler.js"; +import { UploadDataHandler } from "../FetchEventHandlers/UploadDataHandler.js"; +import { BenificiarySpreadSheetRow } from "../Models/BenificiarySpreadSheetRow.js"; +import { DeleteDistributionPost } from "../Models/DeleteDistributionPost.js"; +import { Distribution } from "../Models/Distribution.js"; +import { SelectDistributionPost } from "../Models/SelectDistributionPost.js"; +import { RouteEvents } from "../RouteEvents.js"; +import { BenificiaryInfoService } from "./BenificiaryInfoService.js"; +import { BenificiaryJsonValidator } from "./BenificiaryJsonValidator.js"; +import { Database } from "./Database.js"; +import { DeserialisationService } from "./DeserialisationService.js"; +import { FormParser } from "./FormParser.js"; + + +export class CacheFilePathService { + pathsOfFilesToCache(): string[] { + return [ + this.pagePaths(), + this.modelPaths(), + this.toplevelScriptsPaths(), + this.fetchEventHanderPaths(), + this.interfacesPaths(), + this.externalLibrariesPaths(), + this.servicePaths() + ].reduce((previousArray, currentValue) => { + return previousArray.concat(currentValue) + }, []) + } + + private pagePaths(): string[] { + return [ + RouteEvents.template, + RouteEvents.home, + RouteEvents.distributionsHome, + RouteEvents.nameDistribution, + RouteEvents.listDistributions, + RouteEvents.deleteDistribution, + RouteEvents.uploadData, + RouteEvents.uploadDataError, + RouteEvents.chooseBenificiaryCodeInputMethodPage + ] + } + + private toplevelScriptsPaths(): string[] { + return this.pathsForTypesInFolder("", [ + "app", + "sw", + "navbar-burger", + RouteEvents.name + ]); + } + + private externalLibrariesPaths(): string[] { + return this.pathsForTypesInFolder("ExternalLibraries", [ + "mustache", + "xlsx.full.min" + ]); + } + + private modelPaths(): string[] { + return this.pathsForTypesInFolder("Models", [ + BenificiarySpreadSheetRow.name, + Distribution.name, + DeleteDistributionPost.name, + SelectDistributionPost.name, + ]); + } + + private servicePaths(): string[] { + return this.pathsForTypesInFolder("Services", [ + BenificiaryInfoService.name, + BenificiaryJsonValidator.name, + CacheFilePathService.name, + Database.name, + DeserialisationService.name, + FormParser.name, + ]) + } + + private fetchEventHanderPaths(): string[] { + return this.pathsForTypesInFolder("FetchEventHandlers", [ + BeneficiaryDataUploadHandler.name, + CreateDistributionRequestHandler.name, + DeleteDistributionPostHandler.name, + FetchEventHandlers.name, + ListDistributionRequestHandler.name, + NameDistributionRequestHandler.name, + SelectDistributionRequestHandler.name, + UploadDataHandler.name, + ChooseBenificiaryCodeInputMethodHandler.name + ]) + } + + private interfacesPaths(): string[] { + return this.pathsForTypesInFolder("Interfaces", [ + "FetchEvent", + "FetchEventHandler" + ]) + } + + private pathsForTypesInFolder(folder: string, typeNames: String[], extension: string = ".js"): string[] { + return typeNames.map((name) => this.pathForTypeInFolder(name, folder, extension)); + } + + private pathForTypeInFolder(typeName: String, folder: string, extension: string = ".js"): string { + let path = "/" + if(folder.length > 0) { + path += folder + "/" + } + path += typeName + extension + + return path + } +} diff --git a/PWA/src/Services/Database.ts b/PWA/src/Services/Database.ts new file mode 100644 index 0000000..6972afe --- /dev/null +++ b/PWA/src/Services/Database.ts @@ -0,0 +1,199 @@ +import { BenificiarySpreadSheetRow } from "../Models/BenificiarySpreadSheetRow.js"; +import { Distribution } from "../Models/Distribution.js"; + +let db: IDBDatabase + +export enum ObjectStoreName { + distribution = "Distributions", + benificiary = "Beneficiaries" +} +const allObjectStoreNames = [ObjectStoreName.benificiary, ObjectStoreName.distribution] + +type DatabaseColumn = { + name: string; + isUnique: boolean +}; + +function columnsForObjectStore(objectStore: ObjectStoreName): DatabaseColumn[] { + switch (objectStore) { + case ObjectStoreName.distribution: + return [ + { name: "distrib_name", isUnique: true }, + { name: "distrib_place", isUnique: false }, + { name: "distrib_date", isUnique: false }, + { name: "distrib_items", isUnique: false } + ] + case ObjectStoreName.benificiary: + return [ + { name: "comma_separated_cells", isUnique: true } + ] + } +} + +export class Database { + static instance = new Database(); + + private constructor() { + let db!: IDBDatabase; + const request = indexedDB.open("data", 1); + request.onerror = (err) => + console.error(`IndexedDB error: ${request.error}`, err); + request.onsuccess = () => (db = request.result); + request.onupgradeneeded = () => { + const db = request.result; + allObjectStoreNames.forEach((storeName) => { + const postsStore = db.createObjectStore(storeName, { + keyPath: storeName, + autoIncrement: true, + }); + columnsForObjectStore(storeName).forEach((column) => + postsStore.createIndex(column.name, column.name, { + unique: column.isUnique, + }) + ); + }); + }; + //Temporarily seed for debuging purposes + this.addDistribution(new Distribution("24", "1/2/3", "Utrecht", "Sandwhiches")) + this.addBenificiary(new BenificiarySpreadSheetRow("one, two, three")) + } + + async readDistributions(): Promise<[Distribution]> { + return this.getElement(ObjectStoreName.distribution); + } + + async distributionsWithName(name: string): Promise { + const distributions = await this.readDistributions(); + return distributions.filter( + (distribution) => distribution.distrib_name == name + ); + } + + async addDistribution(distribution: Distribution): Promise { + return this.addElement(ObjectStoreName.distribution, distribution); + } + + async deleteDistributionWithName(name: string): Promise { + return this.removeElement( + ObjectStoreName.distribution, + await this.keyForDistributionWithName(name) + ) as Promise; + } + + async benificiariesForDistribution( + distribution: Distribution + ): Promise { + return this.getElement(ObjectStoreName.benificiary); + } + + async addBenificiary(beneficiary: BenificiarySpreadSheetRow): Promise { + return this.addElement(ObjectStoreName.benificiary, beneficiary) + } + + private async keyForDistributionWithName(name: string): Promise { + const distributions = await this.readDistributions(); + const keys: number[] = await this.performRequestForObjectStoreNamed( + ObjectStoreName.distribution, + "readonly", + (store: IDBObjectStore) => { + return store.getAllKeys() + } + ) + let distributionIndex = 0 + for (let i = 0; i < distributions.length; i++) { + if (distributions[i].distrib_name == name) { + distributionIndex = i + break + } + } + + return keys[distributionIndex]; + } + + private getElement( + storeName: ObjectStoreName, + key: IDBValidKey | IDBKeyRange = `all` + ): Promise { + return this.performRequestForObjectStoreNamed( + storeName, + "readonly", + (store: IDBObjectStore) => { + return key === "all" ? store.getAll() : store.get(key); + } + ); + } + + private addElement(storeName: ObjectStoreName, payload: object): Promise { + return this.performRequestForObjectStoreNamed( + storeName, + "readwrite", + (store: IDBObjectStore) => { + const serialized = JSON.parse(JSON.stringify(payload)); + return store.add(serialized); + } + ); + } + + private removeElement(storeName: ObjectStoreName, key: IDBValidKey | IDBKeyRange) { + console.log("Will remove element " + key + " from store " + storeName); + return this.performRequestForObjectStoreNamed( + storeName, + "readwrite", + (store: IDBObjectStore) => { + return key === "all" ? store.clear() : store.delete(key) + } + ); + } + + private performRequestForObjectStoreNamed( + storeName: string, + transactionMode: IDBTransactionMode, + makeRequest: (store: IDBObjectStore) => IDBRequest + ): Promise { + const open = indexedDB.open("data"); + return new Promise((resolve, reject) => { + open.onsuccess = () => { + db = open.result; + if ([...db.objectStoreNames].find((name) => name === storeName)) { + const transaction = db.transaction(storeName, transactionMode); + const objectStore = transaction.objectStore(storeName); + const request = makeRequest(objectStore); + request.onerror = () => reject(request.error); + request.onsuccess = () => resolve(request.result); + transaction.oncomplete = () => db.close(); + } else { + indexedDB.deleteDatabase("data"); + } + }; + }); + } + + private editElement( + store: ObjectStoreName, + key: IDBValidKey | IDBKeyRange, + payload: object + ): Promise { + const open = indexedDB.open("data"); + return new Promise((resolve, reject) => { + open.onsuccess = () => { + let request: IDBRequest; + db = open.result; + if ([...db.objectStoreNames].find((name) => name === store)) { + const transaction = db.transaction(store, "readwrite"); + const objectStore = transaction.objectStore(store); + if (key === "all") request = objectStore.getAll(); + else request = objectStore.get(key); + request.onerror = () => reject(request.error); + request.onsuccess = () => { + const serialized = JSON.parse(JSON.stringify(payload)); + const updateRequest = objectStore.put(serialized); + updateRequest.onsuccess = () => resolve(request.result); + }; + transaction.oncomplete = () => db.close(); + } else { + indexedDB.deleteDatabase("data"); + } + }; + }); + } +} \ No newline at end of file diff --git a/PWA/src/Services/DeserialisationService.ts b/PWA/src/Services/DeserialisationService.ts new file mode 100644 index 0000000..710cdd2 --- /dev/null +++ b/PWA/src/Services/DeserialisationService.ts @@ -0,0 +1,6 @@ +export class DeserialisationService { + static async deserializeFormDataFromRequest(request: Request): Promise { + const formData = await request.clone().formData(); + return Object.fromEntries(formData.entries()) as unknown as T; + } +} \ No newline at end of file diff --git a/PWA/src/Services/FormParser.ts b/PWA/src/Services/FormParser.ts new file mode 100644 index 0000000..9e23d68 --- /dev/null +++ b/PWA/src/Services/FormParser.ts @@ -0,0 +1,38 @@ +export class FormParser { + static firstFileFromFormData(formData: FormData): File | null { + for (const keyValuePair of formData.entries()) { + const possibleFile = keyValuePair[1]; + if (possibleFile instanceof File) { + return possibleFile; + } + } + return null; + } +} + +// TODO: Move +export class BenificiaryDataParser { + static isValidBenificiaryJson(json: any): boolean { + const rows = this.rowsFromJson(json) + if(rows.length == 0) { + console.log("Expected more than zero rows of data") + return false + } + for(const row in rows) { + if(!this.rowHasCodeColumn(row)) { + console.log("Expected row to have column named code") + return false + } + } + return true + } + + static rowsFromJson(json: any): any[] { + return Object.values(json) + } + + static rowHasCodeColumn(jsonRow: any): boolean { + return Object.keys(jsonRow) + .indexOf("code") > -1 + } +} \ No newline at end of file diff --git a/PWA/src/Services/ResponseTools.ts b/PWA/src/Services/ResponseTools.ts new file mode 100644 index 0000000..572ebc6 --- /dev/null +++ b/PWA/src/Services/ResponseTools.ts @@ -0,0 +1,40 @@ +import mustache from "../ExternalLibraries/mustache.js"; +import { RouteEvents } from "../RouteEvents.js"; + +export class ResponseTools { + static async replaceTemplateKeysWithValues( + oldResponse: Response, + keysAndValues: { [key: string]: any } + ): Promise { + return this.changeResponseText(oldResponse, (oldResponseText: string) => { + const untypedMustache = mustache as any + const changedText = untypedMustache.render(oldResponseText, keysAndValues) + return changedText + }); + } + + static async wrapInHtmlTemplate(routeEvent: RouteEvents): Promise { + return this.replaceTemplateKeysWithValues(await this.cachedPage(RouteEvents.template) as Response, { + content: (await this.cachedPage(routeEvent)).text() + }) + } + + private static async changeResponseText( + oldResponse: Response, + responseTextChanger: (text: string) => string + ): Promise { + try { + const oldResponseText = await oldResponse.text(); + const newResponseText = responseTextChanger(oldResponseText); + + return new Response(newResponseText, oldResponse); + } catch (error) { + console.log(error); + return oldResponse; + } + } + + private static async cachedPage(routeEvent: RouteEvents): Promise { + return await caches.match(routeEvent as string) as Response + } +} \ No newline at end of file diff --git a/PWA/src/Services/SpreadSheetFileParser.ts b/PWA/src/Services/SpreadSheetFileParser.ts new file mode 100644 index 0000000..c9802b2 --- /dev/null +++ b/PWA/src/Services/SpreadSheetFileParser.ts @@ -0,0 +1,21 @@ +import { read, utils } from "../ExternalLibraries/xlsx.full.min.js"; + +export class SpreadSheetFileParser { + static async firstSheetFromSpreadSheetFile( + spreadSheetFile: File + ): Promise { + const workBook = read(await spreadSheetFile.arrayBuffer(), { + type: "array", + }); + const spreadSheetNames = workBook.SheetNames; + const firstSheet = workBook.Sheets[spreadSheetNames[0]]; + return firstSheet; + } + + static async jsonFromSpreadSheetFile(spreadSheetFile: File): Promise { + const spreadSheet = await this.firstSheetFromSpreadSheetFile( + spreadSheetFile + ); + return utils.sheet_to_json(spreadSheet); + } +} diff --git a/PWA/src/app.ts b/PWA/src/app.ts new file mode 100644 index 0000000..8aad1e4 --- /dev/null +++ b/PWA/src/app.ts @@ -0,0 +1,10 @@ +if ('serviceWorker' in navigator) { + console.log("Will register serviceworker..") + navigator.serviceWorker + .register('/sw.js', { type: 'module' }) + .then(function() { + console.log('Service worker registered!'); + }); +} else { + console.log('Service worker not supported in this browser..') +} \ No newline at end of file diff --git a/PWA/src/navbar-burger.ts b/PWA/src/navbar-burger.ts new file mode 100644 index 0000000..6886143 --- /dev/null +++ b/PWA/src/navbar-burger.ts @@ -0,0 +1,25 @@ +document.addEventListener('DOMContentLoaded', () => { + + // Get all "navbar-burger" elements + const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); + + // Check if there are any navbar burgers + if ($navbarBurgers.length > 0) { + + // Add a click event on each of them + $navbarBurgers.forEach( el => { + el.addEventListener('click', () => { + + // Get the target from the "data-target" attribute + const target = el.dataset.target; + const $target = document.getElementById(target); + + // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" + el.classList.toggle('is-active'); + $target?.classList.toggle('is-active'); + + }); + }); + } + +}); \ No newline at end of file diff --git a/PWA/src/sw.ts b/PWA/src/sw.ts new file mode 100644 index 0000000..7cc151c --- /dev/null +++ b/PWA/src/sw.ts @@ -0,0 +1,60 @@ +import { FetchEventHandlers } from "./FetchEventHandlers/FetchEventHandlers.js"; +import { CacheFilePathService } from "./Services/CacheFilePathService.js"; + +var CACHE_STATIC_NAME = "static-v10"; +var CACHE_DYNAMIC_NAME = "dynamic-v2"; + +self.addEventListener("install", function (event: any) { + console.log("[Service Worker] Installing Service Worker ...", event); + console.log(new CacheFilePathService().pathsOfFilesToCache()) + event.waitUntil( + caches.open(CACHE_STATIC_NAME) + .then(function (cache) { + console.log("[Service Worker] Precaching App Shell"); + cache.addAll([ + "/", + "https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css", + "/favicon.ico", + "/manifest.json", + "/images/ReliefBox-horizontal-nobackground.png", + "/images/510logo.jpg", + "/images/ReliefBox-horizontal.png", + "/images/ReliefBox.PNG", + "/apple-touch-icon.png", + "/apple-touch-icon-precomposed.png" + ] + .concat(new CacheFilePathService().pathsOfFilesToCache()) + ); + }) + ); +}); + +self.addEventListener("activate", function (event: any) { + console.log("[Service Worker] Activating Service Worker ....", event); + event.waitUntil( + caches.keys().then(function (keyList) { + return Promise.all( + keyList.map(function (key) { + if (key !== CACHE_STATIC_NAME && key !== CACHE_DYNAMIC_NAME) { + console.log("[Service Worker] Removing old cache.", key); + return caches.delete(key); + } + }) + ); + }) + ); + return (self as any).clients.claim(); +}); + +// Cache-only +self.addEventListener("fetch", function (event: any) { + let customHandlers = new FetchEventHandlers(); + console.log("Handling fetch request " + event.request.url); + if (customHandlers.canHandleEvent(event)) { + console.log("using custom event handler"); + event.respondWith(customHandlers.handleEvent(event)) + } else { + console.log("using custom cache"); + event.respondWith(caches.match(event.request)); + } +}); \ No newline at end of file diff --git a/PWA/tsconfig.json b/PWA/tsconfig.json new file mode 100644 index 0000000..c06c762 --- /dev/null +++ b/PWA/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "ES2019", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": ["es2019","dom","dom.iterable"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "ES2015", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["../node_modules/@types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "types": ["node"], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./public", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/README.md b/README.md index 59f5a6a..cbc66bb 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,9 @@ # ReliefBox A simple web app for relief. -https://relief-system-webapp.azurewebsites.net/ -## Description +## Porting from proof of concept stack to progressive web app stack in progress +* Proof of concept code can be found in /POC foder +* Progressive web app code can be found in /PWA folder -Synopsis: a [flask python app](https://flask.palletsprojects.com/en/2.0.x/). - -Workflow: upload data of beneficiaries, start distribution, check if beneficiaries are eligible, download report. - -## Setup - -### on Azure -1. [Deploy the web app to Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python) -3. Add necessary keys as environmental variables. From Azure Portal, App Service > Configuration > New application setting -``` -SQL_USERNAME=... -SQL_PASSWORD=... -COSMOS_KEY=... -MODE=online -``` - -### build as standalone app -``` -pyinstaller --onefile --add-data 'templates;templates' --add-data 'static;static' --add-data 'data;data' --add-data './*.py;.' app.py -``` - -### on Raspberry Pi 4 -1. [Create wireless access point](https://raspberrypi-guide.github.io/networking/create-wireless-access-point#start-up-the-wireless-access-point) -2. Clone this repository -``` -$ git clone https://github.com/rodekruis/relief-app.git -$ cd relief-app -``` -3. Set offline mode in .env -``` -$ echo -n "MODE=offline" > .env -``` -4. Install app dependencies and run it -``` -$ sudo apt-get update -$ sudo apt-get install libatlas-base-dev libcblas-dev g++ unixodbc-dev -$ pip install -r requirements.txt -$ python app.py -``` -Debug connection issues (to be improved): -``` -$ sudo systemctl stop hostapd -$ sudo systemctl unmask hostapd -$ sudo systemctl enable hostapd -$ sudo systemctl start hostapd -``` +both folders have their own readme.md diff --git a/node_modules/.bin/tsc b/node_modules/.bin/tsc new file mode 120000 index 0000000..0863208 --- /dev/null +++ b/node_modules/.bin/tsc @@ -0,0 +1 @@ +../typescript/bin/tsc \ No newline at end of file diff --git a/node_modules/.bin/tsserver b/node_modules/.bin/tsserver new file mode 120000 index 0000000..f8f8f1a --- /dev/null +++ b/node_modules/.bin/tsserver @@ -0,0 +1 @@ +../typescript/bin/tsserver \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..4d911aa --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,26 @@ +{ + "name": "relief-app", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@types/node": { + "version": "20.5.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.9.tgz", + "integrity": "sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==", + "dev": true + }, + "node_modules/typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=12.20" + } + } + } +} diff --git a/node_modules/@types/node/LICENSE b/node_modules/@types/node/LICENSE new file mode 100755 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/node/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md new file mode 100755 index 0000000..c881f91 --- /dev/null +++ b/node_modules/@types/node/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/node` + +# Summary +This package contains type definitions for Node.js (https://nodejs.org/). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node. + +### Additional Details + * Last updated: Sat, 02 Sep 2023 20:02:59 GMT + * Dependencies: none + * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone` + +# Credits +These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky). diff --git a/node_modules/@types/node/assert.d.ts b/node_modules/@types/node/assert.d.ts new file mode 100755 index 0000000..e309252 --- /dev/null +++ b/node_modules/@types/node/assert.d.ts @@ -0,0 +1,972 @@ +/** + * The `node:assert` module provides a set of assertion functions for verifying + * invariants. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js) + */ +declare module 'assert' { + /** + * An alias of {@link ok}. + * @since v0.5.9 + * @param value The input that is checked for being truthy. + */ + function assert(value: unknown, message?: string | Error): asserts value; + namespace assert { + /** + * Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class. + */ + class AssertionError extends Error { + /** + * Set to the `actual` argument for methods such as {@link assert.strictEqual()}. + */ + actual: unknown; + /** + * Set to the `expected` argument for methods such as {@link assert.strictEqual()}. + */ + expected: unknown; + /** + * Set to the passed in operator value. + */ + operator: string; + /** + * Indicates if the message was auto-generated (`true`) or not. + */ + generatedMessage: boolean; + /** + * Value is always `ERR_ASSERTION` to show that the error is an assertion error. + */ + code: 'ERR_ASSERTION'; + constructor(options?: { + /** If provided, the error message is set to this value. */ + message?: string | undefined; + /** The `actual` property on the error instance. */ + actual?: unknown | undefined; + /** The `expected` property on the error instance. */ + expected?: unknown | undefined; + /** The `operator` property on the error instance. */ + operator?: string | undefined; + /** If provided, the generated stack trace omits frames before this function. */ + // tslint:disable-next-line:ban-types + stackStartFn?: Function | undefined; + }); + } + /** + * This feature is deprecated and will be removed in a future version. + * Please consider using alternatives such as the `mock` helper function. + * @since v14.2.0, v12.19.0 + * @deprecated Deprecated + */ + class CallTracker { + /** + * The wrapper function is expected to be called exactly `exact` times. If the + * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an + * error. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func); + * ``` + * @since v14.2.0, v12.19.0 + * @param [fn='A no-op function'] + * @param [exact=1] + * @return that wraps `fn`. + */ + calls(exact?: number): () => void; + calls any>(fn?: Func, exact?: number): Func; + /** + * Example: + * + * ```js + * import assert from 'node:assert'; + * + * const tracker = new assert.CallTracker(); + * + * function func() {} + * const callsfunc = tracker.calls(func); + * callsfunc(1, 2, 3); + * + * assert.deepStrictEqual(tracker.getCalls(callsfunc), + * [{ thisArg: undefined, arguments: [1, 2, 3] }]); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn + * @return An Array with all the calls to a tracked function. + */ + getCalls(fn: Function): CallTrackerCall[]; + /** + * The arrays contains information about the expected and actual number of calls of + * the functions that have not been called the expected number of times. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func, 2); + * + * // Returns an array containing information on callsfunc() + * console.log(tracker.report()); + * // [ + * // { + * // message: 'Expected the func function to be executed 2 time(s) but was + * // executed 0 time(s).', + * // actual: 0, + * // expected: 2, + * // operator: 'func', + * // stack: stack trace + * // } + * // ] + * ``` + * @since v14.2.0, v12.19.0 + * @return An Array of objects containing information about the wrapper functions returned by `calls`. + */ + report(): CallTrackerReportInformation[]; + /** + * Reset calls of the call tracker. + * If a tracked function is passed as an argument, the calls will be reset for it. + * If no arguments are passed, all tracked functions will be reset. + * + * ```js + * import assert from 'node:assert'; + * + * const tracker = new assert.CallTracker(); + * + * function func() {} + * const callsfunc = tracker.calls(func); + * + * callsfunc(); + * // Tracker was called once + * assert.strictEqual(tracker.getCalls(callsfunc).length, 1); + * + * tracker.reset(callsfunc); + * assert.strictEqual(tracker.getCalls(callsfunc).length, 0); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn a tracked function to reset. + */ + reset(fn?: Function): void; + /** + * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that + * have not been called the expected number of times. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func, 2); + * + * callsfunc(); + * + * // Will throw an error since callsfunc() was only called once. + * tracker.verify(); + * ``` + * @since v14.2.0, v12.19.0 + */ + verify(): void; + } + interface CallTrackerCall { + thisArg: object; + arguments: unknown[]; + } + interface CallTrackerReportInformation { + message: string; + /** The actual number of times the function was called. */ + actual: number; + /** The number of times the function was expected to be called. */ + expected: number; + /** The name of the function that is wrapped. */ + operator: string; + /** A stack trace of the function. */ + stack: object; + } + type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error; + /** + * Throws an `AssertionError` with the provided error message or a default + * error message. If the `message` parameter is an instance of an `Error` then + * it will be thrown instead of the `AssertionError`. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.fail(); + * // AssertionError [ERR_ASSERTION]: Failed + * + * assert.fail('boom'); + * // AssertionError [ERR_ASSERTION]: boom + * + * assert.fail(new TypeError('need array')); + * // TypeError: need array + * ``` + * + * Using `assert.fail()` with more than two arguments is possible but deprecated. + * See below for further details. + * @since v0.1.21 + * @param [message='Failed'] + */ + function fail(message?: string | Error): never; + /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ + function fail( + actual: unknown, + expected: unknown, + message?: string | Error, + operator?: string, + // tslint:disable-next-line:ban-types + stackStartFn?: Function + ): never; + /** + * Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`. + * + * If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default + * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. + * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``. + * + * Be aware that in the `repl` the error message will be different to the one + * thrown in a file! See below for further details. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.ok(true); + * // OK + * assert.ok(1); + * // OK + * + * assert.ok(); + * // AssertionError: No value argument passed to `assert.ok()` + * + * assert.ok(false, 'it\'s false'); + * // AssertionError: it's false + * + * // In the repl: + * assert.ok(typeof 123 === 'string'); + * // AssertionError: false == true + * + * // In a file (e.g. test.js): + * assert.ok(typeof 123 === 'string'); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(typeof 123 === 'string') + * + * assert.ok(false); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(false) + * + * assert.ok(0); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(0) + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * // Using `assert()` works the same: + * assert(0); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert(0) + * ``` + * @since v0.1.21 + */ + function ok(value: unknown, message?: string | Error): asserts value; + /** + * **Strict assertion mode** + * + * An alias of {@link strictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link strictEqual} instead. + * + * Tests shallow, coercive equality between the `actual` and `expected` parameters + * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled + * and treated as being identical if both sides are `NaN`. + * + * ```js + * import assert from 'node:assert'; + * + * assert.equal(1, 1); + * // OK, 1 == 1 + * assert.equal(1, '1'); + * // OK, 1 == '1' + * assert.equal(NaN, NaN); + * // OK + * + * assert.equal(1, 2); + * // AssertionError: 1 == 2 + * assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); + * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } } + * ``` + * + * If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default + * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. + * @since v0.1.21 + */ + function equal(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link notStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead. + * + * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is + * specially handled and treated as being identical if both sides are `NaN`. + * + * ```js + * import assert from 'node:assert'; + * + * assert.notEqual(1, 2); + * // OK + * + * assert.notEqual(1, 1); + * // AssertionError: 1 != 1 + * + * assert.notEqual(1, '1'); + * // AssertionError: 1 != '1' + * ``` + * + * If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error + * message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. + * @since v0.1.21 + */ + function notEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link deepStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead. + * + * Tests for deep equality between the `actual` and `expected` parameters. Consider + * using {@link deepStrictEqual} instead. {@link deepEqual} can have + * surprising results. + * + * _Deep equality_ means that the enumerable "own" properties of child objects + * are also recursively evaluated by the following rules. + * @since v0.1.21 + */ + function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link notDeepStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead. + * + * Tests for any deep inequality. Opposite of {@link deepEqual}. + * + * ```js + * import assert from 'node:assert'; + * + * const obj1 = { + * a: { + * b: 1, + * }, + * }; + * const obj2 = { + * a: { + * b: 2, + * }, + * }; + * const obj3 = { + * a: { + * b: 1, + * }, + * }; + * const obj4 = { __proto__: obj1 }; + * + * assert.notDeepEqual(obj1, obj1); + * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } + * + * assert.notDeepEqual(obj1, obj2); + * // OK + * + * assert.notDeepEqual(obj1, obj3); + * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } + * + * assert.notDeepEqual(obj1, obj4); + * // OK + * ``` + * + * If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default + * error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Tests strict equality between the `actual` and `expected` parameters as + * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.strictEqual(1, 2); + * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: + * // + * // 1 !== 2 + * + * assert.strictEqual(1, 1); + * // OK + * + * assert.strictEqual('Hello foobar', 'Hello World!'); + * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: + * // + actual - expected + * // + * // + 'Hello foobar' + * // - 'Hello World!' + * // ^ + * + * const apples = 1; + * const oranges = 2; + * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`); + * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2 + * + * assert.strictEqual(1, '1', new TypeError('Inputs are not identical')); + * // TypeError: Inputs are not identical + * ``` + * + * If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a + * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function strictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; + /** + * Tests strict inequality between the `actual` and `expected` parameters as + * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.notStrictEqual(1, 2); + * // OK + * + * assert.notStrictEqual(1, 1); + * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to: + * // + * // 1 + * + * assert.notStrictEqual(1, '1'); + * // OK + * ``` + * + * If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a + * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Tests for deep equality between the `actual` and `expected` parameters. + * "Deep" equality means that the enumerable "own" properties of child objects + * are recursively evaluated also by the following rules. + * @since v1.2.0 + */ + function deepStrictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; + /** + * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); + * // OK + * ``` + * + * If the values are deeply and strictly equal, an `AssertionError` is thrown + * with a `message` property set equal to the value of the `message` parameter. If + * the `message` parameter is undefined, a default error message is assigned. If + * the `message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v1.2.0 + */ + function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Expects the function `fn` to throw an error. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, + * a validation object where each property will be tested for strict deep equality, + * or an instance of error where each property will be tested for strict deep + * equality including the non-enumerable `message` and `name` properties. When + * using an object, it is also possible to use a regular expression, when + * validating against a string property. See below for examples. + * + * If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation + * fails. + * + * Custom validation object/error instance: + * + * ```js + * import assert from 'node:assert/strict'; + * + * const err = new TypeError('Wrong value'); + * err.code = 404; + * err.foo = 'bar'; + * err.info = { + * nested: true, + * baz: 'text', + * }; + * err.reg = /abc/i; + * + * assert.throws( + * () => { + * throw err; + * }, + * { + * name: 'TypeError', + * message: 'Wrong value', + * info: { + * nested: true, + * baz: 'text', + * }, + * // Only properties on the validation object will be tested for. + * // Using nested objects requires all properties to be present. Otherwise + * // the validation is going to fail. + * }, + * ); + * + * // Using regular expressions to validate error properties: + * assert.throws( + * () => { + * throw err; + * }, + * { + * // The `name` and `message` properties are strings and using regular + * // expressions on those will match against the string. If they fail, an + * // error is thrown. + * name: /^TypeError$/, + * message: /Wrong/, + * foo: 'bar', + * info: { + * nested: true, + * // It is not possible to use regular expressions for nested properties! + * baz: 'text', + * }, + * // The `reg` property contains a regular expression and only if the + * // validation object contains an identical regular expression, it is going + * // to pass. + * reg: /abc/i, + * }, + * ); + * + * // Fails due to the different `message` and `name` properties: + * assert.throws( + * () => { + * const otherErr = new Error('Not found'); + * // Copy all enumerable properties from `err` to `otherErr`. + * for (const [key, value] of Object.entries(err)) { + * otherErr[key] = value; + * } + * throw otherErr; + * }, + * // The error's `message` and `name` properties will also be checked when using + * // an error as validation object. + * err, + * ); + * ``` + * + * Validate instanceof using constructor: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * Error, + * ); + * ``` + * + * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions): + * + * Using a regular expression runs `.toString` on the error object, and will + * therefore also include the error name. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * /^Error: Wrong value$/, + * ); + * ``` + * + * Custom error validation: + * + * The function must return `true` to indicate all internal validations passed. + * It will otherwise fail with an `AssertionError`. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * (err) => { + * assert(err instanceof Error); + * assert(/value/.test(err)); + * // Avoid returning anything from validation functions besides `true`. + * // Otherwise, it's not clear what part of the validation failed. Instead, + * // throw an error about the specific validation that failed (as done in this + * // example) and add as much helpful debugging information to that error as + * // possible. + * return true; + * }, + * 'unexpected error', + * ); + * ``` + * + * `error` cannot be a string. If a string is provided as the second + * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same + * message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using + * a string as the second argument gets considered: + * + * ```js + * import assert from 'node:assert/strict'; + * + * function throwingFirst() { + * throw new Error('First'); + * } + * + * function throwingSecond() { + * throw new Error('Second'); + * } + * + * function notThrowing() {} + * + * // The second argument is a string and the input function threw an Error. + * // The first case will not throw as it does not match for the error message + * // thrown by the input function! + * assert.throws(throwingFirst, 'Second'); + * // In the next example the message has no benefit over the message from the + * // error and since it is not clear if the user intended to actually match + * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error. + * assert.throws(throwingSecond, 'Second'); + * // TypeError [ERR_AMBIGUOUS_ARGUMENT] + * + * // The string is only used (as message) in case the function does not throw: + * assert.throws(notThrowing, 'Second'); + * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second + * + * // If it was intended to match for the error message do this instead: + * // It does not throw because the error messages match. + * assert.throws(throwingSecond, /Second$/); + * + * // If the error message does not match, an AssertionError is thrown. + * assert.throws(throwingFirst, /Second$/); + * // AssertionError [ERR_ASSERTION] + * ``` + * + * Due to the confusing error-prone notation, avoid a string as the second + * argument. + * @since v0.1.21 + */ + function throws(block: () => unknown, message?: string | Error): void; + function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void; + /** + * Asserts that the function `fn` does not throw an error. + * + * Using `assert.doesNotThrow()` is actually not useful because there + * is no benefit in catching an error and then rethrowing it. Instead, consider + * adding a comment next to the specific code path that should not throw and keep + * error messages as expressive as possible. + * + * When `assert.doesNotThrow()` is called, it will immediately call the `fn`function. + * + * If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a + * different type, or if the `error` parameter is undefined, the error is + * propagated back to the caller. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation + * function. See {@link throws} for more details. + * + * The following, for instance, will throw the `TypeError` because there is no + * matching error type in the assertion: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * SyntaxError, + * ); + * ``` + * + * However, the following will result in an `AssertionError` with the message + * 'Got unwanted exception...': + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * TypeError, + * ); + * ``` + * + * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * /Wrong value/, + * 'Whoops', + * ); + * // Throws: AssertionError: Got unwanted exception: Whoops + * ``` + * @since v0.1.21 + */ + function doesNotThrow(block: () => unknown, message?: string | Error): void; + function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void; + /** + * Throws `value` if `value` is not `undefined` or `null`. This is useful when + * testing the `error` argument in callbacks. The stack trace contains all frames + * from the error passed to `ifError()` including the potential new frames for`ifError()` itself. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.ifError(null); + * // OK + * assert.ifError(0); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0 + * assert.ifError('error'); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error' + * assert.ifError(new Error()); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error + * + * // Create some random error frames. + * let err; + * (function errorFrame() { + * err = new Error('test error'); + * })(); + * + * (function ifErrorFrame() { + * assert.ifError(err); + * })(); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error + * // at ifErrorFrame + * // at errorFrame + * ``` + * @since v0.1.97 + */ + function ifError(value: unknown): asserts value is null | undefined; + /** + * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately + * calls the function and awaits the returned promise to complete. It will then + * check that the promise is rejected. + * + * If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the + * function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error + * handler is skipped. + * + * Besides the async nature to await the completion behaves identically to {@link throws}. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, + * an object where each property will be tested for, or an instance of error where + * each property will be tested for including the non-enumerable `message` and`name` properties. + * + * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject. + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.rejects( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * { + * name: 'TypeError', + * message: 'Wrong value', + * }, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.rejects( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * (err) => { + * assert.strictEqual(err.name, 'TypeError'); + * assert.strictEqual(err.message, 'Wrong value'); + * return true; + * }, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.rejects( + * Promise.reject(new Error('Wrong value')), + * Error, + * ).then(() => { + * // ... + * }); + * ``` + * + * `error` cannot be a string. If a string is provided as the second + * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the + * example in {@link throws} carefully if using a string as the second + * argument gets considered. + * @since v10.0.0 + */ + function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; + function rejects(block: (() => Promise) | Promise, error: AssertPredicate, message?: string | Error): Promise; + /** + * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately + * calls the function and awaits the returned promise to complete. It will then + * check that the promise is not rejected. + * + * If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If + * the function does not return a promise, `assert.doesNotReject()` will return a + * rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases + * the error handler is skipped. + * + * Using `assert.doesNotReject()` is actually not useful because there is little + * benefit in catching a rejection and then rejecting it again. Instead, consider + * adding a comment next to the specific code path that should not reject and keep + * error messages as expressive as possible. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation + * function. See {@link throws} for more details. + * + * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}. + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.doesNotReject( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * SyntaxError, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotReject(Promise.reject(new TypeError('Wrong value'))) + * .then(() => { + * // ... + * }); + * ``` + * @since v10.0.0 + */ + function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; + function doesNotReject(block: (() => Promise) | Promise, error: AssertPredicate, message?: string | Error): Promise; + /** + * Expects the `string` input to match the regular expression. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.match('I will fail', /pass/); + * // AssertionError [ERR_ASSERTION]: The input did not match the regular ... + * + * assert.match(123, /pass/); + * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. + * + * assert.match('I will pass', /pass/); + * // OK + * ``` + * + * If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal + * to the value of the `message` parameter. If the `message` parameter is + * undefined, a default error message is assigned. If the `message` parameter is an + * instance of an `Error` then it will be thrown instead of the `AssertionError`. + * @since v13.6.0, v12.16.0 + */ + function match(value: string, regExp: RegExp, message?: string | Error): void; + /** + * Expects the `string` input not to match the regular expression. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotMatch('I will fail', /fail/); + * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ... + * + * assert.doesNotMatch(123, /pass/); + * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. + * + * assert.doesNotMatch('I will pass', /different/); + * // OK + * ``` + * + * If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal + * to the value of the `message` parameter. If the `message` parameter is + * undefined, a default error message is assigned. If the `message` parameter is an + * instance of an `Error` then it will be thrown instead of the `AssertionError`. + * @since v13.6.0, v12.16.0 + */ + function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; + const strict: Omit & { + (value: unknown, message?: string | Error): asserts value; + equal: typeof strictEqual; + notEqual: typeof notStrictEqual; + deepEqual: typeof deepStrictEqual; + notDeepEqual: typeof notDeepStrictEqual; + // Mapped types and assertion functions are incompatible? + // TS2775: Assertions require every name in the call target + // to be declared with an explicit type annotation. + ok: typeof ok; + strictEqual: typeof strictEqual; + deepStrictEqual: typeof deepStrictEqual; + ifError: typeof ifError; + strict: typeof strict; + }; + } + export = assert; +} +declare module 'node:assert' { + import assert = require('assert'); + export = assert; +} diff --git a/node_modules/@types/node/assert/strict.d.ts b/node_modules/@types/node/assert/strict.d.ts new file mode 100755 index 0000000..b4319b9 --- /dev/null +++ b/node_modules/@types/node/assert/strict.d.ts @@ -0,0 +1,8 @@ +declare module 'assert/strict' { + import { strict } from 'node:assert'; + export = strict; +} +declare module 'node:assert/strict' { + import { strict } from 'node:assert'; + export = strict; +} diff --git a/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts new file mode 100755 index 0000000..d0b2ebf --- /dev/null +++ b/node_modules/@types/node/async_hooks.d.ts @@ -0,0 +1,531 @@ +/** + * We strongly discourage the use of the `async_hooks` API. + * Other APIs that can cover most of its use cases include: + * + * * `AsyncLocalStorage` tracks async context + * * `process.getActiveResourcesInfo()` tracks active resources + * + * The `node:async_hooks` module provides an API to track asynchronous resources. + * It can be accessed using: + * + * ```js + * import async_hooks from 'node:async_hooks'; + * ``` + * @experimental + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js) + */ +declare module 'async_hooks' { + /** + * ```js + * import { executionAsyncId } from 'node:async_hooks'; + * import fs from 'node:fs'; + * + * console.log(executionAsyncId()); // 1 - bootstrap + * fs.open(path, 'r', (err, fd) => { + * console.log(executionAsyncId()); // 6 - open() + * }); + * ``` + * + * The ID returned from `executionAsyncId()` is related to execution timing, not + * causality (which is covered by `triggerAsyncId()`): + * + * ```js + * const server = net.createServer((conn) => { + * // Returns the ID of the server, not of the new connection, because the + * // callback runs in the execution scope of the server's MakeCallback(). + * async_hooks.executionAsyncId(); + * + * }).listen(port, () => { + * // Returns the ID of a TickObject (process.nextTick()) because all + * // callbacks passed to .listen() are wrapped in a nextTick(). + * async_hooks.executionAsyncId(); + * }); + * ``` + * + * Promise contexts may not get precise `executionAsyncIds` by default. + * See the section on `promise execution tracking`. + * @since v8.1.0 + * @return The `asyncId` of the current execution context. Useful to track when something calls. + */ + function executionAsyncId(): number; + /** + * Resource objects returned by `executionAsyncResource()` are most often internal + * Node.js handle objects with undocumented APIs. Using any functions or properties + * on the object is likely to crash your application and should be avoided. + * + * Using `executionAsyncResource()` in the top-level execution context will + * return an empty object as there is no handle or request object to use, + * but having an object representing the top-level can be helpful. + * + * ```js + * import { open } from 'node:fs'; + * import { executionAsyncId, executionAsyncResource } from 'node:async_hooks'; + * + * console.log(executionAsyncId(), executionAsyncResource()); // 1 {} + * open(new URL(import.meta.url), 'r', (err, fd) => { + * console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap + * }); + * ``` + * + * This can be used to implement continuation local storage without the + * use of a tracking `Map` to store the metadata: + * + * ```js + * import { createServer } from 'node:http'; + * import { + * executionAsyncId, + * executionAsyncResource, + * createHook, + * } from 'async_hooks'; + * const sym = Symbol('state'); // Private symbol to avoid pollution + * + * createHook({ + * init(asyncId, type, triggerAsyncId, resource) { + * const cr = executionAsyncResource(); + * if (cr) { + * resource[sym] = cr[sym]; + * } + * }, + * }).enable(); + * + * const server = createServer((req, res) => { + * executionAsyncResource()[sym] = { state: req.url }; + * setTimeout(function() { + * res.end(JSON.stringify(executionAsyncResource()[sym])); + * }, 100); + * }).listen(3000); + * ``` + * @since v13.9.0, v12.17.0 + * @return The resource representing the current execution. Useful to store data within the resource. + */ + function executionAsyncResource(): object; + /** + * ```js + * const server = net.createServer((conn) => { + * // The resource that caused (or triggered) this callback to be called + * // was that of the new connection. Thus the return value of triggerAsyncId() + * // is the asyncId of "conn". + * async_hooks.triggerAsyncId(); + * + * }).listen(port, () => { + * // Even though all callbacks passed to .listen() are wrapped in a nextTick() + * // the callback itself exists because the call to the server's .listen() + * // was made. So the return value would be the ID of the server. + * async_hooks.triggerAsyncId(); + * }); + * ``` + * + * Promise contexts may not get valid `triggerAsyncId`s by default. See + * the section on `promise execution tracking`. + * @return The ID of the resource responsible for calling the callback that is currently being executed. + */ + function triggerAsyncId(): number; + interface HookCallbacks { + /** + * Called when a class is constructed that has the possibility to emit an asynchronous event. + * @param asyncId a unique ID for the async resource + * @param type the type of the async resource + * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created + * @param resource reference to the resource representing the async operation, needs to be released during destroy + */ + init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; + /** + * When an asynchronous operation is initiated or completes a callback is called to notify the user. + * The before callback is called just before said callback is executed. + * @param asyncId the unique identifier assigned to the resource about to execute the callback. + */ + before?(asyncId: number): void; + /** + * Called immediately after the callback specified in before is completed. + * @param asyncId the unique identifier assigned to the resource which has executed the callback. + */ + after?(asyncId: number): void; + /** + * Called when a promise has resolve() called. This may not be in the same execution id + * as the promise itself. + * @param asyncId the unique id for the promise that was resolve()d. + */ + promiseResolve?(asyncId: number): void; + /** + * Called after the resource corresponding to asyncId is destroyed + * @param asyncId a unique ID for the async resource + */ + destroy?(asyncId: number): void; + } + interface AsyncHook { + /** + * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. + */ + enable(): this; + /** + * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. + */ + disable(): this; + } + /** + * Registers functions to be called for different lifetime events of each async + * operation. + * + * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the + * respective asynchronous event during a resource's lifetime. + * + * All callbacks are optional. For example, if only resource cleanup needs to + * be tracked, then only the `destroy` callback needs to be passed. The + * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section. + * + * ```js + * import { createHook } from 'node:async_hooks'; + * + * const asyncHook = createHook({ + * init(asyncId, type, triggerAsyncId, resource) { }, + * destroy(asyncId) { }, + * }); + * ``` + * + * The callbacks will be inherited via the prototype chain: + * + * ```js + * class MyAsyncCallbacks { + * init(asyncId, type, triggerAsyncId, resource) { } + * destroy(asyncId) {} + * } + * + * class MyAddedCallbacks extends MyAsyncCallbacks { + * before(asyncId) { } + * after(asyncId) { } + * } + * + * const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); + * ``` + * + * Because promises are asynchronous resources whose lifecycle is tracked + * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises. + * @since v8.1.0 + * @param callbacks The `Hook Callbacks` to register + * @return Instance used for disabling and enabling hooks + */ + function createHook(callbacks: HookCallbacks): AsyncHook; + interface AsyncResourceOptions { + /** + * The ID of the execution context that created this async event. + * @default executionAsyncId() + */ + triggerAsyncId?: number | undefined; + /** + * Disables automatic `emitDestroy` when the object is garbage collected. + * This usually does not need to be set (even if `emitDestroy` is called + * manually), unless the resource's `asyncId` is retrieved and the + * sensitive API's `emitDestroy` is called with it. + * @default false + */ + requireManualDestroy?: boolean | undefined; + } + /** + * The class `AsyncResource` is designed to be extended by the embedder's async + * resources. Using this, users can easily trigger the lifetime events of their + * own resources. + * + * The `init` hook will trigger when an `AsyncResource` is instantiated. + * + * The following is an overview of the `AsyncResource` API. + * + * ```js + * import { AsyncResource, executionAsyncId } from 'node:async_hooks'; + * + * // AsyncResource() is meant to be extended. Instantiating a + * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then + * // async_hook.executionAsyncId() is used. + * const asyncResource = new AsyncResource( + * type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }, + * ); + * + * // Run a function in the execution context of the resource. This will + * // * establish the context of the resource + * // * trigger the AsyncHooks before callbacks + * // * call the provided function `fn` with the supplied arguments + * // * trigger the AsyncHooks after callbacks + * // * restore the original execution context + * asyncResource.runInAsyncScope(fn, thisArg, ...args); + * + * // Call AsyncHooks destroy callbacks. + * asyncResource.emitDestroy(); + * + * // Return the unique ID assigned to the AsyncResource instance. + * asyncResource.asyncId(); + * + * // Return the trigger ID for the AsyncResource instance. + * asyncResource.triggerAsyncId(); + * ``` + */ + class AsyncResource { + /** + * AsyncResource() is meant to be extended. Instantiating a + * new AsyncResource() also triggers init. If triggerAsyncId is omitted then + * async_hook.executionAsyncId() is used. + * @param type The type of async event. + * @param triggerAsyncId The ID of the execution context that created + * this async event (default: `executionAsyncId()`), or an + * AsyncResourceOptions object (since v9.3.0) + */ + constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions); + /** + * Binds the given function to the current execution context. + * @since v14.8.0, v12.19.0 + * @param fn The function to bind to the current execution context. + * @param type An optional name to associate with the underlying `AsyncResource`. + */ + static bind any, ThisArg>(fn: Func, type?: string, thisArg?: ThisArg): Func; + /** + * Binds the given function to execute to this `AsyncResource`'s scope. + * @since v14.8.0, v12.19.0 + * @param fn The function to bind to the current `AsyncResource`. + */ + bind any>(fn: Func): Func; + /** + * Call the provided function with the provided arguments in the execution context + * of the async resource. This will establish the context, trigger the AsyncHooks + * before callbacks, call the function, trigger the AsyncHooks after callbacks, and + * then restore the original execution context. + * @since v9.6.0 + * @param fn The function to call in the execution context of this async resource. + * @param thisArg The receiver to be used for the function call. + * @param args Optional arguments to pass to the function. + */ + runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result; + /** + * Call all `destroy` hooks. This should only ever be called once. An error will + * be thrown if it is called more than once. This **must** be manually called. If + * the resource is left to be collected by the GC then the `destroy` hooks will + * never be called. + * @return A reference to `asyncResource`. + */ + emitDestroy(): this; + /** + * @return The unique `asyncId` assigned to the resource. + */ + asyncId(): number; + /** + * + * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. + */ + triggerAsyncId(): number; + } + /** + * This class creates stores that stay coherent through asynchronous operations. + * + * While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory + * safe implementation that involves significant optimizations that are non-obvious + * to implement. + * + * The following example uses `AsyncLocalStorage` to build a simple logger + * that assigns IDs to incoming HTTP requests and includes them in messages + * logged within each request. + * + * ```js + * import http from 'node:http'; + * import { AsyncLocalStorage } from 'node:async_hooks'; + * + * const asyncLocalStorage = new AsyncLocalStorage(); + * + * function logWithId(msg) { + * const id = asyncLocalStorage.getStore(); + * console.log(`${id !== undefined ? id : '-'}:`, msg); + * } + * + * let idSeq = 0; + * http.createServer((req, res) => { + * asyncLocalStorage.run(idSeq++, () => { + * logWithId('start'); + * // Imagine any chain of async operations here + * setImmediate(() => { + * logWithId('finish'); + * res.end(); + * }); + * }); + * }).listen(8080); + * + * http.get('http://localhost:8080'); + * http.get('http://localhost:8080'); + * // Prints: + * // 0: start + * // 1: start + * // 0: finish + * // 1: finish + * ``` + * + * Each instance of `AsyncLocalStorage` maintains an independent storage context. + * Multiple instances can safely exist simultaneously without risk of interfering + * with each other's data. + * @since v13.10.0, v12.17.0 + */ + class AsyncLocalStorage { + /** + * Binds the given function to the current execution context. + * @since v19.8.0 + * @experimental + * @param fn The function to bind to the current execution context. + * @return A new function that calls `fn` within the captured execution context. + */ + static bind any>(fn: Func): Func; + /** + * Captures the current execution context and returns a function that accepts a + * function as an argument. Whenever the returned function is called, it + * calls the function passed to it within the captured context. + * + * ```js + * const asyncLocalStorage = new AsyncLocalStorage(); + * const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot()); + * const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore())); + * console.log(result); // returns 123 + * ``` + * + * AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple + * async context tracking purposes, for example: + * + * ```js + * class Foo { + * #runInAsyncScope = AsyncLocalStorage.snapshot(); + * + * get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); } + * } + * + * const foo = asyncLocalStorage.run(123, () => new Foo()); + * console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123 + * ``` + * @since v19.8.0 + * @experimental + * @return A new function with the signature `(fn: (...args) : R, ...args) : R`. + */ + static snapshot(): (fn: (...args: TArgs) => R, ...args: TArgs) => R; + /** + * Disables the instance of `AsyncLocalStorage`. All subsequent calls + * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. + * + * When calling `asyncLocalStorage.disable()`, all current contexts linked to the + * instance will be exited. + * + * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores + * provided by the `asyncLocalStorage`, as those objects are garbage collected + * along with the corresponding async resources. + * + * Use this method when the `asyncLocalStorage` is not in use anymore + * in the current process. + * @since v13.10.0, v12.17.0 + * @experimental + */ + disable(): void; + /** + * Returns the current store. + * If called outside of an asynchronous context initialized by + * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it + * returns `undefined`. + * @since v13.10.0, v12.17.0 + */ + getStore(): T | undefined; + /** + * Runs a function synchronously within a context and returns its + * return value. The store is not accessible outside of the callback function. + * The store is accessible to any asynchronous operations created within the + * callback. + * + * The optional `args` are passed to the callback function. + * + * If the callback function throws an error, the error is thrown by `run()` too. + * The stacktrace is not impacted by this call and the context is exited. + * + * Example: + * + * ```js + * const store = { id: 2 }; + * try { + * asyncLocalStorage.run(store, () => { + * asyncLocalStorage.getStore(); // Returns the store object + * setTimeout(() => { + * asyncLocalStorage.getStore(); // Returns the store object + * }, 200); + * throw new Error(); + * }); + * } catch (e) { + * asyncLocalStorage.getStore(); // Returns undefined + * // The error will be caught here + * } + * ``` + * @since v13.10.0, v12.17.0 + */ + run(store: T, callback: () => R): R; + run(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R; + /** + * Runs a function synchronously outside of a context and returns its + * return value. The store is not accessible within the callback function or + * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`. + * + * The optional `args` are passed to the callback function. + * + * If the callback function throws an error, the error is thrown by `exit()` too. + * The stacktrace is not impacted by this call and the context is re-entered. + * + * Example: + * + * ```js + * // Within a call to run + * try { + * asyncLocalStorage.getStore(); // Returns the store object or value + * asyncLocalStorage.exit(() => { + * asyncLocalStorage.getStore(); // Returns undefined + * throw new Error(); + * }); + * } catch (e) { + * asyncLocalStorage.getStore(); // Returns the same object or value + * // The error will be caught here + * } + * ``` + * @since v13.10.0, v12.17.0 + * @experimental + */ + exit(callback: (...args: TArgs) => R, ...args: TArgs): R; + /** + * Transitions into the context for the remainder of the current + * synchronous execution and then persists the store through any following + * asynchronous calls. + * + * Example: + * + * ```js + * const store = { id: 1 }; + * // Replaces previous store with the given store object + * asyncLocalStorage.enterWith(store); + * asyncLocalStorage.getStore(); // Returns the store object + * someAsyncOperation(() => { + * asyncLocalStorage.getStore(); // Returns the same object + * }); + * ``` + * + * This transition will continue for the _entire_ synchronous execution. + * This means that if, for example, the context is entered within an event + * handler subsequent event handlers will also run within that context unless + * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons + * to use the latter method. + * + * ```js + * const store = { id: 1 }; + * + * emitter.on('my-event', () => { + * asyncLocalStorage.enterWith(store); + * }); + * emitter.on('my-event', () => { + * asyncLocalStorage.getStore(); // Returns the same object + * }); + * + * asyncLocalStorage.getStore(); // Returns undefined + * emitter.emit('my-event'); + * asyncLocalStorage.getStore(); // Returns the same object + * ``` + * @since v13.11.0, v12.17.0 + * @experimental + */ + enterWith(store: T): void; + } +} +declare module 'node:async_hooks' { + export * from 'async_hooks'; +} diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts new file mode 100755 index 0000000..179a825 --- /dev/null +++ b/node_modules/@types/node/buffer.d.ts @@ -0,0 +1,2354 @@ +/** + * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many + * Node.js APIs support `Buffer`s. + * + * The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and + * extends it with methods that cover additional use cases. Node.js APIs accept + * plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well. + * + * While the `Buffer` class is available within the global scope, it is still + * recommended to explicitly reference it via an import or require statement. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Creates a zero-filled Buffer of length 10. + * const buf1 = Buffer.alloc(10); + * + * // Creates a Buffer of length 10, + * // filled with bytes which all have the value `1`. + * const buf2 = Buffer.alloc(10, 1); + * + * // Creates an uninitialized buffer of length 10. + * // This is faster than calling Buffer.alloc() but the returned + * // Buffer instance might contain old data that needs to be + * // overwritten using fill(), write(), or other functions that fill the Buffer's + * // contents. + * const buf3 = Buffer.allocUnsafe(10); + * + * // Creates a Buffer containing the bytes [1, 2, 3]. + * const buf4 = Buffer.from([1, 2, 3]); + * + * // Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries + * // are all truncated using `(value & 255)` to fit into the range 0–255. + * const buf5 = Buffer.from([257, 257.5, -255, '1']); + * + * // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést': + * // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation) + * // [116, 195, 169, 115, 116] (in decimal notation) + * const buf6 = Buffer.from('tést'); + * + * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74]. + * const buf7 = Buffer.from('tést', 'latin1'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/buffer.js) + */ +declare module 'buffer' { + import { BinaryLike } from 'node:crypto'; + import { ReadableStream as WebReadableStream } from 'node:stream/web'; + /** + * This function returns `true` if `input` contains only valid UTF-8-encoded data, + * including the case in which `input` is empty. + * + * Throws if the `input` is a detached array buffer. + * @since v19.4.0, v18.14.0 + * @param input The input to validate. + */ + export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; + /** + * This function returns `true` if `input` contains only valid ASCII-encoded data, + * including the case in which `input` is empty. + * + * Throws if the `input` is a detached array buffer. + * @since v19.6.0, v18.15.0 + * @param input The input to validate. + */ + export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; + export const INSPECT_MAX_BYTES: number; + export const kMaxLength: number; + export const kStringMaxLength: number; + export const constants: { + MAX_LENGTH: number; + MAX_STRING_LENGTH: number; + }; + export type TranscodeEncoding = 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'latin1' | 'binary'; + /** + * Re-encodes the given `Buffer` or `Uint8Array` instance from one character + * encoding to another. Returns a new `Buffer` instance. + * + * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if + * conversion from `fromEnc` to `toEnc` is not permitted. + * + * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`,`'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`. + * + * The transcoding process will use substitution characters if a given byte + * sequence cannot be adequately represented in the target encoding. For instance: + * + * ```js + * import { Buffer, transcode } from 'node:buffer'; + * + * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii'); + * console.log(newBuf.toString('ascii')); + * // Prints: '?' + * ``` + * + * Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced + * with `?` in the transcoded `Buffer`. + * @since v7.1.0 + * @param source A `Buffer` or `Uint8Array` instance. + * @param fromEnc The current encoding. + * @param toEnc To target encoding. + */ + export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; + export const SlowBuffer: { + /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */ + new (size: number): Buffer; + prototype: Buffer; + }; + /** + * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using + * a prior call to `URL.createObjectURL()`. + * @since v16.7.0 + * @experimental + * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. + */ + export function resolveObjectURL(id: string): Blob | undefined; + export { Buffer }; + /** + * @experimental + */ + export interface BlobOptions { + /** + * @default 'utf8' + */ + encoding?: BufferEncoding | undefined; + /** + * The Blob content-type. The intent is for `type` to convey + * the MIME media type of the data, however no validation of the type format + * is performed. + */ + type?: string | undefined; + } + /** + * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across + * multiple worker threads. + * @since v15.7.0, v14.18.0 + */ + export class Blob { + /** + * The total size of the `Blob` in bytes. + * @since v15.7.0, v14.18.0 + */ + readonly size: number; + /** + * The content-type of the `Blob`. + * @since v15.7.0, v14.18.0 + */ + readonly type: string; + /** + * Creates a new `Blob` object containing a concatenation of the given sources. + * + * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into + * the 'Blob' and can therefore be safely modified after the 'Blob' is created. + * + * String sources are also copied into the `Blob`. + */ + constructor(sources: Array, options?: BlobOptions); + /** + * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of + * the `Blob` data. + * @since v15.7.0, v14.18.0 + */ + arrayBuffer(): Promise; + /** + * Creates and returns a new `Blob` containing a subset of this `Blob` objects + * data. The original `Blob` is not altered. + * @since v15.7.0, v14.18.0 + * @param start The starting index. + * @param end The ending index. + * @param type The content-type for the new `Blob` + */ + slice(start?: number, end?: number, type?: string): Blob; + /** + * Returns a promise that fulfills with the contents of the `Blob` decoded as a + * UTF-8 string. + * @since v15.7.0, v14.18.0 + */ + text(): Promise; + /** + * Returns a new `ReadableStream` that allows the content of the `Blob` to be read. + * @since v16.7.0 + */ + stream(): WebReadableStream; + } + export interface FileOptions { + /** + * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be + * converted to the platform native line-ending as specified by `require('node:os').EOL`. + */ + endings?: 'native' | 'transparent'; + /** The File content-type. */ + type?: string; + /** The last modified date of the file. `Default`: Date.now(). */ + lastModified?: number; + } + /** + * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. + * @since v19.2.0, v18.13.0 + */ + export class File extends Blob { + constructor(sources: Array, fileName: string, options?: FileOptions); + /** + * The name of the `File`. + * @since v19.2.0, v18.13.0 + */ + readonly name: string; + /** + * The last modified date of the `File`. + * @since v19.2.0, v18.13.0 + */ + readonly lastModified: number; + } + export import atob = globalThis.atob; + export import btoa = globalThis.btoa; + import { Blob as NodeBlob } from 'buffer'; + // This conditional type will be the existing global Blob in a browser, or + // the copy below in a Node environment. + type __Blob = typeof globalThis extends { onmessage: any; Blob: infer T } ? T : NodeBlob; + global { + namespace NodeJS { + export { BufferEncoding }; + } + // Buffer class + type BufferEncoding = + | 'ascii' + | 'utf8' + | 'utf-8' + | 'utf16le' + | 'ucs2' + | 'ucs-2' + | 'base64' + | 'base64url' + | 'latin1' + | 'binary' + | 'hex'; + type WithImplicitCoercion = + | T + | { + valueOf(): T; + }; + /** + * Raw data is stored in instances of the Buffer class. + * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. + * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex' + */ + interface BufferConstructor { + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. + */ + new (str: string, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). + */ + new (size: number): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. + */ + new (array: Uint8Array): Buffer; + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}/{SharedArrayBuffer}. + * + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. + */ + new (arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. + */ + new (array: ReadonlyArray): Buffer; + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. + */ + new (buffer: Buffer): Buffer; + /** + * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. + * Array entries outside that range will be truncated to fit into it. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'. + * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); + * ``` + * + * If `array` is an `Array`\-like object (that is, one with a `length` property of + * type `number`), it is treated as if it is an array, unless it is a `Buffer` or + * a `Uint8Array`. This means all other `TypedArray` variants get treated as an`Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`. + * + * A `TypeError` will be thrown if `array` is not an `Array` or another type + * appropriate for `Buffer.from()` variants. + * + * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does. + * @since v5.10.0 + */ + from( + arrayBuffer: WithImplicitCoercion, + byteOffset?: number, + length?: number, + ): Buffer; + /** + * Creates a new Buffer using the passed {data} + * @param data data to create a new Buffer + */ + from(data: Uint8Array | ReadonlyArray): Buffer; + from(data: WithImplicitCoercion | string>): Buffer; + /** + * Creates a new Buffer containing the given JavaScript string {str}. + * If provided, the {encoding} parameter identifies the character encoding. + * If not provided, {encoding} defaults to 'utf8'. + */ + from( + str: + | WithImplicitCoercion + | { + [Symbol.toPrimitive](hint: 'string'): string; + }, + encoding?: BufferEncoding, + ): Buffer; + /** + * Creates a new Buffer using the passed {data} + * @param values to create a new Buffer + */ + of(...items: number[]): Buffer; + /** + * Returns `true` if `obj` is a `Buffer`, `false` otherwise. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * Buffer.isBuffer(Buffer.alloc(10)); // true + * Buffer.isBuffer(Buffer.from('foo')); // true + * Buffer.isBuffer('a string'); // false + * Buffer.isBuffer([]); // false + * Buffer.isBuffer(new Uint8Array(1024)); // false + * ``` + * @since v0.1.101 + */ + isBuffer(obj: any): obj is Buffer; + /** + * Returns `true` if `encoding` is the name of a supported character encoding, + * or `false` otherwise. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * console.log(Buffer.isEncoding('utf8')); + * // Prints: true + * + * console.log(Buffer.isEncoding('hex')); + * // Prints: true + * + * console.log(Buffer.isEncoding('utf/8')); + * // Prints: false + * + * console.log(Buffer.isEncoding('')); + * // Prints: false + * ``` + * @since v0.9.1 + * @param encoding A character encoding name to check. + */ + isEncoding(encoding: string): encoding is BufferEncoding; + /** + * Returns the byte length of a string when encoded using `encoding`. + * This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account + * for the encoding that is used to convert the string into bytes. + * + * For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input. + * For strings that contain non-base64/hex-encoded data (e.g. whitespace), the + * return value might be greater than the length of a `Buffer` created from the + * string. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const str = '\u00bd + \u00bc = \u00be'; + * + * console.log(`${str}: ${str.length} characters, ` + + * `${Buffer.byteLength(str, 'utf8')} bytes`); + * // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes + * ``` + * + * When `string` is a + * `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/- + * Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop- + * er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned. + * @since v0.1.90 + * @param string A value to calculate the length of. + * @param [encoding='utf8'] If `string` is a string, this is its encoding. + * @return The number of bytes contained within `string`. + */ + byteLength( + string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, + encoding?: BufferEncoding, + ): number; + /** + * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. + * + * If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned. + * + * If `totalLength` is not provided, it is calculated from the `Buffer` instances + * in `list` by adding their lengths. + * + * If `totalLength` is provided, it is coerced to an unsigned integer. If the + * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is + * truncated to `totalLength`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a single `Buffer` from a list of three `Buffer` instances. + * + * const buf1 = Buffer.alloc(10); + * const buf2 = Buffer.alloc(14); + * const buf3 = Buffer.alloc(18); + * const totalLength = buf1.length + buf2.length + buf3.length; + * + * console.log(totalLength); + * // Prints: 42 + * + * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); + * + * console.log(bufA); + * // Prints: + * console.log(bufA.length); + * // Prints: 42 + * ``` + * + * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. + * @since v0.7.11 + * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate. + * @param totalLength Total length of the `Buffer` instances in `list` when concatenated. + */ + concat(list: ReadonlyArray, totalLength?: number): Buffer; + /** + * Copies the underlying memory of `view` into a new `Buffer`. + * + * ```js + * const u16 = new Uint16Array([0, 0xffff]); + * const buf = Buffer.copyBytesFrom(u16, 1, 1); + * u16[1] = 0; + * console.log(buf.length); // 2 + * console.log(buf[0]); // 255 + * console.log(buf[1]); // 255 + * ``` + * @since v19.8.0 + * @param view The {TypedArray} to copy. + * @param [offset=': 0'] The starting offset within `view`. + * @param [length=view.length - offset] The number of elements from `view` to copy. + */ + copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer; + /** + * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('1234'); + * const buf2 = Buffer.from('0123'); + * const arr = [buf1, buf2]; + * + * console.log(arr.sort(Buffer.compare)); + * // Prints: [ , ] + * // (This result is equal to: [buf2, buf1].) + * ``` + * @since v0.11.13 + * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details. + */ + compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1; + /** + * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(5); + * + * console.log(buf); + * // Prints: + * ``` + * + * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. + * + * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(5, 'a'); + * + * console.log(buf); + * // Prints: + * ``` + * + * If both `fill` and `encoding` are specified, the allocated `Buffer` will be + * initialized by calling `buf.fill(fill, encoding)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); + * + * console.log(buf); + * // Prints: + * ``` + * + * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance + * contents will never contain sensitive data from previous allocations, including + * data that might not have been allocated for `Buffer`s. + * + * A `TypeError` will be thrown if `size` is not a number. + * @since v5.10.0 + * @param size The desired length of the new `Buffer`. + * @param [fill=0] A value to pre-fill the new `Buffer` with. + * @param [encoding='utf8'] If `fill` is a string, this is its encoding. + */ + alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. + * + * The underlying memory for `Buffer` instances created in this way is _not_ + * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(10); + * + * console.log(buf); + * // Prints (contents may vary): + * + * buf.fill(0); + * + * console.log(buf); + * // Prints: + * ``` + * + * A `TypeError` will be thrown if `size` is not a number. + * + * The `Buffer` module pre-allocates an internal `Buffer` instance of + * size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, + * and `Buffer.concat()` only when `size` is less than or equal to`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). + * + * Use of this pre-allocated internal memory pool is a key difference between + * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. + * Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less + * than or equal to half `Buffer.poolSize`. The + * difference is subtle but can be important when an application requires the + * additional performance that `Buffer.allocUnsafe()` provides. + * @since v5.10.0 + * @param size The desired length of the new `Buffer`. + */ + allocUnsafe(size: number): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if + * `size` is 0. + * + * The underlying memory for `Buffer` instances created in this way is _not_ + * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize + * such `Buffer` instances with zeroes. + * + * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, + * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This + * allows applications to avoid the garbage collection overhead of creating many + * individually allocated `Buffer` instances. This approach improves both + * performance and memory usage by eliminating the need to track and clean up as + * many individual `ArrayBuffer` objects. + * + * However, in the case where a developer may need to retain a small chunk of + * memory from a pool for an indeterminate amount of time, it may be appropriate + * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and + * then copying out the relevant bits. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Need to keep around a few small chunks of memory. + * const store = []; + * + * socket.on('readable', () => { + * let data; + * while (null !== (data = readable.read())) { + * // Allocate for retained data. + * const sb = Buffer.allocUnsafeSlow(10); + * + * // Copy the data into the new allocation. + * data.copy(sb, 0, 0, 10); + * + * store.push(sb); + * } + * }); + * ``` + * + * A `TypeError` will be thrown if `size` is not a number. + * @since v5.12.0 + * @param size The desired length of the new `Buffer`. + */ + allocUnsafeSlow(size: number): Buffer; + /** + * This is the size (in bytes) of pre-allocated internal `Buffer` instances used + * for pooling. This value may be modified. + * @since v0.11.3 + */ + poolSize: number; + } + interface Buffer extends Uint8Array { + /** + * Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did + * not contain enough space to fit the entire string, only part of `string` will be + * written. However, partially encoded characters will not be written. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(256); + * + * const len = buf.write('\u00bd + \u00bc = \u00be', 0); + * + * console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); + * // Prints: 12 bytes: ½ + ¼ = ¾ + * + * const buffer = Buffer.alloc(10); + * + * const length = buffer.write('abcd', 8); + * + * console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`); + * // Prints: 2 bytes : ab + * ``` + * @since v0.1.90 + * @param string String to write to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write `string`. + * @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`). + * @param [encoding='utf8'] The character encoding of `string`. + * @return Number of bytes written. + */ + write(string: string, encoding?: BufferEncoding): number; + write(string: string, offset: number, encoding?: BufferEncoding): number; + write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; + /** + * Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`. + * + * If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8, + * then each invalid byte is replaced with the replacement character `U+FFFD`. + * + * The maximum length of a string instance (in UTF-16 code units) is available + * as {@link constants.MAX_STRING_LENGTH}. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * console.log(buf1.toString('utf8')); + * // Prints: abcdefghijklmnopqrstuvwxyz + * console.log(buf1.toString('utf8', 0, 5)); + * // Prints: abcde + * + * const buf2 = Buffer.from('tést'); + * + * console.log(buf2.toString('hex')); + * // Prints: 74c3a97374 + * console.log(buf2.toString('utf8', 0, 3)); + * // Prints: té + * console.log(buf2.toString(undefined, 0, 3)); + * // Prints: té + * ``` + * @since v0.1.90 + * @param [encoding='utf8'] The character encoding to use. + * @param [start=0] The byte offset to start decoding at. + * @param [end=buf.length] The byte offset to stop decoding at (not inclusive). + */ + toString(encoding?: BufferEncoding, start?: number, end?: number): string; + /** + * Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls + * this function when stringifying a `Buffer` instance. + * + * `Buffer.from()` accepts objects in the format returned from this method. + * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); + * const json = JSON.stringify(buf); + * + * console.log(json); + * // Prints: {"type":"Buffer","data":[1,2,3,4,5]} + * + * const copy = JSON.parse(json, (key, value) => { + * return value && value.type === 'Buffer' ? + * Buffer.from(value) : + * value; + * }); + * + * console.log(copy); + * // Prints: + * ``` + * @since v0.9.2 + */ + toJSON(): { + type: 'Buffer'; + data: number[]; + }; + /** + * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('ABC'); + * const buf2 = Buffer.from('414243', 'hex'); + * const buf3 = Buffer.from('ABCD'); + * + * console.log(buf1.equals(buf2)); + * // Prints: true + * console.log(buf1.equals(buf3)); + * // Prints: false + * ``` + * @since v0.11.13 + * @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`. + */ + equals(otherBuffer: Uint8Array): boolean; + /** + * Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order. + * Comparison is based on the actual sequence of bytes in each `Buffer`. + * + * * `0` is returned if `target` is the same as `buf` + * * `1` is returned if `target` should come _before_`buf` when sorted. + * * `-1` is returned if `target` should come _after_`buf` when sorted. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('ABC'); + * const buf2 = Buffer.from('BCD'); + * const buf3 = Buffer.from('ABCD'); + * + * console.log(buf1.compare(buf1)); + * // Prints: 0 + * console.log(buf1.compare(buf2)); + * // Prints: -1 + * console.log(buf1.compare(buf3)); + * // Prints: -1 + * console.log(buf2.compare(buf1)); + * // Prints: 1 + * console.log(buf2.compare(buf3)); + * // Prints: 1 + * console.log([buf1, buf2, buf3].sort(Buffer.compare)); + * // Prints: [ , , ] + * // (This result is equal to: [buf1, buf3, buf2].) + * ``` + * + * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]); + * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]); + * + * console.log(buf1.compare(buf2, 5, 9, 0, 4)); + * // Prints: 0 + * console.log(buf1.compare(buf2, 0, 6, 4)); + * // Prints: -1 + * console.log(buf1.compare(buf2, 5, 6, 5)); + * // Prints: 1 + * ``` + * + * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`,`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`. + * @since v0.11.13 + * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`. + * @param [targetStart=0] The offset within `target` at which to begin comparison. + * @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive). + * @param [sourceStart=0] The offset within `buf` at which to begin comparison. + * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive). + */ + compare( + target: Uint8Array, + targetStart?: number, + targetEnd?: number, + sourceStart?: number, + sourceEnd?: number, + ): -1 | 0 | 1; + /** + * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`. + * + * [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available + * for all TypedArrays, including Node.js `Buffer`s, although it takes + * different function arguments. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create two `Buffer` instances. + * const buf1 = Buffer.allocUnsafe(26); + * const buf2 = Buffer.allocUnsafe(26).fill('!'); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`. + * buf1.copy(buf2, 8, 16, 20); + * // This is equivalent to: + * // buf2.set(buf1.subarray(16, 20), 8); + * + * console.log(buf2.toString('ascii', 0, 25)); + * // Prints: !!!!!!!!qrst!!!!!!!!!!!!! + * ``` + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a `Buffer` and copy data from one region to an overlapping region + * // within the same `Buffer`. + * + * const buf = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf[i] = i + 97; + * } + * + * buf.copy(buf, 0, 4, 10); + * + * console.log(buf.toString()); + * // Prints: efghijghijklmnopqrstuvwxyz + * ``` + * @since v0.1.90 + * @param target A `Buffer` or {@link Uint8Array} to copy into. + * @param [targetStart=0] The offset within `target` at which to begin writing. + * @param [sourceStart=0] The offset within `buf` from which to begin copying. + * @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive). + * @return The number of bytes copied. + */ + copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + /** + * Returns a new `Buffer` that references the same memory as the original, but + * offset and cropped by the `start` and `end` indices. + * + * This method is not compatible with the `Uint8Array.prototype.slice()`, + * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * const copiedBuf = Uint8Array.prototype.slice.call(buf); + * copiedBuf[0]++; + * console.log(copiedBuf.toString()); + * // Prints: cuffer + * + * console.log(buf.toString()); + * // Prints: buffer + * + * // With buf.slice(), the original buffer is modified. + * const notReallyCopiedBuf = buf.slice(); + * notReallyCopiedBuf[0]++; + * console.log(notReallyCopiedBuf.toString()); + * // Prints: cuffer + * console.log(buf.toString()); + * // Also prints: cuffer (!) + * ``` + * @since v0.3.0 + * @deprecated Use `subarray` instead. + * @param [start=0] Where the new `Buffer` will start. + * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). + */ + slice(start?: number, end?: number): Buffer; + /** + * Returns a new `Buffer` that references the same memory as the original, but + * offset and cropped by the `start` and `end` indices. + * + * Specifying `end` greater than `buf.length` will return the same result as + * that of `end` equal to `buf.length`. + * + * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). + * + * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte + * // from the original `Buffer`. + * + * const buf1 = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * const buf2 = buf1.subarray(0, 3); + * + * console.log(buf2.toString('ascii', 0, buf2.length)); + * // Prints: abc + * + * buf1[0] = 33; + * + * console.log(buf2.toString('ascii', 0, buf2.length)); + * // Prints: !bc + * ``` + * + * Specifying negative indexes causes the slice to be generated relative to the + * end of `buf` rather than the beginning. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * console.log(buf.subarray(-6, -1).toString()); + * // Prints: buffe + * // (Equivalent to buf.subarray(0, 5).) + * + * console.log(buf.subarray(-6, -2).toString()); + * // Prints: buff + * // (Equivalent to buf.subarray(0, 4).) + * + * console.log(buf.subarray(-5, -2).toString()); + * // Prints: uff + * // (Equivalent to buf.subarray(1, 4).) + * ``` + * @since v3.0.0 + * @param [start=0] Where the new `Buffer` will start. + * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). + */ + subarray(start?: number, end?: number): Buffer; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigInt64BE(0x0102030405060708n, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigInt64BE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigInt64LE(0x0102030405060708n, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigInt64LE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. + * + * This function is also available under the `writeBigUint64BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigUInt64BE(0xdecafafecacefaden, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigUInt64BE(value: bigint, offset?: number): number; + /** + * @alias Buffer.writeBigUInt64BE + * @since v14.10.0, v12.19.0 + */ + writeBigUint64BE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigUInt64LE(0xdecafafecacefaden, 0); + * + * console.log(buf); + * // Prints: + * ``` + * + * This function is also available under the `writeBigUint64LE` alias. + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigUInt64LE(value: bigint, offset?: number): number; + /** + * @alias Buffer.writeBigUInt64LE + * @since v14.10.0, v12.19.0 + */ + writeBigUint64LE(value: bigint, offset?: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than an unsigned integer. + * + * This function is also available under the `writeUintLE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeUIntLE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeUIntLE(value: number, offset: number, byteLength: number): number; + /** + * @alias Buffer.writeUIntLE + * @since v14.9.0, v12.19.0 + */ + writeUintLE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than an unsigned integer. + * + * This function is also available under the `writeUintBE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeUIntBE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeUIntBE(value: number, offset: number, byteLength: number): number; + /** + * @alias Buffer.writeUIntBE + * @since v14.9.0, v12.19.0 + */ + writeUintBE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than a signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeIntLE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeIntLE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a + * signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeIntBE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeIntBE(value: number, offset: number, byteLength: number): number; + /** + * Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readBigUint64BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); + * + * console.log(buf.readBigUInt64BE(0)); + * // Prints: 4294967295n + * ``` + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigUInt64BE(offset?: number): bigint; + /** + * @alias Buffer.readBigUInt64BE + * @since v14.10.0, v12.19.0 + */ + readBigUint64BE(offset?: number): bigint; + /** + * Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readBigUint64LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); + * + * console.log(buf.readBigUInt64LE(0)); + * // Prints: 18446744069414584320n + * ``` + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigUInt64LE(offset?: number): bigint; + /** + * @alias Buffer.readBigUInt64LE + * @since v14.10.0, v12.19.0 + */ + readBigUint64LE(offset?: number): bigint; + /** + * Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed + * values. + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigInt64BE(offset?: number): bigint; + /** + * Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed + * values. + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigInt64LE(offset?: number): bigint; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting + * up to 48 bits of accuracy. + * + * This function is also available under the `readUintLE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readUIntLE(0, 6).toString(16)); + * // Prints: ab9078563412 + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readUIntLE(offset: number, byteLength: number): number; + /** + * @alias Buffer.readUIntLE + * @since v14.9.0, v12.19.0 + */ + readUintLE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting + * up to 48 bits of accuracy. + * + * This function is also available under the `readUintBE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readUIntBE(0, 6).toString(16)); + * // Prints: 1234567890ab + * console.log(buf.readUIntBE(1, 6).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readUIntBE(offset: number, byteLength: number): number; + /** + * @alias Buffer.readUIntBE + * @since v14.9.0, v12.19.0 + */ + readUintBE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value + * supporting up to 48 bits of accuracy. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readIntLE(0, 6).toString(16)); + * // Prints: -546f87a9cbee + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readIntLE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value + * supporting up to 48 bits of accuracy. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readIntBE(0, 6).toString(16)); + * // Prints: 1234567890ab + * console.log(buf.readIntBE(1, 6).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * console.log(buf.readIntBE(1, 0).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readIntBE(offset: number, byteLength: number): number; + /** + * Reads an unsigned 8-bit integer from `buf` at the specified `offset`. + * + * This function is also available under the `readUint8` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, -2]); + * + * console.log(buf.readUInt8(0)); + * // Prints: 1 + * console.log(buf.readUInt8(1)); + * // Prints: 254 + * console.log(buf.readUInt8(2)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. + */ + readUInt8(offset?: number): number; + /** + * @alias Buffer.readUInt8 + * @since v14.9.0, v12.19.0 + */ + readUint8(offset?: number): number; + /** + * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint16LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56]); + * + * console.log(buf.readUInt16LE(0).toString(16)); + * // Prints: 3412 + * console.log(buf.readUInt16LE(1).toString(16)); + * // Prints: 5634 + * console.log(buf.readUInt16LE(2).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readUInt16LE(offset?: number): number; + /** + * @alias Buffer.readUInt16LE + * @since v14.9.0, v12.19.0 + */ + readUint16LE(offset?: number): number; + /** + * Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint16BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56]); + * + * console.log(buf.readUInt16BE(0).toString(16)); + * // Prints: 1234 + * console.log(buf.readUInt16BE(1).toString(16)); + * // Prints: 3456 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readUInt16BE(offset?: number): number; + /** + * @alias Buffer.readUInt16BE + * @since v14.9.0, v12.19.0 + */ + readUint16BE(offset?: number): number; + /** + * Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint32LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); + * + * console.log(buf.readUInt32LE(0).toString(16)); + * // Prints: 78563412 + * console.log(buf.readUInt32LE(1).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readUInt32LE(offset?: number): number; + /** + * @alias Buffer.readUInt32LE + * @since v14.9.0, v12.19.0 + */ + readUint32LE(offset?: number): number; + /** + * Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint32BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); + * + * console.log(buf.readUInt32BE(0).toString(16)); + * // Prints: 12345678 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readUInt32BE(offset?: number): number; + /** + * @alias Buffer.readUInt32BE + * @since v14.9.0, v12.19.0 + */ + readUint32BE(offset?: number): number; + /** + * Reads a signed 8-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([-1, 5]); + * + * console.log(buf.readInt8(0)); + * // Prints: -1 + * console.log(buf.readInt8(1)); + * // Prints: 5 + * console.log(buf.readInt8(2)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. + */ + readInt8(offset?: number): number; + /** + * Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 5]); + * + * console.log(buf.readInt16LE(0)); + * // Prints: 1280 + * console.log(buf.readInt16LE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readInt16LE(offset?: number): number; + /** + * Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 5]); + * + * console.log(buf.readInt16BE(0)); + * // Prints: 5 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readInt16BE(offset?: number): number; + /** + * Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 0, 0, 5]); + * + * console.log(buf.readInt32LE(0)); + * // Prints: 83886080 + * console.log(buf.readInt32LE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readInt32LE(offset?: number): number; + /** + * Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 0, 0, 5]); + * + * console.log(buf.readInt32BE(0)); + * // Prints: 5 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readInt32BE(offset?: number): number; + /** + * Reads a 32-bit, little-endian float from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4]); + * + * console.log(buf.readFloatLE(0)); + * // Prints: 1.539989614439558e-36 + * console.log(buf.readFloatLE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readFloatLE(offset?: number): number; + /** + * Reads a 32-bit, big-endian float from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4]); + * + * console.log(buf.readFloatBE(0)); + * // Prints: 2.387939260590663e-38 + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readFloatBE(offset?: number): number; + /** + * Reads a 64-bit, little-endian double from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + * + * console.log(buf.readDoubleLE(0)); + * // Prints: 5.447603722011605e-270 + * console.log(buf.readDoubleLE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. + */ + readDoubleLE(offset?: number): number; + /** + * Reads a 64-bit, big-endian double from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + * + * console.log(buf.readDoubleBE(0)); + * // Prints: 8.20788039913184e-304 + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. + */ + readDoubleBE(offset?: number): number; + reverse(): this; + /** + * Interprets `buf` as an array of unsigned 16-bit integers and swaps the + * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap16(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap16(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * + * One convenient use of `buf.swap16()` is to perform a fast in-place conversion + * between UTF-16 little-endian and UTF-16 big-endian: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le'); + * buf.swap16(); // Convert to big-endian UTF-16 text. + * ``` + * @since v5.10.0 + * @return A reference to `buf`. + */ + swap16(): Buffer; + /** + * Interprets `buf` as an array of unsigned 32-bit integers and swaps the + * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap32(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap32(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * @since v5.10.0 + * @return A reference to `buf`. + */ + swap32(): Buffer; + /** + * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_. + * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap64(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap64(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * @since v6.3.0 + * @return A reference to `buf`. + */ + swap64(): Buffer; + /** + * Writes `value` to `buf` at the specified `offset`. `value` must be a + * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything + * other than an unsigned 8-bit integer. + * + * This function is also available under the `writeUint8` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt8(0x3, 0); + * buf.writeUInt8(0x4, 1); + * buf.writeUInt8(0x23, 2); + * buf.writeUInt8(0x42, 3); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. + * @return `offset` plus the number of bytes written. + */ + writeUInt8(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt8 + * @since v14.9.0, v12.19.0 + */ + writeUint8(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is + * anything other than an unsigned 16-bit integer. + * + * This function is also available under the `writeUint16LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt16LE(0xdead, 0); + * buf.writeUInt16LE(0xbeef, 2); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeUInt16LE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt16LE + * @since v14.9.0, v12.19.0 + */ + writeUint16LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an + * unsigned 16-bit integer. + * + * This function is also available under the `writeUint16BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt16BE(0xdead, 0); + * buf.writeUInt16BE(0xbeef, 2); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeUInt16BE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt16BE + * @since v14.9.0, v12.19.0 + */ + writeUint16BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is + * anything other than an unsigned 32-bit integer. + * + * This function is also available under the `writeUint32LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt32LE(0xfeedface, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeUInt32LE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt32LE + * @since v14.9.0, v12.19.0 + */ + writeUint32LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an + * unsigned 32-bit integer. + * + * This function is also available under the `writeUint32BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt32BE(0xfeedface, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeUInt32BE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt32BE + * @since v14.9.0, v12.19.0 + */ + writeUint32BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset`. `value` must be a valid + * signed 8-bit integer. Behavior is undefined when `value` is anything other than + * a signed 8-bit integer. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt8(2, 0); + * buf.writeInt8(-2, 1); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. + * @return `offset` plus the number of bytes written. + */ + writeInt8(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is + * anything other than a signed 16-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt16LE(0x0304, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeInt16LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is + * anything other than a signed 16-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt16BE(0x0102, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeInt16BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is + * anything other than a signed 32-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeInt32LE(0x05060708, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeInt32LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is + * anything other than a signed 32-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeInt32BE(0x01020304, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeInt32BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is + * undefined when `value` is anything other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeFloatLE(0xcafebabe, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeFloatLE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is + * undefined when `value` is anything other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeFloatBE(0xcafebabe, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeFloatBE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything + * other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeDoubleLE(123.456, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeDoubleLE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything + * other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeDoubleBE(123.456, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeDoubleBE(value: number, offset?: number): number; + /** + * Fills `buf` with the specified `value`. If the `offset` and `end` are not given, + * the entire `buf` will be filled: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Fill a `Buffer` with the ASCII character 'h'. + * + * const b = Buffer.allocUnsafe(50).fill('h'); + * + * console.log(b.toString()); + * // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh + * + * // Fill a buffer with empty string + * const c = Buffer.allocUnsafe(5).fill(''); + * + * console.log(c.fill('')); + * // Prints: + * ``` + * + * `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or + * integer. If the resulting integer is greater than `255` (decimal), `buf` will be + * filled with `value & 255`. + * + * If the final write of a `fill()` operation falls on a multi-byte character, + * then only the bytes of that character that fit into `buf` are written: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Fill a `Buffer` with character that takes up two bytes in UTF-8. + * + * console.log(Buffer.allocUnsafe(5).fill('\u0222')); + * // Prints: + * ``` + * + * If `value` contains invalid characters, it is truncated; if no valid + * fill data remains, an exception is thrown: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(5); + * + * console.log(buf.fill('a')); + * // Prints: + * console.log(buf.fill('aazz', 'hex')); + * // Prints: + * console.log(buf.fill('zz', 'hex')); + * // Throws an exception. + * ``` + * @since v0.5.0 + * @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`. + * @param [offset=0] Number of bytes to skip before starting to fill `buf`. + * @param [end=buf.length] Where to stop filling `buf` (not inclusive). + * @param [encoding='utf8'] The encoding for `value` if `value` is a string. + * @return A reference to `buf`. + */ + fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; + /** + * If `value` is: + * + * * a string, `value` is interpreted according to the character encoding in`encoding`. + * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety. + * To compare a partial `Buffer`, use `buf.subarray`. + * * a number, `value` will be interpreted as an unsigned 8-bit integer + * value between `0` and `255`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this is a buffer'); + * + * console.log(buf.indexOf('this')); + * // Prints: 0 + * console.log(buf.indexOf('is')); + * // Prints: 2 + * console.log(buf.indexOf(Buffer.from('a buffer'))); + * // Prints: 8 + * console.log(buf.indexOf(97)); + * // Prints: 8 (97 is the decimal ASCII value for 'a') + * console.log(buf.indexOf(Buffer.from('a buffer example'))); + * // Prints: -1 + * console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8))); + * // Prints: 8 + * + * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); + * + * console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le')); + * // Prints: 4 + * console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le')); + * // Prints: 6 + * ``` + * + * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value, + * an integer between 0 and 255. + * + * If `byteOffset` is not a number, it will be coerced to a number. If the result + * of coercion is `NaN` or `0`, then the entire buffer will be searched. This + * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf). + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const b = Buffer.from('abcdef'); + * + * // Passing a value that's a number, but not a valid byte. + * // Prints: 2, equivalent to searching for 99 or 'c'. + * console.log(b.indexOf(99.9)); + * console.log(b.indexOf(256 + 99)); + * + * // Passing a byteOffset that coerces to NaN or 0. + * // Prints: 1, searching the whole buffer. + * console.log(b.indexOf('b', undefined)); + * console.log(b.indexOf('b', {})); + * console.log(b.indexOf('b', null)); + * console.log(b.indexOf('b', [])); + * ``` + * + * If `value` is an empty string or empty `Buffer` and `byteOffset` is less + * than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned. + * @since v1.5.0 + * @param value What to search for. + * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. + * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. + */ + indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + /** + * Identical to `buf.indexOf()`, except the last occurrence of `value` is found + * rather than the first occurrence. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this buffer is a buffer'); + * + * console.log(buf.lastIndexOf('this')); + * // Prints: 0 + * console.log(buf.lastIndexOf('buffer')); + * // Prints: 17 + * console.log(buf.lastIndexOf(Buffer.from('buffer'))); + * // Prints: 17 + * console.log(buf.lastIndexOf(97)); + * // Prints: 15 (97 is the decimal ASCII value for 'a') + * console.log(buf.lastIndexOf(Buffer.from('yolo'))); + * // Prints: -1 + * console.log(buf.lastIndexOf('buffer', 5)); + * // Prints: 5 + * console.log(buf.lastIndexOf('buffer', 4)); + * // Prints: -1 + * + * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); + * + * console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le')); + * // Prints: 6 + * console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le')); + * // Prints: 4 + * ``` + * + * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value, + * an integer between 0 and 255. + * + * If `byteOffset` is not a number, it will be coerced to a number. Any arguments + * that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer. + * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf). + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const b = Buffer.from('abcdef'); + * + * // Passing a value that's a number, but not a valid byte. + * // Prints: 2, equivalent to searching for 99 or 'c'. + * console.log(b.lastIndexOf(99.9)); + * console.log(b.lastIndexOf(256 + 99)); + * + * // Passing a byteOffset that coerces to NaN. + * // Prints: 1, searching the whole buffer. + * console.log(b.lastIndexOf('b', undefined)); + * console.log(b.lastIndexOf('b', {})); + * + * // Passing a byteOffset that coerces to 0. + * // Prints: -1, equivalent to passing 0. + * console.log(b.lastIndexOf('b', null)); + * console.log(b.lastIndexOf('b', [])); + * ``` + * + * If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned. + * @since v6.0.0 + * @param value What to search for. + * @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. + * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. + */ + lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + /** + * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `[index, byte]` pairs from the contents + * of `buf`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Log the entire contents of a `Buffer`. + * + * const buf = Buffer.from('buffer'); + * + * for (const pair of buf.entries()) { + * console.log(pair); + * } + * // Prints: + * // [0, 98] + * // [1, 117] + * // [2, 102] + * // [3, 102] + * // [4, 101] + * // [5, 114] + * ``` + * @since v1.1.0 + */ + entries(): IterableIterator<[number, number]>; + /** + * Equivalent to `buf.indexOf() !== -1`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this is a buffer'); + * + * console.log(buf.includes('this')); + * // Prints: true + * console.log(buf.includes('is')); + * // Prints: true + * console.log(buf.includes(Buffer.from('a buffer'))); + * // Prints: true + * console.log(buf.includes(97)); + * // Prints: true (97 is the decimal ASCII value for 'a') + * console.log(buf.includes(Buffer.from('a buffer example'))); + * // Prints: false + * console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8))); + * // Prints: true + * console.log(buf.includes('this', 4)); + * // Prints: false + * ``` + * @since v5.3.0 + * @param value What to search for. + * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is its encoding. + * @return `true` if `value` was found in `buf`, `false` otherwise. + */ + includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; + /** + * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices). + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * for (const key of buf.keys()) { + * console.log(key); + * } + * // Prints: + * // 0 + * // 1 + * // 2 + * // 3 + * // 4 + * // 5 + * ``` + * @since v1.1.0 + */ + keys(): IterableIterator; + /** + * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) for `buf` values (bytes). This function is + * called automatically when a `Buffer` is used in a `for..of` statement. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * for (const value of buf.values()) { + * console.log(value); + * } + * // Prints: + * // 98 + * // 117 + * // 102 + * // 102 + * // 101 + * // 114 + * + * for (const value of buf) { + * console.log(value); + * } + * // Prints: + * // 98 + * // 117 + * // 102 + * // 102 + * // 101 + * // 114 + * ``` + * @since v1.1.0 + */ + values(): IterableIterator; + } + var Buffer: BufferConstructor; + /** + * Decodes a string of Base64-encoded data into bytes, and encodes those bytes + * into a string using Latin-1 (ISO-8859-1). + * + * The `data` may be any JavaScript-value that can be coerced into a string. + * + * **This function is only provided for compatibility with legacy web platform APIs** + * **and should never be used in new code, because they use strings to represent** + * **binary data and predate the introduction of typed arrays in JavaScript.** + * **For code running using Node.js APIs, converting between base64-encoded strings** + * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.** + * @since v15.13.0, v14.17.0 + * @legacy Use `Buffer.from(data, 'base64')` instead. + * @param data The Base64-encoded input string. + */ + function atob(data: string): string; + /** + * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes + * into a string using Base64. + * + * The `data` may be any JavaScript-value that can be coerced into a string. + * + * **This function is only provided for compatibility with legacy web platform APIs** + * **and should never be used in new code, because they use strings to represent** + * **binary data and predate the introduction of typed arrays in JavaScript.** + * **For code running using Node.js APIs, converting between base64-encoded strings** + * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.** + * @since v15.13.0, v14.17.0 + * @legacy Use `buf.toString('base64')` instead. + * @param data An ASCII (Latin1) string. + */ + function btoa(data: string): string; + interface Blob extends __Blob {} + /** + * `Blob` class is a global reference for `require('node:buffer').Blob` + * https://nodejs.org/api/buffer.html#class-blob + * @since v18.0.0 + */ + var Blob: typeof globalThis extends { + onmessage: any; + Blob: infer T; + } + ? T + : typeof NodeBlob; + } +} +declare module 'node:buffer' { + export * from 'buffer'; +} diff --git a/node_modules/@types/node/child_process.d.ts b/node_modules/@types/node/child_process.d.ts new file mode 100755 index 0000000..b255795 --- /dev/null +++ b/node_modules/@types/node/child_process.d.ts @@ -0,0 +1,1400 @@ +/** + * The `node:child_process` module provides the ability to spawn subprocesses in + * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability + * is primarily provided by the {@link spawn} function: + * + * ```js + * const { spawn } = require('node:child_process'); + * const ls = spawn('ls', ['-lh', '/usr']); + * + * ls.stdout.on('data', (data) => { + * console.log(`stdout: ${data}`); + * }); + * + * ls.stderr.on('data', (data) => { + * console.error(`stderr: ${data}`); + * }); + * + * ls.on('close', (code) => { + * console.log(`child process exited with code ${code}`); + * }); + * ``` + * + * By default, pipes for `stdin`, `stdout`, and `stderr` are established between + * the parent Node.js process and the spawned subprocess. These pipes have + * limited (and platform-specific) capacity. If the subprocess writes to + * stdout in excess of that limit without the output being captured, the + * subprocess blocks waiting for the pipe buffer to accept more data. This is + * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed. + * + * The command lookup is performed using the `options.env.PATH` environment + * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is + * used. If `options.env` is set without `PATH`, lookup on Unix is performed + * on a default search path search of `/usr/bin:/bin` (see your operating system's + * manual for execvpe/execvp), on Windows the current processes environment + * variable `PATH` is used. + * + * On Windows, environment variables are case-insensitive. Node.js + * lexicographically sorts the `env` keys and uses the first one that + * case-insensitively matches. Only first (in lexicographic order) entry will be + * passed to the subprocess. This might lead to issues on Windows when passing + * objects to the `env` option that have multiple variants of the same key, such as`PATH` and `Path`. + * + * The {@link spawn} method spawns the child process asynchronously, + * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks + * the event loop until the spawned process either exits or is terminated. + * + * For convenience, the `node:child_process` module provides a handful of + * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on + * top of {@link spawn} or {@link spawnSync}. + * + * * {@link exec}: spawns a shell and runs a command within that + * shell, passing the `stdout` and `stderr` to a callback function when + * complete. + * * {@link execFile}: similar to {@link exec} except + * that it spawns the command directly without first spawning a shell by + * default. + * * {@link fork}: spawns a new Node.js process and invokes a + * specified module with an IPC communication channel established that allows + * sending messages between parent and child. + * * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop. + * * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop. + * + * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however, + * the synchronous methods can have significant impact on performance due to + * stalling the event loop while spawned processes complete. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/child_process.js) + */ +declare module 'child_process' { + import { ObjectEncodingOptions } from 'node:fs'; + import { EventEmitter, Abortable } from 'node:events'; + import * as net from 'node:net'; + import { Writable, Readable, Stream, Pipe } from 'node:stream'; + import { URL } from 'node:url'; + type Serializable = string | object | number | boolean | bigint; + type SendHandle = net.Socket | net.Server; + /** + * Instances of the `ChildProcess` represent spawned child processes. + * + * Instances of `ChildProcess` are not intended to be created directly. Rather, + * use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create + * instances of `ChildProcess`. + * @since v2.2.0 + */ + class ChildProcess extends EventEmitter { + /** + * A `Writable Stream` that represents the child process's `stdin`. + * + * If a child process waits to read all of its input, the child will not continue + * until this stream has been closed via `end()`. + * + * If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will + * refer to the same value. + * + * The `subprocess.stdin` property can be `null` or `undefined`if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stdin: Writable | null; + /** + * A `Readable Stream` that represents the child process's `stdout`. + * + * If the child was spawned with `stdio[1]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will + * refer to the same value. + * + * ```js + * const { spawn } = require('node:child_process'); + * + * const subprocess = spawn('ls'); + * + * subprocess.stdout.on('data', (data) => { + * console.log(`Received chunk ${data}`); + * }); + * ``` + * + * The `subprocess.stdout` property can be `null` or `undefined`if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stdout: Readable | null; + /** + * A `Readable Stream` that represents the child process's `stderr`. + * + * If the child was spawned with `stdio[2]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will + * refer to the same value. + * + * The `subprocess.stderr` property can be `null` or `undefined`if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stderr: Readable | null; + /** + * The `subprocess.channel` property is a reference to the child's IPC channel. If + * no IPC channel exists, this property is `undefined`. + * @since v7.1.0 + */ + readonly channel?: Pipe | null | undefined; + /** + * A sparse array of pipes to the child process, corresponding with positions in + * the `stdio` option passed to {@link spawn} that have been set + * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and`subprocess.stdio[2]` are also available as `subprocess.stdin`,`subprocess.stdout`, and `subprocess.stderr`, + * respectively. + * + * In the following example, only the child's fd `1` (stdout) is configured as a + * pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values + * in the array are `null`. + * + * ```js + * const assert = require('node:assert'); + * const fs = require('node:fs'); + * const child_process = require('node:child_process'); + * + * const subprocess = child_process.spawn('ls', { + * stdio: [ + * 0, // Use parent's stdin for child. + * 'pipe', // Pipe child's stdout to parent. + * fs.openSync('err.out', 'w'), // Direct child's stderr to a file. + * ], + * }); + * + * assert.strictEqual(subprocess.stdio[0], null); + * assert.strictEqual(subprocess.stdio[0], subprocess.stdin); + * + * assert(subprocess.stdout); + * assert.strictEqual(subprocess.stdio[1], subprocess.stdout); + * + * assert.strictEqual(subprocess.stdio[2], null); + * assert.strictEqual(subprocess.stdio[2], subprocess.stderr); + * ``` + * + * The `subprocess.stdio` property can be `undefined` if the child process could + * not be successfully spawned. + * @since v0.7.10 + */ + readonly stdio: [ + Writable | null, + // stdin + Readable | null, + // stdout + Readable | null, + // stderr + Readable | Writable | null | undefined, + // extra + Readable | Writable | null | undefined // extra + ]; + /** + * The `subprocess.killed` property indicates whether the child process + * successfully received a signal from `subprocess.kill()`. The `killed` property + * does not indicate that the child process has been terminated. + * @since v0.5.10 + */ + readonly killed: boolean; + /** + * Returns the process identifier (PID) of the child process. If the child process + * fails to spawn due to errors, then the value is `undefined` and `error` is + * emitted. + * + * ```js + * const { spawn } = require('node:child_process'); + * const grep = spawn('grep', ['ssh']); + * + * console.log(`Spawned child pid: ${grep.pid}`); + * grep.stdin.end(); + * ``` + * @since v0.1.90 + */ + readonly pid?: number | undefined; + /** + * The `subprocess.connected` property indicates whether it is still possible to + * send and receive messages from a child process. When `subprocess.connected` is`false`, it is no longer possible to send or receive messages. + * @since v0.7.2 + */ + readonly connected: boolean; + /** + * The `subprocess.exitCode` property indicates the exit code of the child process. + * If the child process is still running, the field will be `null`. + */ + readonly exitCode: number | null; + /** + * The `subprocess.signalCode` property indicates the signal received by + * the child process if any, else `null`. + */ + readonly signalCode: NodeJS.Signals | null; + /** + * The `subprocess.spawnargs` property represents the full list of command-line + * arguments the child process was launched with. + */ + readonly spawnargs: string[]; + /** + * The `subprocess.spawnfile` property indicates the executable file name of + * the child process that is launched. + * + * For {@link fork}, its value will be equal to `process.execPath`. + * For {@link spawn}, its value will be the name of + * the executable file. + * For {@link exec}, its value will be the name of the shell + * in which the child process is launched. + */ + readonly spawnfile: string; + /** + * The `subprocess.kill()` method sends a signal to the child process. If no + * argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function + * returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise. + * + * ```js + * const { spawn } = require('node:child_process'); + * const grep = spawn('grep', ['ssh']); + * + * grep.on('close', (code, signal) => { + * console.log( + * `child process terminated due to receipt of signal ${signal}`); + * }); + * + * // Send SIGHUP to process. + * grep.kill('SIGHUP'); + * ``` + * + * The `ChildProcess` object may emit an `'error'` event if the signal + * cannot be delivered. Sending a signal to a child process that has already exited + * is not an error but may have unforeseen consequences. Specifically, if the + * process identifier (PID) has been reassigned to another process, the signal will + * be delivered to that process instead which can have unexpected results. + * + * While the function is called `kill`, the signal delivered to the child process + * may not actually terminate the process. + * + * See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference. + * + * On Windows, where POSIX signals do not exist, the `signal` argument will be + * ignored, and the process will be killed forcefully and abruptly (similar to`'SIGKILL'`). + * See `Signal Events` for more details. + * + * On Linux, child processes of child processes will not be terminated + * when attempting to kill their parent. This is likely to happen when running a + * new process in a shell or with the use of the `shell` option of `ChildProcess`: + * + * ```js + * 'use strict'; + * const { spawn } = require('node:child_process'); + * + * const subprocess = spawn( + * 'sh', + * [ + * '-c', + * `node -e "setInterval(() => { + * console.log(process.pid, 'is alive') + * }, 500);"`, + * ], { + * stdio: ['inherit', 'inherit', 'inherit'], + * }, + * ); + * + * setTimeout(() => { + * subprocess.kill(); // Does not terminate the Node.js process in the shell. + * }, 2000); + * ``` + * @since v0.1.90 + */ + kill(signal?: NodeJS.Signals | number): boolean; + /** + * Calls {@link ChildProcess.kill} with `'SIGTERM'`. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + /** + * When an IPC channel has been established between the parent and child ( + * i.e. when using {@link fork}), the `subprocess.send()` method can + * be used to send messages to the child process. When the child process is a + * Node.js instance, these messages can be received via the `'message'` event. + * + * The message goes through serialization and parsing. The resulting + * message might not be the same as what is originally sent. + * + * For example, in the parent script: + * + * ```js + * const cp = require('node:child_process'); + * const n = cp.fork(`${__dirname}/sub.js`); + * + * n.on('message', (m) => { + * console.log('PARENT got message:', m); + * }); + * + * // Causes the child to print: CHILD got message: { hello: 'world' } + * n.send({ hello: 'world' }); + * ``` + * + * And then the child script, `'sub.js'` might look like this: + * + * ```js + * process.on('message', (m) => { + * console.log('CHILD got message:', m); + * }); + * + * // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null } + * process.send({ foo: 'bar', baz: NaN }); + * ``` + * + * Child Node.js processes will have a `process.send()` method of their own + * that allows the child to send messages back to the parent. + * + * There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages + * containing a `NODE_` prefix in the `cmd` property are reserved for use within + * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the`'internalMessage'` event and are consumed internally by Node.js. + * Applications should avoid using such messages or listening for`'internalMessage'` events as it is subject to change without notice. + * + * The optional `sendHandle` argument that may be passed to `subprocess.send()` is + * for passing a TCP server or socket object to the child process. The child will + * receive the object as the second argument passed to the callback function + * registered on the `'message'` event. Any data that is received + * and buffered in the socket will not be sent to the child. + * + * The optional `callback` is a function that is invoked after the message is + * sent but before the child may have received it. The function is called with a + * single argument: `null` on success, or an `Error` object on failure. + * + * If no `callback` function is provided and the message cannot be sent, an`'error'` event will be emitted by the `ChildProcess` object. This can + * happen, for instance, when the child process has already exited. + * + * `subprocess.send()` will return `false` if the channel has closed or when the + * backlog of unsent messages exceeds a threshold that makes it unwise to send + * more. Otherwise, the method returns `true`. The `callback` function can be + * used to implement flow control. + * + * #### Example: sending a server object + * + * The `sendHandle` argument can be used, for instance, to pass the handle of + * a TCP server object to the child process as illustrated in the example below: + * + * ```js + * const subprocess = require('node:child_process').fork('subprocess.js'); + * + * // Open up the server object and send the handle. + * const server = require('node:net').createServer(); + * server.on('connection', (socket) => { + * socket.end('handled by parent'); + * }); + * server.listen(1337, () => { + * subprocess.send('server', server); + * }); + * ``` + * + * The child would then receive the server object as: + * + * ```js + * process.on('message', (m, server) => { + * if (m === 'server') { + * server.on('connection', (socket) => { + * socket.end('handled by child'); + * }); + * } + * }); + * ``` + * + * Once the server is now shared between the parent and child, some connections + * can be handled by the parent and some by the child. + * + * While the example above uses a server created using the `node:net` module,`node:dgram` module servers use exactly the same workflow with the exceptions of + * listening on a `'message'` event instead of `'connection'` and using`server.bind()` instead of `server.listen()`. This is, however, only + * supported on Unix platforms. + * + * #### Example: sending a socket object + * + * Similarly, the `sendHandler` argument can be used to pass the handle of a + * socket to the child process. The example below spawns two children that each + * handle connections with "normal" or "special" priority: + * + * ```js + * const { fork } = require('node:child_process'); + * const normal = fork('subprocess.js', ['normal']); + * const special = fork('subprocess.js', ['special']); + * + * // Open up the server and send sockets to child. Use pauseOnConnect to prevent + * // the sockets from being read before they are sent to the child process. + * const server = require('node:net').createServer({ pauseOnConnect: true }); + * server.on('connection', (socket) => { + * + * // If this is special priority... + * if (socket.remoteAddress === '74.125.127.100') { + * special.send('socket', socket); + * return; + * } + * // This is normal priority. + * normal.send('socket', socket); + * }); + * server.listen(1337); + * ``` + * + * The `subprocess.js` would receive the socket handle as the second argument + * passed to the event callback function: + * + * ```js + * process.on('message', (m, socket) => { + * if (m === 'socket') { + * if (socket) { + * // Check that the client socket exists. + * // It is possible for the socket to be closed between the time it is + * // sent and the time it is received in the child process. + * socket.end(`Request handled with ${process.argv[2]} priority`); + * } + * } + * }); + * ``` + * + * Do not use `.maxConnections` on a socket that has been passed to a subprocess. + * The parent cannot track when the socket is destroyed. + * + * Any `'message'` handlers in the subprocess should verify that `socket` exists, + * as the connection may have been closed during the time it takes to send the + * connection to the child. + * @since v0.5.9 + * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: + */ + send(message: Serializable, callback?: (error: Error | null) => void): boolean; + send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; + send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean; + /** + * Closes the IPC channel between parent and child, allowing the child to exit + * gracefully once there are no other connections keeping it alive. After calling + * this method the `subprocess.connected` and `process.connected` properties in + * both the parent and child (respectively) will be set to `false`, and it will be + * no longer possible to pass messages between the processes. + * + * The `'disconnect'` event will be emitted when there are no messages in the + * process of being received. This will most often be triggered immediately after + * calling `subprocess.disconnect()`. + * + * When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked + * within the child process to close the IPC channel as well. + * @since v0.7.2 + */ + disconnect(): void; + /** + * By default, the parent will wait for the detached child to exit. To prevent the + * parent from waiting for a given `subprocess` to exit, use the`subprocess.unref()` method. Doing so will cause the parent's event loop to not + * include the child in its reference count, allowing the parent to exit + * independently of the child, unless there is an established IPC channel between + * the child and the parent. + * + * ```js + * const { spawn } = require('node:child_process'); + * + * const subprocess = spawn(process.argv[0], ['child_program.js'], { + * detached: true, + * stdio: 'ignore', + * }); + * + * subprocess.unref(); + * ``` + * @since v0.7.10 + */ + unref(): void; + /** + * Calling `subprocess.ref()` after making a call to `subprocess.unref()` will + * restore the removed reference count for the child process, forcing the parent + * to wait for the child to exit before exiting itself. + * + * ```js + * const { spawn } = require('node:child_process'); + * + * const subprocess = spawn(process.argv[0], ['child_program.js'], { + * detached: true, + * stdio: 'ignore', + * }); + * + * subprocess.unref(); + * subprocess.ref(); + * ``` + * @since v0.7.10 + */ + ref(): void; + /** + * events.EventEmitter + * 1. close + * 2. disconnect + * 3. error + * 4. exit + * 5. message + * 6. spawn + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + addListener(event: 'disconnect', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + addListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + addListener(event: 'spawn', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close', code: number | null, signal: NodeJS.Signals | null): boolean; + emit(event: 'disconnect'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'exit', code: number | null, signal: NodeJS.Signals | null): boolean; + emit(event: 'message', message: Serializable, sendHandle: SendHandle): boolean; + emit(event: 'spawn', listener: () => void): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + on(event: 'disconnect', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + on(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + on(event: 'spawn', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + once(event: 'disconnect', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + once(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + once(event: 'spawn', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependListener(event: 'disconnect', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + prependListener(event: 'spawn', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependOnceListener(event: 'disconnect', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependOnceListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + prependOnceListener(event: 'spawn', listener: () => void): this; + } + // return this object when stdio option is undefined or not specified + interface ChildProcessWithoutNullStreams extends ChildProcess { + stdin: Writable; + stdout: Readable; + stderr: Readable; + readonly stdio: [ + Writable, + Readable, + Readable, + // stderr + Readable | Writable | null | undefined, + // extra, no modification + Readable | Writable | null | undefined // extra, no modification + ]; + } + // return this object when stdio option is a tuple of 3 + interface ChildProcessByStdio extends ChildProcess { + stdin: I; + stdout: O; + stderr: E; + readonly stdio: [ + I, + O, + E, + Readable | Writable | null | undefined, + // extra, no modification + Readable | Writable | null | undefined // extra, no modification + ]; + } + interface MessageOptions { + keepOpen?: boolean | undefined; + } + type IOType = 'overlapped' | 'pipe' | 'ignore' | 'inherit'; + type StdioOptions = IOType | Array; + type SerializationType = 'json' | 'advanced'; + interface MessagingOptions extends Abortable { + /** + * Specify the kind of serialization used for sending messages between processes. + * @default 'json' + */ + serialization?: SerializationType | undefined; + /** + * The signal value to be used when the spawned process will be killed by the abort signal. + * @default 'SIGTERM' + */ + killSignal?: NodeJS.Signals | number | undefined; + /** + * In milliseconds the maximum amount of time the process is allowed to run. + */ + timeout?: number | undefined; + } + interface ProcessEnvOptions { + uid?: number | undefined; + gid?: number | undefined; + cwd?: string | URL | undefined; + env?: NodeJS.ProcessEnv | undefined; + } + interface CommonOptions extends ProcessEnvOptions { + /** + * @default false + */ + windowsHide?: boolean | undefined; + /** + * @default 0 + */ + timeout?: number | undefined; + } + interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable { + argv0?: string | undefined; + /** + * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + shell?: boolean | string | undefined; + windowsVerbatimArguments?: boolean | undefined; + } + interface SpawnOptions extends CommonSpawnOptions { + detached?: boolean | undefined; + } + interface SpawnOptionsWithoutStdio extends SpawnOptions { + stdio?: StdioPipeNamed | StdioPipe[] | undefined; + } + type StdioNull = 'inherit' | 'ignore' | Stream; + type StdioPipeNamed = 'pipe' | 'overlapped'; + type StdioPipe = undefined | null | StdioPipeNamed; + interface SpawnOptionsWithStdioTuple extends SpawnOptions { + stdio: [Stdin, Stdout, Stderr]; + } + /** + * The `child_process.spawn()` method spawns a new process using the given`command`, with command-line arguments in `args`. If omitted, `args` defaults + * to an empty array. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * + * A third argument may be used to specify additional options, with these defaults: + * + * ```js + * const defaults = { + * cwd: undefined, + * env: process.env, + * }; + * ``` + * + * Use `cwd` to specify the working directory from which the process is spawned. + * If not given, the default is to inherit the current working directory. If given, + * but the path does not exist, the child process emits an `ENOENT` error + * and exits immediately. `ENOENT` is also emitted when the command + * does not exist. + * + * Use `env` to specify environment variables that will be visible to the new + * process, the default is `process.env`. + * + * `undefined` values in `env` will be ignored. + * + * Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the + * exit code: + * + * ```js + * const { spawn } = require('node:child_process'); + * const ls = spawn('ls', ['-lh', '/usr']); + * + * ls.stdout.on('data', (data) => { + * console.log(`stdout: ${data}`); + * }); + * + * ls.stderr.on('data', (data) => { + * console.error(`stderr: ${data}`); + * }); + * + * ls.on('close', (code) => { + * console.log(`child process exited with code ${code}`); + * }); + * ``` + * + * Example: A very elaborate way to run `ps ax | grep ssh` + * + * ```js + * const { spawn } = require('node:child_process'); + * const ps = spawn('ps', ['ax']); + * const grep = spawn('grep', ['ssh']); + * + * ps.stdout.on('data', (data) => { + * grep.stdin.write(data); + * }); + * + * ps.stderr.on('data', (data) => { + * console.error(`ps stderr: ${data}`); + * }); + * + * ps.on('close', (code) => { + * if (code !== 0) { + * console.log(`ps process exited with code ${code}`); + * } + * grep.stdin.end(); + * }); + * + * grep.stdout.on('data', (data) => { + * console.log(data.toString()); + * }); + * + * grep.stderr.on('data', (data) => { + * console.error(`grep stderr: ${data}`); + * }); + * + * grep.on('close', (code) => { + * if (code !== 0) { + * console.log(`grep process exited with code ${code}`); + * } + * }); + * ``` + * + * Example of checking for failed `spawn`: + * + * ```js + * const { spawn } = require('node:child_process'); + * const subprocess = spawn('bad_command'); + * + * subprocess.on('error', (err) => { + * console.error('Failed to start subprocess.'); + * }); + * ``` + * + * Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process + * title while others (Windows, SunOS) will use `command`. + * + * Node.js overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent. Retrieve + * it with the`process.argv0` property instead. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * const { spawn } = require('node:child_process'); + * const controller = new AbortController(); + * const { signal } = controller; + * const grep = spawn('grep', ['ssh'], { signal }); + * grep.on('error', (err) => { + * // This will be called with err being an AbortError if the controller aborts + * }); + * controller.abort(); // Stops the child process + * ``` + * @since v0.1.90 + * @param command The command to run. + * @param args List of string arguments. + */ + function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptions): ChildProcess; + // overloads of spawn with 'args' + function spawn(command: string, args?: ReadonlyArray, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptions): ChildProcess; + interface ExecOptions extends CommonOptions { + shell?: string | undefined; + signal?: AbortSignal | undefined; + maxBuffer?: number | undefined; + killSignal?: NodeJS.Signals | number | undefined; + } + interface ExecOptionsWithStringEncoding extends ExecOptions { + encoding: BufferEncoding; + } + interface ExecOptionsWithBufferEncoding extends ExecOptions { + encoding: BufferEncoding | null; // specify `null`. + } + interface ExecException extends Error { + cmd?: string | undefined; + killed?: boolean | undefined; + code?: number | undefined; + signal?: NodeJS.Signals | undefined; + } + /** + * Spawns a shell then executes the `command` within that shell, buffering any + * generated output. The `command` string passed to the exec function is processed + * directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters)) + * need to be dealt with accordingly: + * + * ```js + * const { exec } = require('node:child_process'); + * + * exec('"/path/to/test file/test.sh" arg1 arg2'); + * // Double quotes are used so that the space in the path is not interpreted as + * // a delimiter of multiple arguments. + * + * exec('echo "The \\$HOME variable is $HOME"'); + * // The $HOME variable is escaped in the first instance, but not in the second. + * ``` + * + * **Never pass unsanitized user input to this function. Any input containing shell** + * **metacharacters may be used to trigger arbitrary command execution.** + * + * If a `callback` function is provided, it is called with the arguments`(error, stdout, stderr)`. On success, `error` will be `null`. On error,`error` will be an instance of `Error`. The + * `error.code` property will be + * the exit code of the process. By convention, any exit code other than `0`indicates an error. `error.signal` will be the signal that terminated the + * process. + * + * The `stdout` and `stderr` arguments passed to the callback will contain the + * stdout and stderr output of the child process. By default, Node.js will decode + * the output as UTF-8 and pass strings to the callback. The `encoding` option + * can be used to specify the character encoding used to decode the stdout and + * stderr output. If `encoding` is `'buffer'`, or an unrecognized character + * encoding, `Buffer` objects will be passed to the callback instead. + * + * ```js + * const { exec } = require('node:child_process'); + * exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => { + * if (error) { + * console.error(`exec error: ${error}`); + * return; + * } + * console.log(`stdout: ${stdout}`); + * console.error(`stderr: ${stderr}`); + * }); + * ``` + * + * If `timeout` is greater than `0`, the parent will send the signal + * identified by the `killSignal` property (the default is `'SIGTERM'`) if the + * child runs longer than `timeout` milliseconds. + * + * Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace + * the existing process and uses a shell to execute the command. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In + * case of an error (including any error resulting in an exit code other than 0), a + * rejected promise is returned, with the same `error` object given in the + * callback, but with two additional properties `stdout` and `stderr`. + * + * ```js + * const util = require('node:util'); + * const exec = util.promisify(require('node:child_process').exec); + * + * async function lsExample() { + * const { stdout, stderr } = await exec('ls'); + * console.log('stdout:', stdout); + * console.error('stderr:', stderr); + * } + * lsExample(); + * ``` + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * const { exec } = require('node:child_process'); + * const controller = new AbortController(); + * const { signal } = controller; + * const child = exec('grep ssh', { signal }, (error) => { + * console.error(error); // an AbortError + * }); + * controller.abort(); + * ``` + * @since v0.1.90 + * @param command The command to run, with space-separated arguments. + * @param callback called with the output when process terminates. + */ + function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; + // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. + function exec( + command: string, + options: { + encoding: 'buffer' | null; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void + ): ChildProcess; + // `options` with well known `encoding` means stdout/stderr are definitely `string`. + function exec( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: string, stderr: string) => void + ): ChildProcess; + // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. + // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. + function exec( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void + ): ChildProcess; + // `options` without an `encoding` means stdout/stderr are definitely `string`. + function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; + // fallback if nothing else matches. Worst case is always `string | Buffer`. + function exec( + command: string, + options: (ObjectEncodingOptions & ExecOptions) | undefined | null, + callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void + ): ChildProcess; + interface PromiseWithChild extends Promise { + child: ChildProcess; + } + namespace exec { + function __promisify__(command: string): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options: { + encoding: 'buffer' | null; + } & ExecOptions + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options: ExecOptions + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options?: (ObjectEncodingOptions & ExecOptions) | null + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + } + interface ExecFileOptions extends CommonOptions, Abortable { + maxBuffer?: number | undefined; + killSignal?: NodeJS.Signals | number | undefined; + windowsVerbatimArguments?: boolean | undefined; + shell?: boolean | string | undefined; + signal?: AbortSignal | undefined; + } + interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { + encoding: BufferEncoding; + } + interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { + encoding: 'buffer' | null; + } + interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { + encoding: BufferEncoding; + } + type ExecFileException = + & Omit + & Omit + & { code?: string | number | undefined | null }; + /** + * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified + * executable `file` is spawned directly as a new process making it slightly more + * efficient than {@link exec}. + * + * The same options as {@link exec} are supported. Since a shell is + * not spawned, behaviors such as I/O redirection and file globbing are not + * supported. + * + * ```js + * const { execFile } = require('node:child_process'); + * const child = execFile('node', ['--version'], (error, stdout, stderr) => { + * if (error) { + * throw error; + * } + * console.log(stdout); + * }); + * ``` + * + * The `stdout` and `stderr` arguments passed to the callback will contain the + * stdout and stderr output of the child process. By default, Node.js will decode + * the output as UTF-8 and pass strings to the callback. The `encoding` option + * can be used to specify the character encoding used to decode the stdout and + * stderr output. If `encoding` is `'buffer'`, or an unrecognized character + * encoding, `Buffer` objects will be passed to the callback instead. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In + * case of an error (including any error resulting in an exit code other than 0), a + * rejected promise is returned, with the same `error` object given in the + * callback, but with two additional properties `stdout` and `stderr`. + * + * ```js + * const util = require('node:util'); + * const execFile = util.promisify(require('node:child_process').execFile); + * async function getVersion() { + * const { stdout } = await execFile('node', ['--version']); + * console.log(stdout); + * } + * getVersion(); + * ``` + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * const { execFile } = require('node:child_process'); + * const controller = new AbortController(); + * const { signal } = controller; + * const child = execFile('node', ['--version'], { signal }, (error) => { + * console.error(error); // an AbortError + * }); + * controller.abort(); + * ``` + * @since v0.1.91 + * @param file The name or path of the executable file to run. + * @param args List of string arguments. + * @param callback Called with the output when process terminates. + */ + function execFile(file: string): ChildProcess; + function execFile(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess; + function execFile(file: string, args?: ReadonlyArray | null): ChildProcess; + function execFile(file: string, args: ReadonlyArray | undefined | null, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess; + // no `options` definitely means stdout/stderr are `string`. + function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; + function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; + // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. + function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithBufferEncoding, + callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void + ): ChildProcess; + // `options` with well known `encoding` means stdout/stderr are definitely `string`. + function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithStringEncoding, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void + ): ChildProcess; + // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. + // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. + function execFile(file: string, options: ExecFileOptionsWithOtherEncoding, callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithOtherEncoding, + callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void + ): ChildProcess; + // `options` without an `encoding` means stdout/stderr are definitely `string`. + function execFile(file: string, options: ExecFileOptions, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptions, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void + ): ChildProcess; + // fallback if nothing else matches. Worst case is always `string | Buffer`. + function execFile( + file: string, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null + ): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null + ): ChildProcess; + namespace execFile { + function __promisify__(file: string): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithBufferEncoding + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithBufferEncoding + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithStringEncoding + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithStringEncoding + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithOtherEncoding + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithOtherEncoding + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + options: ExecFileOptions + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptions + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + } + interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable { + execPath?: string | undefined; + execArgv?: string[] | undefined; + silent?: boolean | undefined; + /** + * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + detached?: boolean | undefined; + windowsVerbatimArguments?: boolean | undefined; + } + /** + * The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes. + * Like {@link spawn}, a `ChildProcess` object is returned. The + * returned `ChildProcess` will have an additional communication channel + * built-in that allows messages to be passed back and forth between the parent and + * child. See `subprocess.send()` for details. + * + * Keep in mind that spawned Node.js child processes are + * independent of the parent with exception of the IPC communication channel + * that is established between the two. Each process has its own memory, with + * their own V8 instances. Because of the additional resource allocations + * required, spawning a large number of child Node.js processes is not + * recommended. + * + * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the`options` object allows for an alternative + * execution path to be used. + * + * Node.js processes launched with a custom `execPath` will communicate with the + * parent process using the file descriptor (fd) identified using the + * environment variable `NODE_CHANNEL_FD` on the child process. + * + * Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the + * current process. + * + * The `shell` option available in {@link spawn} is not supported by`child_process.fork()` and will be ignored if set. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * if (process.argv[2] === 'child') { + * setTimeout(() => { + * console.log(`Hello from ${process.argv[2]}!`); + * }, 1_000); + * } else { + * const { fork } = require('node:child_process'); + * const controller = new AbortController(); + * const { signal } = controller; + * const child = fork(__filename, ['child'], { signal }); + * child.on('error', (err) => { + * // This will be called with err being an AbortError if the controller aborts + * }); + * controller.abort(); // Stops the child process + * } + * ``` + * @since v0.5.0 + * @param modulePath The module to run in the child. + * @param args List of string arguments. + */ + function fork(modulePath: string, options?: ForkOptions): ChildProcess; + function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess; + interface SpawnSyncOptions extends CommonSpawnOptions { + input?: string | NodeJS.ArrayBufferView | undefined; + maxBuffer?: number | undefined; + encoding?: BufferEncoding | 'buffer' | null | undefined; + } + interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { + encoding: BufferEncoding; + } + interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { + encoding?: 'buffer' | null | undefined; + } + interface SpawnSyncReturns { + pid: number; + output: Array; + stdout: T; + stderr: T; + status: number | null; + signal: NodeJS.Signals | null; + error?: Error | undefined; + } + /** + * The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return + * until the child process has fully closed. When a timeout has been encountered + * and `killSignal` is sent, the method won't return until the process has + * completely exited. If the process intercepts and handles the `SIGTERM` signal + * and doesn't exit, the parent process will wait until the child process has + * exited. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * @since v0.11.12 + * @param command The command to run. + * @param args List of string arguments. + */ + function spawnSync(command: string): SpawnSyncReturns; + function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; + function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; + function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; + function spawnSync(command: string, args: ReadonlyArray): SpawnSyncReturns; + function spawnSync(command: string, args: ReadonlyArray, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; + function spawnSync(command: string, args: ReadonlyArray, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; + function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns; + interface CommonExecOptions extends CommonOptions { + input?: string | NodeJS.ArrayBufferView | undefined; + /** + * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + killSignal?: NodeJS.Signals | number | undefined; + maxBuffer?: number | undefined; + encoding?: BufferEncoding | 'buffer' | null | undefined; + } + interface ExecSyncOptions extends CommonExecOptions { + shell?: string | undefined; + } + interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { + encoding: BufferEncoding; + } + interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { + encoding?: 'buffer' | null | undefined; + } + /** + * The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return + * until the child process has fully closed. When a timeout has been encountered + * and `killSignal` is sent, the method won't return until the process has + * completely exited. If the child process intercepts and handles the `SIGTERM`signal and doesn't exit, the parent process will wait until the child process + * has exited. + * + * If the process times out or has a non-zero exit code, this method will throw. + * The `Error` object will contain the entire result from {@link spawnSync}. + * + * **Never pass unsanitized user input to this function. Any input containing shell** + * **metacharacters may be used to trigger arbitrary command execution.** + * @since v0.11.12 + * @param command The command to run. + * @return The stdout from the command. + */ + function execSync(command: string): Buffer; + function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string; + function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer; + function execSync(command: string, options?: ExecSyncOptions): string | Buffer; + interface ExecFileSyncOptions extends CommonExecOptions { + shell?: boolean | string | undefined; + } + interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { + encoding: BufferEncoding; + } + interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { + encoding?: 'buffer' | null; // specify `null`. + } + /** + * The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not + * return until the child process has fully closed. When a timeout has been + * encountered and `killSignal` is sent, the method won't return until the process + * has completely exited. + * + * If the child process intercepts and handles the `SIGTERM` signal and + * does not exit, the parent process will still wait until the child process has + * exited. + * + * If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * @since v0.11.12 + * @param file The name or path of the executable file to run. + * @param args List of string arguments. + * @return The stdout from the command. + */ + function execFileSync(file: string): Buffer; + function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string; + function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; + function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer; + function execFileSync(file: string, args: ReadonlyArray): Buffer; + function execFileSync(file: string, args: ReadonlyArray, options: ExecFileSyncOptionsWithStringEncoding): string; + function execFileSync(file: string, args: ReadonlyArray, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; + function execFileSync(file: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): string | Buffer; +} +declare module 'node:child_process' { + export * from 'child_process'; +} diff --git a/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts new file mode 100755 index 0000000..4fa9aef --- /dev/null +++ b/node_modules/@types/node/cluster.d.ts @@ -0,0 +1,414 @@ +/** + * Clusters of Node.js processes can be used to run multiple instances of Node.js + * that can distribute workloads among their application threads. When process + * isolation is not needed, use the `worker_threads` module instead, which + * allows running multiple application threads within a single Node.js instance. + * + * The cluster module allows easy creation of child processes that all share + * server ports. + * + * ```js + * import cluster from 'node:cluster'; + * import http from 'node:http'; + * import { availableParallelism } from 'node:os'; + * import process from 'node:process'; + * + * const numCPUs = availableParallelism(); + * + * if (cluster.isPrimary) { + * console.log(`Primary ${process.pid} is running`); + * + * // Fork workers. + * for (let i = 0; i < numCPUs; i++) { + * cluster.fork(); + * } + * + * cluster.on('exit', (worker, code, signal) => { + * console.log(`worker ${worker.process.pid} died`); + * }); + * } else { + * // Workers can share any TCP connection + * // In this case it is an HTTP server + * http.createServer((req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * + * console.log(`Worker ${process.pid} started`); + * } + * ``` + * + * Running Node.js will now share port 8000 between the workers: + * + * ```console + * $ node server.js + * Primary 3596 is running + * Worker 4324 started + * Worker 4520 started + * Worker 6056 started + * Worker 5644 started + * ``` + * + * On Windows, it is not yet possible to set up a named pipe server in a worker. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/cluster.js) + */ +declare module 'cluster' { + import * as child from 'node:child_process'; + import EventEmitter = require('node:events'); + import * as net from 'node:net'; + type SerializationType = 'json' | 'advanced'; + export interface ClusterSettings { + execArgv?: string[] | undefined; // default: process.execArgv + exec?: string | undefined; + args?: string[] | undefined; + silent?: boolean | undefined; + stdio?: any[] | undefined; + uid?: number | undefined; + gid?: number | undefined; + inspectPort?: number | (() => number) | undefined; + serialization?: SerializationType | undefined; + cwd?: string | undefined; + windowsHide?: boolean | undefined; + } + export interface Address { + address: string; + port: number; + addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6" + } + /** + * A `Worker` object contains all public information and method about a worker. + * In the primary it can be obtained using `cluster.workers`. In a worker + * it can be obtained using `cluster.worker`. + * @since v0.7.0 + */ + export class Worker extends EventEmitter { + /** + * Each new worker is given its own unique id, this id is stored in the`id`. + * + * While a worker is alive, this is the key that indexes it in`cluster.workers`. + * @since v0.8.0 + */ + id: number; + /** + * All workers are created using `child_process.fork()`, the returned object + * from this function is stored as `.process`. In a worker, the global `process`is stored. + * + * See: `Child Process module`. + * + * Workers will call `process.exit(0)` if the `'disconnect'` event occurs + * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against + * accidental disconnection. + * @since v0.7.0 + */ + process: child.ChildProcess; + /** + * Send a message to a worker or primary, optionally with a handle. + * + * In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`. + * + * In a worker, this sends a message to the primary. It is identical to`process.send()`. + * + * This example will echo back all messages from the primary: + * + * ```js + * if (cluster.isPrimary) { + * const worker = cluster.fork(); + * worker.send('hi there'); + * + * } else if (cluster.isWorker) { + * process.on('message', (msg) => { + * process.send(msg); + * }); + * } + * ``` + * @since v0.7.0 + * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: + */ + send(message: child.Serializable, callback?: (error: Error | null) => void): boolean; + send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean; + send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean; + /** + * This function will kill the worker. In the primary worker, it does this by + * disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`. + * + * The `kill()` function kills the worker process without waiting for a graceful + * disconnect, it has the same behavior as `worker.process.kill()`. + * + * This method is aliased as `worker.destroy()` for backwards compatibility. + * + * In a worker, `process.kill()` exists, but it is not this function; + * it is `kill()`. + * @since v0.9.12 + * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process. + */ + kill(signal?: string): void; + destroy(signal?: string): void; + /** + * In a worker, this function will close all servers, wait for the `'close'` event + * on those servers, and then disconnect the IPC channel. + * + * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself. + * + * Causes `.exitedAfterDisconnect` to be set. + * + * After a server is closed, it will no longer accept new connections, + * but connections may be accepted by any other listening worker. Existing + * connections will be allowed to close as usual. When no more connections exist, + * see `server.close()`, the IPC channel to the worker will close allowing it + * to die gracefully. + * + * The above applies _only_ to server connections, client connections are not + * automatically closed by workers, and disconnect does not wait for them to close + * before exiting. + * + * In a worker, `process.disconnect` exists, but it is not this function; + * it is `disconnect()`. + * + * Because long living server connections may block workers from disconnecting, it + * may be useful to send a message, so application specific actions may be taken to + * close them. It also may be useful to implement a timeout, killing a worker if + * the `'disconnect'` event has not been emitted after some time. + * + * ```js + * if (cluster.isPrimary) { + * const worker = cluster.fork(); + * let timeout; + * + * worker.on('listening', (address) => { + * worker.send('shutdown'); + * worker.disconnect(); + * timeout = setTimeout(() => { + * worker.kill(); + * }, 2000); + * }); + * + * worker.on('disconnect', () => { + * clearTimeout(timeout); + * }); + * + * } else if (cluster.isWorker) { + * const net = require('node:net'); + * const server = net.createServer((socket) => { + * // Connections never end + * }); + * + * server.listen(8000); + * + * process.on('message', (msg) => { + * if (msg === 'shutdown') { + * // Initiate graceful close of any connections to server + * } + * }); + * } + * ``` + * @since v0.7.7 + * @return A reference to `worker`. + */ + disconnect(): void; + /** + * This function returns `true` if the worker is connected to its primary via its + * IPC channel, `false` otherwise. A worker is connected to its primary after it + * has been created. It is disconnected after the `'disconnect'` event is emitted. + * @since v0.11.14 + */ + isConnected(): boolean; + /** + * This function returns `true` if the worker's process has terminated (either + * because of exiting or being signaled). Otherwise, it returns `false`. + * + * ```js + * import cluster from 'node:cluster'; + * import http from 'node:http'; + * import { availableParallelism } from 'node:os'; + * import process from 'node:process'; + * + * const numCPUs = availableParallelism(); + * + * if (cluster.isPrimary) { + * console.log(`Primary ${process.pid} is running`); + * + * // Fork workers. + * for (let i = 0; i < numCPUs; i++) { + * cluster.fork(); + * } + * + * cluster.on('fork', (worker) => { + * console.log('worker is dead:', worker.isDead()); + * }); + * + * cluster.on('exit', (worker, code, signal) => { + * console.log('worker is dead:', worker.isDead()); + * }); + * } else { + * // Workers can share any TCP connection. In this case, it is an HTTP server. + * http.createServer((req, res) => { + * res.writeHead(200); + * res.end(`Current process\n ${process.pid}`); + * process.kill(process.pid); + * }).listen(8000); + * } + * ``` + * @since v0.11.14 + */ + isDead(): boolean; + /** + * This property is `true` if the worker exited due to `.disconnect()`. + * If the worker exited any other way, it is `false`. If the + * worker has not exited, it is `undefined`. + * + * The boolean `worker.exitedAfterDisconnect` allows distinguishing between + * voluntary and accidental exit, the primary may choose not to respawn a worker + * based on this value. + * + * ```js + * cluster.on('exit', (worker, code, signal) => { + * if (worker.exitedAfterDisconnect === true) { + * console.log('Oh, it was just voluntary – no need to worry'); + * } + * }); + * + * // kill worker + * worker.kill(); + * ``` + * @since v6.0.0 + */ + exitedAfterDisconnect: boolean; + /** + * events.EventEmitter + * 1. disconnect + * 2. error + * 3. exit + * 4. listening + * 5. message + * 6. online + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'disconnect', listener: () => void): this; + addListener(event: 'error', listener: (error: Error) => void): this; + addListener(event: 'exit', listener: (code: number, signal: string) => void): this; + addListener(event: 'listening', listener: (address: Address) => void): this; + addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + addListener(event: 'online', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'disconnect'): boolean; + emit(event: 'error', error: Error): boolean; + emit(event: 'exit', code: number, signal: string): boolean; + emit(event: 'listening', address: Address): boolean; + emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean; + emit(event: 'online'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'disconnect', listener: () => void): this; + on(event: 'error', listener: (error: Error) => void): this; + on(event: 'exit', listener: (code: number, signal: string) => void): this; + on(event: 'listening', listener: (address: Address) => void): this; + on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + on(event: 'online', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'disconnect', listener: () => void): this; + once(event: 'error', listener: (error: Error) => void): this; + once(event: 'exit', listener: (code: number, signal: string) => void): this; + once(event: 'listening', listener: (address: Address) => void): this; + once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + once(event: 'online', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'disconnect', listener: () => void): this; + prependListener(event: 'error', listener: (error: Error) => void): this; + prependListener(event: 'exit', listener: (code: number, signal: string) => void): this; + prependListener(event: 'listening', listener: (address: Address) => void): this; + prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + prependListener(event: 'online', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'disconnect', listener: () => void): this; + prependOnceListener(event: 'error', listener: (error: Error) => void): this; + prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this; + prependOnceListener(event: 'listening', listener: (address: Address) => void): this; + prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + prependOnceListener(event: 'online', listener: () => void): this; + } + export interface Cluster extends EventEmitter { + disconnect(callback?: () => void): void; + fork(env?: any): Worker; + /** @deprecated since v16.0.0 - use isPrimary. */ + readonly isMaster: boolean; + readonly isPrimary: boolean; + readonly isWorker: boolean; + schedulingPolicy: number; + readonly settings: ClusterSettings; + /** @deprecated since v16.0.0 - use setupPrimary. */ + setupMaster(settings?: ClusterSettings): void; + /** + * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings. + */ + setupPrimary(settings?: ClusterSettings): void; + readonly worker?: Worker | undefined; + readonly workers?: NodeJS.Dict | undefined; + readonly SCHED_NONE: number; + readonly SCHED_RR: number; + /** + * events.EventEmitter + * 1. disconnect + * 2. exit + * 3. fork + * 4. listening + * 5. message + * 6. online + * 7. setup + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'disconnect', listener: (worker: Worker) => void): this; + addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + addListener(event: 'fork', listener: (worker: Worker) => void): this; + addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + addListener(event: 'online', listener: (worker: Worker) => void): this; + addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'disconnect', worker: Worker): boolean; + emit(event: 'exit', worker: Worker, code: number, signal: string): boolean; + emit(event: 'fork', worker: Worker): boolean; + emit(event: 'listening', worker: Worker, address: Address): boolean; + emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean; + emit(event: 'online', worker: Worker): boolean; + emit(event: 'setup', settings: ClusterSettings): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'disconnect', listener: (worker: Worker) => void): this; + on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + on(event: 'fork', listener: (worker: Worker) => void): this; + on(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + on(event: 'online', listener: (worker: Worker) => void): this; + on(event: 'setup', listener: (settings: ClusterSettings) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'disconnect', listener: (worker: Worker) => void): this; + once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + once(event: 'fork', listener: (worker: Worker) => void): this; + once(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + once(event: 'online', listener: (worker: Worker) => void): this; + once(event: 'setup', listener: (settings: ClusterSettings) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'disconnect', listener: (worker: Worker) => void): this; + prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + prependListener(event: 'fork', listener: (worker: Worker) => void): this; + prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + // the handle is a net.Socket or net.Server object, or undefined. + prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this; + prependListener(event: 'online', listener: (worker: Worker) => void): this; + prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this; + prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this; + prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + // the handle is a net.Socket or net.Server object, or undefined. + prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; + prependOnceListener(event: 'online', listener: (worker: Worker) => void): this; + prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this; + } + const cluster: Cluster; + export default cluster; +} +declare module 'node:cluster' { + export * from 'cluster'; + export { default as default } from 'cluster'; +} diff --git a/node_modules/@types/node/console.d.ts b/node_modules/@types/node/console.d.ts new file mode 100755 index 0000000..7e35638 --- /dev/null +++ b/node_modules/@types/node/console.d.ts @@ -0,0 +1,412 @@ +/** + * The `node:console` module provides a simple debugging console that is similar to + * the JavaScript console mechanism provided by web browsers. + * + * The module exports two specific components: + * + * * A `Console` class with methods such as `console.log()`, `console.error()`, and`console.warn()` that can be used to write to any Node.js stream. + * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('node:console')`. + * + * _**Warning**_: The global console object's methods are neither consistently + * synchronous like the browser APIs they resemble, nor are they consistently + * asynchronous like all other Node.js streams. See the `note on process I/O` for + * more information. + * + * Example using the global `console`: + * + * ```js + * console.log('hello world'); + * // Prints: hello world, to stdout + * console.log('hello %s', 'world'); + * // Prints: hello world, to stdout + * console.error(new Error('Whoops, something bad happened')); + * // Prints error message and stack trace to stderr: + * // Error: Whoops, something bad happened + * // at [eval]:5:15 + * // at Script.runInThisContext (node:vm:132:18) + * // at Object.runInThisContext (node:vm:309:38) + * // at node:internal/process/execution:77:19 + * // at [eval]-wrapper:6:22 + * // at evalScript (node:internal/process/execution:76:60) + * // at node:internal/main/eval_string:23:3 + * + * const name = 'Will Robinson'; + * console.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to stderr + * ``` + * + * Example using the `Console` class: + * + * ```js + * const out = getStreamSomehow(); + * const err = getStreamSomehow(); + * const myConsole = new console.Console(out, err); + * + * myConsole.log('hello world'); + * // Prints: hello world, to out + * myConsole.log('hello %s', 'world'); + * // Prints: hello world, to out + * myConsole.error(new Error('Whoops, something bad happened')); + * // Prints: [Error: Whoops, something bad happened], to err + * + * const name = 'Will Robinson'; + * myConsole.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to err + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/console.js) + */ +declare module 'console' { + import console = require('node:console'); + export = console; +} +declare module 'node:console' { + import { InspectOptions } from 'node:util'; + global { + // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build + interface Console { + Console: console.ConsoleConstructor; + /** + * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only + * writes a message and does not otherwise affect execution. The output always + * starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`. + * + * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens. + * + * ```js + * console.assert(true, 'does nothing'); + * + * console.assert(false, 'Whoops %s work', 'didn\'t'); + * // Assertion failed: Whoops didn't work + * + * console.assert(); + * // Assertion failed + * ``` + * @since v0.1.101 + * @param value The value tested for being truthy. + * @param message All arguments besides `value` are used as error message. + */ + assert(value: any, message?: string, ...optionalParams: any[]): void; + /** + * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the + * TTY. When `stdout` is not a TTY, this method does nothing. + * + * The specific operation of `console.clear()` can vary across operating systems + * and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the + * current terminal viewport for the Node.js + * binary. + * @since v8.3.0 + */ + clear(): void; + /** + * Maintains an internal counter specific to `label` and outputs to `stdout` the + * number of times `console.count()` has been called with the given `label`. + * + * ```js + * > console.count() + * default: 1 + * undefined + * > console.count('default') + * default: 2 + * undefined + * > console.count('abc') + * abc: 1 + * undefined + * > console.count('xyz') + * xyz: 1 + * undefined + * > console.count('abc') + * abc: 2 + * undefined + * > console.count() + * default: 3 + * undefined + * > + * ``` + * @since v8.3.0 + * @param label The display label for the counter. + */ + count(label?: string): void; + /** + * Resets the internal counter specific to `label`. + * + * ```js + * > console.count('abc'); + * abc: 1 + * undefined + * > console.countReset('abc'); + * undefined + * > console.count('abc'); + * abc: 1 + * undefined + * > + * ``` + * @since v8.3.0 + * @param label The display label for the counter. + */ + countReset(label?: string): void; + /** + * The `console.debug()` function is an alias for {@link log}. + * @since v8.0.0 + */ + debug(message?: any, ...optionalParams: any[]): void; + /** + * Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`. + * This function bypasses any custom `inspect()` function defined on `obj`. + * @since v0.1.101 + */ + dir(obj: any, options?: InspectOptions): void; + /** + * This method calls `console.log()` passing it the arguments received. + * This method does not produce any XML formatting. + * @since v8.0.0 + */ + dirxml(...data: any[]): void; + /** + * Prints to `stderr` with newline. Multiple arguments can be passed, with the + * first used as the primary message and all additional used as substitution + * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`). + * + * ```js + * const code = 5; + * console.error('error #%d', code); + * // Prints: error #5, to stderr + * console.error('error', code); + * // Prints: error 5, to stderr + * ``` + * + * If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string + * values are concatenated. See `util.format()` for more information. + * @since v0.1.100 + */ + error(message?: any, ...optionalParams: any[]): void; + /** + * Increases indentation of subsequent lines by spaces for `groupIndentation`length. + * + * If one or more `label`s are provided, those are printed first without the + * additional indentation. + * @since v8.5.0 + */ + group(...label: any[]): void; + /** + * An alias for {@link group}. + * @since v8.5.0 + */ + groupCollapsed(...label: any[]): void; + /** + * Decreases indentation of subsequent lines by spaces for `groupIndentation`length. + * @since v8.5.0 + */ + groupEnd(): void; + /** + * The `console.info()` function is an alias for {@link log}. + * @since v0.1.100 + */ + info(message?: any, ...optionalParams: any[]): void; + /** + * Prints to `stdout` with newline. Multiple arguments can be passed, with the + * first used as the primary message and all additional used as substitution + * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`). + * + * ```js + * const count = 5; + * console.log('count: %d', count); + * // Prints: count: 5, to stdout + * console.log('count:', count); + * // Prints: count: 5, to stdout + * ``` + * + * See `util.format()` for more information. + * @since v0.1.100 + */ + log(message?: any, ...optionalParams: any[]): void; + /** + * Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just + * logging the argument if it can’t be parsed as tabular. + * + * ```js + * // These can't be parsed as tabular data + * console.table(Symbol()); + * // Symbol() + * + * console.table(undefined); + * // undefined + * + * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]); + * // ┌─────────┬─────┬─────┐ + * // │ (index) │ a │ b │ + * // ├─────────┼─────┼─────┤ + * // │ 0 │ 1 │ 'Y' │ + * // │ 1 │ 'Z' │ 2 │ + * // └─────────┴─────┴─────┘ + * + * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); + * // ┌─────────┬─────┐ + * // │ (index) │ a │ + * // ├─────────┼─────┤ + * // │ 0 │ 1 │ + * // │ 1 │ 'Z' │ + * // └─────────┴─────┘ + * ``` + * @since v10.0.0 + * @param properties Alternate properties for constructing the table. + */ + table(tabularData: any, properties?: ReadonlyArray): void; + /** + * Starts a timer that can be used to compute the duration of an operation. Timers + * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in + * suitable time units to `stdout`. For example, if the elapsed + * time is 3869ms, `console.timeEnd()` displays "3.869s". + * @since v0.1.104 + */ + time(label?: string): void; + /** + * Stops a timer that was previously started by calling {@link time} and + * prints the result to `stdout`: + * + * ```js + * console.time('100-elements'); + * for (let i = 0; i < 100; i++) {} + * console.timeEnd('100-elements'); + * // prints 100-elements: 225.438ms + * ``` + * @since v0.1.104 + */ + timeEnd(label?: string): void; + /** + * For a timer that was previously started by calling {@link time}, prints + * the elapsed time and other `data` arguments to `stdout`: + * + * ```js + * console.time('process'); + * const value = expensiveProcess1(); // Returns 42 + * console.timeLog('process', value); + * // Prints "process: 365.227ms 42". + * doExpensiveProcess2(value); + * console.timeEnd('process'); + * ``` + * @since v10.7.0 + */ + timeLog(label?: string, ...data: any[]): void; + /** + * Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code. + * + * ```js + * console.trace('Show me'); + * // Prints: (stack trace will vary based on where trace is called) + * // Trace: Show me + * // at repl:2:9 + * // at REPLServer.defaultEval (repl.js:248:27) + * // at bound (domain.js:287:14) + * // at REPLServer.runBound [as eval] (domain.js:300:12) + * // at REPLServer. (repl.js:412:12) + * // at emitOne (events.js:82:20) + * // at REPLServer.emit (events.js:169:7) + * // at REPLServer.Interface._onLine (readline.js:210:10) + * // at REPLServer.Interface._line (readline.js:549:8) + * // at REPLServer.Interface._ttyWrite (readline.js:826:14) + * ``` + * @since v0.1.104 + */ + trace(message?: any, ...optionalParams: any[]): void; + /** + * The `console.warn()` function is an alias for {@link error}. + * @since v0.1.100 + */ + warn(message?: any, ...optionalParams: any[]): void; + // --- Inspector mode only --- + /** + * This method does not display anything unless used in the inspector. + * Starts a JavaScript CPU profile with an optional label. + */ + profile(label?: string): void; + /** + * This method does not display anything unless used in the inspector. + * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. + */ + profileEnd(label?: string): void; + /** + * This method does not display anything unless used in the inspector. + * Adds an event with the label `label` to the Timeline panel of the inspector. + */ + timeStamp(label?: string): void; + } + /** + * The `console` module provides a simple debugging console that is similar to the + * JavaScript console mechanism provided by web browsers. + * + * The module exports two specific components: + * + * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream. + * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`. + * + * _**Warning**_: The global console object's methods are neither consistently + * synchronous like the browser APIs they resemble, nor are they consistently + * asynchronous like all other Node.js streams. See the `note on process I/O` for + * more information. + * + * Example using the global `console`: + * + * ```js + * console.log('hello world'); + * // Prints: hello world, to stdout + * console.log('hello %s', 'world'); + * // Prints: hello world, to stdout + * console.error(new Error('Whoops, something bad happened')); + * // Prints error message and stack trace to stderr: + * // Error: Whoops, something bad happened + * // at [eval]:5:15 + * // at Script.runInThisContext (node:vm:132:18) + * // at Object.runInThisContext (node:vm:309:38) + * // at node:internal/process/execution:77:19 + * // at [eval]-wrapper:6:22 + * // at evalScript (node:internal/process/execution:76:60) + * // at node:internal/main/eval_string:23:3 + * + * const name = 'Will Robinson'; + * console.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to stderr + * ``` + * + * Example using the `Console` class: + * + * ```js + * const out = getStreamSomehow(); + * const err = getStreamSomehow(); + * const myConsole = new console.Console(out, err); + * + * myConsole.log('hello world'); + * // Prints: hello world, to out + * myConsole.log('hello %s', 'world'); + * // Prints: hello world, to out + * myConsole.error(new Error('Whoops, something bad happened')); + * // Prints: [Error: Whoops, something bad happened], to err + * + * const name = 'Will Robinson'; + * myConsole.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to err + * ``` + * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js) + */ + namespace console { + interface ConsoleConstructorOptions { + stdout: NodeJS.WritableStream; + stderr?: NodeJS.WritableStream | undefined; + ignoreErrors?: boolean | undefined; + colorMode?: boolean | 'auto' | undefined; + inspectOptions?: InspectOptions | undefined; + /** + * Set group indentation + * @default 2 + */ + groupIndentation?: number | undefined; + } + interface ConsoleConstructor { + prototype: Console; + new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console; + new (options: ConsoleConstructorOptions): Console; + } + } + var console: Console; + } + export = globalThis.console; +} diff --git a/node_modules/@types/node/constants.d.ts b/node_modules/@types/node/constants.d.ts new file mode 100755 index 0000000..208020d --- /dev/null +++ b/node_modules/@types/node/constants.d.ts @@ -0,0 +1,18 @@ +/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ +declare module 'constants' { + import { constants as osConstants, SignalConstants } from 'node:os'; + import { constants as cryptoConstants } from 'node:crypto'; + import { constants as fsConstants } from 'node:fs'; + + const exp: typeof osConstants.errno & + typeof osConstants.priority & + SignalConstants & + typeof cryptoConstants & + typeof fsConstants; + export = exp; +} + +declare module 'node:constants' { + import constants = require('constants'); + export = constants; +} diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts new file mode 100755 index 0000000..9018464 --- /dev/null +++ b/node_modules/@types/node/crypto.d.ts @@ -0,0 +1,3978 @@ +/** + * The `node:crypto` module provides cryptographic functionality that includes a + * set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify + * functions. + * + * ```js + * const { createHmac } = await import('node:crypto'); + * + * const secret = 'abcdefg'; + * const hash = createHmac('sha256', secret) + * .update('I love cupcakes') + * .digest('hex'); + * console.log(hash); + * // Prints: + * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js) + */ +declare module 'crypto' { + import * as stream from 'node:stream'; + import { PeerCertificate } from 'node:tls'; + /** + * SPKAC is a Certificate Signing Request mechanism originally implemented by + * Netscape and was specified formally as part of HTML5's `keygen` element. + * + * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects + * should not use this element anymore. + * + * The `node:crypto` module provides the `Certificate` class for working with SPKAC + * data. The most common usage is handling output generated by the HTML5`` element. Node.js uses [OpenSSL's SPKAC + * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally. + * @since v0.11.8 + */ + class Certificate { + /** + * ```js + * const { Certificate } = await import('node:crypto'); + * const spkac = getSpkacSomehow(); + * const challenge = Certificate.exportChallenge(spkac); + * console.log(challenge.toString('utf8')); + * // Prints: the challenge as a UTF8 string + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge. + */ + static exportChallenge(spkac: BinaryLike): Buffer; + /** + * ```js + * const { Certificate } = await import('node:crypto'); + * const spkac = getSpkacSomehow(); + * const publicKey = Certificate.exportPublicKey(spkac); + * console.log(publicKey); + * // Prints: the public key as + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return The public key component of the `spkac` data structure, which includes a public key and a challenge. + */ + static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; + /** + * ```js + * import { Buffer } from 'node:buffer'; + * const { Certificate } = await import('node:crypto'); + * + * const spkac = getSpkacSomehow(); + * console.log(Certificate.verifySpkac(Buffer.from(spkac))); + * // Prints: true or false + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return `true` if the given `spkac` data structure is valid, `false` otherwise. + */ + static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; + /** + * @deprecated + * @param spkac + * @returns The challenge component of the `spkac` data structure, + * which includes a public key and a challenge. + */ + exportChallenge(spkac: BinaryLike): Buffer; + /** + * @deprecated + * @param spkac + * @param encoding The encoding of the spkac string. + * @returns The public key component of the `spkac` data structure, + * which includes a public key and a challenge. + */ + exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; + /** + * @deprecated + * @param spkac + * @returns `true` if the given `spkac` data structure is valid, + * `false` otherwise. + */ + verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; + } + namespace constants { + // https://nodejs.org/dist/latest-v20.x/docs/api/crypto.html#crypto-constants + const OPENSSL_VERSION_NUMBER: number; + /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ + const SSL_OP_ALL: number; + /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ + const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; + /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ + const SSL_OP_CIPHER_SERVER_PREFERENCE: number; + /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */ + const SSL_OP_CISCO_ANYCONNECT: number; + /** Instructs OpenSSL to turn on cookie exchange. */ + const SSL_OP_COOKIE_EXCHANGE: number; + /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ + const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; + /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ + const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; + /** Allows initial connection to servers that do not support RI. */ + const SSL_OP_LEGACY_SERVER_CONNECT: number; + /** Instructs OpenSSL to disable support for SSL/TLS compression. */ + const SSL_OP_NO_COMPRESSION: number; + const SSL_OP_NO_QUERY_MTU: number; + /** Instructs OpenSSL to always start a new session when performing renegotiation. */ + const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; + const SSL_OP_NO_SSLv2: number; + const SSL_OP_NO_SSLv3: number; + const SSL_OP_NO_TICKET: number; + const SSL_OP_NO_TLSv1: number; + const SSL_OP_NO_TLSv1_1: number; + const SSL_OP_NO_TLSv1_2: number; + /** Instructs OpenSSL to disable version rollback attack detection. */ + const SSL_OP_TLS_ROLLBACK_BUG: number; + const ENGINE_METHOD_RSA: number; + const ENGINE_METHOD_DSA: number; + const ENGINE_METHOD_DH: number; + const ENGINE_METHOD_RAND: number; + const ENGINE_METHOD_EC: number; + const ENGINE_METHOD_CIPHERS: number; + const ENGINE_METHOD_DIGESTS: number; + const ENGINE_METHOD_PKEY_METHS: number; + const ENGINE_METHOD_PKEY_ASN1_METHS: number; + const ENGINE_METHOD_ALL: number; + const ENGINE_METHOD_NONE: number; + const DH_CHECK_P_NOT_SAFE_PRIME: number; + const DH_CHECK_P_NOT_PRIME: number; + const DH_UNABLE_TO_CHECK_GENERATOR: number; + const DH_NOT_SUITABLE_GENERATOR: number; + const RSA_PKCS1_PADDING: number; + const RSA_SSLV23_PADDING: number; + const RSA_NO_PADDING: number; + const RSA_PKCS1_OAEP_PADDING: number; + const RSA_X931_PADDING: number; + const RSA_PKCS1_PSS_PADDING: number; + /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ + const RSA_PSS_SALTLEN_DIGEST: number; + /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ + const RSA_PSS_SALTLEN_MAX_SIGN: number; + /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ + const RSA_PSS_SALTLEN_AUTO: number; + const POINT_CONVERSION_COMPRESSED: number; + const POINT_CONVERSION_UNCOMPRESSED: number; + const POINT_CONVERSION_HYBRID: number; + /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ + const defaultCoreCipherList: string; + /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ + const defaultCipherList: string; + } + interface HashOptions extends stream.TransformOptions { + /** + * For XOF hash functions such as `shake256`, the + * outputLength option can be used to specify the desired output length in bytes. + */ + outputLength?: number | undefined; + } + /** @deprecated since v10.0.0 */ + const fips: boolean; + /** + * Creates and returns a `Hash` object that can be used to generate hash digests + * using the given `algorithm`. Optional `options` argument controls stream + * behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option + * can be used to specify the desired output length in bytes. + * + * The `algorithm` is dependent on the available algorithms supported by the + * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. + * On recent releases of OpenSSL, `openssl list -digest-algorithms` will + * display the available digest algorithms. + * + * Example: generating the sha256 sum of a file + * + * ```js + * import { + * createReadStream, + * } from 'node:fs'; + * import { argv } from 'node:process'; + * const { + * createHash, + * } = await import('node:crypto'); + * + * const filename = argv[2]; + * + * const hash = createHash('sha256'); + * + * const input = createReadStream(filename); + * input.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = input.read(); + * if (data) + * hash.update(data); + * else { + * console.log(`${hash.digest('hex')} ${filename}`); + * } + * }); + * ``` + * @since v0.1.92 + * @param options `stream.transform` options + */ + function createHash(algorithm: string, options?: HashOptions): Hash; + /** + * Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. + * Optional `options` argument controls stream behavior. + * + * The `algorithm` is dependent on the available algorithms supported by the + * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. + * On recent releases of OpenSSL, `openssl list -digest-algorithms` will + * display the available digest algorithms. + * + * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is + * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was + * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not + * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). + * + * Example: generating the sha256 HMAC of a file + * + * ```js + * import { + * createReadStream, + * } from 'node:fs'; + * import { argv } from 'node:process'; + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const filename = argv[2]; + * + * const hmac = createHmac('sha256', 'a secret'); + * + * const input = createReadStream(filename); + * input.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = input.read(); + * if (data) + * hmac.update(data); + * else { + * console.log(`${hmac.digest('hex')} ${filename}`); + * } + * }); + * ``` + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac; + // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings + type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex' | 'binary'; + type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1'; + type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2'; + type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding; + type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid'; + /** + * The `Hash` class is a utility for creating hash digests of data. It can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where data is written + * to produce a computed hash digest on the readable side, or + * * Using the `hash.update()` and `hash.digest()` methods to produce the + * computed hash. + * + * The {@link createHash} method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword. + * + * Example: Using `Hash` objects as streams: + * + * ```js + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = hash.read(); + * if (data) { + * console.log(data.toString('hex')); + * // Prints: + * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + * } + * }); + * + * hash.write('some data to hash'); + * hash.end(); + * ``` + * + * Example: Using `Hash` and piped streams: + * + * ```js + * import { createReadStream } from 'node:fs'; + * import { stdout } from 'node:process'; + * const { createHash } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * const input = createReadStream('test.js'); + * input.pipe(hash).setEncoding('hex').pipe(stdout); + * ``` + * + * Example: Using the `hash.update()` and `hash.digest()` methods: + * + * ```js + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.update('some data to hash'); + * console.log(hash.digest('hex')); + * // Prints: + * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + * ``` + * @since v0.1.92 + */ + class Hash extends stream.Transform { + private constructor(); + /** + * Creates a new `Hash` object that contains a deep copy of the internal state + * of the current `Hash` object. + * + * The optional `options` argument controls stream behavior. For XOF hash + * functions such as `'shake256'`, the `outputLength` option can be used to + * specify the desired output length in bytes. + * + * An error is thrown when an attempt is made to copy the `Hash` object after + * its `hash.digest()` method has been called. + * + * ```js + * // Calculate a rolling hash. + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.update('one'); + * console.log(hash.copy().digest('hex')); + * + * hash.update('two'); + * console.log(hash.copy().digest('hex')); + * + * hash.update('three'); + * console.log(hash.copy().digest('hex')); + * + * // Etc. + * ``` + * @since v13.1.0 + * @param options `stream.transform` options + */ + copy(options?: stream.TransformOptions): Hash; + /** + * Updates the hash content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Hash; + update(data: string, inputEncoding: Encoding): Hash; + /** + * Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method). + * If `encoding` is provided a string will be returned; otherwise + * a `Buffer` is returned. + * + * The `Hash` object can not be used again after `hash.digest()` method has been + * called. Multiple calls will cause an error to be thrown. + * @since v0.1.92 + * @param encoding The `encoding` of the return value. + */ + digest(): Buffer; + digest(encoding: BinaryToTextEncoding): string; + } + /** + * The `Hmac` class is a utility for creating cryptographic HMAC digests. It can + * be used in one of two ways: + * + * * As a `stream` that is both readable and writable, where data is written + * to produce a computed HMAC digest on the readable side, or + * * Using the `hmac.update()` and `hmac.digest()` methods to produce the + * computed HMAC digest. + * + * The {@link createHmac} method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword. + * + * Example: Using `Hmac` objects as streams: + * + * ```js + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * hmac.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = hmac.read(); + * if (data) { + * console.log(data.toString('hex')); + * // Prints: + * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + * } + * }); + * + * hmac.write('some data to hash'); + * hmac.end(); + * ``` + * + * Example: Using `Hmac` and piped streams: + * + * ```js + * import { createReadStream } from 'node:fs'; + * import { stdout } from 'node:process'; + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * const input = createReadStream('test.js'); + * input.pipe(hmac).pipe(stdout); + * ``` + * + * Example: Using the `hmac.update()` and `hmac.digest()` methods: + * + * ```js + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * hmac.update('some data to hash'); + * console.log(hmac.digest('hex')); + * // Prints: + * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + * ``` + * @since v0.1.94 + */ + class Hmac extends stream.Transform { + private constructor(); + /** + * Updates the `Hmac` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Hmac; + update(data: string, inputEncoding: Encoding): Hmac; + /** + * Calculates the HMAC digest of all of the data passed using `hmac.update()`. + * If `encoding` is + * provided a string is returned; otherwise a `Buffer` is returned; + * + * The `Hmac` object can not be used again after `hmac.digest()` has been + * called. Multiple calls to `hmac.digest()` will result in an error being thrown. + * @since v0.1.94 + * @param encoding The `encoding` of the return value. + */ + digest(): Buffer; + digest(encoding: BinaryToTextEncoding): string; + } + type KeyObjectType = 'secret' | 'public' | 'private'; + interface KeyExportOptions { + type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1'; + format: T; + cipher?: string | undefined; + passphrase?: string | Buffer | undefined; + } + interface JwkKeyExportOptions { + format: 'jwk'; + } + interface JsonWebKey { + crv?: string | undefined; + d?: string | undefined; + dp?: string | undefined; + dq?: string | undefined; + e?: string | undefined; + k?: string | undefined; + kty?: string | undefined; + n?: string | undefined; + p?: string | undefined; + q?: string | undefined; + qi?: string | undefined; + x?: string | undefined; + y?: string | undefined; + [key: string]: unknown; + } + interface AsymmetricKeyDetails { + /** + * Key size in bits (RSA, DSA). + */ + modulusLength?: number | undefined; + /** + * Public exponent (RSA). + */ + publicExponent?: bigint | undefined; + /** + * Name of the message digest (RSA-PSS). + */ + hashAlgorithm?: string | undefined; + /** + * Name of the message digest used by MGF1 (RSA-PSS). + */ + mgf1HashAlgorithm?: string | undefined; + /** + * Minimal salt length in bytes (RSA-PSS). + */ + saltLength?: number | undefined; + /** + * Size of q in bits (DSA). + */ + divisorLength?: number | undefined; + /** + * Name of the curve (EC). + */ + namedCurve?: string | undefined; + } + /** + * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key, + * and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject` + * objects are not to be created directly using the `new`keyword. + * + * Most applications should consider using the new `KeyObject` API instead of + * passing keys as strings or `Buffer`s due to improved security features. + * + * `KeyObject` instances can be passed to other threads via `postMessage()`. + * The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to + * be listed in the `transferList` argument. + * @since v11.6.0 + */ + class KeyObject { + private constructor(); + /** + * Example: Converting a `CryptoKey` instance to a `KeyObject`: + * + * ```js + * const { KeyObject } = await import('node:crypto'); + * const { subtle } = globalThis.crypto; + * + * const key = await subtle.generateKey({ + * name: 'HMAC', + * hash: 'SHA-256', + * length: 256, + * }, true, ['sign', 'verify']); + * + * const keyObject = KeyObject.from(key); + * console.log(keyObject.symmetricKeySize); + * // Prints: 32 (symmetric key size in bytes) + * ``` + * @since v15.0.0 + */ + static from(key: webcrypto.CryptoKey): KeyObject; + /** + * For asymmetric keys, this property represents the type of the key. Supported key + * types are: + * + * * `'rsa'` (OID 1.2.840.113549.1.1.1) + * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10) + * * `'dsa'` (OID 1.2.840.10040.4.1) + * * `'ec'` (OID 1.2.840.10045.2.1) + * * `'x25519'` (OID 1.3.101.110) + * * `'x448'` (OID 1.3.101.111) + * * `'ed25519'` (OID 1.3.101.112) + * * `'ed448'` (OID 1.3.101.113) + * * `'dh'` (OID 1.2.840.113549.1.3.1) + * + * This property is `undefined` for unrecognized `KeyObject` types and symmetric + * keys. + * @since v11.6.0 + */ + asymmetricKeyType?: KeyType | undefined; + /** + * For asymmetric keys, this property represents the size of the embedded key in + * bytes. This property is `undefined` for symmetric keys. + */ + asymmetricKeySize?: number | undefined; + /** + * This property exists only on asymmetric keys. Depending on the type of the key, + * this object contains information about the key. None of the information obtained + * through this property can be used to uniquely identify a key or to compromise + * the security of the key. + * + * For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence, + * the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be + * set. + * + * Other key details might be exposed via this API using additional attributes. + * @since v15.7.0 + */ + asymmetricKeyDetails?: AsymmetricKeyDetails | undefined; + /** + * For symmetric keys, the following encoding options can be used: + * + * For public keys, the following encoding options can be used: + * + * For private keys, the following encoding options can be used: + * + * The result type depends on the selected encoding format, when PEM the + * result is a string, when DER it will be a buffer containing the data + * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object. + * + * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are + * ignored. + * + * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of + * the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be + * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for + * encrypted private keys. Since PKCS#8 defines its own + * encryption mechanism, PEM-level encryption is not supported when encrypting + * a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for + * PKCS#1 and SEC1 encryption. + * @since v11.6.0 + */ + export(options: KeyExportOptions<'pem'>): string | Buffer; + export(options?: KeyExportOptions<'der'>): Buffer; + export(options?: JwkKeyExportOptions): JsonWebKey; + /** + * For secret keys, this property represents the size of the key in bytes. This + * property is `undefined` for asymmetric keys. + * @since v11.6.0 + */ + symmetricKeySize?: number | undefined; + /** + * Depending on the type of this `KeyObject`, this property is either`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys + * or `'private'` for private (asymmetric) keys. + * @since v11.6.0 + */ + type: KeyObjectType; + } + type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305'; + type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm'; + type CipherOCBTypes = 'aes-128-ocb' | 'aes-192-ocb' | 'aes-256-ocb'; + type BinaryLike = string | NodeJS.ArrayBufferView; + type CipherKey = BinaryLike | KeyObject; + interface CipherCCMOptions extends stream.TransformOptions { + authTagLength: number; + } + interface CipherGCMOptions extends stream.TransformOptions { + authTagLength?: number | undefined; + } + interface CipherOCBOptions extends stream.TransformOptions { + authTagLength: number; + } + /** + * Creates and returns a `Cipher` object that uses the given `algorithm` and`password`. + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication + * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On + * recent OpenSSL releases, `openssl list -cipher-algorithms` will + * display the available cipher algorithms. + * + * The `password` is used to derive the cipher key and initialization vector (IV). + * The value must be either a `'latin1'` encoded string, a `Buffer`, a`TypedArray`, or a `DataView`. + * + * **This function is semantically insecure for all** + * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,** + * **GCM, or CCM).** + * + * The implementation of `crypto.createCipher()` derives keys using the OpenSSL + * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one + * iteration, and no salt. The lack of salt allows dictionary attacks as the same + * password always creates the same key. The low iteration count and + * non-cryptographically secure hash algorithm allow passwords to be tested very + * rapidly. + * + * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that + * developers derive a key and IV on + * their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode + * (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when + * they are used in order to avoid the risk of IV reuse that causes + * vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. + * @since v0.1.94 + * @deprecated Since v10.0.0 - Use {@link createCipheriv} instead. + * @param options `stream.transform` options + */ + function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM; + /** @deprecated since v10.0.0 use `createCipheriv()` */ + function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM; + /** @deprecated since v10.0.0 use `createCipheriv()` */ + function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher; + /** + * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and + * initialization vector (`iv`). + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication + * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On + * recent OpenSSL releases, `openssl list -cipher-algorithms` will + * display the available cipher algorithms. + * + * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded + * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be + * a `KeyObject` of type `secret`. If the cipher does not need + * an initialization vector, `iv` may be `null`. + * + * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * Initialization vectors should be unpredictable and unique; ideally, they will be + * cryptographically random. They do not have to be secret: IVs are typically just + * added to ciphertext messages unencrypted. It may sound contradictory that + * something has to be unpredictable and unique, but does not have to be secret; + * remember that an attacker must not be able to predict ahead of time what a + * given IV will be. + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createCipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): CipherCCM; + function createCipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): CipherOCB; + function createCipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): CipherGCM; + function createCipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Cipher; + /** + * Instances of the `Cipher` class are used to encrypt data. The class can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where plain unencrypted + * data is written to produce encrypted data on the readable side, or + * * Using the `cipher.update()` and `cipher.final()` methods to produce + * the encrypted data. + * + * The {@link createCipher} or {@link createCipheriv} methods are + * used to create `Cipher` instances. `Cipher` objects are not to be created + * directly using the `new` keyword. + * + * Example: Using `Cipher` objects as streams: + * + * ```js + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * // Once we have the key and iv, we can create and use the cipher... + * const cipher = createCipheriv(algorithm, key, iv); + * + * let encrypted = ''; + * cipher.setEncoding('hex'); + * + * cipher.on('data', (chunk) => encrypted += chunk); + * cipher.on('end', () => console.log(encrypted)); + * + * cipher.write('some clear text data'); + * cipher.end(); + * }); + * }); + * ``` + * + * Example: Using `Cipher` and piped streams: + * + * ```js + * import { + * createReadStream, + * createWriteStream, + * } from 'node:fs'; + * + * import { + * pipeline, + * } from 'node:stream'; + * + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * const cipher = createCipheriv(algorithm, key, iv); + * + * const input = createReadStream('test.js'); + * const output = createWriteStream('test.enc'); + * + * pipeline(input, cipher, output, (err) => { + * if (err) throw err; + * }); + * }); + * }); + * ``` + * + * Example: Using the `cipher.update()` and `cipher.final()` methods: + * + * ```js + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * const cipher = createCipheriv(algorithm, key, iv); + * + * let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); + * encrypted += cipher.final('hex'); + * console.log(encrypted); + * }); + * }); + * ``` + * @since v0.1.94 + */ + class Cipher extends stream.Transform { + private constructor(); + /** + * Updates the cipher with `data`. If the `inputEncoding` argument is given, + * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or`DataView`. If `data` is a `Buffer`, + * `TypedArray`, or `DataView`, then`inputEncoding` is ignored. + * + * The `outputEncoding` specifies the output format of the enciphered + * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. + * + * The `cipher.update()` method can be called multiple times with new data until `cipher.final()` is called. Calling `cipher.update()` after `cipher.final()` will result in an error being + * thrown. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the data. + * @param outputEncoding The `encoding` of the return value. + */ + update(data: BinaryLike): Buffer; + update(data: string, inputEncoding: Encoding): Buffer; + update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; + update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; + /** + * Once the `cipher.final()` method has been called, the `Cipher` object can no + * longer be used to encrypt data. Attempts to call `cipher.final()` more than + * once will result in an error being thrown. + * @since v0.1.94 + * @param outputEncoding The `encoding` of the return value. + * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. + */ + final(): Buffer; + final(outputEncoding: BufferEncoding): string; + /** + * When using block encryption algorithms, the `Cipher` class will automatically + * add padding to the input data to the appropriate block size. To disable the + * default padding call `cipher.setAutoPadding(false)`. + * + * When `autoPadding` is `false`, the length of the entire input data must be a + * multiple of the cipher's block size or `cipher.final()` will throw an error. + * Disabling automatic padding is useful for non-standard padding, for instance + * using `0x0` instead of PKCS padding. + * + * The `cipher.setAutoPadding()` method must be called before `cipher.final()`. + * @since v0.7.1 + * @param [autoPadding=true] + * @return for method chaining. + */ + setAutoPadding(autoPadding?: boolean): this; + } + interface CipherCCM extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options: { + plaintextLength: number; + } + ): this; + getAuthTag(): Buffer; + } + interface CipherGCM extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + } + ): this; + getAuthTag(): Buffer; + } + interface CipherOCB extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + } + ): this; + getAuthTag(): Buffer; + } + /** + * Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key). + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * **This function is semantically insecure for all** + * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,** + * **GCM, or CCM).** + * + * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL + * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one + * iteration, and no salt. The lack of salt allows dictionary attacks as the same + * password always creates the same key. The low iteration count and + * non-cryptographically secure hash algorithm allow passwords to be tested very + * rapidly. + * + * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that + * developers derive a key and IV on + * their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object. + * @since v0.1.94 + * @deprecated Since v10.0.0 - Use {@link createDecipheriv} instead. + * @param options `stream.transform` options + */ + function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; + /** @deprecated since v10.0.0 use `createDecipheriv()` */ + function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM; + /** @deprecated since v10.0.0 use `createDecipheriv()` */ + function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher; + /** + * Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`). + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags + * to those with the specified length. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On + * recent OpenSSL releases, `openssl list -cipher-algorithms` will + * display the available cipher algorithms. + * + * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded + * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be + * a `KeyObject` of type `secret`. If the cipher does not need + * an initialization vector, `iv` may be `null`. + * + * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * Initialization vectors should be unpredictable and unique; ideally, they will be + * cryptographically random. They do not have to be secret: IVs are typically just + * added to ciphertext messages unencrypted. It may sound contradictory that + * something has to be unpredictable and unique, but does not have to be secret; + * remember that an attacker must not be able to predict ahead of time what a given + * IV will be. + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createDecipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): DecipherCCM; + function createDecipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): DecipherOCB; + function createDecipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): DecipherGCM; + function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher; + /** + * Instances of the `Decipher` class are used to decrypt data. The class can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where plain encrypted + * data is written to produce unencrypted data on the readable side, or + * * Using the `decipher.update()` and `decipher.final()` methods to + * produce the unencrypted data. + * + * The {@link createDecipher} or {@link createDecipheriv} methods are + * used to create `Decipher` instances. `Decipher` objects are not to be created + * directly using the `new` keyword. + * + * Example: Using `Decipher` objects as streams: + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Key length is dependent on the algorithm. In this case for aes192, it is + * // 24 bytes (192 bits). + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * let decrypted = ''; + * decipher.on('readable', () => { + * let chunk; + * while (null !== (chunk = decipher.read())) { + * decrypted += chunk.toString('utf8'); + * } + * }); + * decipher.on('end', () => { + * console.log(decrypted); + * // Prints: some clear text data + * }); + * + * // Encrypted with same algorithm, key and iv. + * const encrypted = + * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; + * decipher.write(encrypted, 'hex'); + * decipher.end(); + * ``` + * + * Example: Using `Decipher` and piped streams: + * + * ```js + * import { + * createReadStream, + * createWriteStream, + * } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * const input = createReadStream('test.enc'); + * const output = createWriteStream('test.js'); + * + * input.pipe(decipher).pipe(output); + * ``` + * + * Example: Using the `decipher.update()` and `decipher.final()` methods: + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * // Encrypted using same algorithm, key and iv. + * const encrypted = + * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; + * let decrypted = decipher.update(encrypted, 'hex', 'utf8'); + * decrypted += decipher.final('utf8'); + * console.log(decrypted); + * // Prints: some clear text data + * ``` + * @since v0.1.94 + */ + class Decipher extends stream.Transform { + private constructor(); + /** + * Updates the decipher with `data`. If the `inputEncoding` argument is given, + * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is + * ignored. + * + * The `outputEncoding` specifies the output format of the enciphered + * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. + * + * The `decipher.update()` method can be called multiple times with new data until `decipher.final()` is called. Calling `decipher.update()` after `decipher.final()` will result in an error + * being thrown. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the `data` string. + * @param outputEncoding The `encoding` of the return value. + */ + update(data: NodeJS.ArrayBufferView): Buffer; + update(data: string, inputEncoding: Encoding): Buffer; + update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; + update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; + /** + * Once the `decipher.final()` method has been called, the `Decipher` object can + * no longer be used to decrypt data. Attempts to call `decipher.final()` more + * than once will result in an error being thrown. + * @since v0.1.94 + * @param outputEncoding The `encoding` of the return value. + * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. + */ + final(): Buffer; + final(outputEncoding: BufferEncoding): string; + /** + * When data has been encrypted without standard block padding, calling`decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and + * removing padding. + * + * Turning auto padding off will only work if the input data's length is a + * multiple of the ciphers block size. + * + * The `decipher.setAutoPadding()` method must be called before `decipher.final()`. + * @since v0.7.1 + * @param [autoPadding=true] + * @return for method chaining. + */ + setAutoPadding(auto_padding?: boolean): this; + } + interface DecipherCCM extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options: { + plaintextLength: number; + } + ): this; + } + interface DecipherGCM extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + } + ): this; + } + interface DecipherOCB extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + } + ): this; + } + interface PrivateKeyInput { + key: string | Buffer; + format?: KeyFormat | undefined; + type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined; + passphrase?: string | Buffer | undefined; + encoding?: string | undefined; + } + interface PublicKeyInput { + key: string | Buffer; + format?: KeyFormat | undefined; + type?: 'pkcs1' | 'spki' | undefined; + encoding?: string | undefined; + } + /** + * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`. + * + * ```js + * const { + * generateKey, + * } = await import('node:crypto'); + * + * generateKey('hmac', { length: 512 }, (err, key) => { + * if (err) throw err; + * console.log(key.export().toString('hex')); // 46e..........620 + * }); + * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. + * @since v15.0.0 + * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. + */ + function generateKey( + type: 'hmac' | 'aes', + options: { + length: number; + }, + callback: (err: Error | null, key: KeyObject) => void + ): void; + /** + * Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`. + * + * ```js + * const { + * generateKeySync, + * } = await import('node:crypto'); + * + * const key = generateKeySync('hmac', { length: 512 }); + * console.log(key.export().toString('hex')); // e89..........41e + * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. + * @since v15.0.0 + * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. + */ + function generateKeySync( + type: 'hmac' | 'aes', + options: { + length: number; + } + ): KeyObject; + interface JsonWebKeyInput { + key: JsonWebKey; + format: 'jwk'; + } + /** + * Creates and returns a new key object containing a private key. If `key` is a + * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key`must be an object with the properties described above. + * + * If the private key is encrypted, a `passphrase` must be specified. The length + * of the passphrase is limited to 1024 bytes. + * @since v11.6.0 + */ + function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject; + /** + * Creates and returns a new key object containing a public key. If `key` is a + * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject`with type `'private'`, the public key is derived from the given private key; + * otherwise, `key` must be an object with the properties described above. + * + * If the format is `'pem'`, the `'key'` may also be an X.509 certificate. + * + * Because public keys can be derived from private keys, a private key may be + * passed instead of a public key. In that case, this function behaves as if {@link createPrivateKey} had been called, except that the type of the + * returned `KeyObject` will be `'public'` and that the private key cannot be + * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type`'private'` is given, a new `KeyObject` with type `'public'` will be returned + * and it will be impossible to extract the private key from the returned object. + * @since v11.6.0 + */ + function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject; + /** + * Creates and returns a new key object containing a secret key for symmetric + * encryption or `Hmac`. + * @since v11.6.0 + * @param encoding The string encoding when `key` is a string. + */ + function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject; + function createSecretKey(key: string, encoding: BufferEncoding): KeyObject; + /** + * Creates and returns a `Sign` object that uses the given `algorithm`. Use {@link getHashes} to obtain the names of the available digest algorithms. + * Optional `options` argument controls the `stream.Writable` behavior. + * + * In some cases, a `Sign` instance can be created using the name of a signature + * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use + * the corresponding digest algorithm. This does not work for all signature + * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest + * algorithm names. + * @since v0.1.92 + * @param options `stream.Writable` options + */ + function createSign(algorithm: string, options?: stream.WritableOptions): Sign; + type DSAEncoding = 'der' | 'ieee-p1363'; + interface SigningOptions { + /** + * @see crypto.constants.RSA_PKCS1_PADDING + */ + padding?: number | undefined; + saltLength?: number | undefined; + dsaEncoding?: DSAEncoding | undefined; + } + interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {} + interface SignKeyObjectInput extends SigningOptions { + key: KeyObject; + } + interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {} + interface VerifyKeyObjectInput extends SigningOptions { + key: KeyObject; + } + interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {} + type KeyLike = string | Buffer | KeyObject; + /** + * The `Sign` class is a utility for generating signatures. It can be used in one + * of two ways: + * + * * As a writable `stream`, where data to be signed is written and the `sign.sign()` method is used to generate and return the signature, or + * * Using the `sign.update()` and `sign.sign()` methods to produce the + * signature. + * + * The {@link createSign} method is used to create `Sign` instances. The + * argument is the string name of the hash function to use. `Sign` objects are not + * to be created directly using the `new` keyword. + * + * Example: Using `Sign` and `Verify` objects as streams: + * + * ```js + * const { + * generateKeyPairSync, + * createSign, + * createVerify, + * } = await import('node:crypto'); + * + * const { privateKey, publicKey } = generateKeyPairSync('ec', { + * namedCurve: 'sect239k1', + * }); + * + * const sign = createSign('SHA256'); + * sign.write('some data to sign'); + * sign.end(); + * const signature = sign.sign(privateKey, 'hex'); + * + * const verify = createVerify('SHA256'); + * verify.write('some data to sign'); + * verify.end(); + * console.log(verify.verify(publicKey, signature, 'hex')); + * // Prints: true + * ``` + * + * Example: Using the `sign.update()` and `verify.update()` methods: + * + * ```js + * const { + * generateKeyPairSync, + * createSign, + * createVerify, + * } = await import('node:crypto'); + * + * const { privateKey, publicKey } = generateKeyPairSync('rsa', { + * modulusLength: 2048, + * }); + * + * const sign = createSign('SHA256'); + * sign.update('some data to sign'); + * sign.end(); + * const signature = sign.sign(privateKey); + * + * const verify = createVerify('SHA256'); + * verify.update('some data to sign'); + * verify.end(); + * console.log(verify.verify(publicKey, signature)); + * // Prints: true + * ``` + * @since v0.1.92 + */ + class Sign extends stream.Writable { + private constructor(); + /** + * Updates the `Sign` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): this; + update(data: string, inputEncoding: Encoding): this; + /** + * Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the following additional properties can be passed: + * + * If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned. + * + * The `Sign` object can not be again used after `sign.sign()` method has been + * called. Multiple calls to `sign.sign()` will result in an error being thrown. + * @since v0.1.92 + */ + sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; + sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, outputFormat: BinaryToTextEncoding): string; + } + /** + * Creates and returns a `Verify` object that uses the given algorithm. + * Use {@link getHashes} to obtain an array of names of the available + * signing algorithms. Optional `options` argument controls the`stream.Writable` behavior. + * + * In some cases, a `Verify` instance can be created using the name of a signature + * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use + * the corresponding digest algorithm. This does not work for all signature + * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest + * algorithm names. + * @since v0.1.92 + * @param options `stream.Writable` options + */ + function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; + /** + * The `Verify` class is a utility for verifying signatures. It can be used in one + * of two ways: + * + * * As a writable `stream` where written data is used to validate against the + * supplied signature, or + * * Using the `verify.update()` and `verify.verify()` methods to verify + * the signature. + * + * The {@link createVerify} method is used to create `Verify` instances.`Verify` objects are not to be created directly using the `new` keyword. + * + * See `Sign` for examples. + * @since v0.1.92 + */ + class Verify extends stream.Writable { + private constructor(); + /** + * Updates the `Verify` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `inputEncoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Verify; + update(data: string, inputEncoding: Encoding): Verify; + /** + * Verifies the provided data using the given `object` and `signature`. + * + * If `object` is not a `KeyObject`, this function behaves as if`object` had been passed to {@link createPublicKey}. If it is an + * object, the following additional properties can be passed: + * + * The `signature` argument is the previously calculated signature for the data, in + * the `signatureEncoding`. + * If a `signatureEncoding` is specified, the `signature` is expected to be a + * string; otherwise `signature` is expected to be a `Buffer`,`TypedArray`, or `DataView`. + * + * The `verify` object can not be used again after `verify.verify()` has been + * called. Multiple calls to `verify.verify()` will result in an error being + * thrown. + * + * Because public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v0.1.92 + */ + verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean; + verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean; + } + /** + * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an + * optional specific `generator`. + * + * The `generator` argument can be a number, string, or `Buffer`. If`generator` is not specified, the value `2` is used. + * + * If `primeEncoding` is specified, `prime` is expected to be a string; otherwise + * a `Buffer`, `TypedArray`, or `DataView` is expected. + * + * If `generatorEncoding` is specified, `generator` is expected to be a string; + * otherwise a number, `Buffer`, `TypedArray`, or `DataView` is expected. + * @since v0.11.12 + * @param primeEncoding The `encoding` of the `prime` string. + * @param [generator=2] + * @param generatorEncoding The `encoding` of the `generator` string. + */ + function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman; + function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman; + function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman; + function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman; + function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman; + /** + * The `DiffieHellman` class is a utility for creating Diffie-Hellman key + * exchanges. + * + * Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function. + * + * ```js + * import assert from 'node:assert'; + * + * const { + * createDiffieHellman, + * } = await import('node:crypto'); + * + * // Generate Alice's keys... + * const alice = createDiffieHellman(2048); + * const aliceKey = alice.generateKeys(); + * + * // Generate Bob's keys... + * const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator()); + * const bobKey = bob.generateKeys(); + * + * // Exchange and generate the secret... + * const aliceSecret = alice.computeSecret(bobKey); + * const bobSecret = bob.computeSecret(aliceKey); + * + * // OK + * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); + * ``` + * @since v0.5.0 + */ + class DiffieHellman { + private constructor(); + /** + * Generates private and public Diffie-Hellman key values unless they have been + * generated or computed already, and returns + * the public key in the specified `encoding`. This key should be + * transferred to the other party. + * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. + * + * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular, + * once a private key has been generated or set, calling this function only updates + * the public key but does not generate a new private key. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + generateKeys(): Buffer; + generateKeys(encoding: BinaryToTextEncoding): string; + /** + * Computes the shared secret using `otherPublicKey` as the other + * party's public key and returns the computed shared secret. The supplied + * key is interpreted using the specified `inputEncoding`, and secret is + * encoded using specified `outputEncoding`. + * If the `inputEncoding` is not + * provided, `otherPublicKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`. + * + * If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned. + * @since v0.5.0 + * @param inputEncoding The `encoding` of an `otherPublicKey` string. + * @param outputEncoding The `encoding` of the return value. + */ + computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer; + computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman prime in the specified `encoding`. + * If `encoding` is provided a string is + * returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPrime(): Buffer; + getPrime(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman generator in the specified `encoding`. + * If `encoding` is provided a string is + * returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getGenerator(): Buffer; + getGenerator(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman public key in the specified `encoding`. + * If `encoding` is provided a + * string is returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPublicKey(): Buffer; + getPublicKey(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman private key in the specified `encoding`. + * If `encoding` is provided a + * string is returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPrivateKey(): Buffer; + getPrivateKey(encoding: BinaryToTextEncoding): string; + /** + * Sets the Diffie-Hellman public key. If the `encoding` argument is provided,`publicKey` is expected + * to be a string. If no `encoding` is provided, `publicKey` is expected + * to be a `Buffer`, `TypedArray`, or `DataView`. + * @since v0.5.0 + * @param encoding The `encoding` of the `publicKey` string. + */ + setPublicKey(publicKey: NodeJS.ArrayBufferView): void; + setPublicKey(publicKey: string, encoding: BufferEncoding): void; + /** + * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected + * to be a string. If no `encoding` is provided, `privateKey` is expected + * to be a `Buffer`, `TypedArray`, or `DataView`. + * + * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be + * used to manually provide the public key or to automatically derive it. + * @since v0.5.0 + * @param encoding The `encoding` of the `privateKey` string. + */ + setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; + setPrivateKey(privateKey: string, encoding: BufferEncoding): void; + /** + * A bit field containing any warnings and/or errors resulting from a check + * performed during initialization of the `DiffieHellman` object. + * + * The following values are valid for this property (as defined in `node:constants` module): + * + * * `DH_CHECK_P_NOT_SAFE_PRIME` + * * `DH_CHECK_P_NOT_PRIME` + * * `DH_UNABLE_TO_CHECK_GENERATOR` + * * `DH_NOT_SUITABLE_GENERATOR` + * @since v0.11.12 + */ + verifyError: number; + } + /** + * The `DiffieHellmanGroup` class takes a well-known modp group as its argument. + * It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. + * In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. + * + * ```js + * const { createDiffieHellmanGroup } = await import('node:crypto'); + * const dh = createDiffieHellmanGroup('modp1'); + * ``` + * The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt): + * ```bash + * $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h + * modp1 # 768 bits + * modp2 # 1024 bits + * modp5 # 1536 bits + * modp14 # 2048 bits + * modp15 # etc. + * modp16 + * modp17 + * modp18 + * ``` + * @since v0.7.5 + */ + const DiffieHellmanGroup: DiffieHellmanGroupConstructor; + interface DiffieHellmanGroupConstructor { + new (name: string): DiffieHellmanGroup; + (name: string): DiffieHellmanGroup; + readonly prototype: DiffieHellmanGroup; + } + type DiffieHellmanGroup = Omit; + /** + * Creates a predefined `DiffieHellmanGroup` key exchange object. The + * supported groups are listed in the documentation for `DiffieHellmanGroup`. + * + * The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing + * the keys (with `diffieHellman.setPublicKey()`, for example). The + * advantage of using this method is that the parties do not have to + * generate nor exchange a group modulus beforehand, saving both processor + * and communication time. + * + * Example (obtaining a shared secret): + * + * ```js + * const { + * getDiffieHellman, + * } = await import('node:crypto'); + * const alice = getDiffieHellman('modp14'); + * const bob = getDiffieHellman('modp14'); + * + * alice.generateKeys(); + * bob.generateKeys(); + * + * const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); + * const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + * + * // aliceSecret and bobSecret should be the same + * console.log(aliceSecret === bobSecret); + * ``` + * @since v0.7.5 + */ + function getDiffieHellman(groupName: string): DiffieHellmanGroup; + /** + * An alias for {@link getDiffieHellman} + * @since v0.9.3 + */ + function createDiffieHellmanGroup(name: string): DiffieHellmanGroup; + /** + * Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) + * implementation. A selected HMAC digest algorithm specified by `digest` is + * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`. + * + * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an error occurs while deriving the key, `err` will be set; + * otherwise `err` will be `null`. By default, the successfully generated`derivedKey` will be passed to the callback as a `Buffer`. An error will be + * thrown if any of the input arguments specify invalid values or types. + * + * The `iterations` argument must be a number set as high as possible. The + * higher the number of iterations, the more secure the derived key will be, + * but will take a longer amount of time to complete. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * ```js + * const { + * pbkdf2, + * } = await import('node:crypto'); + * + * pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' + * }); + * ``` + * + * An array of supported digest functions can be retrieved using {@link getHashes}. + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * @since v0.5.5 + */ + function pbkdf2(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => void): void; + /** + * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) + * implementation. A selected HMAC digest algorithm specified by `digest` is + * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`. + * + * If an error occurs an `Error` will be thrown, otherwise the derived key will be + * returned as a `Buffer`. + * + * The `iterations` argument must be a number set as high as possible. The + * higher the number of iterations, the more secure the derived key will be, + * but will take a longer amount of time to complete. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * ```js + * const { + * pbkdf2Sync, + * } = await import('node:crypto'); + * + * const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); + * console.log(key.toString('hex')); // '3745e48...08d59ae' + * ``` + * + * An array of supported digest functions can be retrieved using {@link getHashes}. + * @since v0.9.3 + */ + function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer; + /** + * Generates cryptographically strong pseudorandom data. The `size` argument + * is a number indicating the number of bytes to generate. + * + * If a `callback` function is provided, the bytes are generated asynchronously + * and the `callback` function is invoked with two arguments: `err` and `buf`. + * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The`buf` argument is a `Buffer` containing the generated bytes. + * + * ```js + * // Asynchronous + * const { + * randomBytes, + * } = await import('node:crypto'); + * + * randomBytes(256, (err, buf) => { + * if (err) throw err; + * console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); + * }); + * ``` + * + * If the `callback` function is not provided, the random bytes are generated + * synchronously and returned as a `Buffer`. An error will be thrown if + * there is a problem generating the bytes. + * + * ```js + * // Synchronous + * const { + * randomBytes, + * } = await import('node:crypto'); + * + * const buf = randomBytes(256); + * console.log( + * `${buf.length} bytes of random data: ${buf.toString('hex')}`); + * ``` + * + * The `crypto.randomBytes()` method will not complete until there is + * sufficient entropy available. + * This should normally never take longer than a few milliseconds. The only time + * when generating the random bytes may conceivably block for a longer period of + * time is right after boot, when the whole system is still low on entropy. + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * + * The asynchronous version of `crypto.randomBytes()` is carried out in a single + * threadpool request. To minimize threadpool task length variation, partition + * large `randomBytes` requests when doing so as part of fulfilling a client + * request. + * @since v0.5.8 + * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`. + * @return if the `callback` function is not provided. + */ + function randomBytes(size: number): Buffer; + function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; + function pseudoRandomBytes(size: number): Buffer; + function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; + /** + * Return a random integer `n` such that `min <= n < max`. This + * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias). + * + * The range (`max - min`) must be less than 248. `min` and `max` must + * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger). + * + * If the `callback` function is not provided, the random integer is + * generated synchronously. + * + * ```js + * // Asynchronous + * const { + * randomInt, + * } = await import('node:crypto'); + * + * randomInt(3, (err, n) => { + * if (err) throw err; + * console.log(`Random number chosen from (0, 1, 2): ${n}`); + * }); + * ``` + * + * ```js + * // Synchronous + * const { + * randomInt, + * } = await import('node:crypto'); + * + * const n = randomInt(3); + * console.log(`Random number chosen from (0, 1, 2): ${n}`); + * ``` + * + * ```js + * // With `min` argument + * const { + * randomInt, + * } = await import('node:crypto'); + * + * const n = randomInt(1, 7); + * console.log(`The dice rolled: ${n}`); + * ``` + * @since v14.10.0, v12.19.0 + * @param [min=0] Start of random range (inclusive). + * @param max End of random range (exclusive). + * @param callback `function(err, n) {}`. + */ + function randomInt(max: number): number; + function randomInt(min: number, max: number): number; + function randomInt(max: number, callback: (err: Error | null, value: number) => void): void; + function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void; + /** + * Synchronous version of {@link randomFill}. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFillSync } = await import('node:crypto'); + * + * const buf = Buffer.alloc(10); + * console.log(randomFillSync(buf).toString('hex')); + * + * randomFillSync(buf, 5); + * console.log(buf.toString('hex')); + * + * // The above is equivalent to the following: + * randomFillSync(buf, 5, 5); + * console.log(buf.toString('hex')); + * ``` + * + * Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFillSync } = await import('node:crypto'); + * + * const a = new Uint32Array(10); + * console.log(Buffer.from(randomFillSync(a).buffer, + * a.byteOffset, a.byteLength).toString('hex')); + * + * const b = new DataView(new ArrayBuffer(10)); + * console.log(Buffer.from(randomFillSync(b).buffer, + * b.byteOffset, b.byteLength).toString('hex')); + * + * const c = new ArrayBuffer(10); + * console.log(Buffer.from(randomFillSync(c)).toString('hex')); + * ``` + * @since v7.10.0, v6.13.0 + * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. + * @param [offset=0] + * @param [size=buffer.length - offset] + * @return The object passed as `buffer` argument. + */ + function randomFillSync(buffer: T, offset?: number, size?: number): T; + /** + * This function is similar to {@link randomBytes} but requires the first + * argument to be a `Buffer` that will be filled. It also + * requires that a callback is passed in. + * + * If the `callback` function is not provided, an error will be thrown. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFill } = await import('node:crypto'); + * + * const buf = Buffer.alloc(10); + * randomFill(buf, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * + * randomFill(buf, 5, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * + * // The above is equivalent to the following: + * randomFill(buf, 5, 5, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * ``` + * + * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as`buffer`. + * + * While this includes instances of `Float32Array` and `Float64Array`, this + * function should not be used to generate random floating-point numbers. The + * result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array + * contains finite numbers only, they are not drawn from a uniform random + * distribution and have no meaningful lower or upper bounds. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFill } = await import('node:crypto'); + * + * const a = new Uint32Array(10); + * randomFill(a, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + * .toString('hex')); + * }); + * + * const b = new DataView(new ArrayBuffer(10)); + * randomFill(b, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + * .toString('hex')); + * }); + * + * const c = new ArrayBuffer(10); + * randomFill(c, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf).toString('hex')); + * }); + * ``` + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * + * The asynchronous version of `crypto.randomFill()` is carried out in a single + * threadpool request. To minimize threadpool task length variation, partition + * large `randomFill` requests when doing so as part of fulfilling a client + * request. + * @since v7.10.0, v6.13.0 + * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. + * @param [offset=0] + * @param [size=buffer.length - offset] + * @param callback `function(err, buf) {}`. + */ + function randomFill(buffer: T, callback: (err: Error | null, buf: T) => void): void; + function randomFill(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void; + function randomFill(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void; + interface ScryptOptions { + cost?: number | undefined; + blockSize?: number | undefined; + parallelization?: number | undefined; + N?: number | undefined; + r?: number | undefined; + p?: number | undefined; + maxmem?: number | undefined; + } + /** + * Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based + * key derivation function that is designed to be expensive computationally and + * memory-wise in order to make brute-force attacks unrewarding. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * The `callback` function is called with two arguments: `err` and `derivedKey`.`err` is an exception object when key derivation fails, otherwise `err` is`null`. `derivedKey` is passed to the + * callback as a `Buffer`. + * + * An exception is thrown when any of the input arguments specify invalid values + * or types. + * + * ```js + * const { + * scrypt, + * } = await import('node:crypto'); + * + * // Using the factory defaults. + * scrypt('password', 'salt', 64, (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' + * }); + * // Using a custom N parameter. Must be a power of two. + * scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' + * }); + * ``` + * @since v10.5.0 + */ + function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void): void; + function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, options: ScryptOptions, callback: (err: Error | null, derivedKey: Buffer) => void): void; + /** + * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based + * key derivation function that is designed to be expensive computationally and + * memory-wise in order to make brute-force attacks unrewarding. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * An exception is thrown when key derivation fails, otherwise the derived key is + * returned as a `Buffer`. + * + * An exception is thrown when any of the input arguments specify invalid values + * or types. + * + * ```js + * const { + * scryptSync, + * } = await import('node:crypto'); + * // Using the factory defaults. + * + * const key1 = scryptSync('password', 'salt', 64); + * console.log(key1.toString('hex')); // '3745e48...08d59ae' + * // Using a custom N parameter. Must be a power of two. + * const key2 = scryptSync('password', 'salt', 64, { N: 1024 }); + * console.log(key2.toString('hex')); // '3745e48...aa39b34' + * ``` + * @since v10.5.0 + */ + function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; + interface RsaPublicKey { + key: KeyLike; + padding?: number | undefined; + } + interface RsaPrivateKey { + key: KeyLike; + passphrase?: string | undefined; + /** + * @default 'sha1' + */ + oaepHash?: string | undefined; + oaepLabel?: NodeJS.TypedArray | undefined; + padding?: number | undefined; + } + /** + * Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using + * the corresponding private key, for example using {@link privateDecrypt}. + * + * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`. + * + * Because RSA public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v0.11.14 + */ + function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Decrypts `buffer` with `key`.`buffer` was previously encrypted using + * the corresponding private key, for example using {@link privateEncrypt}. + * + * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`. + * + * Because RSA public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v1.1.0 + */ + function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using + * the corresponding public key, for example using {@link publicEncrypt}. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`. + * @since v0.11.14 + */ + function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using + * the corresponding public key, for example using {@link publicDecrypt}. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`. + * @since v1.1.0 + */ + function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * ```js + * const { + * getCiphers, + * } = await import('node:crypto'); + * + * console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...] + * ``` + * @since v0.9.3 + * @return An array with the names of the supported cipher algorithms. + */ + function getCiphers(): string[]; + /** + * ```js + * const { + * getCurves, + * } = await import('node:crypto'); + * + * console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] + * ``` + * @since v2.3.0 + * @return An array with the names of the supported elliptic curves. + */ + function getCurves(): string[]; + /** + * @since v10.0.0 + * @return `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}. + */ + function getFips(): 1 | 0; + /** + * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. + * Throws an error if FIPS mode is not available. + * @since v10.0.0 + * @param bool `true` to enable FIPS mode. + */ + function setFips(bool: boolean): void; + /** + * ```js + * const { + * getHashes, + * } = await import('node:crypto'); + * + * console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] + * ``` + * @since v0.9.3 + * @return An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. + */ + function getHashes(): string[]; + /** + * The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) + * key exchanges. + * + * Instances of the `ECDH` class can be created using the {@link createECDH} function. + * + * ```js + * import assert from 'node:assert'; + * + * const { + * createECDH, + * } = await import('node:crypto'); + * + * // Generate Alice's keys... + * const alice = createECDH('secp521r1'); + * const aliceKey = alice.generateKeys(); + * + * // Generate Bob's keys... + * const bob = createECDH('secp521r1'); + * const bobKey = bob.generateKeys(); + * + * // Exchange and generate the secret... + * const aliceSecret = alice.computeSecret(bobKey); + * const bobSecret = bob.computeSecret(aliceKey); + * + * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); + * // OK + * ``` + * @since v0.11.14 + */ + class ECDH { + private constructor(); + /** + * Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the + * format specified by `format`. The `format` argument specifies point encoding + * and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is + * interpreted using the specified `inputEncoding`, and the returned key is encoded + * using the specified `outputEncoding`. + * + * Use {@link getCurves} to obtain a list of available curve names. + * On recent OpenSSL releases, `openssl ecparam -list_curves` will also display + * the name and description of each available elliptic curve. + * + * If `format` is not specified the point will be returned in `'uncompressed'`format. + * + * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`,`TypedArray`, or `DataView`. + * + * Example (uncompressing a key): + * + * ```js + * const { + * createECDH, + * ECDH, + * } = await import('node:crypto'); + * + * const ecdh = createECDH('secp256k1'); + * ecdh.generateKeys(); + * + * const compressedKey = ecdh.getPublicKey('hex', 'compressed'); + * + * const uncompressedKey = ECDH.convertKey(compressedKey, + * 'secp256k1', + * 'hex', + * 'hex', + * 'uncompressed'); + * + * // The converted key and the uncompressed public key should be the same + * console.log(uncompressedKey === ecdh.getPublicKey('hex')); + * ``` + * @since v10.0.0 + * @param inputEncoding The `encoding` of the `key` string. + * @param outputEncoding The `encoding` of the return value. + * @param [format='uncompressed'] + */ + static convertKey( + key: BinaryLike, + curve: string, + inputEncoding?: BinaryToTextEncoding, + outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url', + format?: 'uncompressed' | 'compressed' | 'hybrid' + ): Buffer | string; + /** + * Generates private and public EC Diffie-Hellman key values, and returns + * the public key in the specified `format` and `encoding`. This key should be + * transferred to the other party. + * + * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format. + * + * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @param [format='uncompressed'] + */ + generateKeys(): Buffer; + generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; + /** + * Computes the shared secret using `otherPublicKey` as the other + * party's public key and returns the computed shared secret. The supplied + * key is interpreted using specified `inputEncoding`, and the returned secret + * is encoded using the specified `outputEncoding`. + * If the `inputEncoding` is not + * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or`DataView`. + * + * If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned. + * + * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey`lies outside of the elliptic curve. Since `otherPublicKey` is + * usually supplied from a remote user over an insecure network, + * be sure to handle this exception accordingly. + * @since v0.11.14 + * @param inputEncoding The `encoding` of the `otherPublicKey` string. + * @param outputEncoding The `encoding` of the return value. + */ + computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer; + computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string; + /** + * If `encoding` is specified, a string is returned; otherwise a `Buffer` is + * returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @return The EC Diffie-Hellman in the specified `encoding`. + */ + getPrivateKey(): Buffer; + getPrivateKey(encoding: BinaryToTextEncoding): string; + /** + * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format. + * + * If `encoding` is specified, a string is returned; otherwise a `Buffer` is + * returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @param [format='uncompressed'] + * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`. + */ + getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer; + getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; + /** + * Sets the EC Diffie-Hellman private key. + * If `encoding` is provided, `privateKey` is expected + * to be a string; otherwise `privateKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`. + * + * If `privateKey` is not valid for the curve specified when the `ECDH` object was + * created, an error is thrown. Upon setting the private key, the associated + * public point (key) is also generated and set in the `ECDH` object. + * @since v0.11.14 + * @param encoding The `encoding` of the `privateKey` string. + */ + setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; + setPrivateKey(privateKey: string, encoding: BinaryToTextEncoding): void; + } + /** + * Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a + * predefined curve specified by the `curveName` string. Use {@link getCurves} to obtain a list of available curve names. On recent + * OpenSSL releases, `openssl ecparam -list_curves` will also display the name + * and description of each available elliptic curve. + * @since v0.11.14 + */ + function createECDH(curveName: string): ECDH; + /** + * This function compares the underlying bytes that represent the given`ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time + * algorithm. + * + * This function does not leak timing information that + * would allow an attacker to guess one of the values. This is suitable for + * comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/). + * + * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they + * must have the same byte length. An error is thrown if `a` and `b` have + * different byte lengths. + * + * If at least one of `a` and `b` is a `TypedArray` with more than one byte per + * entry, such as `Uint16Array`, the result will be computed using the platform + * byte order. + * + * **When both of the inputs are `Float32Array`s or`Float64Array`s, this function might return unexpected results due to IEEE 754** + * **encoding of floating-point numbers. In particular, neither `x === y` nor`Object.is(x, y)` implies that the byte representations of two floating-point** + * **numbers `x` and `y` are equal.** + * + * Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code + * is timing-safe. Care should be taken to ensure that the surrounding code does + * not introduce timing vulnerabilities. + * @since v6.6.0 + */ + function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; + type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448'; + type KeyFormat = 'pem' | 'der' | 'jwk'; + interface BasePrivateKeyEncodingOptions { + format: T; + cipher?: string | undefined; + passphrase?: string | undefined; + } + interface KeyPairKeyObjectResult { + publicKey: KeyObject; + privateKey: KeyObject; + } + interface ED25519KeyPairKeyObjectOptions {} + interface ED448KeyPairKeyObjectOptions {} + interface X25519KeyPairKeyObjectOptions {} + interface X448KeyPairKeyObjectOptions {} + interface ECKeyPairKeyObjectOptions { + /** + * Name of the curve to use + */ + namedCurve: string; + } + interface RSAKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + } + interface RSAPSSKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + /** + * Name of the message digest + */ + hashAlgorithm?: string; + /** + * Name of the message digest used by MGF1 + */ + mgf1HashAlgorithm?: string; + /** + * Minimal salt length in bytes + */ + saltLength?: string; + } + interface DSAKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Size of q in bits + */ + divisorLength: number; + } + interface RSAKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + publicKeyEncoding: { + type: 'pkcs1' | 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs1' | 'pkcs8'; + }; + } + interface RSAPSSKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + /** + * Name of the message digest + */ + hashAlgorithm?: string; + /** + * Name of the message digest used by MGF1 + */ + mgf1HashAlgorithm?: string; + /** + * Minimal salt length in bytes + */ + saltLength?: string; + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface DSAKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Size of q in bits + */ + divisorLength: number; + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface ECKeyPairOptions { + /** + * Name of the curve to use. + */ + namedCurve: string; + publicKeyEncoding: { + type: 'pkcs1' | 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'sec1' | 'pkcs8'; + }; + } + interface ED25519KeyPairOptions { + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface ED448KeyPairOptions { + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface X25519KeyPairOptions { + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface X448KeyPairOptions { + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface KeyPairSyncResult { + publicKey: T1; + privateKey: T2; + } + /** + * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, + * Ed25519, Ed448, X25519, X448, and DH are currently supported. + * + * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function + * behaves as if `keyObject.export()` had been called on its result. Otherwise, + * the respective part of the key is returned as a `KeyObject`. + * + * When encoding public keys, it is recommended to use `'spki'`. When encoding + * private keys, it is recommended to use `'pkcs8'` with a strong passphrase, + * and to keep the passphrase confidential. + * + * ```js + * const { + * generateKeyPairSync, + * } = await import('node:crypto'); + * + * const { + * publicKey, + * privateKey, + * } = generateKeyPairSync('rsa', { + * modulusLength: 4096, + * publicKeyEncoding: { + * type: 'spki', + * format: 'pem', + * }, + * privateKeyEncoding: { + * type: 'pkcs8', + * format: 'pem', + * cipher: 'aes-256-cbc', + * passphrase: 'top secret', + * }, + * }); + * ``` + * + * The return value `{ publicKey, privateKey }` represents the generated key pair. + * When PEM encoding was selected, the respective key will be a string, otherwise + * it will be a buffer containing the data encoded as DER. + * @since v10.12.0 + * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. + */ + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + /** + * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, + * Ed25519, Ed448, X25519, X448, and DH are currently supported. + * + * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function + * behaves as if `keyObject.export()` had been called on its result. Otherwise, + * the respective part of the key is returned as a `KeyObject`. + * + * It is recommended to encode public keys as `'spki'` and private keys as`'pkcs8'` with encryption for long-term storage: + * + * ```js + * const { + * generateKeyPair, + * } = await import('node:crypto'); + * + * generateKeyPair('rsa', { + * modulusLength: 4096, + * publicKeyEncoding: { + * type: 'spki', + * format: 'pem', + * }, + * privateKeyEncoding: { + * type: 'pkcs8', + * format: 'pem', + * cipher: 'aes-256-cbc', + * passphrase: 'top secret', + * }, + * }, (err, publicKey, privateKey) => { + * // Handle errors and use the generated key pair. + * }); + * ``` + * + * On completion, `callback` will be called with `err` set to `undefined` and`publicKey` / `privateKey` representing the generated key pair. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `publicKey` and `privateKey` properties. + * @since v10.12.0 + * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. + */ + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + namespace generateKeyPair { + function __promisify__( + type: 'rsa', + options: RSAKeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'rsa', + options: RSAKeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'rsa', + options: RSAKeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'rsa', + options: RSAKeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'rsa-pss', + options: RSAPSSKeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'rsa-pss', + options: RSAPSSKeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'rsa-pss', + options: RSAPSSKeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'rsa-pss', + options: RSAPSSKeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'dsa', + options: DSAKeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'dsa', + options: DSAKeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'dsa', + options: DSAKeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'dsa', + options: DSAKeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'ec', + options: ECKeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'ec', + options: ECKeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'ec', + options: ECKeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'ec', + options: ECKeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'ed25519', + options: ED25519KeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'ed25519', + options: ED25519KeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'ed25519', + options: ED25519KeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'ed25519', + options: ED25519KeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'ed448', + options: ED448KeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'ed448', + options: ED448KeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'ed448', + options: ED448KeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'ed448', + options: ED448KeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'x25519', + options: X25519KeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'x25519', + options: X25519KeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'x25519', + options: X25519KeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'x25519', + options: X25519KeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'x448', + options: X448KeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'x448', + options: X448KeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'x448', + options: X448KeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'x448', + options: X448KeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'x448', options?: X448KeyPairKeyObjectOptions): Promise; + } + /** + * Calculates and returns the signature for `data` using the given private key and + * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is + * dependent upon the key type (especially Ed25519 and Ed448). + * + * If `key` is not a `KeyObject`, this function behaves as if `key` had been + * passed to {@link createPrivateKey}. If it is an object, the following + * additional properties can be passed: + * + * If the `callback` function is provided this function uses libuv's threadpool. + * @since v12.0.0 + */ + function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; + function sign( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, + callback: (error: Error | null, data: Buffer) => void + ): void; + /** + * Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the + * key type (especially Ed25519 and Ed448). + * + * If `key` is not a `KeyObject`, this function behaves as if `key` had been + * passed to {@link createPublicKey}. If it is an object, the following + * additional properties can be passed: + * + * The `signature` argument is the previously calculated signature for the `data`. + * + * Because public keys can be derived from private keys, a private key or a public + * key may be passed for `key`. + * + * If the `callback` function is provided this function uses libuv's threadpool. + * @since v12.0.0 + */ + function verify( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, + signature: NodeJS.ArrayBufferView + ): boolean; + function verify( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, + signature: NodeJS.ArrayBufferView, + callback: (error: Error | null, result: boolean) => void + ): void; + /** + * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`. + * Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'`(for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES). + * @since v13.9.0, v12.17.0 + */ + function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer; + type CipherMode = 'cbc' | 'ccm' | 'cfb' | 'ctr' | 'ecb' | 'gcm' | 'ocb' | 'ofb' | 'stream' | 'wrap' | 'xts'; + interface CipherInfoOptions { + /** + * A test key length. + */ + keyLength?: number | undefined; + /** + * A test IV length. + */ + ivLength?: number | undefined; + } + interface CipherInfo { + /** + * The name of the cipher. + */ + name: string; + /** + * The nid of the cipher. + */ + nid: number; + /** + * The block size of the cipher in bytes. + * This property is omitted when mode is 'stream'. + */ + blockSize?: number | undefined; + /** + * The expected or default initialization vector length in bytes. + * This property is omitted if the cipher does not use an initialization vector. + */ + ivLength?: number | undefined; + /** + * The expected or default key length in bytes. + */ + keyLength: number; + /** + * The cipher mode. + */ + mode: CipherMode; + } + /** + * Returns information about a given cipher. + * + * Some ciphers accept variable length keys and initialization vectors. By default, + * the `crypto.getCipherInfo()` method will return the default values for these + * ciphers. To test if a given key length or iv length is acceptable for given + * cipher, use the `keyLength` and `ivLength` options. If the given values are + * unacceptable, `undefined` will be returned. + * @since v15.0.0 + * @param nameOrNid The name or nid of the cipher to query. + */ + function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined; + /** + * HKDF is a simple key derivation function defined in RFC 5869\. The given `ikm`,`salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. + * + * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an errors occurs while deriving the key, `err` will be set; + * otherwise `err` will be `null`. The successfully generated `derivedKey` will + * be passed to the callback as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any + * of the input arguments specify invalid values or types. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * hkdf, + * } = await import('node:crypto'); + * + * hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => { + * if (err) throw err; + * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' + * }); + * ``` + * @since v15.0.0 + * @param digest The digest algorithm to use. + * @param ikm The input keying material. Must be provided but can be zero-length. + * @param salt The salt value. Must be provided but can be zero-length. + * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. + * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` + * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). + */ + function hkdf(digest: string, irm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => void): void; + /** + * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The + * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes. + * + * The successfully generated `derivedKey` will be returned as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). + * + * An error will be thrown if any of the input arguments specify invalid values or + * types, or if the derived key cannot be generated. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * hkdfSync, + * } = await import('node:crypto'); + * + * const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); + * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' + * ``` + * @since v15.0.0 + * @param digest The digest algorithm to use. + * @param ikm The input keying material. Must be provided but can be zero-length. + * @param salt The salt value. Must be provided but can be zero-length. + * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. + * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` + * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). + */ + function hkdfSync(digest: string, ikm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number): ArrayBuffer; + interface SecureHeapUsage { + /** + * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag. + */ + total: number; + /** + * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag. + */ + min: number; + /** + * The total number of bytes currently allocated from the secure heap. + */ + used: number; + /** + * The calculated ratio of `used` to `total` allocated bytes. + */ + utilization: number; + } + /** + * @since v15.6.0 + */ + function secureHeapUsed(): SecureHeapUsage; + interface RandomUUIDOptions { + /** + * By default, to improve performance, + * Node.js will pre-emptively generate and persistently cache enough + * random data to generate up to 128 random UUIDs. To generate a UUID + * without using the cache, set `disableEntropyCache` to `true`. + * + * @default `false` + */ + disableEntropyCache?: boolean | undefined; + } + type UUID = `${string}-${string}-${string}-${string}-${string}`; + /** + * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a + * cryptographic pseudorandom number generator. + * @since v15.6.0, v14.17.0 + */ + function randomUUID(options?: RandomUUIDOptions): UUID; + interface X509CheckOptions { + /** + * @default 'always' + */ + subject?: 'always' | 'default' | 'never'; + /** + * @default true + */ + wildcards?: boolean; + /** + * @default true + */ + partialWildcards?: boolean; + /** + * @default false + */ + multiLabelWildcards?: boolean; + /** + * @default false + */ + singleLabelSubdomains?: boolean; + } + /** + * Encapsulates an X509 certificate and provides read-only access to + * its information. + * + * ```js + * const { X509Certificate } = await import('node:crypto'); + * + * const x509 = new X509Certificate('{... pem encoded cert ...}'); + * + * console.log(x509.subject); + * ``` + * @since v15.6.0 + */ + class X509Certificate { + /** + * Will be \`true\` if this is a Certificate Authority (CA) certificate. + * @since v15.6.0 + */ + readonly ca: boolean; + /** + * The SHA-1 fingerprint of this certificate. + * + * Because SHA-1 is cryptographically broken and because the security of SHA-1 is + * significantly worse than that of algorithms that are commonly used to sign + * certificates, consider using `x509.fingerprint256` instead. + * @since v15.6.0 + */ + readonly fingerprint: string; + /** + * The SHA-256 fingerprint of this certificate. + * @since v15.6.0 + */ + readonly fingerprint256: string; + /** + * The SHA-512 fingerprint of this certificate. + * + * Because computing the SHA-256 fingerprint is usually faster and because it is + * only half the size of the SHA-512 fingerprint, `x509.fingerprint256` may be + * a better choice. While SHA-512 presumably provides a higher level of security in + * general, the security of SHA-256 matches that of most algorithms that are + * commonly used to sign certificates. + * @since v17.2.0, v16.14.0 + */ + readonly fingerprint512: string; + /** + * The complete subject of this certificate. + * @since v15.6.0 + */ + readonly subject: string; + /** + * The subject alternative name specified for this certificate. + * + * This is a comma-separated list of subject alternative names. Each entry begins + * with a string identifying the kind of the subject alternative name followed by + * a colon and the value associated with the entry. + * + * Earlier versions of Node.js incorrectly assumed that it is safe to split this + * property at the two-character sequence `', '` (see [CVE-2021-44532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532)). However, + * both malicious and legitimate certificates can contain subject alternative names + * that include this sequence when represented as a string. + * + * After the prefix denoting the type of the entry, the remainder of each entry + * might be enclosed in quotes to indicate that the value is a JSON string literal. + * For backward compatibility, Node.js only uses JSON string literals within this + * property when necessary to avoid ambiguity. Third-party code should be prepared + * to handle both possible entry formats. + * @since v15.6.0 + */ + readonly subjectAltName: string | undefined; + /** + * A textual representation of the certificate's authority information access + * extension. + * + * This is a line feed separated list of access descriptions. Each line begins with + * the access method and the kind of the access location, followed by a colon and + * the value associated with the access location. + * + * After the prefix denoting the access method and the kind of the access location, + * the remainder of each line might be enclosed in quotes to indicate that the + * value is a JSON string literal. For backward compatibility, Node.js only uses + * JSON string literals within this property when necessary to avoid ambiguity. + * Third-party code should be prepared to handle both possible entry formats. + * @since v15.6.0 + */ + readonly infoAccess: string | undefined; + /** + * An array detailing the key usages for this certificate. + * @since v15.6.0 + */ + readonly keyUsage: string[]; + /** + * The issuer identification included in this certificate. + * @since v15.6.0 + */ + readonly issuer: string; + /** + * The issuer certificate or `undefined` if the issuer certificate is not + * available. + * @since v15.9.0 + */ + readonly issuerCertificate?: X509Certificate | undefined; + /** + * The public key `KeyObject` for this certificate. + * @since v15.6.0 + */ + readonly publicKey: KeyObject; + /** + * A `Buffer` containing the DER encoding of this certificate. + * @since v15.6.0 + */ + readonly raw: Buffer; + /** + * The serial number of this certificate. + * + * Serial numbers are assigned by certificate authorities and do not uniquely + * identify certificates. Consider using `x509.fingerprint256` as a unique + * identifier instead. + * @since v15.6.0 + */ + readonly serialNumber: string; + /** + * The date/time from which this certificate is considered valid. + * @since v15.6.0 + */ + readonly validFrom: string; + /** + * The date/time until which this certificate is considered valid. + * @since v15.6.0 + */ + readonly validTo: string; + constructor(buffer: BinaryLike); + /** + * Checks whether the certificate matches the given email address. + * + * If the `'subject'` option is undefined or set to `'default'`, the certificate + * subject is only considered if the subject alternative name extension either does + * not exist or does not contain any email addresses. + * + * If the `'subject'` option is set to `'always'` and if the subject alternative + * name extension either does not exist or does not contain a matching email + * address, the certificate subject is considered. + * + * If the `'subject'` option is set to `'never'`, the certificate subject is never + * considered, even if the certificate contains no subject alternative names. + * @since v15.6.0 + * @return Returns `email` if the certificate matches, `undefined` if it does not. + */ + checkEmail(email: string, options?: Pick): string | undefined; + /** + * Checks whether the certificate matches the given host name. + * + * If the certificate matches the given host name, the matching subject name is + * returned. The returned name might be an exact match (e.g., `foo.example.com`) + * or it might contain wildcards (e.g., `*.example.com`). Because host name + * comparisons are case-insensitive, the returned subject name might also differ + * from the given `name` in capitalization. + * + * If the `'subject'` option is undefined or set to `'default'`, the certificate + * subject is only considered if the subject alternative name extension either does + * not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS"). + * + * If the `'subject'` option is set to `'always'` and if the subject alternative + * name extension either does not exist or does not contain a matching DNS name, + * the certificate subject is considered. + * + * If the `'subject'` option is set to `'never'`, the certificate subject is never + * considered, even if the certificate contains no subject alternative names. + * @since v15.6.0 + * @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`. + */ + checkHost(name: string, options?: X509CheckOptions): string | undefined; + /** + * Checks whether the certificate matches the given IP address (IPv4 or IPv6). + * + * Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they + * must match the given `ip` address exactly. Other subject alternative names as + * well as the subject field of the certificate are ignored. + * @since v15.6.0 + * @return Returns `ip` if the certificate matches, `undefined` if it does not. + */ + checkIP(ip: string): string | undefined; + /** + * Checks whether this certificate was issued by the given `otherCert`. + * @since v15.6.0 + */ + checkIssued(otherCert: X509Certificate): boolean; + /** + * Checks whether the public key for this certificate is consistent with + * the given private key. + * @since v15.6.0 + * @param privateKey A private key. + */ + checkPrivateKey(privateKey: KeyObject): boolean; + /** + * There is no standard JSON encoding for X509 certificates. The`toJSON()` method returns a string containing the PEM encoded + * certificate. + * @since v15.6.0 + */ + toJSON(): string; + /** + * Returns information about this certificate using the legacy `certificate object` encoding. + * @since v15.6.0 + */ + toLegacyObject(): PeerCertificate; + /** + * Returns the PEM-encoded certificate. + * @since v15.6.0 + */ + toString(): string; + /** + * Verifies that this certificate was signed by the given public key. + * Does not perform any other validation checks on the certificate. + * @since v15.6.0 + * @param publicKey A public key. + */ + verify(publicKey: KeyObject): boolean; + } + type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint; + interface GeneratePrimeOptions { + add?: LargeNumberLike | undefined; + rem?: LargeNumberLike | undefined; + /** + * @default false + */ + safe?: boolean | undefined; + bigint?: boolean | undefined; + } + interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions { + bigint: true; + } + interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions { + bigint?: false | undefined; + } + /** + * Generates a pseudorandom prime of `size` bits. + * + * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime. + * + * The `options.add` and `options.rem` parameters can be used to enforce additional + * requirements, e.g., for Diffie-Hellman: + * + * * If `options.add` and `options.rem` are both set, the prime will satisfy the + * condition that `prime % add = rem`. + * * If only `options.add` is set and `options.safe` is not `true`, the prime will + * satisfy the condition that `prime % add = 1`. + * * If only `options.add` is set and `options.safe` is set to `true`, the prime + * will instead satisfy the condition that `prime % add = 3`. This is necessary + * because `prime % add = 1` for `options.add > 2` would contradict the condition + * enforced by `options.safe`. + * * `options.rem` is ignored if `options.add` is not given. + * + * Both `options.add` and `options.rem` must be encoded as big-endian sequences + * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`. + * + * By default, the prime is encoded as a big-endian sequence of octets + * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. + * @since v15.8.0 + * @param size The size (in bits) of the prime to generate. + */ + function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void; + function generatePrime(size: number, options: GeneratePrimeOptionsBigInt, callback: (err: Error | null, prime: bigint) => void): void; + function generatePrime(size: number, options: GeneratePrimeOptionsArrayBuffer, callback: (err: Error | null, prime: ArrayBuffer) => void): void; + function generatePrime(size: number, options: GeneratePrimeOptions, callback: (err: Error | null, prime: ArrayBuffer | bigint) => void): void; + /** + * Generates a pseudorandom prime of `size` bits. + * + * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime. + * + * The `options.add` and `options.rem` parameters can be used to enforce additional + * requirements, e.g., for Diffie-Hellman: + * + * * If `options.add` and `options.rem` are both set, the prime will satisfy the + * condition that `prime % add = rem`. + * * If only `options.add` is set and `options.safe` is not `true`, the prime will + * satisfy the condition that `prime % add = 1`. + * * If only `options.add` is set and `options.safe` is set to `true`, the prime + * will instead satisfy the condition that `prime % add = 3`. This is necessary + * because `prime % add = 1` for `options.add > 2` would contradict the condition + * enforced by `options.safe`. + * * `options.rem` is ignored if `options.add` is not given. + * + * Both `options.add` and `options.rem` must be encoded as big-endian sequences + * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`. + * + * By default, the prime is encoded as a big-endian sequence of octets + * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. + * @since v15.8.0 + * @param size The size (in bits) of the prime to generate. + */ + function generatePrimeSync(size: number): ArrayBuffer; + function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint; + function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer; + function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint; + interface CheckPrimeOptions { + /** + * The number of Miller-Rabin probabilistic primality iterations to perform. + * When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most `2**-64` for random input. + * Care must be used when selecting a number of checks. + * Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details. + * + * @default 0 + */ + checks?: number | undefined; + } + /** + * Checks the primality of the `candidate`. + * @since v15.8.0 + * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. + */ + function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void; + function checkPrime(value: LargeNumberLike, options: CheckPrimeOptions, callback: (err: Error | null, result: boolean) => void): void; + /** + * Checks the primality of the `candidate`. + * @since v15.8.0 + * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. + * @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`. + */ + function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean; + /** + * Load and set the `engine` for some or all OpenSSL functions (selected by flags). + * + * `engine` could be either an id or a path to the engine's shared library. + * + * The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags`is a bit field taking one of or a mix of the following flags (defined in`crypto.constants`): + * + * * `crypto.constants.ENGINE_METHOD_RSA` + * * `crypto.constants.ENGINE_METHOD_DSA` + * * `crypto.constants.ENGINE_METHOD_DH` + * * `crypto.constants.ENGINE_METHOD_RAND` + * * `crypto.constants.ENGINE_METHOD_EC` + * * `crypto.constants.ENGINE_METHOD_CIPHERS` + * * `crypto.constants.ENGINE_METHOD_DIGESTS` + * * `crypto.constants.ENGINE_METHOD_PKEY_METHS` + * * `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` + * * `crypto.constants.ENGINE_METHOD_ALL` + * * `crypto.constants.ENGINE_METHOD_NONE` + * @since v0.11.11 + * @param flags + */ + function setEngine(engine: string, flags?: number): void; + /** + * A convenient alias for {@link webcrypto.getRandomValues}. This + * implementation is not compliant with the Web Crypto spec, to write + * web-compatible code use {@link webcrypto.getRandomValues} instead. + * @since v17.4.0 + * @return Returns `typedArray`. + */ + function getRandomValues(typedArray: T): T; + /** + * A convenient alias for `crypto.webcrypto.subtle`. + * @since v17.4.0 + */ + const subtle: webcrypto.SubtleCrypto; + /** + * An implementation of the Web Crypto API standard. + * + * See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details. + * @since v15.0.0 + */ + const webcrypto: webcrypto.Crypto; + namespace webcrypto { + type BufferSource = ArrayBufferView | ArrayBuffer; + type KeyFormat = 'jwk' | 'pkcs8' | 'raw' | 'spki'; + type KeyType = 'private' | 'public' | 'secret'; + type KeyUsage = 'decrypt' | 'deriveBits' | 'deriveKey' | 'encrypt' | 'sign' | 'unwrapKey' | 'verify' | 'wrapKey'; + type AlgorithmIdentifier = Algorithm | string; + type HashAlgorithmIdentifier = AlgorithmIdentifier; + type NamedCurve = string; + type BigInteger = Uint8Array; + interface AesCbcParams extends Algorithm { + iv: BufferSource; + } + interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; + } + interface AesDerivedKeyParams extends Algorithm { + length: number; + } + interface AesGcmParams extends Algorithm { + additionalData?: BufferSource; + iv: BufferSource; + tagLength?: number; + } + interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; + } + interface AesKeyGenParams extends Algorithm { + length: number; + } + interface Algorithm { + name: string; + } + interface EcKeyAlgorithm extends KeyAlgorithm { + namedCurve: NamedCurve; + } + interface EcKeyGenParams extends Algorithm { + namedCurve: NamedCurve; + } + interface EcKeyImportParams extends Algorithm { + namedCurve: NamedCurve; + } + interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; + } + interface EcdsaParams extends Algorithm { + hash: HashAlgorithmIdentifier; + } + interface Ed448Params extends Algorithm { + context?: BufferSource; + } + interface HkdfParams extends Algorithm { + hash: HashAlgorithmIdentifier; + info: BufferSource; + salt: BufferSource; + } + interface HmacImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; + } + interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: KeyAlgorithm; + length: number; + } + interface HmacKeyGenParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; + } + interface JsonWebKey { + alg?: string; + crv?: string; + d?: string; + dp?: string; + dq?: string; + e?: string; + ext?: boolean; + k?: string; + key_ops?: string[]; + kty?: string; + n?: string; + oth?: RsaOtherPrimesInfo[]; + p?: string; + q?: string; + qi?: string; + use?: string; + x?: string; + y?: string; + } + interface KeyAlgorithm { + name: string; + } + interface Pbkdf2Params extends Algorithm { + hash: HashAlgorithmIdentifier; + iterations: number; + salt: BufferSource; + } + interface RsaHashedImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + } + interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: KeyAlgorithm; + } + interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: HashAlgorithmIdentifier; + } + interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: BigInteger; + } + interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: BigInteger; + } + interface RsaOaepParams extends Algorithm { + label?: BufferSource; + } + interface RsaOtherPrimesInfo { + d?: string; + r?: string; + t?: string; + } + interface RsaPssParams extends Algorithm { + saltLength: number; + } + /** + * Calling `require('node:crypto').webcrypto` returns an instance of the `Crypto` class. + * `Crypto` is a singleton that provides access to the remainder of the crypto API. + * @since v15.0.0 + */ + interface Crypto { + /** + * Provides access to the `SubtleCrypto` API. + * @since v15.0.0 + */ + readonly subtle: SubtleCrypto; + /** + * Generates cryptographically strong random values. + * The given `typedArray` is filled with random values, and a reference to `typedArray` is returned. + * + * The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted. + * + * An error will be thrown if the given `typedArray` is larger than 65,536 bytes. + * @since v15.0.0 + */ + getRandomValues>(typedArray: T): T; + /** + * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID. + * The UUID is generated using a cryptographic pseudorandom number generator. + * @since v16.7.0 + */ + randomUUID(): UUID; + CryptoKey: CryptoKeyConstructor; + } + // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable. + interface CryptoKeyConstructor { + /** Illegal constructor */ + (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user. + readonly length: 0; + readonly name: 'CryptoKey'; + readonly prototype: CryptoKey; + } + /** + * @since v15.0.0 + */ + interface CryptoKey { + /** + * An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters. + * @since v15.0.0 + */ + readonly algorithm: KeyAlgorithm; + /** + * When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`. + * @since v15.0.0 + */ + readonly extractable: boolean; + /** + * A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key. + * @since v15.0.0 + */ + readonly type: KeyType; + /** + * An array of strings identifying the operations for which the key may be used. + * + * The possible usages are: + * - `'encrypt'` - The key may be used to encrypt data. + * - `'decrypt'` - The key may be used to decrypt data. + * - `'sign'` - The key may be used to generate digital signatures. + * - `'verify'` - The key may be used to verify digital signatures. + * - `'deriveKey'` - The key may be used to derive a new key. + * - `'deriveBits'` - The key may be used to derive bits. + * - `'wrapKey'` - The key may be used to wrap another key. + * - `'unwrapKey'` - The key may be used to unwrap another key. + * + * Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`). + * @since v15.0.0 + */ + readonly usages: KeyUsage[]; + } + /** + * The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair. + * @since v15.0.0 + */ + interface CryptoKeyPair { + /** + * A {@link CryptoKey} whose type will be `'private'`. + * @since v15.0.0 + */ + privateKey: CryptoKey; + /** + * A {@link CryptoKey} whose type will be `'public'`. + * @since v15.0.0 + */ + publicKey: CryptoKey; + } + /** + * @since v15.0.0 + */ + interface SubtleCrypto { + /** + * Using the method and parameters specified in `algorithm` and the keying material provided by `key`, + * `subtle.decrypt()` attempts to decipher the provided `data`. If successful, + * the returned promise will be resolved with an `` containing the plaintext result. + * + * The algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * @since v15.0.0 + */ + decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; + /** + * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, + * `subtle.deriveBits()` attempts to generate `length` bits. + * The Node.js implementation requires that when `length` is a number it must be multiple of `8`. + * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed + * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms. + * If successful, the returned promise will be resolved with an `` containing the generated data. + * + * The algorithms currently supported include: + * + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HKDF'` + * - `'PBKDF2'` + * @since v15.0.0 + */ + deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise; + deriveBits(algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise; + /** + * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, + * `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. + * + * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, + * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. + * + * The algorithms currently supported include: + * + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HKDF'` + * - `'PBKDF2'` + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + deriveKey( + algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, + baseKey: CryptoKey, + derivedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, + extractable: boolean, + keyUsages: ReadonlyArray + ): Promise; + /** + * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`. + * If successful, the returned promise is resolved with an `` containing the computed digest. + * + * If `algorithm` is provided as a ``, it must be one of: + * + * - `'SHA-1'` + * - `'SHA-256'` + * - `'SHA-384'` + * - `'SHA-512'` + * + * If `algorithm` is provided as an ``, it must have a `name` property whose value is one of the above. + * @since v15.0.0 + */ + digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise; + /** + * Using the method and parameters specified by `algorithm` and the keying material provided by `key`, + * `subtle.encrypt()` attempts to encipher `data`. If successful, + * the returned promise is resolved with an `` containing the encrypted result. + * + * The algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * @since v15.0.0 + */ + encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; + /** + * Exports the given key into the specified format, if supported. + * + * If the `` is not extractable, the returned promise will reject. + * + * When `format` is either `'pkcs8'` or `'spki'` and the export is successful, + * the returned promise will be resolved with an `` containing the exported key data. + * + * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a + * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification. + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @returns `` containing ``. + * @since v15.0.0 + */ + exportKey(format: 'jwk', key: CryptoKey): Promise; + exportKey(format: Exclude, key: CryptoKey): Promise; + /** + * Using the method and parameters provided in `algorithm`, + * `subtle.generateKey()` attempts to generate new keying material. + * Depending the method used, the method may generate either a single `` or a ``. + * + * The `` (public and private key) generating algorithms supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'RSA-OAEP'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * The `` (secret key) generating algorithms supported include: + * + * - `'HMAC'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray): Promise; + generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray): Promise; + generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise; + /** + * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format` + * to create a `` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments. + * If the import is successful, the returned promise will be resolved with the created ``. + * + * If importing a `'PBKDF2'` key, `extractable` must be `false`. + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + importKey( + format: 'jwk', + keyData: JsonWebKey, + algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, + extractable: boolean, + keyUsages: ReadonlyArray + ): Promise; + importKey( + format: Exclude, + keyData: BufferSource, + algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, + extractable: boolean, + keyUsages: KeyUsage[] + ): Promise; + /** + * Using the method and parameters given by `algorithm` and the keying material provided by `key`, + * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful, + * the returned promise is resolved with an `` containing the generated signature. + * + * The algorithms currently supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'HMAC'` + * @since v15.0.0 + */ + sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, data: BufferSource): Promise; + /** + * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. + * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `` instance. + * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input) + * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs. + * If successful, the returned promise is resolved with a `` object. + * + * The wrapping algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * + * The unwrapped key algorithms supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'RSA-OAEP'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HMAC'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + unwrapKey( + format: KeyFormat, + wrappedKey: BufferSource, + unwrappingKey: CryptoKey, + unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, + unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, + extractable: boolean, + keyUsages: KeyUsage[] + ): Promise; + /** + * Using the method and parameters given in `algorithm` and the keying material provided by `key`, + * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`. + * The returned promise is resolved with either `true` or `false`. + * + * The algorithms currently supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'HMAC'` + * @since v15.0.0 + */ + verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise; + /** + * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. + * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`, + * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`. + * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments, + * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs. + * If successful, the returned promise will be resolved with an `` containing the encrypted key data. + * + * The wrapping algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @since v15.0.0 + */ + wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise; + } + } +} +declare module 'node:crypto' { + export * from 'crypto'; +} diff --git a/node_modules/@types/node/dgram.d.ts b/node_modules/@types/node/dgram.d.ts new file mode 100755 index 0000000..5b183b8 --- /dev/null +++ b/node_modules/@types/node/dgram.d.ts @@ -0,0 +1,550 @@ +/** + * The `node:dgram` module provides an implementation of UDP datagram sockets. + * + * ```js + * import dgram from 'node:dgram'; + * + * const server = dgram.createSocket('udp4'); + * + * server.on('error', (err) => { + * console.error(`server error:\n${err.stack}`); + * server.close(); + * }); + * + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * + * server.on('listening', () => { + * const address = server.address(); + * console.log(`server listening ${address.address}:${address.port}`); + * }); + * + * server.bind(41234); + * // Prints: server listening 0.0.0.0:41234 + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dgram.js) + */ +declare module 'dgram' { + import { AddressInfo } from 'node:net'; + import * as dns from 'node:dns'; + import { EventEmitter, Abortable } from 'node:events'; + interface RemoteInfo { + address: string; + family: 'IPv4' | 'IPv6'; + port: number; + size: number; + } + interface BindOptions { + port?: number | undefined; + address?: string | undefined; + exclusive?: boolean | undefined; + fd?: number | undefined; + } + type SocketType = 'udp4' | 'udp6'; + interface SocketOptions extends Abortable { + type: SocketType; + reuseAddr?: boolean | undefined; + /** + * @default false + */ + ipv6Only?: boolean | undefined; + recvBufferSize?: number | undefined; + sendBufferSize?: number | undefined; + lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined; + } + /** + * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram + * messages. When `address` and `port` are not passed to `socket.bind()` the + * method will bind the socket to the "all interfaces" address on a random port + * (it does the right thing for both `udp4` and `udp6` sockets). The bound address + * and port can be retrieved using `socket.address().address` and `socket.address().port`. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket: + * + * ```js + * const controller = new AbortController(); + * const { signal } = controller; + * const server = dgram.createSocket({ type: 'udp4', signal }); + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * // Later, when you want to close the server. + * controller.abort(); + * ``` + * @since v0.11.13 + * @param options Available options are: + * @param callback Attached as a listener for `'message'` events. Optional. + */ + function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + /** + * Encapsulates the datagram functionality. + * + * New instances of `dgram.Socket` are created using {@link createSocket}. + * The `new` keyword is not to be used to create `dgram.Socket` instances. + * @since v0.1.99 + */ + class Socket extends EventEmitter { + /** + * Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not + * specified, the operating system will choose + * one interface and will add membership to it. To add membership to every + * available interface, call `addMembership` multiple times, once per interface. + * + * When called on an unbound socket, this method will implicitly bind to a random + * port, listening on all interfaces. + * + * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur: + * + * ```js + * import cluster from 'node:cluster'; + * import dgram from 'node:dgram'; + * + * if (cluster.isPrimary) { + * cluster.fork(); // Works ok. + * cluster.fork(); // Fails with EADDRINUSE. + * } else { + * const s = dgram.createSocket('udp4'); + * s.bind(1234, () => { + * s.addMembership('224.0.0.114'); + * }); + * } + * ``` + * @since v0.6.9 + */ + addMembership(multicastAddress: string, multicastInterface?: string): void; + /** + * Returns an object containing the address information for a socket. + * For UDP sockets, this object will contain `address`, `family`, and `port`properties. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.1.99 + */ + address(): AddressInfo; + /** + * For UDP sockets, causes the `dgram.Socket` to listen for datagram + * messages on a named `port` and optional `address`. If `port` is not + * specified or is `0`, the operating system will attempt to bind to a + * random port. If `address` is not specified, the operating system will + * attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is + * called. + * + * Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very + * useful. + * + * A bound datagram socket keeps the Node.js process running to receive + * datagram messages. + * + * If binding fails, an `'error'` event is generated. In rare case (e.g. + * attempting to bind with a closed socket), an `Error` may be thrown. + * + * Example of a UDP server listening on port 41234: + * + * ```js + * import dgram from 'node:dgram'; + * + * const server = dgram.createSocket('udp4'); + * + * server.on('error', (err) => { + * console.error(`server error:\n${err.stack}`); + * server.close(); + * }); + * + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * + * server.on('listening', () => { + * const address = server.address(); + * console.log(`server listening ${address.address}:${address.port}`); + * }); + * + * server.bind(41234); + * // Prints: server listening 0.0.0.0:41234 + * ``` + * @since v0.1.99 + * @param callback with no parameters. Called when binding is complete. + */ + bind(port?: number, address?: string, callback?: () => void): this; + bind(port?: number, callback?: () => void): this; + bind(callback?: () => void): this; + bind(options: BindOptions, callback?: () => void): this; + /** + * Close the underlying socket and stop listening for data on it. If a callback is + * provided, it is added as a listener for the `'close'` event. + * @since v0.1.99 + * @param callback Called when the socket has been closed. + */ + close(callback?: () => void): this; + /** + * Associates the `dgram.Socket` to a remote address and port. Every + * message sent by this handle is automatically sent to that destination. Also, + * the socket will only receive messages from that remote peer. + * Trying to call `connect()` on an already connected socket will result + * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not + * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) + * will be used by default. Once the connection is complete, a `'connect'` event + * is emitted and the optional `callback` function is called. In case of failure, + * the `callback` is called or, failing this, an `'error'` event is emitted. + * @since v12.0.0 + * @param callback Called when the connection is completed or on error. + */ + connect(port: number, address?: string, callback?: () => void): void; + connect(port: number, callback: () => void): void; + /** + * A synchronous function that disassociates a connected `dgram.Socket` from + * its remote address. Trying to call `disconnect()` on an unbound or already + * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception. + * @since v12.0.0 + */ + disconnect(): void; + /** + * Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the + * kernel when the socket is closed or the process terminates, so most apps will + * never have reason to call this. + * + * If `multicastInterface` is not specified, the operating system will attempt to + * drop membership on all valid interfaces. + * @since v0.6.9 + */ + dropMembership(multicastAddress: string, multicastInterface?: string): void; + /** + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + * @return the `SO_RCVBUF` socket receive buffer size in bytes. + */ + getRecvBufferSize(): number; + /** + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + * @return the `SO_SNDBUF` socket send buffer size in bytes. + */ + getSendBufferSize(): number; + /** + * By default, binding a socket will cause it to block the Node.js process from + * exiting as long as the socket is open. The `socket.unref()` method can be used + * to exclude the socket from the reference counting that keeps the Node.js + * process active. The `socket.ref()` method adds the socket back to the reference + * counting and restores the default behavior. + * + * Calling `socket.ref()` multiples times will have no additional effect. + * + * The `socket.ref()` method returns a reference to the socket so calls can be + * chained. + * @since v0.9.1 + */ + ref(): this; + /** + * Returns an object containing the `address`, `family`, and `port` of the remote + * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception + * if the socket is not connected. + * @since v12.0.0 + */ + remoteAddress(): AddressInfo; + /** + * Broadcasts a datagram on the socket. + * For connectionless sockets, the destination `port` and `address` must be + * specified. Connected sockets, on the other hand, will use their associated + * remote endpoint, so the `port` and `address` arguments must not be set. + * + * The `msg` argument contains the message to be sent. + * Depending on its type, different behavior can apply. If `msg` is a `Buffer`, + * any `TypedArray` or a `DataView`, + * the `offset` and `length` specify the offset within the `Buffer` where the + * message begins and the number of bytes in the message, respectively. + * If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that + * contain multi-byte characters, `offset` and `length` will be calculated with + * respect to `byte length` and not the character position. + * If `msg` is an array, `offset` and `length` must not be specified. + * + * The `address` argument is a string. If the value of `address` is a host name, + * DNS will be used to resolve the address of the host. If `address` is not + * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default. + * + * If the socket has not been previously bound with a call to `bind`, the socket + * is assigned a random port number and is bound to the "all interfaces" address + * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.) + * + * An optional `callback` function may be specified to as a way of reporting + * DNS errors or for determining when it is safe to reuse the `buf` object. + * DNS lookups delay the time to send for at least one tick of the + * Node.js event loop. + * + * The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be + * passed as the first argument to the `callback`. If a `callback` is not given, + * the error is emitted as an `'error'` event on the `socket` object. + * + * Offset and length are optional but both _must_ be set if either are used. + * They are supported only when the first argument is a `Buffer`, a `TypedArray`, + * or a `DataView`. + * + * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket. + * + * Example of sending a UDP packet to a port on `localhost`; + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const message = Buffer.from('Some bytes'); + * const client = dgram.createSocket('udp4'); + * client.send(message, 41234, 'localhost', (err) => { + * client.close(); + * }); + * ``` + * + * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`; + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('Some '); + * const buf2 = Buffer.from('bytes'); + * const client = dgram.createSocket('udp4'); + * client.send([buf1, buf2], 41234, (err) => { + * client.close(); + * }); + * ``` + * + * Sending multiple buffers might be faster or slower depending on the + * application and operating system. Run benchmarks to + * determine the optimal strategy on a case-by-case basis. Generally speaking, + * however, sending multiple buffers is faster. + * + * Example of sending a UDP packet using a socket connected to a port on`localhost`: + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const message = Buffer.from('Some bytes'); + * const client = dgram.createSocket('udp4'); + * client.connect(41234, 'localhost', (err) => { + * client.send(message, (err) => { + * client.close(); + * }); + * }); + * ``` + * @since v0.1.99 + * @param msg Message to be sent. + * @param offset Offset in the buffer where the message starts. + * @param length Number of bytes in the message. + * @param port Destination port. + * @param address Destination host name or IP address. + * @param callback Called when the message has been sent. + */ + send(msg: string | Uint8Array | ReadonlyArray, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array | ReadonlyArray, port?: number, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array | ReadonlyArray, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void; + /** + * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP + * packets may be sent to a local interface's broadcast address. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.6.9 + */ + setBroadcast(flag: boolean): void; + /** + * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC + * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_ + * _with a scope index is written as `'IP%scope'` where scope is an interface name_ + * _or interface number._ + * + * Sets the default outgoing multicast interface of the socket to a chosen + * interface or back to system interface selection. The `multicastInterface` must + * be a valid string representation of an IP from the socket's family. + * + * For IPv4 sockets, this should be the IP configured for the desired physical + * interface. All packets sent to multicast on the socket will be sent on the + * interface determined by the most recent successful use of this call. + * + * For IPv6 sockets, `multicastInterface` should include a scope to indicate the + * interface as in the examples that follow. In IPv6, individual `send` calls can + * also use explicit scope in addresses, so only packets sent to a multicast + * address without specifying an explicit scope are affected by the most recent + * successful use of this call. + * + * This method throws `EBADF` if called on an unbound socket. + * + * #### Example: IPv6 outgoing multicast interface + * + * On most systems, where scope format uses the interface name: + * + * ```js + * const socket = dgram.createSocket('udp6'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('::%eth1'); + * }); + * ``` + * + * On Windows, where scope format uses an interface number: + * + * ```js + * const socket = dgram.createSocket('udp6'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('::%2'); + * }); + * ``` + * + * #### Example: IPv4 outgoing multicast interface + * + * All systems use an IP of the host on the desired physical interface: + * + * ```js + * const socket = dgram.createSocket('udp4'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('10.0.0.2'); + * }); + * ``` + * @since v8.6.0 + */ + setMulticastInterface(multicastInterface: string): void; + /** + * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, + * multicast packets will also be received on the local interface. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.3.8 + */ + setMulticastLoopback(flag: boolean): boolean; + /** + * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for + * "Time to Live", in this context it specifies the number of IP hops that a + * packet is allowed to travel through, specifically for multicast traffic. Each + * router or gateway that forwards a packet decrements the TTL. If the TTL is + * decremented to 0 by a router, it will not be forwarded. + * + * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.3.8 + */ + setMulticastTTL(ttl: number): number; + /** + * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer + * in bytes. + * + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + */ + setRecvBufferSize(size: number): void; + /** + * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer + * in bytes. + * + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + */ + setSendBufferSize(size: number): void; + /** + * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", + * in this context it specifies the number of IP hops that a packet is allowed to + * travel through. Each router or gateway that forwards a packet decrements the + * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. + * Changing TTL values is typically done for network probes or when multicasting. + * + * The `ttl` argument may be between 1 and 255\. The default on most systems + * is 64. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.1.101 + */ + setTTL(ttl: number): number; + /** + * By default, binding a socket will cause it to block the Node.js process from + * exiting as long as the socket is open. The `socket.unref()` method can be used + * to exclude the socket from the reference counting that keeps the Node.js + * process active, allowing the process to exit even if the socket is still + * listening. + * + * Calling `socket.unref()` multiple times will have no addition effect. + * + * The `socket.unref()` method returns a reference to the socket so calls can be + * chained. + * @since v0.9.1 + */ + unref(): this; + /** + * Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket + * option. If the `multicastInterface` argument + * is not specified, the operating system will choose one interface and will add + * membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface. + * + * When called on an unbound socket, this method will implicitly bind to a random + * port, listening on all interfaces. + * @since v13.1.0, v12.16.0 + */ + addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; + /** + * Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is + * automatically called by the kernel when the + * socket is closed or the process terminates, so most apps will never have + * reason to call this. + * + * If `multicastInterface` is not specified, the operating system will attempt to + * drop membership on all valid interfaces. + * @since v13.1.0, v12.16.0 + */ + dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; + /** + * events.EventEmitter + * 1. close + * 2. connect + * 3. error + * 4. listening + * 5. message + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'connect', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'listening', listener: () => void): this; + addListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'connect'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'listening'): boolean; + emit(event: 'message', msg: Buffer, rinfo: RemoteInfo): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'connect', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'listening', listener: () => void): this; + on(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'connect', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'listening', listener: () => void): this; + once(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'connect', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'listening', listener: () => void): this; + prependListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'connect', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'listening', listener: () => void): this; + prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + /** + * Calls `socket.close()` and returns a promise that fulfills when the socket has closed. + * @since v20.5.0 + */ + [Symbol.asyncDispose](): Promise; + } +} +declare module 'node:dgram' { + export * from 'dgram'; +} diff --git a/node_modules/@types/node/diagnostics_channel.d.ts b/node_modules/@types/node/diagnostics_channel.d.ts new file mode 100755 index 0000000..5f19b20 --- /dev/null +++ b/node_modules/@types/node/diagnostics_channel.d.ts @@ -0,0 +1,191 @@ +/** + * The `node:diagnostics_channel` module provides an API to create named channels + * to report arbitrary message data for diagnostics purposes. + * + * It can be accessed using: + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * ``` + * + * It is intended that a module writer wanting to report diagnostics messages + * will create one or many top-level channels to report messages through. + * Channels may also be acquired at runtime but it is not encouraged + * due to the additional overhead of doing so. Channels may be exported for + * convenience, but as long as the name is known it can be acquired anywhere. + * + * If you intend for your module to produce diagnostics data for others to + * consume it is recommended that you include documentation of what named + * channels are used along with the shape of the message data. Channel names + * should generally include the module name to avoid collisions with data from + * other modules. + * @since v15.1.0, v14.17.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js) + */ +declare module 'diagnostics_channel' { + /** + * Check if there are active subscribers to the named channel. This is helpful if + * the message you want to send might be expensive to prepare. + * + * This API is optional but helpful when trying to publish messages from very + * performance-sensitive code. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * if (diagnostics_channel.hasSubscribers('my-channel')) { + * // There are subscribers, prepare and publish message + * } + * ``` + * @since v15.1.0, v14.17.0 + * @param name The channel name + * @return If there are active subscribers + */ + function hasSubscribers(name: string | symbol): boolean; + /** + * This is the primary entry-point for anyone wanting to publish to a named + * channel. It produces a channel object which is optimized to reduce overhead at + * publish time as much as possible. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * ``` + * @since v15.1.0, v14.17.0 + * @param name The channel name + * @return The named channel object + */ + function channel(name: string | symbol): Channel; + type ChannelListener = (message: unknown, name: string | symbol) => void; + /** + * Register a message handler to subscribe to this channel. This message handler + * will be run synchronously whenever a message is published to the channel. Any + * errors thrown in the message handler will trigger an `'uncaughtException'`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * diagnostics_channel.subscribe('my-channel', (message, name) => { + * // Received data + * }); + * ``` + * @since v18.7.0, v16.17.0 + * @param name The channel name + * @param onMessage The handler to receive channel messages + */ + function subscribe(name: string | symbol, onMessage: ChannelListener): void; + /** + * Remove a message handler previously registered to this channel with {@link subscribe}. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * function onMessage(message, name) { + * // Received data + * } + * + * diagnostics_channel.subscribe('my-channel', onMessage); + * + * diagnostics_channel.unsubscribe('my-channel', onMessage); + * ``` + * @since v18.7.0, v16.17.0 + * @param name The channel name + * @param onMessage The previous subscribed handler to remove + * @return `true` if the handler was found, `false` otherwise. + */ + function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean; + /** + * The class `Channel` represents an individual named channel within the data + * pipeline. It is used to track subscribers and to publish messages when there + * are subscribers present. It exists as a separate object to avoid channel + * lookups at publish time, enabling very fast publish speeds and allowing + * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly + * with `new Channel(name)` is not supported. + * @since v15.1.0, v14.17.0 + */ + class Channel { + readonly name: string | symbol; + /** + * Check if there are active subscribers to this channel. This is helpful if + * the message you want to send might be expensive to prepare. + * + * This API is optional but helpful when trying to publish messages from very + * performance-sensitive code. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * if (channel.hasSubscribers) { + * // There are subscribers, prepare and publish message + * } + * ``` + * @since v15.1.0, v14.17.0 + */ + readonly hasSubscribers: boolean; + private constructor(name: string | symbol); + /** + * Publish a message to any subscribers to the channel. This will trigger + * message handlers synchronously so they will execute within the same context. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.publish({ + * some: 'message', + * }); + * ``` + * @since v15.1.0, v14.17.0 + * @param message The message to send to the channel subscribers + */ + publish(message: unknown): void; + /** + * Register a message handler to subscribe to this channel. This message handler + * will be run synchronously whenever a message is published to the channel. Any + * errors thrown in the message handler will trigger an `'uncaughtException'`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.subscribe((message, name) => { + * // Received data + * }); + * ``` + * @since v15.1.0, v14.17.0 + * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)} + * @param onMessage The handler to receive channel messages + */ + subscribe(onMessage: ChannelListener): void; + /** + * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * function onMessage(message, name) { + * // Received data + * } + * + * channel.subscribe(onMessage); + * + * channel.unsubscribe(onMessage); + * ``` + * @since v15.1.0, v14.17.0 + * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)} + * @param onMessage The previous subscribed handler to remove + * @return `true` if the handler was found, `false` otherwise. + */ + unsubscribe(onMessage: ChannelListener): void; + } +} +declare module 'node:diagnostics_channel' { + export * from 'diagnostics_channel'; +} diff --git a/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts new file mode 100755 index 0000000..db3febc --- /dev/null +++ b/node_modules/@types/node/dns.d.ts @@ -0,0 +1,668 @@ +/** + * The `node:dns` module enables name resolution. For example, use it to look up IP + * addresses of host names. + * + * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the + * DNS protocol for lookups. {@link lookup} uses the operating system + * facilities to perform name resolution. It may not need to perform any network + * communication. To perform name resolution the way other applications on the same + * system do, use {@link lookup}. + * + * ```js + * const dns = require('node:dns'); + * + * dns.lookup('example.org', (err, address, family) => { + * console.log('address: %j family: IPv%s', address, family); + * }); + * // address: "93.184.216.34" family: IPv4 + * ``` + * + * All other functions in the `node:dns` module connect to an actual DNS server to + * perform name resolution. They will always use the network to perform DNS + * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform + * DNS queries, bypassing other name-resolution facilities. + * + * ```js + * const dns = require('node:dns'); + * + * dns.resolve4('archive.org', (err, addresses) => { + * if (err) throw err; + * + * console.log(`addresses: ${JSON.stringify(addresses)}`); + * + * addresses.forEach((a) => { + * dns.reverse(a, (err, hostnames) => { + * if (err) { + * throw err; + * } + * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); + * }); + * }); + * }); + * ``` + * + * See the `Implementation considerations section` for more information. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dns.js) + */ +declare module 'dns' { + import * as dnsPromises from 'node:dns/promises'; + // Supported getaddrinfo flags. + export const ADDRCONFIG: number; + export const V4MAPPED: number; + /** + * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as + * well as IPv4 mapped IPv6 addresses. + */ + export const ALL: number; + export interface LookupOptions { + family?: number | undefined; + hints?: number | undefined; + all?: boolean | undefined; + /** + * @default true + */ + verbatim?: boolean | undefined; + } + export interface LookupOneOptions extends LookupOptions { + all?: false | undefined; + } + export interface LookupAllOptions extends LookupOptions { + all: true; + } + export interface LookupAddress { + address: string; + family: number; + } + /** + * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or + * AAAA (IPv6) record. All `option` properties are optional. If `options` is an + * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then + * IPv4 and IPv6 addresses are both returned if found. + * + * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the + * properties `address` and `family`. + * + * On error, `err` is an `Error` object, where `err.code` is the error code. + * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when + * the host name does not exist but also when the lookup fails in other ways + * such as no available file descriptors. + * + * `dns.lookup()` does not necessarily have anything to do with the DNS protocol. + * The implementation uses an operating system facility that can associate names + * with addresses and vice versa. This implementation can have subtle but + * important consequences on the behavior of any Node.js program. Please take some + * time to consult the `Implementation considerations section` before using`dns.lookup()`. + * + * Example usage: + * + * ```js + * const dns = require('node:dns'); + * const options = { + * family: 6, + * hints: dns.ADDRCONFIG | dns.V4MAPPED, + * }; + * dns.lookup('example.com', options, (err, address, family) => + * console.log('address: %j family: IPv%s', address, family)); + * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 + * + * // When options.all is true, the result will be an Array. + * options.all = true; + * dns.lookup('example.com', options, (err, addresses) => + * console.log('addresses: %j', addresses)); + * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] + * ``` + * + * If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties. + * @since v0.1.90 + */ + export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; + export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; + export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export namespace lookup { + function __promisify__(hostname: string, options: LookupAllOptions): Promise; + function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; + function __promisify__(hostname: string, options: LookupOptions): Promise; + } + /** + * Resolves the given `address` and `port` into a host name and service using + * the operating system's underlying `getnameinfo` implementation. + * + * If `address` is not a valid IP address, a `TypeError` will be thrown. + * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. + * + * On an error, `err` is an `Error` object, where `err.code` is the error code. + * + * ```js + * const dns = require('node:dns'); + * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { + * console.log(hostname, service); + * // Prints: localhost ssh + * }); + * ``` + * + * If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties. + * @since v0.11.14 + */ + export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; + export namespace lookupService { + function __promisify__( + address: string, + port: number + ): Promise<{ + hostname: string; + service: string; + }>; + } + export interface ResolveOptions { + ttl: boolean; + } + export interface ResolveWithTtlOptions extends ResolveOptions { + ttl: true; + } + export interface RecordWithTtl { + address: string; + ttl: number; + } + /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */ + export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; + export interface AnyARecord extends RecordWithTtl { + type: 'A'; + } + export interface AnyAaaaRecord extends RecordWithTtl { + type: 'AAAA'; + } + export interface CaaRecord { + critical: number; + issue?: string | undefined; + issuewild?: string | undefined; + iodef?: string | undefined; + contactemail?: string | undefined; + contactphone?: string | undefined; + } + export interface MxRecord { + priority: number; + exchange: string; + } + export interface AnyMxRecord extends MxRecord { + type: 'MX'; + } + export interface NaptrRecord { + flags: string; + service: string; + regexp: string; + replacement: string; + order: number; + preference: number; + } + export interface AnyNaptrRecord extends NaptrRecord { + type: 'NAPTR'; + } + export interface SoaRecord { + nsname: string; + hostmaster: string; + serial: number; + refresh: number; + retry: number; + expire: number; + minttl: number; + } + export interface AnySoaRecord extends SoaRecord { + type: 'SOA'; + } + export interface SrvRecord { + priority: number; + weight: number; + port: number; + name: string; + } + export interface AnySrvRecord extends SrvRecord { + type: 'SRV'; + } + export interface AnyTxtRecord { + type: 'TXT'; + entries: string[]; + } + export interface AnyNsRecord { + type: 'NS'; + value: string; + } + export interface AnyPtrRecord { + type: 'PTR'; + value: string; + } + export interface AnyCnameRecord { + type: 'CNAME'; + value: string; + } + export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord; + /** + * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array + * of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource + * records. The type and structure of individual results varies based on `rrtype`: + * + * + * + * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`. + * @since v0.1.27 + * @param hostname Host name to resolve. + * @param [rrtype='A'] Resource record type. + */ + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; + export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; + export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; + export function resolve( + hostname: string, + rrtype: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void + ): void; + export namespace resolve { + function __promisify__(hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise; + function __promisify__(hostname: string, rrtype: 'ANY'): Promise; + function __promisify__(hostname: string, rrtype: 'MX'): Promise; + function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise; + function __promisify__(hostname: string, rrtype: 'SOA'): Promise; + function __promisify__(hostname: string, rrtype: 'SRV'): Promise; + function __promisify__(hostname: string, rrtype: 'TXT'): Promise; + function __promisify__(hostname: string, rrtype: string): Promise; + } + /** + * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function + * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`). + * @since v0.1.16 + * @param hostname Host name to resolve. + */ + export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; + export namespace resolve4 { + function __promisify__(hostname: string): Promise; + function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; + function __promisify__(hostname: string, options?: ResolveOptions): Promise; + } + /** + * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function + * will contain an array of IPv6 addresses. + * @since v0.1.16 + * @param hostname Host name to resolve. + */ + export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; + export namespace resolve6 { + function __promisify__(hostname: string): Promise; + function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; + function __promisify__(hostname: string, options?: ResolveOptions): Promise; + } + /** + * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function + * will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`). + * @since v0.3.2 + */ + export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export namespace resolveCname { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function + * will contain an array of certification authority authorization records + * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`). + * @since v15.0.0, v14.17.0 + */ + export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void; + export namespace resolveCaa { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will + * contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). + * @since v0.1.27 + */ + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + export namespace resolveMx { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of + * objects with the following properties: + * + * * `flags` + * * `service` + * * `regexp` + * * `replacement` + * * `order` + * * `preference` + * + * ```js + * { + * flags: 's', + * service: 'SIP+D2U', + * regexp: '', + * replacement: '_sip._udp.example.com', + * order: 30, + * preference: 100 + * } + * ``` + * @since v0.9.12 + */ + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + export namespace resolveNaptr { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will + * contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`). + * @since v0.1.90 + */ + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export namespace resolveNs { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will + * be an array of strings containing the reply records. + * @since v6.0.0 + */ + export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export namespace resolvePtr { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for + * the `hostname`. The `address` argument passed to the `callback` function will + * be an object with the following properties: + * + * * `nsname` + * * `hostmaster` + * * `serial` + * * `refresh` + * * `retry` + * * `expire` + * * `minttl` + * + * ```js + * { + * nsname: 'ns.example.com', + * hostmaster: 'root.example.com', + * serial: 2013101809, + * refresh: 10000, + * retry: 2400, + * expire: 604800, + * minttl: 3600 + * } + * ``` + * @since v0.11.10 + */ + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; + export namespace resolveSoa { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will + * be an array of objects with the following properties: + * + * * `priority` + * * `weight` + * * `port` + * * `name` + * + * ```js + * { + * priority: 10, + * weight: 5, + * port: 21223, + * name: 'service.example.com' + * } + * ``` + * @since v0.1.27 + */ + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + export namespace resolveSrv { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a + * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of + * one record. Depending on the use case, these could be either joined together or + * treated separately. + * @since v0.1.27 + */ + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; + export namespace resolveTxt { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). + * The `ret` argument passed to the `callback` function will be an array containing + * various types of records. Each object has a property `type` that indicates the + * type of the current record. And depending on the `type`, additional properties + * will be present on the object: + * + * + * + * Here is an example of the `ret` object passed to the callback: + * + * ```js + * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, + * { type: 'CNAME', value: 'example.com' }, + * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, + * { type: 'NS', value: 'ns1.example.com' }, + * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, + * { type: 'SOA', + * nsname: 'ns1.example.com', + * hostmaster: 'admin.example.com', + * serial: 156696742, + * refresh: 900, + * retry: 900, + * expire: 1800, + * minttl: 60 } ] + * ``` + * + * DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC + * 8482](https://tools.ietf.org/html/rfc8482). + */ + export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; + export namespace resolveAny { + function __promisify__(hostname: string): Promise; + } + /** + * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an + * array of host names. + * + * On error, `err` is an `Error` object, where `err.code` is + * one of the `DNS error codes`. + * @since v0.1.16 + */ + export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; + /** + * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: + * + * * `ipv4first`: for `verbatim` defaulting to `false`. + * * `verbatim`: for `verbatim` defaulting to `true`. + * @since v20.1.0 + */ + export function getDefaultResultOrder(): 'ipv4first' | 'verbatim'; + /** + * Sets the IP address and port of servers to be used when performing DNS + * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted + * addresses. If the port is the IANA default DNS port (53) it can be omitted. + * + * ```js + * dns.setServers([ + * '4.4.4.4', + * '[2001:4860:4860::8888]', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ]); + * ``` + * + * An error will be thrown if an invalid address is provided. + * + * The `dns.setServers()` method must not be called while a DNS query is in + * progress. + * + * The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). + * + * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). + * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with + * subsequent servers provided. Fallback DNS servers will only be used if the + * earlier ones time out or result in some other error. + * @since v0.11.3 + * @param servers array of `RFC 5952` formatted addresses + */ + export function setServers(servers: ReadonlyArray): void; + /** + * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), + * that are currently configured for DNS resolution. A string will include a port + * section if a custom port is used. + * + * ```js + * [ + * '4.4.4.4', + * '2001:4860:4860::8888', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ] + * ``` + * @since v0.11.3 + */ + export function getServers(): string[]; + /** + * Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: + * + * * `ipv4first`: sets default `verbatim` `false`. + * * `verbatim`: sets default `verbatim` `true`. + * + * The default is `verbatim` and {@link setDefaultResultOrder} have higher + * priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default + * dns orders in workers. + * @since v16.4.0, v14.18.0 + * @param order must be `'ipv4first'` or `'verbatim'`. + */ + export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void; + // Error codes + export const NODATA: string; + export const FORMERR: string; + export const SERVFAIL: string; + export const NOTFOUND: string; + export const NOTIMP: string; + export const REFUSED: string; + export const BADQUERY: string; + export const BADNAME: string; + export const BADFAMILY: string; + export const BADRESP: string; + export const CONNREFUSED: string; + export const TIMEOUT: string; + export const EOF: string; + export const FILE: string; + export const NOMEM: string; + export const DESTRUCTION: string; + export const BADSTR: string; + export const BADFLAGS: string; + export const NONAME: string; + export const BADHINTS: string; + export const NOTINITIALIZED: string; + export const LOADIPHLPAPI: string; + export const ADDRGETNETWORKPARAMS: string; + export const CANCELLED: string; + export interface ResolverOptions { + timeout?: number | undefined; + /** + * @default 4 + */ + tries?: number; + } + /** + * An independent resolver for DNS requests. + * + * Creating a new resolver uses the default server settings. Setting + * the servers used for a resolver using `resolver.setServers()` does not affect + * other resolvers: + * + * ```js + * const { Resolver } = require('node:dns'); + * const resolver = new Resolver(); + * resolver.setServers(['4.4.4.4']); + * + * // This request will use the server at 4.4.4.4, independent of global settings. + * resolver.resolve4('example.org', (err, addresses) => { + * // ... + * }); + * ``` + * + * The following methods from the `node:dns` module are available: + * + * * `resolver.getServers()` + * * `resolver.resolve()` + * * `resolver.resolve4()` + * * `resolver.resolve6()` + * * `resolver.resolveAny()` + * * `resolver.resolveCaa()` + * * `resolver.resolveCname()` + * * `resolver.resolveMx()` + * * `resolver.resolveNaptr()` + * * `resolver.resolveNs()` + * * `resolver.resolvePtr()` + * * `resolver.resolveSoa()` + * * `resolver.resolveSrv()` + * * `resolver.resolveTxt()` + * * `resolver.reverse()` + * * `resolver.setServers()` + * @since v8.3.0 + */ + export class Resolver { + constructor(options?: ResolverOptions); + /** + * Cancel all outstanding DNS queries made by this resolver. The corresponding + * callbacks will be called with an error with code `ECANCELLED`. + * @since v8.3.0 + */ + cancel(): void; + getServers: typeof getServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCaa: typeof resolveCaa; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + /** + * The resolver instance will send its requests from the specified IP address. + * This allows programs to specify outbound interfaces when used on multi-homed + * systems. + * + * If a v4 or v6 address is not specified, it is set to the default and the + * operating system will choose a local address automatically. + * + * The resolver will use the v4 local address when making requests to IPv4 DNS + * servers, and the v6 local address when making requests to IPv6 DNS servers. + * The `rrtype` of resolution requests has no impact on the local address used. + * @since v15.1.0, v14.17.0 + * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. + * @param [ipv6='::0'] A string representation of an IPv6 address. + */ + setLocalAddress(ipv4?: string, ipv6?: string): void; + setServers: typeof setServers; + } + export { dnsPromises as promises }; +} +declare module 'node:dns' { + export * from 'dns'; +} diff --git a/node_modules/@types/node/dns/promises.d.ts b/node_modules/@types/node/dns/promises.d.ts new file mode 100755 index 0000000..4c151e4 --- /dev/null +++ b/node_modules/@types/node/dns/promises.d.ts @@ -0,0 +1,414 @@ +/** + * The `dns.promises` API provides an alternative set of asynchronous DNS methods + * that return `Promise` objects rather than using callbacks. The API is accessible + * via `require('node:dns').promises` or `require('node:dns/promises')`. + * @since v10.6.0 + */ +declare module 'dns/promises' { + import { + LookupAddress, + LookupOneOptions, + LookupAllOptions, + LookupOptions, + AnyRecord, + CaaRecord, + MxRecord, + NaptrRecord, + SoaRecord, + SrvRecord, + ResolveWithTtlOptions, + RecordWithTtl, + ResolveOptions, + ResolverOptions, + } from 'node:dns'; + /** + * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), + * that are currently configured for DNS resolution. A string will include a port + * section if a custom port is used. + * + * ```js + * [ + * '4.4.4.4', + * '2001:4860:4860::8888', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ] + * ``` + * @since v10.6.0 + */ + function getServers(): string[]; + /** + * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or + * AAAA (IPv6) record. All `option` properties are optional. If `options` is an + * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 + * and IPv6 addresses are both returned if found. + * + * With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`. + * + * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. + * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when + * the host name does not exist but also when the lookup fails in other ways + * such as no available file descriptors. + * + * `dnsPromises.lookup()` does not necessarily have anything to do with the DNS + * protocol. The implementation uses an operating system facility that can + * associate names with addresses and vice versa. This implementation can have + * subtle but important consequences on the behavior of any Node.js program. Please + * take some time to consult the `Implementation considerations section` before + * using `dnsPromises.lookup()`. + * + * Example usage: + * + * ```js + * const dns = require('node:dns'); + * const dnsPromises = dns.promises; + * const options = { + * family: 6, + * hints: dns.ADDRCONFIG | dns.V4MAPPED, + * }; + * + * dnsPromises.lookup('example.com', options).then((result) => { + * console.log('address: %j family: IPv%s', result.address, result.family); + * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 + * }); + * + * // When options.all is true, the result will be an Array. + * options.all = true; + * dnsPromises.lookup('example.com', options).then((result) => { + * console.log('addresses: %j', result); + * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] + * }); + * ``` + * @since v10.6.0 + */ + function lookup(hostname: string, family: number): Promise; + function lookup(hostname: string, options: LookupOneOptions): Promise; + function lookup(hostname: string, options: LookupAllOptions): Promise; + function lookup(hostname: string, options: LookupOptions): Promise; + function lookup(hostname: string): Promise; + /** + * Resolves the given `address` and `port` into a host name and service using + * the operating system's underlying `getnameinfo` implementation. + * + * If `address` is not a valid IP address, a `TypeError` will be thrown. + * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. + * + * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. + * + * ```js + * const dnsPromises = require('node:dns').promises; + * dnsPromises.lookupService('127.0.0.1', 22).then((result) => { + * console.log(result.hostname, result.service); + * // Prints: localhost ssh + * }); + * ``` + * @since v10.6.0 + */ + function lookupService( + address: string, + port: number + ): Promise<{ + hostname: string; + service: string; + }>; + /** + * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array + * of the resource records. When successful, the `Promise` is resolved with an + * array of resource records. The type and structure of individual results vary + * based on `rrtype`: + * + * + * + * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. + * @since v10.6.0 + * @param hostname Host name to resolve. + * @param [rrtype='A'] Resource record type. + */ + function resolve(hostname: string): Promise; + function resolve(hostname: string, rrtype: 'A'): Promise; + function resolve(hostname: string, rrtype: 'AAAA'): Promise; + function resolve(hostname: string, rrtype: 'ANY'): Promise; + function resolve(hostname: string, rrtype: 'CAA'): Promise; + function resolve(hostname: string, rrtype: 'CNAME'): Promise; + function resolve(hostname: string, rrtype: 'MX'): Promise; + function resolve(hostname: string, rrtype: 'NAPTR'): Promise; + function resolve(hostname: string, rrtype: 'NS'): Promise; + function resolve(hostname: string, rrtype: 'PTR'): Promise; + function resolve(hostname: string, rrtype: 'SOA'): Promise; + function resolve(hostname: string, rrtype: 'SRV'): Promise; + function resolve(hostname: string, rrtype: 'TXT'): Promise; + function resolve(hostname: string, rrtype: string): Promise; + /** + * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4 + * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). + * @since v10.6.0 + * @param hostname Host name to resolve. + */ + function resolve4(hostname: string): Promise; + function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; + function resolve4(hostname: string, options: ResolveOptions): Promise; + /** + * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6 + * addresses. + * @since v10.6.0 + * @param hostname Host name to resolve. + */ + function resolve6(hostname: string): Promise; + function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; + function resolve6(hostname: string, options: ResolveOptions): Promise; + /** + * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). + * On success, the `Promise` is resolved with an array containing various types of + * records. Each object has a property `type` that indicates the type of the + * current record. And depending on the `type`, additional properties will be + * present on the object: + * + * + * + * Here is an example of the result object: + * + * ```js + * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, + * { type: 'CNAME', value: 'example.com' }, + * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, + * { type: 'NS', value: 'ns1.example.com' }, + * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, + * { type: 'SOA', + * nsname: 'ns1.example.com', + * hostmaster: 'admin.example.com', + * serial: 156696742, + * refresh: 900, + * retry: 900, + * expire: 1800, + * minttl: 60 } ] + * ``` + * @since v10.6.0 + */ + function resolveAny(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success, + * the `Promise` is resolved with an array of objects containing available + * certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`). + * @since v15.0.0, v14.17.0 + */ + function resolveCaa(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success, + * the `Promise` is resolved with an array of canonical name records available for + * the `hostname` (e.g. `['bar.example.com']`). + * @since v10.6.0 + */ + function resolveCname(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects + * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`). + * @since v10.6.0 + */ + function resolveMx(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array + * of objects with the following properties: + * + * * `flags` + * * `service` + * * `regexp` + * * `replacement` + * * `order` + * * `preference` + * + * ```js + * { + * flags: 's', + * service: 'SIP+D2U', + * regexp: '', + * replacement: '_sip._udp.example.com', + * order: 30, + * preference: 100 + * } + * ``` + * @since v10.6.0 + */ + function resolveNaptr(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server + * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`). + * @since v10.6.0 + */ + function resolveNs(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings + * containing the reply records. + * @since v10.6.0 + */ + function resolvePtr(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for + * the `hostname`. On success, the `Promise` is resolved with an object with the + * following properties: + * + * * `nsname` + * * `hostmaster` + * * `serial` + * * `refresh` + * * `retry` + * * `expire` + * * `minttl` + * + * ```js + * { + * nsname: 'ns.example.com', + * hostmaster: 'root.example.com', + * serial: 2013101809, + * refresh: 10000, + * retry: 2400, + * expire: 604800, + * minttl: 3600 + * } + * ``` + * @since v10.6.0 + */ + function resolveSoa(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with + * the following properties: + * + * * `priority` + * * `weight` + * * `port` + * * `name` + * + * ```js + * { + * priority: 10, + * weight: 5, + * port: 21223, + * name: 'service.example.com' + * } + * ``` + * @since v10.6.0 + */ + function resolveSrv(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array + * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of + * one record. Depending on the use case, these could be either joined together or + * treated separately. + * @since v10.6.0 + */ + function resolveTxt(hostname: string): Promise; + /** + * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an + * array of host names. + * + * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. + * @since v10.6.0 + */ + function reverse(ip: string): Promise; + /** + * Sets the IP address and port of servers to be used when performing DNS + * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted + * addresses. If the port is the IANA default DNS port (53) it can be omitted. + * + * ```js + * dnsPromises.setServers([ + * '4.4.4.4', + * '[2001:4860:4860::8888]', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ]); + * ``` + * + * An error will be thrown if an invalid address is provided. + * + * The `dnsPromises.setServers()` method must not be called while a DNS query is in + * progress. + * + * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). + * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with + * subsequent servers provided. Fallback DNS servers will only be used if the + * earlier ones time out or result in some other error. + * @since v10.6.0 + * @param servers array of `RFC 5952` formatted addresses + */ + function setServers(servers: ReadonlyArray): void; + /** + * Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be: + * + * * `ipv4first`: sets default `verbatim` `false`. + * * `verbatim`: sets default `verbatim` `true`. + * + * The default is `verbatim` and `dnsPromises.setDefaultResultOrder()` have + * higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the + * default dns orders in workers. + * @since v16.4.0, v14.18.0 + * @param order must be `'ipv4first'` or `'verbatim'`. + */ + function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void; + /** + * An independent resolver for DNS requests. + * + * Creating a new resolver uses the default server settings. Setting + * the servers used for a resolver using `resolver.setServers()` does not affect + * other resolvers: + * + * ```js + * const { Resolver } = require('node:dns').promises; + * const resolver = new Resolver(); + * resolver.setServers(['4.4.4.4']); + * + * // This request will use the server at 4.4.4.4, independent of global settings. + * resolver.resolve4('example.org').then((addresses) => { + * // ... + * }); + * + * // Alternatively, the same code can be written using async-await style. + * (async function() { + * const addresses = await resolver.resolve4('example.org'); + * })(); + * ``` + * + * The following methods from the `dnsPromises` API are available: + * + * * `resolver.getServers()` + * * `resolver.resolve()` + * * `resolver.resolve4()` + * * `resolver.resolve6()` + * * `resolver.resolveAny()` + * * `resolver.resolveCaa()` + * * `resolver.resolveCname()` + * * `resolver.resolveMx()` + * * `resolver.resolveNaptr()` + * * `resolver.resolveNs()` + * * `resolver.resolvePtr()` + * * `resolver.resolveSoa()` + * * `resolver.resolveSrv()` + * * `resolver.resolveTxt()` + * * `resolver.reverse()` + * * `resolver.setServers()` + * @since v10.6.0 + */ + class Resolver { + constructor(options?: ResolverOptions); + cancel(): void; + getServers: typeof getServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCaa: typeof resolveCaa; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + setLocalAddress(ipv4?: string, ipv6?: string): void; + setServers: typeof setServers; + } +} +declare module 'node:dns/promises' { + export * from 'dns/promises'; +} diff --git a/node_modules/@types/node/dom-events.d.ts b/node_modules/@types/node/dom-events.d.ts new file mode 100755 index 0000000..b9c1c3a --- /dev/null +++ b/node_modules/@types/node/dom-events.d.ts @@ -0,0 +1,126 @@ +export {}; // Don't export anything! + +//// DOM-like Events +// NB: The Event / EventTarget / EventListener implementations below were copied +// from lib.dom.d.ts, then edited to reflect Node's documentation at +// https://nodejs.org/api/events.html#class-eventtarget. +// Please read that link to understand important implementation differences. + +// This conditional type will be the existing global Event in a browser, or +// the copy below in a Node environment. +type __Event = typeof globalThis extends { onmessage: any, Event: any } +? {} +: { + /** This is not used in Node.js and is provided purely for completeness. */ + readonly bubbles: boolean; + /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */ + cancelBubble: () => void; + /** True if the event was created with the cancelable option */ + readonly cancelable: boolean; + /** This is not used in Node.js and is provided purely for completeness. */ + readonly composed: boolean; + /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */ + composedPath(): [EventTarget?] + /** Alias for event.target. */ + readonly currentTarget: EventTarget | null; + /** Is true if cancelable is true and event.preventDefault() has been called. */ + readonly defaultPrevented: boolean; + /** This is not used in Node.js and is provided purely for completeness. */ + readonly eventPhase: 0 | 2; + /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */ + readonly isTrusted: boolean; + /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */ + preventDefault(): void; + /** This is not used in Node.js and is provided purely for completeness. */ + returnValue: boolean; + /** Alias for event.target. */ + readonly srcElement: EventTarget | null; + /** Stops the invocation of event listeners after the current one completes. */ + stopImmediatePropagation(): void; + /** This is not used in Node.js and is provided purely for completeness. */ + stopPropagation(): void; + /** The `EventTarget` dispatching the event */ + readonly target: EventTarget | null; + /** The millisecond timestamp when the Event object was created. */ + readonly timeStamp: number; + /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ + readonly type: string; +}; + +// See comment above explaining conditional type +type __EventTarget = typeof globalThis extends { onmessage: any, EventTarget: any } +? {} +: { + /** + * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value. + * + * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched. + * + * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification. + * Specifically, the `capture` option is used as part of the key when registering a `listener`. + * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`. + */ + addEventListener( + type: string, + listener: EventListener | EventListenerObject, + options?: AddEventListenerOptions | boolean, + ): void; + /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ + dispatchEvent(event: Event): boolean; + /** Removes the event listener in target's event listener list with the same type, callback, and options. */ + removeEventListener( + type: string, + listener: EventListener | EventListenerObject, + options?: EventListenerOptions | boolean, + ): void; +}; + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; +} + +interface EventListenerOptions { + /** Not directly used by Node.js. Added for API completeness. Default: `false`. */ + capture?: boolean; +} + +interface AddEventListenerOptions extends EventListenerOptions { + /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */ + once?: boolean; + /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */ + passive?: boolean; +} + +interface EventListener { + (evt: Event): void; +} + +interface EventListenerObject { + handleEvent(object: Event): void; +} + +import {} from 'events'; // Make this an ambient declaration +declare global { + /** An event which takes place in the DOM. */ + interface Event extends __Event {} + var Event: typeof globalThis extends { onmessage: any, Event: infer T } + ? T + : { + prototype: __Event; + new (type: string, eventInitDict?: EventInit): __Event; + }; + + /** + * EventTarget is a DOM interface implemented by objects that can + * receive events and may have listeners for them. + */ + interface EventTarget extends __EventTarget {} + var EventTarget: typeof globalThis extends { onmessage: any, EventTarget: infer T } + ? T + : { + prototype: __EventTarget; + new (): __EventTarget; + }; +} diff --git a/node_modules/@types/node/domain.d.ts b/node_modules/@types/node/domain.d.ts new file mode 100755 index 0000000..e49b87f --- /dev/null +++ b/node_modules/@types/node/domain.d.ts @@ -0,0 +1,170 @@ +/** + * **This module is pending deprecation.** Once a replacement API has been + * finalized, this module will be fully deprecated. Most developers should + * **not** have cause to use this module. Users who absolutely must have + * the functionality that domains provide may rely on it for the time being + * but should expect to have to migrate to a different solution + * in the future. + * + * Domains provide a way to handle multiple different IO operations as a + * single group. If any of the event emitters or callbacks registered to a + * domain emit an `'error'` event, or throw an error, then the domain object + * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to + * exit immediately with an error code. + * @deprecated Since v1.4.2 - Deprecated + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/domain.js) + */ +declare module 'domain' { + import EventEmitter = require('node:events'); + /** + * The `Domain` class encapsulates the functionality of routing errors and + * uncaught exceptions to the active `Domain` object. + * + * To handle the errors that it catches, listen to its `'error'` event. + */ + class Domain extends EventEmitter { + /** + * An array of timers and event emitters that have been explicitly added + * to the domain. + */ + members: Array; + /** + * The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly + * pushes the domain onto the domain + * stack managed by the domain module (see {@link exit} for details on the + * domain stack). The call to `enter()` delimits the beginning of a chain of + * asynchronous calls and I/O operations bound to a domain. + * + * Calling `enter()` changes only the active domain, and does not alter the domain + * itself. `enter()` and `exit()` can be called an arbitrary number of times on a + * single domain. + */ + enter(): void; + /** + * The `exit()` method exits the current domain, popping it off the domain stack. + * Any time execution is going to switch to the context of a different chain of + * asynchronous calls, it's important to ensure that the current domain is exited. + * The call to `exit()` delimits either the end of or an interruption to the chain + * of asynchronous calls and I/O operations bound to a domain. + * + * If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain. + * + * Calling `exit()` changes only the active domain, and does not alter the domain + * itself. `enter()` and `exit()` can be called an arbitrary number of times on a + * single domain. + */ + exit(): void; + /** + * Run the supplied function in the context of the domain, implicitly + * binding all event emitters, timers, and low-level requests that are + * created in that context. Optionally, arguments can be passed to + * the function. + * + * This is the most basic way to use a domain. + * + * ```js + * const domain = require('node:domain'); + * const fs = require('node:fs'); + * const d = domain.create(); + * d.on('error', (er) => { + * console.error('Caught error!', er); + * }); + * d.run(() => { + * process.nextTick(() => { + * setTimeout(() => { // Simulating some various async stuff + * fs.open('non-existent file', 'r', (er, fd) => { + * if (er) throw er; + * // proceed... + * }); + * }, 100); + * }); + * }); + * ``` + * + * In this example, the `d.on('error')` handler will be triggered, rather + * than crashing the program. + */ + run(fn: (...args: any[]) => T, ...args: any[]): T; + /** + * Explicitly adds an emitter to the domain. If any event handlers called by + * the emitter throw an error, or if the emitter emits an `'error'` event, it + * will be routed to the domain's `'error'` event, just like with implicit + * binding. + * + * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by + * the domain `'error'` handler. + * + * If the Timer or `EventEmitter` was already bound to a domain, it is removed + * from that one, and bound to this one instead. + * @param emitter emitter or timer to be added to the domain + */ + add(emitter: EventEmitter | NodeJS.Timer): void; + /** + * The opposite of {@link add}. Removes domain handling from the + * specified emitter. + * @param emitter emitter or timer to be removed from the domain + */ + remove(emitter: EventEmitter | NodeJS.Timer): void; + /** + * The returned function will be a wrapper around the supplied callback + * function. When the returned function is called, any errors that are + * thrown will be routed to the domain's `'error'` event. + * + * ```js + * const d = domain.create(); + * + * function readSomeFile(filename, cb) { + * fs.readFile(filename, 'utf8', d.bind((er, data) => { + * // If this throws, it will also be passed to the domain. + * return cb(er, data ? JSON.parse(data) : null); + * })); + * } + * + * d.on('error', (er) => { + * // An error occurred somewhere. If we throw it now, it will crash the program + * // with the normal line number and stack message. + * }); + * ``` + * @param callback The callback function + * @return The bound function + */ + bind(callback: T): T; + /** + * This method is almost identical to {@link bind}. However, in + * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function. + * + * In this way, the common `if (err) return callback(err);` pattern can be replaced + * with a single error handler in a single place. + * + * ```js + * const d = domain.create(); + * + * function readSomeFile(filename, cb) { + * fs.readFile(filename, 'utf8', d.intercept((data) => { + * // Note, the first argument is never passed to the + * // callback since it is assumed to be the 'Error' argument + * // and thus intercepted by the domain. + * + * // If this throws, it will also be passed to the domain + * // so the error-handling logic can be moved to the 'error' + * // event on the domain instead of being repeated throughout + * // the program. + * return cb(null, JSON.parse(data)); + * })); + * } + * + * d.on('error', (er) => { + * // An error occurred somewhere. If we throw it now, it will crash the program + * // with the normal line number and stack message. + * }); + * ``` + * @param callback The callback function + * @return The intercepted function + */ + intercept(callback: T): T; + } + function create(): Domain; +} +declare module 'node:domain' { + export * from 'domain'; +} diff --git a/node_modules/@types/node/events.d.ts b/node_modules/@types/node/events.d.ts new file mode 100755 index 0000000..d9a97f6 --- /dev/null +++ b/node_modules/@types/node/events.d.ts @@ -0,0 +1,788 @@ +/** + * Much of the Node.js core API is built around an idiomatic asynchronous + * event-driven architecture in which certain kinds of objects (called "emitters") + * emit named events that cause `Function` objects ("listeners") to be called. + * + * For instance: a `net.Server` object emits an event each time a peer + * connects to it; a `fs.ReadStream` emits an event when the file is opened; + * a `stream` emits an event whenever data is available to be read. + * + * All objects that emit events are instances of the `EventEmitter` class. These + * objects expose an `eventEmitter.on()` function that allows one or more + * functions to be attached to named events emitted by the object. Typically, + * event names are camel-cased strings but any valid JavaScript property key + * can be used. + * + * When the `EventEmitter` object emits an event, all of the functions attached + * to that specific event are called _synchronously_. Any values returned by the + * called listeners are _ignored_ and discarded. + * + * The following example shows a simple `EventEmitter` instance with a single + * listener. The `eventEmitter.on()` method is used to register listeners, while + * the `eventEmitter.emit()` method is used to trigger the event. + * + * ```js + * import { EventEmitter } from 'node:events'; + * + * class MyEmitter extends EventEmitter {} + * + * const myEmitter = new MyEmitter(); + * myEmitter.on('event', () => { + * console.log('an event occurred!'); + * }); + * myEmitter.emit('event'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js) + */ +declare module 'events' { + // NOTE: This class is in the docs but is **not actually exported** by Node. + // If https://github.com/nodejs/node/issues/39903 gets resolved and Node + // actually starts exporting the class, uncomment below. + // import { EventListener, EventListenerObject } from '__dom-events'; + // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ + // interface NodeEventTarget extends EventTarget { + // /** + // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. + // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. + // */ + // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; + // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ + // eventNames(): string[]; + // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ + // listenerCount(type: string): number; + // /** Node.js-specific alias for `eventTarget.removeListener()`. */ + // off(type: string, listener: EventListener | EventListenerObject): this; + // /** Node.js-specific alias for `eventTarget.addListener()`. */ + // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; + // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ + // once(type: string, listener: EventListener | EventListenerObject): this; + // /** + // * Node.js-specific extension to the `EventTarget` class. + // * If `type` is specified, removes all registered listeners for `type`, + // * otherwise removes all registered listeners. + // */ + // removeAllListeners(type: string): this; + // /** + // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. + // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. + // */ + // removeListener(type: string, listener: EventListener | EventListenerObject): this; + // } + interface EventEmitterOptions { + /** + * Enables automatic capturing of promise rejection. + */ + captureRejections?: boolean | undefined; + } + // Any EventTarget with a Node-style `once` function + interface _NodeEventTarget { + once(eventName: string | symbol, listener: (...args: any[]) => void): this; + } + // Any EventTarget with a DOM-style `addEventListener` + interface _DOMEventTarget { + addEventListener( + eventName: string, + listener: (...args: any[]) => void, + opts?: { + once: boolean; + } + ): any; + } + interface StaticEventEmitterOptions { + signal?: AbortSignal | undefined; + } + interface EventEmitter extends NodeJS.EventEmitter {} + /** + * The `EventEmitter` class is defined and exposed by the `node:events` module: + * + * ```js + * import { EventEmitter } from 'node:events'; + * ``` + * + * All `EventEmitter`s emit the event `'newListener'` when new listeners are + * added and `'removeListener'` when existing listeners are removed. + * + * It supports the following option: + * @since v0.1.26 + */ + class EventEmitter { + constructor(options?: EventEmitterOptions); + /** + * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given + * event or that is rejected if the `EventEmitter` emits `'error'` while waiting. + * The `Promise` will resolve with an array of all the arguments emitted to the + * given event. + * + * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event + * semantics and does not listen to the `'error'` event. + * + * ```js + * import { once, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ee = new EventEmitter(); + * + * process.nextTick(() => { + * ee.emit('myevent', 42); + * }); + * + * const [value] = await once(ee, 'myevent'); + * console.log(value); + * + * const err = new Error('kaboom'); + * process.nextTick(() => { + * ee.emit('error', err); + * }); + * + * try { + * await once(ee, 'myevent'); + * } catch (err) { + * console.error('error happened', err); + * } + * ``` + * + * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the + * '`error'` event itself, then it is treated as any other kind of event without + * special handling: + * + * ```js + * import { EventEmitter, once } from 'node:events'; + * + * const ee = new EventEmitter(); + * + * once(ee, 'error') + * .then(([err]) => console.log('ok', err.message)) + * .catch((err) => console.error('error', err.message)); + * + * ee.emit('error', new Error('boom')); + * + * // Prints: ok boom + * ``` + * + * An `AbortSignal` can be used to cancel waiting for the event: + * + * ```js + * import { EventEmitter, once } from 'node:events'; + * + * const ee = new EventEmitter(); + * const ac = new AbortController(); + * + * async function foo(emitter, event, signal) { + * try { + * await once(emitter, event, { signal }); + * console.log('event emitted!'); + * } catch (error) { + * if (error.name === 'AbortError') { + * console.error('Waiting for the event was canceled!'); + * } else { + * console.error('There was an error', error.message); + * } + * } + * } + * + * foo(ee, 'foo', ac.signal); + * ac.abort(); // Abort waiting for the event + * ee.emit('foo'); // Prints: Waiting for the event was canceled! + * ``` + * @since v11.13.0, v10.16.0 + */ + static once(emitter: _NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise; + static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise; + /** + * ```js + * import { on, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ee = new EventEmitter(); + * + * // Emit later on + * process.nextTick(() => { + * ee.emit('foo', 'bar'); + * ee.emit('foo', 42); + * }); + * + * for await (const event of on(ee, 'foo')) { + * // The execution of this inner block is synchronous and it + * // processes one event at a time (even with await). Do not use + * // if concurrent execution is required. + * console.log(event); // prints ['bar'] [42] + * } + * // Unreachable here + * ``` + * + * Returns an `AsyncIterator` that iterates `eventName` events. It will throw + * if the `EventEmitter` emits `'error'`. It removes all listeners when + * exiting the loop. The `value` returned by each iteration is an array + * composed of the emitted event arguments. + * + * An `AbortSignal` can be used to cancel waiting on events: + * + * ```js + * import { on, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ac = new AbortController(); + * + * (async () => { + * const ee = new EventEmitter(); + * + * // Emit later on + * process.nextTick(() => { + * ee.emit('foo', 'bar'); + * ee.emit('foo', 42); + * }); + * + * for await (const event of on(ee, 'foo', { signal: ac.signal })) { + * // The execution of this inner block is synchronous and it + * // processes one event at a time (even with await). Do not use + * // if concurrent execution is required. + * console.log(event); // prints ['bar'] [42] + * } + * // Unreachable here + * })(); + * + * process.nextTick(() => ac.abort()); + * ``` + * @since v13.6.0, v12.16.0 + * @param eventName The name of the event being listened for + * @return that iterates `eventName` events emitted by the `emitter` + */ + static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator; + /** + * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. + * + * ```js + * import { EventEmitter, listenerCount } from 'node:events'; + * + * const myEmitter = new EventEmitter(); + * myEmitter.on('event', () => {}); + * myEmitter.on('event', () => {}); + * console.log(listenerCount(myEmitter, 'event')); + * // Prints: 2 + * ``` + * @since v0.9.12 + * @deprecated Since v3.2.0 - Use `listenerCount` instead. + * @param emitter The emitter to query + * @param eventName The event name + */ + static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number; + /** + * Returns a copy of the array of listeners for the event named `eventName`. + * + * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on + * the emitter. + * + * For `EventTarget`s this is the only way to get the event listeners for the + * event target. This is useful for debugging and diagnostic purposes. + * + * ```js + * import { getEventListeners, EventEmitter } from 'node:events'; + * + * { + * const ee = new EventEmitter(); + * const listener = () => console.log('Events are fun'); + * ee.on('foo', listener); + * console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ] + * } + * { + * const et = new EventTarget(); + * const listener = () => console.log('Events are fun'); + * et.addEventListener('foo', listener); + * console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ] + * } + * ``` + * @since v15.2.0, v14.17.0 + */ + static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[]; + /** + * Returns the currently set max amount of listeners. + * + * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on + * the emitter. + * + * For `EventTarget`s this is the only way to get the max event listeners for the + * event target. If the number of event handlers on a single EventTarget exceeds + * the max set, the EventTarget will print a warning. + * + * ```js + * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events'; + * + * { + * const ee = new EventEmitter(); + * console.log(getMaxListeners(ee)); // 10 + * setMaxListeners(11, ee); + * console.log(getMaxListeners(ee)); // 11 + * } + * { + * const et = new EventTarget(); + * console.log(getMaxListeners(et)); // 10 + * setMaxListeners(11, et); + * console.log(getMaxListeners(et)); // 11 + * } + * ``` + * @since v19.9.0 + */ + static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number; + /** + * ```js + * import { setMaxListeners, EventEmitter } from 'node:events'; + * + * const target = new EventTarget(); + * const emitter = new EventEmitter(); + * + * setMaxListeners(5, target, emitter); + * ``` + * @since v15.4.0 + * @param n A non-negative number. The maximum number of listeners per `EventTarget` event. + * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter} + * objects. + */ + static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void; + /** + * Listens once to the `abort` event on the provided `signal`. + * + * Listening to the `abort` event on abort signals is unsafe and may + * lead to resource leaks since another third party with the signal can + * call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change + * this since it would violate the web standard. Additionally, the original + * API makes it easy to forget to remove listeners. + * + * This API allows safely using `AbortSignal`s in Node.js APIs by solving these + * two issues by listening to the event such that `stopImmediatePropagation` does + * not prevent the listener from running. + * + * Returns a disposable so that it may be unsubscribed from more easily. + * + * ```js + * import { addAbortListener } from 'node:events'; + * + * function example(signal) { + * let disposable; + * try { + * signal.addEventListener('abort', (e) => e.stopImmediatePropagation()); + * disposable = addAbortListener(signal, (e) => { + * // Do something when signal is aborted. + * }); + * } finally { + * disposable?.[Symbol.dispose](); + * } + * } + * ``` + * @since v20.5.0 + * @experimental + * @return that removes the `abort` listener. + */ + static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable; + /** + * This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called. + * + * Installing a listener using this symbol does not change the behavior once an`'error'` event is emitted. Therefore, the process will still crash if no + * regular `'error'` listener is installed. + * @since v13.6.0, v12.17.0 + */ + static readonly errorMonitor: unique symbol; + /** + * Value: `Symbol.for('nodejs.rejection')` + * + * See how to write a custom `rejection handler`. + * @since v13.4.0, v12.16.0 + */ + static readonly captureRejectionSymbol: unique symbol; + /** + * Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + * + * Change the default `captureRejections` option on all new `EventEmitter` objects. + * @since v13.4.0, v12.16.0 + */ + static captureRejections: boolean; + /** + * By default, a maximum of `10` listeners can be registered for any single + * event. This limit can be changed for individual `EventEmitter` instances + * using the `emitter.setMaxListeners(n)` method. To change the default + * for _all_`EventEmitter` instances, the `events.defaultMaxListeners`property can be used. If this value is not a positive number, a `RangeError`is thrown. + * + * Take caution when setting the `events.defaultMaxListeners` because the + * change affects _all_`EventEmitter` instances, including those created before + * the change is made. However, calling `emitter.setMaxListeners(n)` still has + * precedence over `events.defaultMaxListeners`. + * + * This is not a hard limit. The `EventEmitter` instance will allow + * more listeners to be added but will output a trace warning to stderr indicating + * that a "possible EventEmitter memory leak" has been detected. For any single`EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()`methods can be used to + * temporarily avoid this warning: + * + * ```js + * import { EventEmitter } from 'node:events'; + * const emitter = new EventEmitter(); + * emitter.setMaxListeners(emitter.getMaxListeners() + 1); + * emitter.once('event', () => { + * // do stuff + * emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0)); + * }); + * ``` + * + * The `--trace-warnings` command-line flag can be used to display the + * stack trace for such warnings. + * + * The emitted warning can be inspected with `process.on('warning')` and will + * have the additional `emitter`, `type`, and `count` properties, referring to + * the event emitter instance, the event's name and the number of attached + * listeners, respectively. + * Its `name` property is set to `'MaxListenersExceededWarning'`. + * @since v0.11.2 + */ + static defaultMaxListeners: number; + } + import internal = require('node:events'); + namespace EventEmitter { + // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4 + export { internal as EventEmitter }; + export interface Abortable { + /** + * When provided the corresponding `AbortController` can be used to cancel an asynchronous action. + */ + signal?: AbortSignal | undefined; + } + } + global { + namespace NodeJS { + interface EventEmitter { + /** + * Alias for `emitter.on(eventName, listener)`. + * @since v0.1.26 + */ + addListener(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Adds the `listener` function to the end of the listeners array for the + * event named `eventName`. No checks are made to see if the `listener` has + * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple + * times. + * + * ```js + * server.on('connection', (stream) => { + * console.log('someone connected!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * + * By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the + * event listener to the beginning of the listeners array. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEE = new EventEmitter(); + * myEE.on('foo', () => console.log('a')); + * myEE.prependListener('foo', () => console.log('b')); + * myEE.emit('foo'); + * // Prints: + * // b + * // a + * ``` + * @since v0.1.101 + * @param eventName The name of the event. + * @param listener The callback function + */ + on(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Adds a **one-time**`listener` function for the event named `eventName`. The + * next time `eventName` is triggered, this listener is removed and then invoked. + * + * ```js + * server.once('connection', (stream) => { + * console.log('Ah, we have our first user!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * + * By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the + * event listener to the beginning of the listeners array. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEE = new EventEmitter(); + * myEE.once('foo', () => console.log('a')); + * myEE.prependOnceListener('foo', () => console.log('b')); + * myEE.emit('foo'); + * // Prints: + * // b + * // a + * ``` + * @since v0.3.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + once(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Removes the specified `listener` from the listener array for the event named`eventName`. + * + * ```js + * const callback = (stream) => { + * console.log('someone connected!'); + * }; + * server.on('connection', callback); + * // ... + * server.removeListener('connection', callback); + * ``` + * + * `removeListener()` will remove, at most, one instance of a listener from the + * listener array. If any single listener has been added multiple times to the + * listener array for the specified `eventName`, then `removeListener()` must be + * called multiple times to remove each instance. + * + * Once an event is emitted, all listeners attached to it at the + * time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution + * will not remove them from`emit()` in progress. Subsequent events behave as expected. + * + * ```js + * import { EventEmitter } from 'node:events'; + * class MyEmitter extends EventEmitter {} + * const myEmitter = new MyEmitter(); + * + * const callbackA = () => { + * console.log('A'); + * myEmitter.removeListener('event', callbackB); + * }; + * + * const callbackB = () => { + * console.log('B'); + * }; + * + * myEmitter.on('event', callbackA); + * + * myEmitter.on('event', callbackB); + * + * // callbackA removes listener callbackB but it will still be called. + * // Internal listener array at time of emit [callbackA, callbackB] + * myEmitter.emit('event'); + * // Prints: + * // A + * // B + * + * // callbackB is now removed. + * // Internal listener array [callbackA] + * myEmitter.emit('event'); + * // Prints: + * // A + * ``` + * + * Because listeners are managed using an internal array, calling this will + * change the position indices of any listener registered _after_ the listener + * being removed. This will not impact the order in which listeners are called, + * but it means that any copies of the listener array as returned by + * the `emitter.listeners()` method will need to be recreated. + * + * When a single function has been added as a handler multiple times for a single + * event (as in the example below), `removeListener()` will remove the most + * recently added instance. In the example the `once('ping')`listener is removed: + * + * ```js + * import { EventEmitter } from 'node:events'; + * const ee = new EventEmitter(); + * + * function pong() { + * console.log('pong'); + * } + * + * ee.on('ping', pong); + * ee.once('ping', pong); + * ee.removeListener('ping', pong); + * + * ee.emit('ping'); + * ee.emit('ping'); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.1.26 + */ + removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Alias for `emitter.removeListener()`. + * @since v10.0.0 + */ + off(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Removes all listeners, or those of the specified `eventName`. + * + * It is bad practice to remove listeners added elsewhere in the code, + * particularly when the `EventEmitter` instance was created by some other + * component or module (e.g. sockets or file streams). + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.1.26 + */ + removeAllListeners(event?: string | symbol): this; + /** + * By default `EventEmitter`s will print a warning if more than `10` listeners are + * added for a particular event. This is a useful default that helps finding + * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be + * modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.3.5 + */ + setMaxListeners(n: number): this; + /** + * Returns the current max listener value for the `EventEmitter` which is either + * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}. + * @since v1.0.0 + */ + getMaxListeners(): number; + /** + * Returns a copy of the array of listeners for the event named `eventName`. + * + * ```js + * server.on('connection', (stream) => { + * console.log('someone connected!'); + * }); + * console.log(util.inspect(server.listeners('connection'))); + * // Prints: [ [Function] ] + * ``` + * @since v0.1.26 + */ + listeners(eventName: string | symbol): Function[]; + /** + * Returns a copy of the array of listeners for the event named `eventName`, + * including any wrappers (such as those created by `.once()`). + * + * ```js + * import { EventEmitter } from 'node:events'; + * const emitter = new EventEmitter(); + * emitter.once('log', () => console.log('log once')); + * + * // Returns a new Array with a function `onceWrapper` which has a property + * // `listener` which contains the original listener bound above + * const listeners = emitter.rawListeners('log'); + * const logFnWrapper = listeners[0]; + * + * // Logs "log once" to the console and does not unbind the `once` event + * logFnWrapper.listener(); + * + * // Logs "log once" to the console and removes the listener + * logFnWrapper(); + * + * emitter.on('log', () => console.log('log persistently')); + * // Will return a new Array with a single function bound by `.on()` above + * const newListeners = emitter.rawListeners('log'); + * + * // Logs "log persistently" twice + * newListeners[0](); + * emitter.emit('log'); + * ``` + * @since v9.4.0 + */ + rawListeners(eventName: string | symbol): Function[]; + /** + * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments + * to each. + * + * Returns `true` if the event had listeners, `false` otherwise. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEmitter = new EventEmitter(); + * + * // First listener + * myEmitter.on('event', function firstListener() { + * console.log('Helloooo! first listener'); + * }); + * // Second listener + * myEmitter.on('event', function secondListener(arg1, arg2) { + * console.log(`event with parameters ${arg1}, ${arg2} in second listener`); + * }); + * // Third listener + * myEmitter.on('event', function thirdListener(...args) { + * const parameters = args.join(', '); + * console.log(`event with parameters ${parameters} in third listener`); + * }); + * + * console.log(myEmitter.listeners('event')); + * + * myEmitter.emit('event', 1, 2, 3, 4, 5); + * + * // Prints: + * // [ + * // [Function: firstListener], + * // [Function: secondListener], + * // [Function: thirdListener] + * // ] + * // Helloooo! first listener + * // event with parameters 1, 2 in second listener + * // event with parameters 1, 2, 3, 4, 5 in third listener + * ``` + * @since v0.1.26 + */ + emit(eventName: string | symbol, ...args: any[]): boolean; + /** + * Returns the number of listeners listening for the event named `eventName`. + * If `listener` is provided, it will return how many times the listener is found + * in the list of the listeners of the event. + * @since v3.2.0 + * @param eventName The name of the event being listened for + * @param listener The event handler function + */ + listenerCount(eventName: string | symbol, listener?: Function): number; + /** + * Adds the `listener` function to the _beginning_ of the listeners array for the + * event named `eventName`. No checks are made to see if the `listener` has + * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple + * times. + * + * ```js + * server.prependListener('connection', (stream) => { + * console.log('someone connected!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v6.0.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this + * listener is removed, and then invoked. + * + * ```js + * server.prependOnceListener('connection', (stream) => { + * console.log('Ah, we have our first user!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v6.0.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Returns an array listing the events for which the emitter has registered + * listeners. The values in the array are strings or `Symbol`s. + * + * ```js + * import { EventEmitter } from 'node:events'; + * + * const myEE = new EventEmitter(); + * myEE.on('foo', () => {}); + * myEE.on('bar', () => {}); + * + * const sym = Symbol('symbol'); + * myEE.on(sym, () => {}); + * + * console.log(myEE.eventNames()); + * // Prints: [ 'foo', 'bar', Symbol(symbol) ] + * ``` + * @since v6.0.0 + */ + eventNames(): Array; + } + } + } + export = EventEmitter; +} +declare module 'node:events' { + import events = require('events'); + export = events; +} diff --git a/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts new file mode 100755 index 0000000..88dc63e --- /dev/null +++ b/node_modules/@types/node/fs.d.ts @@ -0,0 +1,4082 @@ +/** + * The `node:fs` module enables interacting with the file system in a + * way modeled on standard POSIX functions. + * + * To use the promise-based APIs: + * + * ```js + * import * as fs from 'node:fs/promises'; + * ``` + * + * To use the callback and sync APIs: + * + * ```js + * import * as fs from 'node:fs'; + * ``` + * + * All file system operations have synchronous, callback, and promise-based + * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM). + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/fs.js) + */ +declare module 'fs' { + import * as stream from 'node:stream'; + import { Abortable, EventEmitter } from 'node:events'; + import { URL } from 'node:url'; + import * as promises from 'node:fs/promises'; + export { promises }; + /** + * Valid types for path values in "fs". + */ + export type PathLike = string | Buffer | URL; + export type PathOrFileDescriptor = PathLike | number; + export type TimeLike = string | number | Date; + export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; + export type BufferEncodingOption = + | 'buffer' + | { + encoding: 'buffer'; + }; + export interface ObjectEncodingOptions { + encoding?: BufferEncoding | null | undefined; + } + export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null; + export type OpenMode = number | string; + export type Mode = number | string; + export interface StatsBase { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: T; + ino: T; + mode: T; + nlink: T; + uid: T; + gid: T; + rdev: T; + size: T; + blksize: T; + blocks: T; + atimeMs: T; + mtimeMs: T; + ctimeMs: T; + birthtimeMs: T; + atime: Date; + mtime: Date; + ctime: Date; + birthtime: Date; + } + export interface Stats extends StatsBase {} + /** + * A `fs.Stats` object provides information about a file. + * + * Objects returned from {@link stat}, {@link lstat}, {@link fstat}, and + * their synchronous counterparts are of this type. + * If `bigint` in the `options` passed to those methods is true, the numeric values + * will be `bigint` instead of `number`, and the object will contain additional + * nanosecond-precision properties suffixed with `Ns`. + * + * ```console + * Stats { + * dev: 2114, + * ino: 48064969, + * mode: 33188, + * nlink: 1, + * uid: 85, + * gid: 100, + * rdev: 0, + * size: 527, + * blksize: 4096, + * blocks: 8, + * atimeMs: 1318289051000.1, + * mtimeMs: 1318289051000.1, + * ctimeMs: 1318289051000.1, + * birthtimeMs: 1318289051000.1, + * atime: Mon, 10 Oct 2011 23:24:11 GMT, + * mtime: Mon, 10 Oct 2011 23:24:11 GMT, + * ctime: Mon, 10 Oct 2011 23:24:11 GMT, + * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } + * ``` + * + * `bigint` version: + * + * ```console + * BigIntStats { + * dev: 2114n, + * ino: 48064969n, + * mode: 33188n, + * nlink: 1n, + * uid: 85n, + * gid: 100n, + * rdev: 0n, + * size: 527n, + * blksize: 4096n, + * blocks: 8n, + * atimeMs: 1318289051000n, + * mtimeMs: 1318289051000n, + * ctimeMs: 1318289051000n, + * birthtimeMs: 1318289051000n, + * atimeNs: 1318289051000000000n, + * mtimeNs: 1318289051000000000n, + * ctimeNs: 1318289051000000000n, + * birthtimeNs: 1318289051000000000n, + * atime: Mon, 10 Oct 2011 23:24:11 GMT, + * mtime: Mon, 10 Oct 2011 23:24:11 GMT, + * ctime: Mon, 10 Oct 2011 23:24:11 GMT, + * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } + * ``` + * @since v0.1.21 + */ + export class Stats {} + export interface StatsFsBase { + /** Type of file system. */ + type: T; + /** Optimal transfer block size. */ + bsize: T; + /** Total data blocks in file system. */ + blocks: T; + /** Free blocks in file system. */ + bfree: T; + /** Available blocks for unprivileged users */ + bavail: T; + /** Total file nodes in file system. */ + files: T; + /** Free file nodes in file system. */ + ffree: T; + } + export interface StatsFs extends StatsFsBase {} + /** + * Provides information about a mounted file system. + * + * Objects returned from {@link statfs} and its synchronous counterpart are of + * this type. If `bigint` in the `options` passed to those methods is `true`, the + * numeric values will be `bigint` instead of `number`. + * + * ```console + * StatFs { + * type: 1397114950, + * bsize: 4096, + * blocks: 121938943, + * bfree: 61058895, + * bavail: 61058895, + * files: 999, + * ffree: 1000000 + * } + * ``` + * + * `bigint` version: + * + * ```console + * StatFs { + * type: 1397114950n, + * bsize: 4096n, + * blocks: 121938943n, + * bfree: 61058895n, + * bavail: 61058895n, + * files: 999n, + * ffree: 1000000n + * } + * ``` + * @since v19.6.0, v18.15.0 + */ + export class StatsFs {} + export interface BigIntStatsFs extends StatsFsBase {} + export interface StatFsOptions { + bigint?: boolean | undefined; + } + /** + * A representation of a directory entry, which can be a file or a subdirectory + * within the directory, as returned by reading from an `fs.Dir`. The + * directory entry is a combination of the file name and file type pairs. + * + * Additionally, when {@link readdir} or {@link readdirSync} is called with + * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s. + * @since v10.10.0 + */ + export class Dirent { + /** + * Returns `true` if the `fs.Dirent` object describes a regular file. + * @since v10.10.0 + */ + isFile(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a file system + * directory. + * @since v10.10.0 + */ + isDirectory(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a block device. + * @since v10.10.0 + */ + isBlockDevice(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a character device. + * @since v10.10.0 + */ + isCharacterDevice(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a symbolic link. + * @since v10.10.0 + */ + isSymbolicLink(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a first-in-first-out + * (FIFO) pipe. + * @since v10.10.0 + */ + isFIFO(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a socket. + * @since v10.10.0 + */ + isSocket(): boolean; + /** + * The file name that this `fs.Dirent` object refers to. The type of this + * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}. + * @since v10.10.0 + */ + name: string; + /** + * The base path that this `fs.Dirent` object refers to. + * @since v20.1.0 + */ + path: string; + } + /** + * A class representing a directory stream. + * + * Created by {@link opendir}, {@link opendirSync}, or `fsPromises.opendir()`. + * + * ```js + * import { opendir } from 'node:fs/promises'; + * + * try { + * const dir = await opendir('./'); + * for await (const dirent of dir) + * console.log(dirent.name); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * When using the async iterator, the `fs.Dir` object will be automatically + * closed after the iterator exits. + * @since v12.12.0 + */ + export class Dir implements AsyncIterable { + /** + * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`. + * @since v12.12.0 + */ + readonly path: string; + /** + * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. + */ + [Symbol.asyncIterator](): AsyncIterableIterator; + /** + * Asynchronously close the directory's underlying resource handle. + * Subsequent reads will result in errors. + * + * A promise is returned that will be resolved after the resource has been + * closed. + * @since v12.12.0 + */ + close(): Promise; + close(cb: NoParamCallback): void; + /** + * Synchronously close the directory's underlying resource handle. + * Subsequent reads will result in errors. + * @since v12.12.0 + */ + closeSync(): void; + /** + * Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an `fs.Dirent`. + * + * A promise is returned that will be resolved with an `fs.Dirent`, or `null`if there are no more directory entries to read. + * + * Directory entries returned by this function are in no particular order as + * provided by the operating system's underlying directory mechanisms. + * Entries added or removed while iterating over the directory might not be + * included in the iteration results. + * @since v12.12.0 + * @return containing {fs.Dirent|null} + */ + read(): Promise; + read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; + /** + * Synchronously read the next directory entry as an `fs.Dirent`. See the + * POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail. + * + * If there are no more directory entries to read, `null` will be returned. + * + * Directory entries returned by this function are in no particular order as + * provided by the operating system's underlying directory mechanisms. + * Entries added or removed while iterating over the directory might not be + * included in the iteration results. + * @since v12.12.0 + */ + readSync(): Dirent | null; + } + /** + * Class: fs.StatWatcher + * @since v14.3.0, v12.20.0 + * Extends `EventEmitter` + * A successful call to {@link watchFile} method will return a new fs.StatWatcher object. + */ + export interface StatWatcher extends EventEmitter { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have + * no effect. + * + * By default, all `fs.StatWatcher` objects are "ref'ed", making it normally + * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been + * called previously. + * @since v14.3.0, v12.20.0 + */ + ref(): this; + /** + * When called, the active `fs.StatWatcher` object will not require the Node.js + * event loop to remain active. If there is no other activity keeping the + * event loop running, the process may exit before the `fs.StatWatcher` object's + * callback is invoked. Calling `watcher.unref()` multiple times will have + * no effect. + * @since v14.3.0, v12.20.0 + */ + unref(): this; + } + export interface FSWatcher extends EventEmitter { + /** + * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable. + * @since v0.5.8 + */ + close(): void; + /** + * events.EventEmitter + * 1. change + * 2. error + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + addListener(event: 'error', listener: (error: Error) => void): this; + addListener(event: 'close', listener: () => void): this; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + on(event: 'error', listener: (error: Error) => void): this; + on(event: 'close', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + once(event: 'error', listener: (error: Error) => void): this; + once(event: 'close', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + prependListener(event: 'error', listener: (error: Error) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + prependOnceListener(event: 'error', listener: (error: Error) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + } + /** + * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function. + * @since v0.1.93 + */ + export class ReadStream extends stream.Readable { + close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; + /** + * The number of bytes that have been read so far. + * @since v6.4.0 + */ + bytesRead: number; + /** + * The path to the file the stream is reading from as specified in the first + * argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a + * `Buffer`. If `fd` is specified, then`readStream.path` will be `undefined`. + * @since v0.1.93 + */ + path: string | Buffer; + /** + * This property is `true` if the underlying file has not been opened yet, + * i.e. before the `'ready'` event is emitted. + * @since v11.2.0, v10.16.0 + */ + pending: boolean; + /** + * events.EventEmitter + * 1. open + * 2. close + * 3. ready + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'open', listener: (fd: number) => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'readable', listener: () => void): this; + addListener(event: 'ready', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: Buffer | string) => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'open', listener: (fd: number) => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'readable', listener: () => void): this; + on(event: 'ready', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: Buffer | string) => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'open', listener: (fd: number) => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'readable', listener: () => void): this; + once(event: 'ready', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'open', listener: (fd: number) => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'readable', listener: () => void): this; + prependListener(event: 'ready', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'open', listener: (fd: number) => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'readable', listener: () => void): this; + prependOnceListener(event: 'ready', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * * Extends `stream.Writable` + * + * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function. + * @since v0.1.93 + */ + export class WriteStream extends stream.Writable { + /** + * Closes `writeStream`. Optionally accepts a + * callback that will be executed once the `writeStream`is closed. + * @since v0.9.4 + */ + close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; + /** + * The number of bytes written so far. Does not include data that is still queued + * for writing. + * @since v0.4.7 + */ + bytesWritten: number; + /** + * The path to the file the stream is writing to as specified in the first + * argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a `Buffer`, then`writeStream.path` will be a + * `Buffer`. + * @since v0.1.93 + */ + path: string | Buffer; + /** + * This property is `true` if the underlying file has not been opened yet, + * i.e. before the `'ready'` event is emitted. + * @since v11.2.0 + */ + pending: boolean; + /** + * events.EventEmitter + * 1. open + * 2. close + * 3. ready + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'open', listener: (fd: number) => void): this; + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'ready', listener: () => void): this; + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'open', listener: (fd: number) => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'ready', listener: () => void): this; + on(event: 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'open', listener: (fd: number) => void): this; + once(event: 'pipe', listener: (src: stream.Readable) => void): this; + once(event: 'ready', listener: () => void): this; + once(event: 'unpipe', listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'open', listener: (fd: number) => void): this; + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'ready', listener: () => void): this; + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'open', listener: (fd: number) => void): this; + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'ready', listener: () => void): this; + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * Asynchronously rename file at `oldPath` to the pathname provided + * as `newPath`. In the case that `newPath` already exists, it will + * be overwritten. If there is a directory at `newPath`, an error will + * be raised instead. No arguments other than a possible exception are + * given to the completion callback. + * + * See also: [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html). + * + * ```js + * import { rename } from 'node:fs'; + * + * rename('oldFile.txt', 'newFile.txt', (err) => { + * if (err) throw err; + * console.log('Rename complete!'); + * }); + * ``` + * @since v0.0.2 + */ + export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; + export namespace rename { + /** + * Asynchronous rename(2) - Change the name or location of a file or directory. + * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; + } + /** + * Renames the file from `oldPath` to `newPath`. Returns `undefined`. + * + * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details. + * @since v0.1.21 + */ + export function renameSync(oldPath: PathLike, newPath: PathLike): void; + /** + * Truncates the file. No arguments other than a possible exception are + * given to the completion callback. A file descriptor can also be passed as the + * first argument. In this case, `fs.ftruncate()` is called. + * + * ```js + * import { truncate } from 'node:fs'; + * // Assuming that 'path/file.txt' is a regular file. + * truncate('path/file.txt', (err) => { + * if (err) throw err; + * console.log('path/file.txt was truncated'); + * }); + * ``` + * + * Passing a file descriptor is deprecated and may result in an error being thrown + * in the future. + * + * See the POSIX [`truncate(2)`](http://man7.org/linux/man-pages/man2/truncate.2.html) documentation for more details. + * @since v0.8.6 + * @param [len=0] + */ + export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void; + /** + * Asynchronous truncate(2) - Truncate a file to a specified length. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function truncate(path: PathLike, callback: NoParamCallback): void; + export namespace truncate { + /** + * Asynchronous truncate(2) - Truncate a file to a specified length. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param len If not specified, defaults to `0`. + */ + function __promisify__(path: PathLike, len?: number | null): Promise; + } + /** + * Truncates the file. Returns `undefined`. A file descriptor can also be + * passed as the first argument. In this case, `fs.ftruncateSync()` is called. + * + * Passing a file descriptor is deprecated and may result in an error being thrown + * in the future. + * @since v0.8.6 + * @param [len=0] + */ + export function truncateSync(path: PathLike, len?: number | null): void; + /** + * Truncates the file descriptor. No arguments other than a possible exception are + * given to the completion callback. + * + * See the POSIX [`ftruncate(2)`](http://man7.org/linux/man-pages/man2/ftruncate.2.html) documentation for more detail. + * + * If the file referred to by the file descriptor was larger than `len` bytes, only + * the first `len` bytes will be retained in the file. + * + * For example, the following program retains only the first four bytes of the + * file: + * + * ```js + * import { open, close, ftruncate } from 'node:fs'; + * + * function closeFd(fd) { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * + * open('temp.txt', 'r+', (err, fd) => { + * if (err) throw err; + * + * try { + * ftruncate(fd, 4, (err) => { + * closeFd(fd); + * if (err) throw err; + * }); + * } catch (err) { + * closeFd(fd); + * if (err) throw err; + * } + * }); + * ``` + * + * If the file previously was shorter than `len` bytes, it is extended, and the + * extended part is filled with null bytes (`'\0'`): + * + * If `len` is negative then `0` will be used. + * @since v0.8.6 + * @param [len=0] + */ + export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void; + /** + * Asynchronous ftruncate(2) - Truncate a file to a specified length. + * @param fd A file descriptor. + */ + export function ftruncate(fd: number, callback: NoParamCallback): void; + export namespace ftruncate { + /** + * Asynchronous ftruncate(2) - Truncate a file to a specified length. + * @param fd A file descriptor. + * @param len If not specified, defaults to `0`. + */ + function __promisify__(fd: number, len?: number | null): Promise; + } + /** + * Truncates the file descriptor. Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link ftruncate}. + * @since v0.8.6 + * @param [len=0] + */ + export function ftruncateSync(fd: number, len?: number | null): void; + /** + * Asynchronously changes owner and group of a file. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. + * @since v0.1.97 + */ + export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; + export namespace chown { + /** + * Asynchronous chown(2) - Change ownership of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, uid: number, gid: number): Promise; + } + /** + * Synchronously changes owner and group of a file. Returns `undefined`. + * This is the synchronous version of {@link chown}. + * + * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. + * @since v0.1.97 + */ + export function chownSync(path: PathLike, uid: number, gid: number): void; + /** + * Sets the owner of the file. No arguments other than a possible exception are + * given to the completion callback. + * + * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; + export namespace fchown { + /** + * Asynchronous fchown(2) - Change ownership of a file. + * @param fd A file descriptor. + */ + function __promisify__(fd: number, uid: number, gid: number): Promise; + } + /** + * Sets the owner of the file. Returns `undefined`. + * + * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. + * @since v0.4.7 + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + */ + export function fchownSync(fd: number, uid: number, gid: number): void; + /** + * Set the owner of the symbolic link. No arguments other than a possible + * exception are given to the completion callback. + * + * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail. + */ + export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; + export namespace lchown { + /** + * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, uid: number, gid: number): Promise; + } + /** + * Set the owner for the path. Returns `undefined`. + * + * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more details. + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + */ + export function lchownSync(path: PathLike, uid: number, gid: number): void; + /** + * Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic + * link, then the link is not dereferenced: instead, the timestamps of the + * symbolic link itself are changed. + * + * No arguments other than a possible exception are given to the completion + * callback. + * @since v14.5.0, v12.19.0 + */ + export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace lutimes { + /** + * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, + * with the difference that if the path refers to a symbolic link, then the link is not + * dereferenced: instead, the timestamps of the symbolic link itself are changed. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Change the file system timestamps of the symbolic link referenced by `path`. + * Returns `undefined`, or throws an exception when parameters are incorrect or + * the operation fails. This is the synchronous version of {@link lutimes}. + * @since v14.5.0, v12.19.0 + */ + export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; + /** + * Asynchronously changes the permissions of a file. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. + * + * ```js + * import { chmod } from 'node:fs'; + * + * chmod('my_file.txt', 0o775, (err) => { + * if (err) throw err; + * console.log('The permissions for file "my_file.txt" have been changed!'); + * }); + * ``` + * @since v0.1.30 + */ + export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; + export namespace chmod { + /** + * Asynchronous chmod(2) - Change permissions of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(path: PathLike, mode: Mode): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link chmod}. + * + * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. + * @since v0.6.7 + */ + export function chmodSync(path: PathLike, mode: Mode): void; + /** + * Sets the permissions on the file. No arguments other than a possible exception + * are given to the completion callback. + * + * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void; + export namespace fchmod { + /** + * Asynchronous fchmod(2) - Change permissions of a file. + * @param fd A file descriptor. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(fd: number, mode: Mode): Promise; + } + /** + * Sets the permissions on the file. Returns `undefined`. + * + * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchmodSync(fd: number, mode: Mode): void; + /** + * Changes the permissions on a symbolic link. No arguments other than a possible + * exception are given to the completion callback. + * + * This method is only implemented on macOS. + * + * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. + * @deprecated Since v0.4.7 + */ + export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; + /** @deprecated */ + export namespace lchmod { + /** + * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(path: PathLike, mode: Mode): Promise; + } + /** + * Changes the permissions on a symbolic link. Returns `undefined`. + * + * This method is only implemented on macOS. + * + * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. + * @deprecated Since v0.4.7 + */ + export function lchmodSync(path: PathLike, mode: Mode): void; + /** + * Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * + * {@link stat} follows symbolic links. Use {@link lstat} to look at the + * links themselves. + * + * Using `fs.stat()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. + * Instead, user code should open/read/write the file directly and handle the + * error raised if the file is not available. + * + * To check if a file exists without manipulating it afterwards, {@link access} is recommended. + * + * For example, given the following directory structure: + * + * ```text + * - txtDir + * -- file.txt + * - app.js + * ``` + * + * The next program will check for the stats of the given paths: + * + * ```js + * import { stat } from 'node:fs'; + * + * const pathsToCheck = ['./txtDir', './txtDir/file.txt']; + * + * for (let i = 0; i < pathsToCheck.length; i++) { + * stat(pathsToCheck[i], (err, stats) => { + * console.log(stats.isDirectory()); + * console.log(stats); + * }); + * } + * ``` + * + * The resulting output will resemble: + * + * ```console + * true + * Stats { + * dev: 16777220, + * mode: 16877, + * nlink: 3, + * uid: 501, + * gid: 20, + * rdev: 0, + * blksize: 4096, + * ino: 14214262, + * size: 96, + * blocks: 0, + * atimeMs: 1561174653071.963, + * mtimeMs: 1561174614583.3518, + * ctimeMs: 1561174626623.5366, + * birthtimeMs: 1561174126937.2893, + * atime: 2019-06-22T03:37:33.072Z, + * mtime: 2019-06-22T03:36:54.583Z, + * ctime: 2019-06-22T03:37:06.624Z, + * birthtime: 2019-06-22T03:28:46.937Z + * } + * false + * Stats { + * dev: 16777220, + * mode: 33188, + * nlink: 1, + * uid: 501, + * gid: 20, + * rdev: 0, + * blksize: 4096, + * ino: 14214074, + * size: 8, + * blocks: 8, + * atimeMs: 1561174616618.8555, + * mtimeMs: 1561174614584, + * ctimeMs: 1561174614583.8145, + * birthtimeMs: 1561174007710.7478, + * atime: 2019-06-22T03:36:56.619Z, + * mtime: 2019-06-22T03:36:54.584Z, + * ctime: 2019-06-22T03:36:54.584Z, + * birthtime: 2019-06-22T03:26:47.711Z + * } + * ``` + * @since v0.0.2 + */ + export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function stat( + path: PathLike, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void + ): void; + export function stat( + path: PathLike, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void + ): void; + export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; + export namespace stat { + /** + * Asynchronous stat(2) - Get file status. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__( + path: PathLike, + options?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function __promisify__( + path: PathLike, + options: StatOptions & { + bigint: true; + } + ): Promise; + function __promisify__(path: PathLike, options?: StatOptions): Promise; + } + export interface StatSyncFn extends Function { + (path: PathLike, options?: undefined): Stats; + ( + path: PathLike, + options?: StatSyncOptions & { + bigint?: false | undefined; + throwIfNoEntry: false; + } + ): Stats | undefined; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: true; + throwIfNoEntry: false; + } + ): BigIntStats | undefined; + ( + path: PathLike, + options?: StatSyncOptions & { + bigint?: false | undefined; + } + ): Stats; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: true; + } + ): BigIntStats; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: boolean; + throwIfNoEntry?: false | undefined; + } + ): Stats | BigIntStats; + (path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined; + } + /** + * Synchronous stat(2) - Get file status. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export const statSync: StatSyncFn; + /** + * Invokes the callback with the `fs.Stats` for the file descriptor. + * + * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. + * @since v0.1.95 + */ + export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function fstat( + fd: number, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void + ): void; + export function fstat( + fd: number, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void + ): void; + export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; + export namespace fstat { + /** + * Asynchronous fstat(2) - Get file status. + * @param fd A file descriptor. + */ + function __promisify__( + fd: number, + options?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function __promisify__( + fd: number, + options: StatOptions & { + bigint: true; + } + ): Promise; + function __promisify__(fd: number, options?: StatOptions): Promise; + } + /** + * Retrieves the `fs.Stats` for the file descriptor. + * + * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. + * @since v0.1.95 + */ + export function fstatSync( + fd: number, + options?: StatOptions & { + bigint?: false | undefined; + } + ): Stats; + export function fstatSync( + fd: number, + options: StatOptions & { + bigint: true; + } + ): BigIntStats; + export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats; + /** + * Retrieves the `fs.Stats` for the symbolic link referred to by the path. + * The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic + * link, then the link itself is stat-ed, not the file that it refers to. + * + * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details. + * @since v0.1.30 + */ + export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function lstat( + path: PathLike, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void + ): void; + export function lstat( + path: PathLike, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void + ): void; + export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; + export namespace lstat { + /** + * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__( + path: PathLike, + options?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function __promisify__( + path: PathLike, + options: StatOptions & { + bigint: true; + } + ): Promise; + function __promisify__(path: PathLike, options?: StatOptions): Promise; + } + /** + * Asynchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which + * contains `path`. The callback gets two arguments `(err, stats)` where `stats`is an `fs.StatFs` object. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * @since v19.6.0, v18.15.0 + * @param path A path to an existing file or directory on the file system to be queried. + */ + export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void; + export function statfs( + path: PathLike, + options: + | (StatFsOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void + ): void; + export function statfs( + path: PathLike, + options: StatFsOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void + ): void; + export function statfs(path: PathLike, options: StatFsOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void): void; + export namespace statfs { + /** + * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an object. + * @param path A path to an existing file or directory on the file system to be queried. + */ + function __promisify__( + path: PathLike, + options?: StatFsOptions & { + bigint?: false | undefined; + } + ): Promise; + function __promisify__( + path: PathLike, + options: StatFsOptions & { + bigint: true; + } + ): Promise; + function __promisify__(path: PathLike, options?: StatFsOptions): Promise; + } + /** + * Synchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which + * contains `path`. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * @since v19.6.0, v18.15.0 + * @param path A path to an existing file or directory on the file system to be queried. + */ + export function statfsSync( + path: PathLike, + options?: StatFsOptions & { + bigint?: false | undefined; + } + ): StatsFs; + export function statfsSync( + path: PathLike, + options: StatFsOptions & { + bigint: true; + } + ): BigIntStatsFs; + export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs; + /** + * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export const lstatSync: StatSyncFn; + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than + * a possible + * exception are given to the completion callback. + * @since v0.1.31 + */ + export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; + export namespace link { + /** + * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. + * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; + } + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`. + * @since v0.1.31 + */ + export function linkSync(existingPath: PathLike, newPath: PathLike): void; + /** + * Creates the link called `path` pointing to `target`. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`symlink(2)`](http://man7.org/linux/man-pages/man2/symlink.2.html) documentation for more details. + * + * The `type` argument is only available on Windows and ignored on other platforms. + * It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is + * not a string, Node.js will autodetect `target` type and use `'file'` or `'dir'`. + * If the `target` does not exist, `'file'` will be used. Windows junction points + * require the destination path to be absolute. When using `'junction'`, the`target` argument will automatically be normalized to absolute path. Junction + * points on NTFS volumes can only point to directories. + * + * Relative targets are relative to the link's parent directory. + * + * ```js + * import { symlink } from 'node:fs'; + * + * symlink('./mew', './mewtwo', callback); + * ``` + * + * The above example creates a symbolic link `mewtwo` which points to `mew` in the + * same directory: + * + * ```bash + * $ tree . + * . + * ├── mew + * └── mewtwo -> ./mew + * ``` + * @since v0.1.31 + * @param [type='null'] + */ + export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void; + /** + * Asynchronous symlink(2) - Create a new symbolic link to an existing file. + * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. + * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + */ + export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; + export namespace symlink { + /** + * Asynchronous symlink(2) - Create a new symbolic link to an existing file. + * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. + * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). + * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. + */ + function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; + type Type = 'dir' | 'file' | 'junction'; + } + /** + * Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link symlink}. + * @since v0.1.31 + * @param [type='null'] + */ + export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; + /** + * Reads the contents of the symbolic link referred to by `path`. The callback gets + * two arguments `(err, linkString)`. + * + * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path passed to the callback. If the `encoding` is set to `'buffer'`, + * the link path returned will be passed as a `Buffer` object. + * @since v0.1.31 + */ + export function readlink(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlink(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlink(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; + export namespace readlink { + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + } + /** + * Returns the symbolic link's string value. + * + * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path returned. If the `encoding` is set to `'buffer'`, + * the link path returned will be passed as a `Buffer` object. + * @since v0.1.31 + */ + export function readlinkSync(path: PathLike, options?: EncodingOption): string; + /** + * Synchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer; + /** + * Synchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer; + /** + * Asynchronously computes the canonical pathname by resolving `.`, `..`, and + * symbolic links. + * + * A canonical pathname is not necessarily unique. Hard links and bind mounts can + * expose a file system entity through many pathnames. + * + * This function behaves like [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html), with some exceptions: + * + * 1. No case conversion is performed on case-insensitive file systems. + * 2. The maximum number of symbolic links is platform-independent and generally + * (much) higher than what the native [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html) implementation supports. + * + * The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd`to resolve relative paths. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path passed to the callback. If the `encoding` is set to `'buffer'`, + * the path returned will be passed as a `Buffer` object. + * + * If `path` resolves to a socket or a pipe, the function will return a system + * dependent name for that object. + * @since v0.1.31 + */ + export function realpath(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpath(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpath(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; + export namespace realpath { + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html). + * + * The `callback` gets two arguments `(err, resolvedPath)`. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path passed to the callback. If the `encoding` is set to `'buffer'`, + * the path returned will be passed as a `Buffer` object. + * + * On Linux, when Node.js is linked against musl libc, the procfs file system must + * be mounted on `/proc` in order for this function to work. Glibc does not have + * this restriction. + * @since v9.2.0 + */ + function native(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; + function native(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; + function native(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; + function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; + } + /** + * Returns the resolved pathname. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link realpath}. + * @since v0.1.31 + */ + export function realpathSync(path: PathLike, options?: EncodingOption): string; + /** + * Synchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer; + /** + * Synchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer; + export namespace realpathSync { + function native(path: PathLike, options?: EncodingOption): string; + function native(path: PathLike, options: BufferEncodingOption): Buffer; + function native(path: PathLike, options?: EncodingOption): string | Buffer; + } + /** + * Asynchronously removes a file or symbolic link. No arguments other than a + * possible exception are given to the completion callback. + * + * ```js + * import { unlink } from 'node:fs'; + * // Assuming that 'path/file.txt' is a regular file. + * unlink('path/file.txt', (err) => { + * if (err) throw err; + * console.log('path/file.txt was deleted'); + * }); + * ``` + * + * `fs.unlink()` will not work on a directory, empty or otherwise. To remove a + * directory, use {@link rmdir}. + * + * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details. + * @since v0.0.2 + */ + export function unlink(path: PathLike, callback: NoParamCallback): void; + export namespace unlink { + /** + * Asynchronous unlink(2) - delete a name and possibly the file it refers to. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike): Promise; + } + /** + * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`. + * @since v0.1.21 + */ + export function unlinkSync(path: PathLike): void; + export interface RmDirOptions { + /** + * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + * `EPERM` error is encountered, Node.js will retry the operation with a linear + * backoff wait of `retryDelay` ms longer on each try. This option represents the + * number of retries. This option is ignored if the `recursive` option is not + * `true`. + * @default 0 + */ + maxRetries?: number | undefined; + /** + * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning + * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file. + * Use `fs.rm(path, { recursive: true, force: true })` instead. + * + * If `true`, perform a recursive directory removal. In + * recursive mode, operations are retried on failure. + * @default false + */ + recursive?: boolean | undefined; + /** + * The amount of time in milliseconds to wait between retries. + * This option is ignored if the `recursive` option is not `true`. + * @default 100 + */ + retryDelay?: number | undefined; + } + /** + * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given + * to the completion callback. + * + * Using `fs.rmdir()` on a file (not a directory) results in an `ENOENT` error on + * Windows and an `ENOTDIR` error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`. + * @since v0.0.2 + */ + export function rmdir(path: PathLike, callback: NoParamCallback): void; + export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; + export namespace rmdir { + /** + * Asynchronous rmdir(2) - delete a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, options?: RmDirOptions): Promise; + } + /** + * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`. + * + * Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error + * on Windows and an `ENOTDIR` error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`. + * @since v0.1.21 + */ + export function rmdirSync(path: PathLike, options?: RmDirOptions): void; + export interface RmOptions { + /** + * When `true`, exceptions will be ignored if `path` does not exist. + * @default false + */ + force?: boolean | undefined; + /** + * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + * `EPERM` error is encountered, Node.js will retry the operation with a linear + * backoff wait of `retryDelay` ms longer on each try. This option represents the + * number of retries. This option is ignored if the `recursive` option is not + * `true`. + * @default 0 + */ + maxRetries?: number | undefined; + /** + * If `true`, perform a recursive directory removal. In + * recursive mode, operations are retried on failure. + * @default false + */ + recursive?: boolean | undefined; + /** + * The amount of time in milliseconds to wait between retries. + * This option is ignored if the `recursive` option is not `true`. + * @default 100 + */ + retryDelay?: number | undefined; + } + /** + * Asynchronously removes files and directories (modeled on the standard POSIX `rm`utility). No arguments other than a possible exception are given to the + * completion callback. + * @since v14.14.0 + */ + export function rm(path: PathLike, callback: NoParamCallback): void; + export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void; + export namespace rm { + /** + * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). + */ + function __promisify__(path: PathLike, options?: RmOptions): Promise; + } + /** + * Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). Returns `undefined`. + * @since v14.14.0 + */ + export function rmSync(path: PathLike, options?: RmOptions): void; + export interface MakeDirectoryOptions { + /** + * Indicates whether parent folders should be created. + * If a folder was created, the path to the first created folder will be returned. + * @default false + */ + recursive?: boolean | undefined; + /** + * A file mode. If a string is passed, it is parsed as an octal integer. If not specified + * @default 0o777 + */ + mode?: Mode | undefined; + } + /** + * Asynchronously creates a directory. + * + * The callback is given a possible exception and, if `recursive` is `true`, the + * first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was + * created (for instance, if it was previously created). + * + * The optional `options` argument can be an integer specifying `mode` (permission + * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fs.mkdir()` when `path` is a directory that + * exists results in an error only + * when `recursive` is false. If `recursive` is false and the directory exists, + * an `EEXIST` error occurs. + * + * ```js + * import { mkdir } from 'node:fs'; + * + * // Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist. + * mkdir('./tmp/a/apple', { recursive: true }, (err) => { + * if (err) throw err; + * }); + * ``` + * + * On Windows, using `fs.mkdir()` on the root directory even with recursion will + * result in an error: + * + * ```js + * import { mkdir } from 'node:fs'; + * + * mkdir('/', { recursive: true }, (err) => { + * // => [Error: EPERM: operation not permitted, mkdir 'C:\'] + * }); + * ``` + * + * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. + * @since v0.1.8 + */ + export function mkdir( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + }, + callback: (err: NodeJS.ErrnoException | null, path?: string) => void + ): void; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdir( + path: PathLike, + options: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + | undefined, + callback: NoParamCallback + ): void; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdir(path: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void; + /** + * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function mkdir(path: PathLike, callback: NoParamCallback): void; + export namespace mkdir { + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + } + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; + } + /** + * Synchronously creates a directory. Returns `undefined`, or if `recursive` is`true`, the first directory path created. + * This is the synchronous version of {@link mkdir}. + * + * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. + * @since v0.1.21 + */ + export function mkdirSync( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + } + ): string | undefined; + /** + * Synchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdirSync( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + ): void; + /** + * Synchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined; + /** + * Creates a unique temporary directory. + * + * Generates six random characters to be appended behind a required`prefix` to create a unique temporary directory. Due to platform + * inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, + * notably the BSDs, can return more than six random characters, and replace + * trailing `X` characters in `prefix` with random characters. + * + * The created directory path is passed as a string to the callback's second + * parameter. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * + * ```js + * import { mkdtemp } from 'node:fs'; + * import { join } from 'node:path'; + * import { tmpdir } from 'node:os'; + * + * mkdtemp(join(tmpdir(), 'foo-'), (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2 + * }); + * ``` + * + * The `fs.mkdtemp()` method will append the six randomly selected characters + * directly to the `prefix` string. For instance, given a directory `/tmp`, if the + * intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator + * (`require('node:path').sep`). + * + * ```js + * import { tmpdir } from 'node:os'; + * import { mkdtemp } from 'node:fs'; + * + * // The parent directory for the new temporary directory + * const tmpDir = tmpdir(); + * + * // This method is *INCORRECT*: + * mkdtemp(tmpDir, (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Will print something similar to `/tmpabc123`. + * // A new temporary directory is created at the file system root + * // rather than *within* the /tmp directory. + * }); + * + * // This method is *CORRECT*: + * import { sep } from 'node:path'; + * mkdtemp(`${tmpDir}${sep}`, (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Will print something similar to `/tmp/abc123`. + * // A new temporary directory is created within + * // the /tmp directory. + * }); + * ``` + * @since v5.10.0 + */ + export function mkdtemp(prefix: string, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtemp( + prefix: string, + options: + | 'buffer' + | { + encoding: 'buffer'; + }, + callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void + ): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtemp(prefix: string, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + */ + export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; + export namespace mkdtemp { + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options?: EncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options: BufferEncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options?: EncodingOption): Promise; + } + /** + * Returns the created directory path. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link mkdtemp}. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * @since v5.10.0 + */ + export function mkdtempSync(prefix: string, options?: EncodingOption): string; + /** + * Synchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer; + /** + * Synchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer; + /** + * Reads the contents of a directory. The callback gets two arguments `(err, files)`where `files` is an array of the names of the files in the directory excluding`'.'` and `'..'`. + * + * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames passed to the callback. If the `encoding` is set to `'buffer'`, + * the filenames returned will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects. + * @since v0.1.8 + */ + export function readdir( + path: PathLike, + options: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, files: string[]) => void + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir( + path: PathLike, + options: + | { + encoding: 'buffer'; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | 'buffer', + callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir( + path: PathLike, + options: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + export function readdir( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + }, + callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void + ): void; + export namespace readdir { + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options?: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | null + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options: + | 'buffer' + | { + encoding: 'buffer'; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent + */ + function __promisify__( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + } + ): Promise; + } + /** + * Reads the contents of the directory. + * + * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames returned. If the `encoding` is set to `'buffer'`, + * the filenames returned will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects. + * @since v0.1.21 + */ + export function readdirSync( + path: PathLike, + options?: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | null + ): string[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync( + path: PathLike, + options: + | { + encoding: 'buffer'; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | 'buffer' + ): Buffer[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null + ): string[] | Buffer[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + export function readdirSync( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + } + ): Dirent[]; + /** + * Closes the file descriptor. No arguments other than a possible exception are + * given to the completion callback. + * + * Calling `fs.close()` on any file descriptor (`fd`) that is currently in use + * through any other `fs` operation may lead to undefined behavior. + * + * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. + * @since v0.0.2 + */ + export function close(fd: number, callback?: NoParamCallback): void; + export namespace close { + /** + * Asynchronous close(2) - close a file descriptor. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Closes the file descriptor. Returns `undefined`. + * + * Calling `fs.closeSync()` on any file descriptor (`fd`) that is currently in use + * through any other `fs` operation may lead to undefined behavior. + * + * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. + * @since v0.1.21 + */ + export function closeSync(fd: number): void; + /** + * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details. + * + * `mode` sets the file mode (permission and sticky bits), but only if the file was + * created. On Windows, only the write permission can be manipulated; see {@link chmod}. + * + * The callback gets two arguments `(err, fd)`. + * + * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented + * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains + * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). + * + * Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc. + * @since v0.0.2 + * @param [flags='r'] See `support of file system `flags``. + * @param [mode=0o666] + */ + export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; + /** + * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param [flags='r'] See `support of file system `flags``. + */ + export function open(path: PathLike, flags: OpenMode | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; + /** + * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; + export namespace open { + /** + * Asynchronous open(2) - open and possibly create a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. + */ + function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise; + } + /** + * Returns an integer representing the file descriptor. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link open}. + * @since v0.1.21 + * @param [flags='r'] + * @param [mode=0o666] + */ + export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number; + /** + * Change the file system timestamps of the object referenced by `path`. + * + * The `atime` and `mtime` arguments follow these rules: + * + * * Values can be either numbers representing Unix epoch time in seconds,`Date`s, or a numeric string like `'123456789.0'`. + * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown. + * @since v0.4.2 + */ + export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace utimes { + /** + * Asynchronously change file timestamps of the file referenced by the supplied path. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link utimes}. + * @since v0.4.2 + */ + export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; + /** + * Change the file system timestamps of the object referenced by the supplied file + * descriptor. See {@link utimes}. + * @since v0.4.2 + */ + export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace futimes { + /** + * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(fd: number, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Synchronous version of {@link futimes}. Returns `undefined`. + * @since v0.4.2 + */ + export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void; + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. No arguments other + * than a possible exception are given to the completion callback. + * @since v0.1.96 + */ + export function fsync(fd: number, callback: NoParamCallback): void; + export namespace fsync { + /** + * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`. + * @since v0.1.96 + */ + export function fsyncSync(fd: number): void; + /** + * Write `buffer` to the file specified by `fd`. + * + * `offset` determines the part of the buffer to be written, and `length` is + * an integer specifying the number of bytes to write. + * + * `position` refers to the offset from the beginning of the file where this data + * should be written. If `typeof position !== 'number'`, the data will be written + * at the current position. See [`pwrite(2)`](http://man7.org/linux/man-pages/man2/pwrite.2.html). + * + * The callback will be given three arguments `(err, bytesWritten, buffer)` where`bytesWritten` specifies how many _bytes_ were written from `buffer`. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesWritten` and `buffer` properties. + * + * It is unsafe to use `fs.write()` multiple times on the same file without waiting + * for the callback. For this scenario, {@link createWriteStream} is + * recommended. + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v0.0.2 + * @param [offset=0] + * @param [length=buffer.byteLength - offset] + * @param [position='null'] + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + length: number | undefined | null, + position: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + length: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + */ + export function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + export function write( + fd: number, + string: string, + position: number | undefined | null, + encoding: BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void + ): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + */ + export function write(fd: number, string: string, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + */ + export function write(fd: number, string: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; + export namespace write { + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + */ + function __promisify__( + fd: number, + buffer?: TBuffer, + offset?: number, + length?: number, + position?: number | null + ): Promise<{ + bytesWritten: number; + buffer: TBuffer; + }>; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + function __promisify__( + fd: number, + string: string, + position?: number | null, + encoding?: BufferEncoding | null + ): Promise<{ + bytesWritten: number; + buffer: string; + }>; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link write}. + * @since v0.1.21 + * @param [offset=0] + * @param [length=buffer.byteLength - offset] + * @param [position='null'] + * @return The number of bytes written. + */ + export function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number; + /** + * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number; + export type ReadPosition = number | bigint; + export interface ReadSyncOptions { + /** + * @default 0 + */ + offset?: number | undefined; + /** + * @default `length of buffer` + */ + length?: number | undefined; + /** + * @default null + */ + position?: ReadPosition | null | undefined; + } + export interface ReadAsyncOptions extends ReadSyncOptions { + buffer?: TBuffer; + } + /** + * Read data from the file specified by `fd`. + * + * The callback is given the three arguments, `(err, bytesRead, buffer)`. + * + * If the file is not modified concurrently, the end-of-file is reached when the + * number of bytes read is zero. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesRead` and `buffer` properties. + * @since v0.0.2 + * @param buffer The buffer that the data will be written to. + * @param offset The position in `buffer` to write the data to. + * @param length The number of bytes to read. + * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If + * `position` is an integer, the file position will be unchanged. + */ + export function read( + fd: number, + buffer: TBuffer, + offset: number, + length: number, + position: ReadPosition | null, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void + ): void; + /** + * Similar to the above `fs.read` function, this version takes an optional `options` object. + * If not otherwise specified in an `options` object, + * `buffer` defaults to `Buffer.alloc(16384)`, + * `offset` defaults to `0`, + * `length` defaults to `buffer.byteLength`, `- offset` as of Node 17.6.0 + * `position` defaults to `null` + * @since v12.17.0, 13.11.0 + */ + export function read( + fd: number, + options: ReadAsyncOptions, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void + ): void; + export function read(fd: number, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void): void; + export namespace read { + /** + * @param fd A file descriptor. + * @param buffer The buffer that the data will be written to. + * @param offset The offset in the buffer at which to start writing. + * @param length The number of bytes to read. + * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. + */ + function __promisify__( + fd: number, + buffer: TBuffer, + offset: number, + length: number, + position: number | null + ): Promise<{ + bytesRead: number; + buffer: TBuffer; + }>; + function __promisify__( + fd: number, + options: ReadAsyncOptions + ): Promise<{ + bytesRead: number; + buffer: TBuffer; + }>; + function __promisify__(fd: number): Promise<{ + bytesRead: number; + buffer: NodeJS.ArrayBufferView; + }>; + } + /** + * Returns the number of `bytesRead`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link read}. + * @since v0.1.21 + * @param [position='null'] + */ + export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: ReadPosition | null): number; + /** + * Similar to the above `fs.readSync` function, this version takes an optional `options` object. + * If no `options` object is specified, it will default with the above values. + */ + export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number; + /** + * Asynchronously reads the entire contents of a file. + * + * ```js + * import { readFile } from 'node:fs'; + * + * readFile('/etc/passwd', (err, data) => { + * if (err) throw err; + * console.log(data); + * }); + * ``` + * + * The callback is passed two arguments `(err, data)`, where `data` is the + * contents of the file. + * + * If no encoding is specified, then the raw buffer is returned. + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { readFile } from 'node:fs'; + * + * readFile('/etc/passwd', 'utf8', callback); + * ``` + * + * When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an + * error will be returned. On FreeBSD, a representation of the directory's contents + * will be returned. + * + * ```js + * import { readFile } from 'node:fs'; + * + * // macOS, Linux, and Windows + * readFile('', (err, data) => { + * // => [Error: EISDIR: illegal operation on a directory, read ] + * }); + * + * // FreeBSD + * readFile('', (err, data) => { + * // => null, + * }); + * ``` + * + * It is possible to abort an ongoing request using an `AbortSignal`. If a + * request is aborted the callback is called with an `AbortError`: + * + * ```js + * import { readFile } from 'node:fs'; + * + * const controller = new AbortController(); + * const signal = controller.signal; + * readFile(fileInfo[0].name, { signal }, (err, buf) => { + * // ... + * }); + * // When you want to abort the request + * controller.abort(); + * ``` + * + * The `fs.readFile()` function buffers the entire file. To minimize memory costs, + * when possible prefer streaming via `fs.createReadStream()`. + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.readFile` performs. + * @since v0.1.29 + * @param path filename or file descriptor + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | ({ + encoding?: null | undefined; + flag?: string | undefined; + } & Abortable) + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | ({ + encoding: BufferEncoding; + flag?: string | undefined; + } & Abortable) + | BufferEncoding, + callback: (err: NodeJS.ErrnoException | null, data: string) => void + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | (ObjectEncodingOptions & { + flag?: string | undefined; + } & Abortable) + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + */ + export function readFile(path: PathOrFileDescriptor, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; + export namespace readFile { + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options?: { + encoding?: null | undefined; + flag?: string | undefined; + } | null + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options: + | { + encoding: BufferEncoding; + flag?: string | undefined; + } + | BufferEncoding + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options?: + | (ObjectEncodingOptions & { + flag?: string | undefined; + }) + | BufferEncoding + | null + ): Promise; + } + /** + * Returns the contents of the `path`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link readFile}. + * + * If the `encoding` option is specified then this function returns a + * string. Otherwise it returns a buffer. + * + * Similar to {@link readFile}, when the path is a directory, the behavior of`fs.readFileSync()` is platform-specific. + * + * ```js + * import { readFileSync } from 'node:fs'; + * + * // macOS, Linux, and Windows + * readFileSync(''); + * // => [Error: EISDIR: illegal operation on a directory, read ] + * + * // FreeBSD + * readFileSync(''); // => + * ``` + * @since v0.1.8 + * @param path filename or file descriptor + */ + export function readFileSync( + path: PathOrFileDescriptor, + options?: { + encoding?: null | undefined; + flag?: string | undefined; + } | null + ): Buffer; + /** + * Synchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFileSync( + path: PathOrFileDescriptor, + options: + | { + encoding: BufferEncoding; + flag?: string | undefined; + } + | BufferEncoding + ): string; + /** + * Synchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFileSync( + path: PathOrFileDescriptor, + options?: + | (ObjectEncodingOptions & { + flag?: string | undefined; + }) + | BufferEncoding + | null + ): string | Buffer; + export type WriteFileOptions = + | (ObjectEncodingOptions & + Abortable & { + mode?: Mode | undefined; + flag?: string | undefined; + }) + | BufferEncoding + | null; + /** + * When `file` is a filename, asynchronously writes data to the file, replacing the + * file if it already exists. `data` can be a string or a buffer. + * + * When `file` is a file descriptor, the behavior is similar to calling`fs.write()` directly (which is recommended). See the notes below on using + * a file descriptor. + * + * The `encoding` option is ignored if `data` is a buffer. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { writeFile } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * writeFile('message.txt', data, (err) => { + * if (err) throw err; + * console.log('The file has been saved!'); + * }); + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { writeFile } from 'node:fs'; + * + * writeFile('message.txt', 'Hello Node.js', 'utf8', callback); + * ``` + * + * It is unsafe to use `fs.writeFile()` multiple times on the same file without + * waiting for the callback. For this scenario, {@link createWriteStream} is + * recommended. + * + * Similarly to `fs.readFile` \- `fs.writeFile` is a convenience method that + * performs multiple `write` calls internally to write the buffer passed to it. + * For performance sensitive code consider using {@link createWriteStream}. + * + * It is possible to use an `AbortSignal` to cancel an `fs.writeFile()`. + * Cancelation is "best effort", and some amount of data is likely still + * to be written. + * + * ```js + * import { writeFile } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * + * const controller = new AbortController(); + * const { signal } = controller; + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * writeFile('message.txt', data, { signal }, (err) => { + * // When a request is aborted - the callback is called with an AbortError + * }); + * // When the request should be aborted + * controller.abort(); + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.writeFile` performs. + * @since v0.1.29 + * @param file filename or file descriptor + */ + export function writeFile(file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void; + /** + * Asynchronously writes data to a file, replacing the file if it already exists. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + */ + export function writeFile(path: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void; + export namespace writeFile { + /** + * Asynchronously writes data to a file, replacing the file if it already exists. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'w'` is used. + */ + function __promisify__(path: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise; + } + /** + * Returns `undefined`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link writeFile}. + * @since v0.1.29 + * @param file filename or file descriptor + */ + export function writeFileSync(file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): void; + /** + * Asynchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { appendFile } from 'node:fs'; + * + * appendFile('message.txt', 'data to append', (err) => { + * if (err) throw err; + * console.log('The "data to append" was appended to file!'); + * }); + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { appendFile } from 'node:fs'; + * + * appendFile('message.txt', 'data to append', 'utf8', callback); + * ``` + * + * The `path` may be specified as a numeric file descriptor that has been opened + * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will + * not be closed automatically. + * + * ```js + * import { open, close, appendFile } from 'node:fs'; + * + * function closeFd(fd) { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * + * open('message.txt', 'a', (err, fd) => { + * if (err) throw err; + * + * try { + * appendFile(fd, 'data to append', 'utf8', (err) => { + * closeFd(fd); + * if (err) throw err; + * }); + * } catch (err) { + * closeFd(fd); + * throw err; + * } + * }); + * ``` + * @since v0.6.7 + * @param path filename or file descriptor + */ + export function appendFile(path: PathOrFileDescriptor, data: string | Uint8Array, options: WriteFileOptions, callback: NoParamCallback): void; + /** + * Asynchronously append data to a file, creating the file if it does not exist. + * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + */ + export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void; + export namespace appendFile { + /** + * Asynchronously append data to a file, creating the file if it does not exist. + * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'a'` is used. + */ + function __promisify__(file: PathOrFileDescriptor, data: string | Uint8Array, options?: WriteFileOptions): Promise; + } + /** + * Synchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { appendFileSync } from 'node:fs'; + * + * try { + * appendFileSync('message.txt', 'data to append'); + * console.log('The "data to append" was appended to file!'); + * } catch (err) { + * // Handle the error + * } + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { appendFileSync } from 'node:fs'; + * + * appendFileSync('message.txt', 'data to append', 'utf8'); + * ``` + * + * The `path` may be specified as a numeric file descriptor that has been opened + * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will + * not be closed automatically. + * + * ```js + * import { openSync, closeSync, appendFileSync } from 'node:fs'; + * + * let fd; + * + * try { + * fd = openSync('message.txt', 'a'); + * appendFileSync(fd, 'data to append', 'utf8'); + * } catch (err) { + * // Handle the error + * } finally { + * if (fd !== undefined) + * closeSync(fd); + * } + * ``` + * @since v0.6.7 + * @param path filename or file descriptor + */ + export function appendFileSync(path: PathOrFileDescriptor, data: string | Uint8Array, options?: WriteFileOptions): void; + /** + * Watch for changes on `filename`. The callback `listener` will be called each + * time the file is accessed. + * + * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates + * whether the process should continue to run as long as files are being watched. + * The `options` object may specify an `interval` property indicating how often the + * target should be polled in milliseconds. + * + * The `listener` gets two arguments the current stat object and the previous + * stat object: + * + * ```js + * import { watchFile } from 'fs'; + * + * watchFile('message.text', (curr, prev) => { + * console.log(`the current mtime is: ${curr.mtime}`); + * console.log(`the previous mtime was: ${prev.mtime}`); + * }); + * ``` + * + * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, + * the numeric values in these objects are specified as `BigInt`s. + * + * To be notified when the file was modified, not just accessed, it is necessary + * to compare `curr.mtimeMs` and `prev.mtimeMs`. + * + * When an `fs.watchFile` operation results in an `ENOENT` error, it + * will invoke the listener once, with all the fields zeroed (or, for dates, the + * Unix Epoch). If the file is created later on, the listener will be called + * again, with the latest stat objects. This is a change in functionality since + * v0.10. + * + * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible. + * + * When a file being watched by `fs.watchFile()` disappears and reappears, + * then the contents of `previous` in the second callback event (the file's + * reappearance) will be the same as the contents of `previous` in the first + * callback event (its disappearance). + * + * This happens when: + * + * * the file is deleted, followed by a restore + * * the file is renamed and then renamed a second time back to its original name + * @since v0.1.31 + */ + export interface WatchFileOptions { + bigint?: boolean | undefined; + persistent?: boolean | undefined; + interval?: number | undefined; + } + /** + * Watch for changes on `filename`. The callback `listener` will be called each + * time the file is accessed. + * + * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates + * whether the process should continue to run as long as files are being watched. + * The `options` object may specify an `interval` property indicating how often the + * target should be polled in milliseconds. + * + * The `listener` gets two arguments the current stat object and the previous + * stat object: + * + * ```js + * import { watchFile } from 'node:fs'; + * + * watchFile('message.text', (curr, prev) => { + * console.log(`the current mtime is: ${curr.mtime}`); + * console.log(`the previous mtime was: ${prev.mtime}`); + * }); + * ``` + * + * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, + * the numeric values in these objects are specified as `BigInt`s. + * + * To be notified when the file was modified, not just accessed, it is necessary + * to compare `curr.mtimeMs` and `prev.mtimeMs`. + * + * When an `fs.watchFile` operation results in an `ENOENT` error, it + * will invoke the listener once, with all the fields zeroed (or, for dates, the + * Unix Epoch). If the file is created later on, the listener will be called + * again, with the latest stat objects. This is a change in functionality since + * v0.10. + * + * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible. + * + * When a file being watched by `fs.watchFile()` disappears and reappears, + * then the contents of `previous` in the second callback event (the file's + * reappearance) will be the same as the contents of `previous` in the first + * callback event (its disappearance). + * + * This happens when: + * + * * the file is deleted, followed by a restore + * * the file is renamed and then renamed a second time back to its original name + * @since v0.1.31 + */ + export function watchFile( + filename: PathLike, + options: + | (WatchFileOptions & { + bigint?: false | undefined; + }) + | undefined, + listener: StatsListener + ): StatWatcher; + export function watchFile( + filename: PathLike, + options: + | (WatchFileOptions & { + bigint: true; + }) + | undefined, + listener: BigIntStatsListener + ): StatWatcher; + /** + * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher; + /** + * Stop watching for changes on `filename`. If `listener` is specified, only that + * particular listener is removed. Otherwise, _all_ listeners are removed, + * effectively stopping watching of `filename`. + * + * Calling `fs.unwatchFile()` with a filename that is not being watched is a + * no-op, not an error. + * + * Using {@link watch} is more efficient than `fs.watchFile()` and`fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()`and `fs.unwatchFile()` when possible. + * @since v0.1.31 + * @param listener Optional, a listener previously attached using `fs.watchFile()` + */ + export function unwatchFile(filename: PathLike, listener?: StatsListener): void; + export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void; + export interface WatchOptions extends Abortable { + encoding?: BufferEncoding | 'buffer' | undefined; + persistent?: boolean | undefined; + recursive?: boolean | undefined; + } + export type WatchEventType = 'rename' | 'change'; + export type WatchListener = (event: WatchEventType, filename: T | null) => void; + export type StatsListener = (curr: Stats, prev: Stats) => void; + export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void; + /** + * Watch for changes on `filename`, where `filename` is either a file or a + * directory. + * + * The second argument is optional. If `options` is provided as a string, it + * specifies the `encoding`. Otherwise `options` should be passed as an object. + * + * The listener callback gets two arguments `(eventType, filename)`. `eventType`is either `'rename'` or `'change'`, and `filename` is the name of the file + * which triggered the event. + * + * On most platforms, `'rename'` is emitted whenever a filename appears or + * disappears in the directory. + * + * The listener callback is attached to the `'change'` event fired by `fs.FSWatcher`, but it is not the same thing as the `'change'` value of`eventType`. + * + * If a `signal` is passed, aborting the corresponding AbortController will close + * the returned `fs.FSWatcher`. + * @since v0.5.10 + * @param listener + */ + export function watch( + filename: PathLike, + options: + | (WatchOptions & { + encoding: 'buffer'; + }) + | 'buffer', + listener?: WatchListener + ): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + export function watch(filename: PathLike, options?: WatchOptions | BufferEncoding | null, listener?: WatchListener): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + export function watch(filename: PathLike, options: WatchOptions | string, listener?: WatchListener): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function watch(filename: PathLike, listener?: WatchListener): FSWatcher; + /** + * Test whether or not the given path exists by checking with the file system. + * Then call the `callback` argument with either true or false: + * + * ```js + * import { exists } from 'node:fs'; + * + * exists('/etc/passwd', (e) => { + * console.log(e ? 'it exists' : 'no passwd!'); + * }); + * ``` + * + * **The parameters for this callback are not consistent with other Node.js** + * **callbacks.** Normally, the first parameter to a Node.js callback is an `err`parameter, optionally followed by other parameters. The `fs.exists()` callback + * has only one boolean parameter. This is one reason `fs.access()` is recommended + * instead of `fs.exists()`. + * + * Using `fs.exists()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing + * so introduces a race condition, since other processes may change the file's + * state between the two calls. Instead, user code should open/read/write the + * file directly and handle the error raised if the file does not exist. + * + * **write (NOT RECOMMENDED)** + * + * ```js + * import { exists, open, close } from 'node:fs'; + * + * exists('myfile', (e) => { + * if (e) { + * console.error('myfile already exists'); + * } else { + * open('myfile', 'wx', (err, fd) => { + * if (err) throw err; + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * } + * }); + * ``` + * + * **write (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * open('myfile', 'wx', (err, fd) => { + * if (err) { + * if (err.code === 'EEXIST') { + * console.error('myfile already exists'); + * return; + * } + * + * throw err; + * } + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * **read (NOT RECOMMENDED)** + * + * ```js + * import { open, close, exists } from 'node:fs'; + * + * exists('myfile', (e) => { + * if (e) { + * open('myfile', 'r', (err, fd) => { + * if (err) throw err; + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * } else { + * console.error('myfile does not exist'); + * } + * }); + * ``` + * + * **read (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'r', (err, fd) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * The "not recommended" examples above check for existence and then use the + * file; the "recommended" examples are better because they use the file directly + * and handle the error, if any. + * + * In general, check for the existence of a file only if the file won't be + * used directly, for example when its existence is a signal from another + * process. + * @since v0.0.2 + * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead. + */ + export function exists(path: PathLike, callback: (exists: boolean) => void): void; + /** @deprecated */ + export namespace exists { + /** + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(path: PathLike): Promise; + } + /** + * Returns `true` if the path exists, `false` otherwise. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link exists}. + * + * `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback`parameter to `fs.exists()` accepts parameters that are inconsistent with other + * Node.js callbacks. `fs.existsSync()` does not use a callback. + * + * ```js + * import { existsSync } from 'node:fs'; + * + * if (existsSync('/etc/passwd')) + * console.log('The path exists.'); + * ``` + * @since v0.1.21 + */ + export function existsSync(path: PathLike): boolean; + export namespace constants { + // File Access Constants + /** Constant for fs.access(). File is visible to the calling process. */ + const F_OK: number; + /** Constant for fs.access(). File can be read by the calling process. */ + const R_OK: number; + /** Constant for fs.access(). File can be written by the calling process. */ + const W_OK: number; + /** Constant for fs.access(). File can be executed by the calling process. */ + const X_OK: number; + // File Copy Constants + /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ + const COPYFILE_EXCL: number; + /** + * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. + * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. + */ + const COPYFILE_FICLONE: number; + /** + * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. + * If the underlying platform does not support copy-on-write, then the operation will fail with an error. + */ + const COPYFILE_FICLONE_FORCE: number; + // File Open Constants + /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ + const O_RDONLY: number; + /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ + const O_WRONLY: number; + /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ + const O_RDWR: number; + /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ + const O_CREAT: number; + /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ + const O_EXCL: number; + /** + * Constant for fs.open(). Flag indicating that if path identifies a terminal device, + * opening the path shall not cause that terminal to become the controlling terminal for the process + * (if the process does not already have one). + */ + const O_NOCTTY: number; + /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ + const O_TRUNC: number; + /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ + const O_APPEND: number; + /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ + const O_DIRECTORY: number; + /** + * constant for fs.open(). + * Flag indicating reading accesses to the file system will no longer result in + * an update to the atime information associated with the file. + * This flag is available on Linux operating systems only. + */ + const O_NOATIME: number; + /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ + const O_NOFOLLOW: number; + /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ + const O_SYNC: number; + /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ + const O_DSYNC: number; + /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ + const O_SYMLINK: number; + /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ + const O_DIRECT: number; + /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ + const O_NONBLOCK: number; + // File Type Constants + /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ + const S_IFMT: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ + const S_IFREG: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ + const S_IFDIR: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ + const S_IFCHR: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ + const S_IFBLK: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ + const S_IFIFO: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ + const S_IFLNK: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ + const S_IFSOCK: number; + // File Mode Constants + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ + const S_IRWXU: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ + const S_IRUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ + const S_IWUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ + const S_IXUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ + const S_IRWXG: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ + const S_IRGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ + const S_IWGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ + const S_IXGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ + const S_IRWXO: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ + const S_IROTH: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ + const S_IWOTH: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ + const S_IXOTH: number; + /** + * When set, a memory file mapping is used to access the file. This flag + * is available on Windows operating systems only. On other operating systems, + * this flag is ignored. + */ + const UV_FS_O_FILEMAP: number; + } + /** + * Tests a user's permissions for the file or directory specified by `path`. + * The `mode` argument is an optional integer that specifies the accessibility + * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK` + * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * The final argument, `callback`, is a callback function that is invoked with + * a possible error argument. If any of the accessibility checks fail, the error + * argument will be an `Error` object. The following examples check if`package.json` exists, and if it is readable or writable. + * + * ```js + * import { access, constants } from 'node:fs'; + * + * const file = 'package.json'; + * + * // Check if the file exists in the current directory. + * access(file, constants.F_OK, (err) => { + * console.log(`${file} ${err ? 'does not exist' : 'exists'}`); + * }); + * + * // Check if the file is readable. + * access(file, constants.R_OK, (err) => { + * console.log(`${file} ${err ? 'is not readable' : 'is readable'}`); + * }); + * + * // Check if the file is writable. + * access(file, constants.W_OK, (err) => { + * console.log(`${file} ${err ? 'is not writable' : 'is writable'}`); + * }); + * + * // Check if the file is readable and writable. + * access(file, constants.R_OK | constants.W_OK, (err) => { + * console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`); + * }); + * ``` + * + * Do not use `fs.access()` to check for the accessibility of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()`. Doing + * so introduces a race condition, since other processes may change the file's + * state between the two calls. Instead, user code should open/read/write the + * file directly and handle the error raised if the file is not accessible. + * + * **write (NOT RECOMMENDED)** + * + * ```js + * import { access, open, close } from 'node:fs'; + * + * access('myfile', (err) => { + * if (!err) { + * console.error('myfile already exists'); + * return; + * } + * + * open('myfile', 'wx', (err, fd) => { + * if (err) throw err; + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * }); + * ``` + * + * **write (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'wx', (err, fd) => { + * if (err) { + * if (err.code === 'EEXIST') { + * console.error('myfile already exists'); + * return; + * } + * + * throw err; + * } + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * **read (NOT RECOMMENDED)** + * + * ```js + * import { access, open, close } from 'node:fs'; + * access('myfile', (err) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * open('myfile', 'r', (err, fd) => { + * if (err) throw err; + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * }); + * ``` + * + * **read (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'r', (err, fd) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * The "not recommended" examples above check for accessibility and then use the + * file; the "recommended" examples are better because they use the file directly + * and handle the error, if any. + * + * In general, check for the accessibility of a file only if the file will not be + * used directly, for example when its accessibility is a signal from another + * process. + * + * On Windows, access-control policies (ACLs) on a directory may limit access to + * a file or directory. The `fs.access()` function, however, does not check the + * ACL and therefore may report that a path is accessible even if the ACL restricts + * the user from reading or writing to it. + * @since v0.11.15 + * @param [mode=fs.constants.F_OK] + */ + export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; + /** + * Asynchronously tests a user's permissions for the file specified by path. + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function access(path: PathLike, callback: NoParamCallback): void; + export namespace access { + /** + * Asynchronously tests a user's permissions for the file specified by path. + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(path: PathLike, mode?: number): Promise; + } + /** + * Synchronously tests a user's permissions for the file or directory specified + * by `path`. The `mode` argument is an optional integer that specifies the + * accessibility checks to be performed. `mode` should be either the value`fs.constants.F_OK` or a mask consisting of the bitwise OR of any of`fs.constants.R_OK`, `fs.constants.W_OK`, and + * `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * If any of the accessibility checks fail, an `Error` will be thrown. Otherwise, + * the method will return `undefined`. + * + * ```js + * import { accessSync, constants } from 'node:fs'; + * + * try { + * accessSync('etc/passwd', constants.R_OK | constants.W_OK); + * console.log('can read/write'); + * } catch (err) { + * console.error('no access!'); + * } + * ``` + * @since v0.11.15 + * @param [mode=fs.constants.F_OK] + */ + export function accessSync(path: PathLike, mode?: number): void; + interface StreamOptions { + flags?: string | undefined; + encoding?: BufferEncoding | undefined; + fd?: number | promises.FileHandle | undefined; + mode?: number | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + signal?: AbortSignal | null | undefined; + } + interface FSImplementation { + open?: (...args: any[]) => any; + close?: (...args: any[]) => any; + } + interface CreateReadStreamFSImplementation extends FSImplementation { + read: (...args: any[]) => any; + } + interface CreateWriteStreamFSImplementation extends FSImplementation { + write: (...args: any[]) => any; + writev?: (...args: any[]) => any; + } + interface ReadStreamOptions extends StreamOptions { + fs?: CreateReadStreamFSImplementation | null | undefined; + end?: number | undefined; + highWaterMark?: number | undefined; + } + interface WriteStreamOptions extends StreamOptions { + fs?: CreateWriteStreamFSImplementation | null | undefined; + } + /** + * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream + * returned by this method has a default `highWaterMark` of 64 KiB. + * + * `options` can include `start` and `end` values to read a range of bytes from + * the file instead of the entire file. Both `start` and `end` are inclusive and + * start counting at 0, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `fd` is specified and `start` is + * omitted or `undefined`, `fs.createReadStream()` reads sequentially from the + * current file position. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `fd` is specified, `ReadStream` will ignore the `path` argument and will use + * the specified file descriptor. This means that no `'open'` event will be + * emitted. `fd` should be blocking; non-blocking `fd`s should be passed to `net.Socket`. + * + * If `fd` points to a character device that only supports blocking reads + * (such as keyboard or sound card), read operations do not finish until data is + * available. This can prevent the process from exiting and the stream from + * closing naturally. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * By providing the `fs` option, it is possible to override the corresponding `fs`implementations for `open`, `read`, and `close`. When providing the `fs` option, + * an override for `read` is required. If no `fd` is provided, an override for`open` is also required. If `autoClose` is `true`, an override for `close` is + * also required. + * + * ```js + * import { createReadStream } from 'node:fs'; + * + * // Create a stream from some character device. + * const stream = createReadStream('/dev/input/event0'); + * setTimeout(() => { + * stream.close(); // This may not close the stream. + * // Artificially marking end-of-stream, as if the underlying resource had + * // indicated end-of-file by itself, allows the stream to close. + * // This does not cancel pending read operations, and if there is such an + * // operation, the process may still not be able to exit successfully + * // until it finishes. + * stream.push(null); + * stream.read(0); + * }, 100); + * ``` + * + * If `autoClose` is false, then the file descriptor won't be closed, even if + * there's an error. It is the application's responsibility to close it and make + * sure there's no file descriptor leak. If `autoClose` is set to true (default + * behavior), on `'error'` or `'end'` the file descriptor will be closed + * automatically. + * + * `mode` sets the file mode (permission and sticky bits), but only if the + * file was created. + * + * An example to read the last 10 bytes of a file which is 100 bytes long: + * + * ```js + * import { createReadStream } from 'node:fs'; + * + * createReadStream('sample.txt', { start: 90, end: 99 }); + * ``` + * + * If `options` is a string, then it specifies the encoding. + * @since v0.1.31 + */ + export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream; + /** + * `options` may also include a `start` option to allow writing data at some + * position past the beginning of the file, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than + * replacing it may require the `flags` option to be set to `r+` rather than the + * default `w`. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false, + * then the file descriptor won't be closed, even if there's an error. + * It is the application's responsibility to close it and make sure there's no + * file descriptor leak. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * By providing the `fs` option it is possible to override the corresponding `fs`implementations for `open`, `write`, `writev`, and `close`. Overriding `write()`without `writev()` can reduce + * performance as some optimizations (`_writev()`) + * will be disabled. When providing the `fs` option, overrides for at least one of`write` and `writev` are required. If no `fd` option is supplied, an override + * for `open` is also required. If `autoClose` is `true`, an override for `close`is also required. + * + * Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the`path` argument and will use the specified file descriptor. This means that no`'open'` event will be + * emitted. `fd` should be blocking; non-blocking `fd`s + * should be passed to `net.Socket`. + * + * If `options` is a string, then it specifies the encoding. + * @since v0.1.31 + */ + export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream; + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other + * than a possible + * exception are given to the completion callback. + * @since v0.1.96 + */ + export function fdatasync(fd: number, callback: NoParamCallback): void; + export namespace fdatasync { + /** + * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`. + * @since v0.1.96 + */ + export function fdatasyncSync(fd: number): void; + /** + * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. No arguments other than a possible exception are given to the + * callback function. Node.js makes no guarantees about the atomicity of the copy + * operation. If an error occurs after the destination file has been opened for + * writing, Node.js will attempt to remove the destination. + * + * `mode` is an optional integer that specifies the behavior + * of the copy operation. It is possible to create a mask consisting of the bitwise + * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). + * + * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already + * exists. + * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a + * copy-on-write reflink. If the platform does not support copy-on-write, then a + * fallback copy mechanism is used. + * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to + * create a copy-on-write reflink. If the platform does not support + * copy-on-write, then the operation will fail. + * + * ```js + * import { copyFile, constants } from 'node:fs'; + * + * function callback(err) { + * if (err) throw err; + * console.log('source.txt was copied to destination.txt'); + * } + * + * // destination.txt will be created or overwritten by default. + * copyFile('source.txt', 'destination.txt', callback); + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL, callback); + * ``` + * @since v8.5.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] modifiers for copy operation. + */ + export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; + export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void; + export namespace copyFile { + function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise; + } + /** + * Synchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. Returns `undefined`. Node.js makes no guarantees about the + * atomicity of the copy operation. If an error occurs after the destination file + * has been opened for writing, Node.js will attempt to remove the destination. + * + * `mode` is an optional integer that specifies the behavior + * of the copy operation. It is possible to create a mask consisting of the bitwise + * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). + * + * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already + * exists. + * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a + * copy-on-write reflink. If the platform does not support copy-on-write, then a + * fallback copy mechanism is used. + * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to + * create a copy-on-write reflink. If the platform does not support + * copy-on-write, then the operation will fail. + * + * ```js + * import { copyFileSync, constants } from 'node:fs'; + * + * // destination.txt will be created or overwritten by default. + * copyFileSync('source.txt', 'destination.txt'); + * console.log('source.txt was copied to destination.txt'); + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * copyFileSync('source.txt', 'destination.txt', constants.COPYFILE_EXCL); + * ``` + * @since v8.5.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] modifiers for copy operation. + */ + export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void; + /** + * Write an array of `ArrayBufferView`s to the file specified by `fd` using`writev()`. + * + * `position` is the offset from the beginning of the file where this data + * should be written. If `typeof position !== 'number'`, the data will be written + * at the current position. + * + * The callback will be given three arguments: `err`, `bytesWritten`, and`buffers`. `bytesWritten` is how many bytes were written from `buffers`. + * + * If this method is `util.promisify()` ed, it returns a promise for an`Object` with `bytesWritten` and `buffers` properties. + * + * It is unsafe to use `fs.writev()` multiple times on the same file without + * waiting for the callback. For this scenario, use {@link createWriteStream}. + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v12.9.0 + * @param [position='null'] + */ + export function writev(fd: number, buffers: ReadonlyArray, cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void): void; + export function writev( + fd: number, + buffers: ReadonlyArray, + position: number, + cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void + ): void; + export interface WriteVResult { + bytesWritten: number; + buffers: NodeJS.ArrayBufferView[]; + } + export namespace writev { + function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link writev}. + * @since v12.9.0 + * @param [position='null'] + * @return The number of bytes written. + */ + export function writevSync(fd: number, buffers: ReadonlyArray, position?: number): number; + /** + * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s + * using `readv()`. + * + * `position` is the offset from the beginning of the file from where data + * should be read. If `typeof position !== 'number'`, the data will be read + * from the current position. + * + * The callback will be given three arguments: `err`, `bytesRead`, and`buffers`. `bytesRead` is how many bytes were read from the file. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesRead` and `buffers` properties. + * @since v13.13.0, v12.17.0 + * @param [position='null'] + */ + export function readv(fd: number, buffers: ReadonlyArray, cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void): void; + export function readv( + fd: number, + buffers: ReadonlyArray, + position: number, + cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void + ): void; + export interface ReadVResult { + bytesRead: number; + buffers: NodeJS.ArrayBufferView[]; + } + export namespace readv { + function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link readv}. + * @since v13.13.0, v12.17.0 + * @param [position='null'] + * @return The number of bytes read. + */ + export function readvSync(fd: number, buffers: ReadonlyArray, position?: number): number; + + export interface OpenAsBlobOptions { + /** + * An optional mime type for the blob. + * + * @default 'undefined' + */ + type?: string | undefined; + } + + /** + * Returns a Blob whose data is backed by the given file. + * + * The file must not be modified after the `Blob` is created. + * Any modifications will cause reading the `Blob` data to fail with a `DOMException` error. + * Synchronous stat operations on the file when the `Blob` is created, and before each read in order to detect whether the file data has been modified on disk. + * + * @param path + * @param [options] + * + * @experimental + * @since v19.8.0 + */ + export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise; + + export interface OpenDirOptions { + /** + * @default 'utf8' + */ + encoding?: BufferEncoding | undefined; + /** + * Number of directory entries that are buffered + * internally when reading from the directory. Higher values lead to better + * performance but higher memory usage. + * @default 32 + */ + bufferSize?: number | undefined; + /** + * @default false + */ + recursive?: boolean; + } + /** + * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html). + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * @since v12.12.0 + */ + export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir; + /** + * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for + * more details. + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * @since v12.12.0 + */ + export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; + export function opendir(path: PathLike, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; + export namespace opendir { + function __promisify__(path: PathLike, options?: OpenDirOptions): Promise; + } + export interface BigIntStats extends StatsBase { + atimeNs: bigint; + mtimeNs: bigint; + ctimeNs: bigint; + birthtimeNs: bigint; + } + export interface BigIntOptions { + bigint: true; + } + export interface StatOptions { + bigint?: boolean | undefined; + } + export interface StatSyncOptions extends StatOptions { + throwIfNoEntry?: boolean | undefined; + } + interface CopyOptionsBase { + /** + * Dereference symlinks + * @default false + */ + dereference?: boolean; + /** + * When `force` is `false`, and the destination + * exists, throw an error. + * @default false + */ + errorOnExist?: boolean; + /** + * Overwrite existing file or directory. _The copy + * operation will ignore errors if you set this to false and the destination + * exists. Use the `errorOnExist` option to change this behavior. + * @default true + */ + force?: boolean; + /** + * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()} + */ + mode?: number; + /** + * When `true` timestamps from `src` will + * be preserved. + * @default false + */ + preserveTimestamps?: boolean; + /** + * Copy directories recursively. + * @default false + */ + recursive?: boolean; + /** + * When true, path resolution for symlinks will be skipped + * @default false + */ + verbatimSymlinks?: boolean; + } + export interface CopyOptions extends CopyOptionsBase { + /** + * Function to filter copied files/directories. Return + * `true` to copy the item, `false` to ignore it. + */ + filter?(source: string, destination: string): boolean | Promise; + } + export interface CopySyncOptions extends CopyOptionsBase { + /** + * Function to filter copied files/directories. Return + * `true` to copy the item, `false` to ignore it. + */ + filter?(source: string, destination: string): boolean; + } + /** + * Asynchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + */ + export function cp(source: string | URL, destination: string | URL, callback: (err: NodeJS.ErrnoException | null) => void): void; + export function cp(source: string | URL, destination: string | URL, opts: CopyOptions, callback: (err: NodeJS.ErrnoException | null) => void): void; + /** + * Synchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + */ + export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void; +} +declare module 'node:fs' { + export * from 'fs'; +} diff --git a/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts new file mode 100755 index 0000000..6082ff8 --- /dev/null +++ b/node_modules/@types/node/fs/promises.d.ts @@ -0,0 +1,1202 @@ +/** + * The `fs/promises` API provides asynchronous file system methods that return + * promises. + * + * The promise APIs use the underlying Node.js threadpool to perform file + * system operations off the event loop thread. These operations are not + * synchronized or threadsafe. Care must be taken when performing multiple + * concurrent modifications on the same file or data corruption may occur. + * @since v10.0.0 + */ +declare module 'fs/promises' { + import { Abortable } from 'node:events'; + import { Stream } from 'node:stream'; + import { ReadableStream } from 'node:stream/web'; + import { + BigIntStats, + BigIntStatsFs, + BufferEncodingOption, + constants as fsConstants, + CopyOptions, + Dir, + Dirent, + MakeDirectoryOptions, + Mode, + ObjectEncodingOptions, + OpenDirOptions, + OpenMode, + PathLike, + ReadStream, + ReadVResult, + RmDirOptions, + RmOptions, + StatOptions, + StatFsOptions, + Stats, + StatsFs, + TimeLike, + WatchEventType, + WatchOptions, + WriteStream, + WriteVResult, + } from 'node:fs'; + import { Interface as ReadlineInterface } from 'node:readline'; + interface FileChangeInfo { + eventType: WatchEventType; + filename: T | null; + } + interface FlagAndOpenMode { + mode?: Mode | undefined; + flag?: OpenMode | undefined; + } + interface FileReadResult { + bytesRead: number; + buffer: T; + } + interface FileReadOptions { + /** + * @default `Buffer.alloc(0xffff)` + */ + buffer?: T; + /** + * @default 0 + */ + offset?: number | null; + /** + * @default `buffer.byteLength` + */ + length?: number | null; + position?: number | null; + } + interface CreateReadStreamOptions { + encoding?: BufferEncoding | null | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + end?: number | undefined; + highWaterMark?: number | undefined; + } + interface CreateWriteStreamOptions { + encoding?: BufferEncoding | null | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + } + interface ReadableWebStreamOptions { + /** + * Whether to open a normal or a `'bytes'` stream. + * @since v20.0.0 + */ + type?: 'bytes' | undefined; + } + // TODO: Add `EventEmitter` close + interface FileHandle { + /** + * The numeric file descriptor managed by the {FileHandle} object. + * @since v10.0.0 + */ + readonly fd: number; + /** + * Alias of `filehandle.writeFile()`. + * + * When operating on file handles, the mode cannot be changed from what it was set + * to with `fsPromises.open()`. Therefore, this is equivalent to `filehandle.writeFile()`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + appendFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise; + /** + * Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html). + * @since v10.0.0 + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + * @return Fulfills with `undefined` upon success. + */ + chown(uid: number, gid: number): Promise; + /** + * Modifies the permissions on the file. See [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html). + * @since v10.0.0 + * @param mode the file mode bit mask. + * @return Fulfills with `undefined` upon success. + */ + chmod(mode: Mode): Promise; + /** + * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream + * returned by this method has a default `highWaterMark` of 64 KiB. + * + * `options` can include `start` and `end` values to read a range of bytes from + * the file instead of the entire file. Both `start` and `end` are inclusive and + * start counting at 0, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `start` is + * omitted or `undefined`, `filehandle.createReadStream()` reads sequentially from + * the current file position. The `encoding` can be any one of those accepted by `Buffer`. + * + * If the `FileHandle` points to a character device that only supports blocking + * reads (such as keyboard or sound card), read operations do not finish until data + * is available. This can prevent the process from exiting and the stream from + * closing naturally. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const fd = await open('/dev/input/event0'); + * // Create a stream from some character device. + * const stream = fd.createReadStream(); + * setTimeout(() => { + * stream.close(); // This may not close the stream. + * // Artificially marking end-of-stream, as if the underlying resource had + * // indicated end-of-file by itself, allows the stream to close. + * // This does not cancel pending read operations, and if there is such an + * // operation, the process may still not be able to exit successfully + * // until it finishes. + * stream.push(null); + * stream.read(0); + * }, 100); + * ``` + * + * If `autoClose` is false, then the file descriptor won't be closed, even if + * there's an error. It is the application's responsibility to close it and make + * sure there's no file descriptor leak. If `autoClose` is set to true (default + * behavior), on `'error'` or `'end'` the file descriptor will be closed + * automatically. + * + * An example to read the last 10 bytes of a file which is 100 bytes long: + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const fd = await open('sample.txt'); + * fd.createReadStream({ start: 90, end: 99 }); + * ``` + * @since v16.11.0 + */ + createReadStream(options?: CreateReadStreamOptions): ReadStream; + /** + * `options` may also include a `start` option to allow writing data at some + * position past the beginning of the file, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than + * replacing it may require the `flags` `open` option to be set to `r+` rather than + * the default `r`. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false, + * then the file descriptor won't be closed, even if there's an error. + * It is the application's responsibility to close it and make sure there's no + * file descriptor leak. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * @since v16.11.0 + */ + createWriteStream(options?: CreateWriteStreamOptions): WriteStream; + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. + * + * Unlike `filehandle.sync` this method does not flush modified metadata. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + datasync(): Promise; + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + sync(): Promise; + /** + * Reads data from the file and stores that in the given buffer. + * + * If the file is not modified concurrently, the end-of-file is reached when the + * number of bytes read is zero. + * @since v10.0.0 + * @param buffer A buffer that will be filled with the file data read. + * @param offset The location in the buffer at which to start filling. + * @param length The number of bytes to read. + * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an + * integer, the current file position will remain unchanged. + * @return Fulfills upon success with an object with two properties: + */ + read(buffer: T, offset?: number | null, length?: number | null, position?: number | null): Promise>; + read(options?: FileReadOptions): Promise>; + /** + * Returns a `ReadableStream` that may be used to read the files data. + * + * An error will be thrown if this method is called more than once or is called + * after the `FileHandle` is closed or closing. + * + * ```js + * import { + * open, + * } from 'node:fs/promises'; + * + * const file = await open('./some/file/to/read'); + * + * for await (const chunk of file.readableWebStream()) + * console.log(chunk); + * + * await file.close(); + * ``` + * + * While the `ReadableStream` will read the file to completion, it will not + * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method. + * @since v17.0.0 + * @experimental + */ + readableWebStream(options?: ReadableWebStreamOptions): ReadableStream; + /** + * Asynchronously reads the entire contents of a file. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `FileHandle` has to support reading. + * + * If one or more `filehandle.read()` calls are made on a file handle and then a`filehandle.readFile()` call is made, the data will be read from the current + * position till the end of the file. It doesn't always read from the beginning + * of the file. + * @since v10.0.0 + * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the + * data will be a string. + */ + readFile( + options?: { + encoding?: null | undefined; + flag?: OpenMode | undefined; + } | null + ): Promise; + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile( + options: + | { + encoding: BufferEncoding; + flag?: OpenMode | undefined; + } + | BufferEncoding + ): Promise; + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile( + options?: + | (ObjectEncodingOptions & { + flag?: OpenMode | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Convenience method to create a `readline` interface and stream over the file. + * See `filehandle.createReadStream()` for the options. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const file = await open('./some/file/to/read'); + * + * for await (const line of file.readLines()) { + * console.log(line); + * } + * ``` + * @since v18.11.0 + */ + readLines(options?: CreateReadStreamOptions): ReadlineInterface; + /** + * @since v10.0.0 + * @return Fulfills with an {fs.Stats} for the file. + */ + stat( + opts?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + stat( + opts: StatOptions & { + bigint: true; + } + ): Promise; + stat(opts?: StatOptions): Promise; + /** + * Truncates the file. + * + * If the file was larger than `len` bytes, only the first `len` bytes will be + * retained in the file. + * + * The following example retains only the first four bytes of the file: + * + * ```js + * import { open } from 'node:fs/promises'; + * + * let filehandle = null; + * try { + * filehandle = await open('temp.txt', 'r+'); + * await filehandle.truncate(4); + * } finally { + * await filehandle?.close(); + * } + * ``` + * + * If the file previously was shorter than `len` bytes, it is extended, and the + * extended part is filled with null bytes (`'\0'`): + * + * If `len` is negative then `0` will be used. + * @since v10.0.0 + * @param [len=0] + * @return Fulfills with `undefined` upon success. + */ + truncate(len?: number): Promise; + /** + * Change the file system timestamps of the object referenced by the `FileHandle` then resolves the promise with no arguments upon success. + * @since v10.0.0 + */ + utimes(atime: TimeLike, mtime: TimeLike): Promise; + /** + * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an + * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an + * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. + * The promise is resolved with no arguments upon success. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `FileHandle` has to support writing. + * + * It is unsafe to use `filehandle.writeFile()` multiple times on the same file + * without waiting for the promise to be resolved (or rejected). + * + * If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the + * current position till the end of the file. It doesn't always write from the + * beginning of the file. + * @since v10.0.0 + */ + writeFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode & Abortable) | BufferEncoding | null): Promise; + /** + * Write `buffer` to the file. + * + * The promise is resolved with an object containing two properties: + * + * It is unsafe to use `filehandle.write()` multiple times on the same file + * without waiting for the promise to be resolved (or rejected). For this + * scenario, use `filehandle.createWriteStream()`. + * + * On Linux, positional writes do not work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v10.0.0 + * @param offset The start position from within `buffer` where the data to write begins. + * @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write. + * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current + * position. See the POSIX pwrite(2) documentation for more detail. + */ + write( + buffer: TBuffer, + offset?: number | null, + length?: number | null, + position?: number | null + ): Promise<{ + bytesWritten: number; + buffer: TBuffer; + }>; + write( + data: string, + position?: number | null, + encoding?: BufferEncoding | null + ): Promise<{ + bytesWritten: number; + buffer: string; + }>; + /** + * Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file. + * + * The promise is resolved with an object containing a two properties: + * + * It is unsafe to call `writev()` multiple times on the same file without waiting + * for the promise to be resolved (or rejected). + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v12.9.0 + * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current + * position. + */ + writev(buffers: ReadonlyArray, position?: number): Promise; + /** + * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s + * @since v13.13.0, v12.17.0 + * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position. + * @return Fulfills upon success an object containing two properties: + */ + readv(buffers: ReadonlyArray, position?: number): Promise; + /** + * Closes the file handle after waiting for any pending operation on the handle to + * complete. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * let filehandle; + * try { + * filehandle = await open('thefile.txt', 'r'); + * } finally { + * await filehandle?.close(); + * } + * ``` + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + close(): Promise; + /** + * An alias for {@link FileHandle.close()}. + * @since v20.4.0 + */ + [Symbol.asyncDispose](): Promise; + } + const constants: typeof fsConstants; + /** + * Tests a user's permissions for the file or directory specified by `path`. + * The `mode` argument is an optional integer that specifies the accessibility + * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK` + * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * If the accessibility check is successful, the promise is resolved with no + * value. If any of the accessibility checks fail, the promise is rejected + * with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and + * written by the current process. + * + * ```js + * import { access, constants } from 'node:fs/promises'; + * + * try { + * await access('/etc/passwd', constants.R_OK | constants.W_OK); + * console.log('can access'); + * } catch { + * console.error('cannot access'); + * } + * ``` + * + * Using `fsPromises.access()` to check for the accessibility of a file before + * calling `fsPromises.open()` is not recommended. Doing so introduces a race + * condition, since other processes may change the file's state between the two + * calls. Instead, user code should open/read/write the file directly and handle + * the error raised if the file is not accessible. + * @since v10.0.0 + * @param [mode=fs.constants.F_OK] + * @return Fulfills with `undefined` upon success. + */ + function access(path: PathLike, mode?: number): Promise; + /** + * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. + * + * No guarantees are made about the atomicity of the copy operation. If an + * error occurs after the destination file has been opened for writing, an attempt + * will be made to remove the destination. + * + * ```js + * import { copyFile, constants } from 'node:fs/promises'; + * + * try { + * await copyFile('source.txt', 'destination.txt'); + * console.log('source.txt was copied to destination.txt'); + * } catch { + * console.error('The file could not be copied'); + * } + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * try { + * await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL); + * console.log('source.txt was copied to destination.txt'); + * } catch { + * console.error('The file could not be copied'); + * } + * ``` + * @since v10.0.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. + * `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`) + * @return Fulfills with `undefined` upon success. + */ + function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise; + /** + * Opens a `FileHandle`. + * + * Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail. + * + * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented + * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains + * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). + * @since v10.0.0 + * @param [flags='r'] See `support of file system `flags``. + * @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created. + * @return Fulfills with a {FileHandle} object. + */ + function open(path: PathLike, flags?: string | number, mode?: Mode): Promise; + /** + * Renames `oldPath` to `newPath`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function rename(oldPath: PathLike, newPath: PathLike): Promise; + /** + * Truncates (shortens or extends the length) of the content at `path` to `len`bytes. + * @since v10.0.0 + * @param [len=0] + * @return Fulfills with `undefined` upon success. + */ + function truncate(path: PathLike, len?: number): Promise; + /** + * Removes the directory identified by `path`. + * + * Using `fsPromises.rmdir()` on a file (not a directory) results in the + * promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR`error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function rmdir(path: PathLike, options?: RmDirOptions): Promise; + /** + * Removes files and directories (modeled on the standard POSIX `rm` utility). + * @since v14.14.0 + * @return Fulfills with `undefined` upon success. + */ + function rm(path: PathLike, options?: RmOptions): Promise; + /** + * Asynchronously creates a directory. + * + * The optional `options` argument can be an integer specifying `mode` (permission + * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory + * that exists results in a + * rejection only when `recursive` is false. + * + * ```js + * import { mkdir } from 'node:fs/promises'; + * + * try { + * const projectFolder = new URL('./test/project/', import.meta.url); + * const createDir = await mkdir(projectFolder, { recursive: true }); + * + * console.log(`created ${createDir}`); + * } catch (err) { + * console.error(err.message); + * } + * ``` + * @since v10.0.0 + * @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`. + */ + function mkdir( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + } + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function mkdir( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function mkdir(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; + /** + * Reads the contents of a directory. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames. If the `encoding` is set to `'buffer'`, the filenames returned + * will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the resolved array will contain `fs.Dirent` objects. + * + * ```js + * import { readdir } from 'node:fs/promises'; + * + * try { + * const files = await readdir(path); + * for (const file of files) + * console.log(file); + * } catch (err) { + * console.error(err); + * } + * ``` + * @since v10.0.0 + * @return Fulfills with an array of the names of the files in the directory excluding `'.'` and `'..'`. + */ + function readdir( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir( + path: PathLike, + options: + | { + encoding: 'buffer'; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | 'buffer' + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + function readdir( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + } + ): Promise; + /** + * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is + * resolved with the`linkString` upon success. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path returned. If the `encoding` is set to `'buffer'`, the link path + * returned will be passed as a `Buffer` object. + * @since v10.0.0 + * @return Fulfills with the `linkString` upon success. + */ + function readlink(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise; + /** + * Creates a symbolic link. + * + * The `type` argument is only used on Windows platforms and can be one of `'dir'`,`'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will + * autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not + * exist, `'file'` will be used. Windows junction points require the destination + * path to be absolute. When using `'junction'`, the `target` argument will + * automatically be normalized to absolute path. Junction points on NTFS volumes + * can only point to directories. + * @since v10.0.0 + * @param [type='null'] + * @return Fulfills with `undefined` upon success. + */ + function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; + /** + * Equivalent to `fsPromises.stat()` unless `path` refers to a symbolic link, + * in which case the link itself is stat-ed, not the file that it refers to. + * Refer to the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) document for more detail. + * @since v10.0.0 + * @return Fulfills with the {fs.Stats} object for the given symbolic link `path`. + */ + function lstat( + path: PathLike, + opts?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function lstat( + path: PathLike, + opts: StatOptions & { + bigint: true; + } + ): Promise; + function lstat(path: PathLike, opts?: StatOptions): Promise; + /** + * @since v10.0.0 + * @return Fulfills with the {fs.Stats} object for the given `path`. + */ + function stat( + path: PathLike, + opts?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function stat( + path: PathLike, + opts: StatOptions & { + bigint: true; + } + ): Promise; + function stat(path: PathLike, opts?: StatOptions): Promise; + /** + * @since v19.6.0, v18.15.0 + * @return Fulfills with the {fs.StatFs} object for the given `path`. + */ + function statfs( + path: PathLike, + opts?: StatFsOptions & { + bigint?: false | undefined; + } + ): Promise; + function statfs( + path: PathLike, + opts: StatFsOptions & { + bigint: true; + } + ): Promise; + function statfs(path: PathLike, opts?: StatFsOptions): Promise; + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function link(existingPath: PathLike, newPath: PathLike): Promise; + /** + * If `path` refers to a symbolic link, then the link is removed without affecting + * the file or directory to which that link refers. If the `path` refers to a file + * path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function unlink(path: PathLike): Promise; + /** + * Changes the permissions of a file. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function chmod(path: PathLike, mode: Mode): Promise; + /** + * Changes the permissions on a symbolic link. + * + * This method is only implemented on macOS. + * @deprecated Since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function lchmod(path: PathLike, mode: Mode): Promise; + /** + * Changes the ownership on a symbolic link. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function lchown(path: PathLike, uid: number, gid: number): Promise; + /** + * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, with the difference that if the path refers to a + * symbolic link, then the link is not dereferenced: instead, the timestamps of + * the symbolic link itself are changed. + * @since v14.5.0, v12.19.0 + * @return Fulfills with `undefined` upon success. + */ + function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + /** + * Changes the ownership of a file. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function chown(path: PathLike, uid: number, gid: number): Promise; + /** + * Change the file system timestamps of the object referenced by `path`. + * + * The `atime` and `mtime` arguments follow these rules: + * + * * Values can be either numbers representing Unix epoch time, `Date`s, or a + * numeric string like `'123456789.0'`. + * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + /** + * Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path. If the `encoding` is set to `'buffer'`, the path returned will be + * passed as a `Buffer` object. + * + * On Linux, when Node.js is linked against musl libc, the procfs file system must + * be mounted on `/proc` in order for this function to work. Glibc does not have + * this restriction. + * @since v10.0.0 + * @return Fulfills with the resolved path upon success. + */ + function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Creates a unique temporary directory. A unique directory name is generated by + * appending six random characters to the end of the provided `prefix`. Due to + * platform inconsistencies, avoid trailing `X` characters in `prefix`. Some + * platforms, notably the BSDs, can return more than six random characters, and + * replace trailing `X` characters in `prefix` with random characters. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * + * ```js + * import { mkdtemp } from 'node:fs/promises'; + * import { join } from 'node:path'; + * import { tmpdir } from 'node:os'; + * + * try { + * await mkdtemp(join(tmpdir(), 'foo-')); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * The `fsPromises.mkdtemp()` method will append the six randomly selected + * characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing + * platform-specific path separator + * (`require('node:path').sep`). + * @since v10.0.0 + * @return Fulfills with a string containing the file system path of the newly created temporary directory. + */ + function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an + * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an + * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. + * + * The `encoding` option is ignored if `data` is a buffer. + * + * If `options` is a string, then it specifies the encoding. + * + * The `mode` option only affects the newly created file. See `fs.open()` for more details. + * + * Any specified `FileHandle` has to support writing. + * + * It is unsafe to use `fsPromises.writeFile()` multiple times on the same file + * without waiting for the promise to be settled. + * + * Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience + * method that performs multiple `write` calls internally to write the buffer + * passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`. + * + * It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`. + * Cancelation is "best effort", and some amount of data is likely still + * to be written. + * + * ```js + * import { writeFile } from 'node:fs/promises'; + * import { Buffer } from 'node:buffer'; + * + * try { + * const controller = new AbortController(); + * const { signal } = controller; + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * const promise = writeFile('message.txt', data, { signal }); + * + * // Abort the request before the promise settles. + * controller.abort(); + * + * await promise; + * } catch (err) { + * // When a request is aborted - err is an AbortError + * console.error(err); + * } + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.writeFile` performs. + * @since v10.0.0 + * @param file filename or `FileHandle` + * @return Fulfills with `undefined` upon success. + */ + function writeFile( + file: PathLike | FileHandle, + data: string | NodeJS.ArrayBufferView | Iterable | AsyncIterable | Stream, + options?: + | (ObjectEncodingOptions & { + mode?: Mode | undefined; + flag?: OpenMode | undefined; + } & Abortable) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `mode` option only affects the newly created file. See `fs.open()` for more details. + * + * The `path` may be specified as a `FileHandle` that has been opened + * for appending (using `fsPromises.open()`). + * @since v10.0.0 + * @param path filename or {FileHandle} + * @return Fulfills with `undefined` upon success. + */ + function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise; + /** + * Asynchronously reads the entire contents of a file. + * + * If no encoding is specified (using `options.encoding`), the data is returned + * as a `Buffer` object. Otherwise, the data will be a string. + * + * If `options` is a string, then it specifies the encoding. + * + * When the `path` is a directory, the behavior of `fsPromises.readFile()` is + * platform-specific. On macOS, Linux, and Windows, the promise will be rejected + * with an error. On FreeBSD, a representation of the directory's contents will be + * returned. + * + * An example of reading a `package.json` file located in the same directory of the + * running code: + * + * ```js + * import { readFile } from 'node:fs/promises'; + * try { + * const filePath = new URL('./package.json', import.meta.url); + * const contents = await readFile(filePath, { encoding: 'utf8' }); + * console.log(contents); + * } catch (err) { + * console.error(err.message); + * } + * ``` + * + * It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a + * request is aborted the promise returned is rejected with an `AbortError`: + * + * ```js + * import { readFile } from 'node:fs/promises'; + * + * try { + * const controller = new AbortController(); + * const { signal } = controller; + * const promise = readFile(fileName, { signal }); + * + * // Abort the request before the promise settles. + * controller.abort(); + * + * await promise; + * } catch (err) { + * // When a request is aborted - err is an AbortError + * console.error(err); + * } + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.readFile` performs. + * + * Any specified `FileHandle` has to support reading. + * @since v10.0.0 + * @param path filename or `FileHandle` + * @return Fulfills with the contents of the file. + */ + function readFile( + path: PathLike | FileHandle, + options?: + | ({ + encoding?: null | undefined; + flag?: OpenMode | undefined; + } & Abortable) + | null + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile( + path: PathLike | FileHandle, + options: + | ({ + encoding: BufferEncoding; + flag?: OpenMode | undefined; + } & Abortable) + | BufferEncoding + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile( + path: PathLike | FileHandle, + options?: + | (ObjectEncodingOptions & + Abortable & { + flag?: OpenMode | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail. + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * + * Example using async iteration: + * + * ```js + * import { opendir } from 'node:fs/promises'; + * + * try { + * const dir = await opendir('./'); + * for await (const dirent of dir) + * console.log(dirent.name); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * When using the async iterator, the `fs.Dir` object will be automatically + * closed after the iterator exits. + * @since v12.12.0 + * @return Fulfills with an {fs.Dir}. + */ + function opendir(path: PathLike, options?: OpenDirOptions): Promise; + /** + * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory. + * + * ```js + * const { watch } = require('node:fs/promises'); + * + * const ac = new AbortController(); + * const { signal } = ac; + * setTimeout(() => ac.abort(), 10000); + * + * (async () => { + * try { + * const watcher = watch(__filename, { signal }); + * for await (const event of watcher) + * console.log(event); + * } catch (err) { + * if (err.name === 'AbortError') + * return; + * throw err; + * } + * })(); + * ``` + * + * On most platforms, `'rename'` is emitted whenever a filename appears or + * disappears in the directory. + * + * All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`. + * @since v15.9.0, v14.18.0 + * @return of objects with the properties: + */ + function watch( + filename: PathLike, + options: + | (WatchOptions & { + encoding: 'buffer'; + }) + | 'buffer' + ): AsyncIterable>; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable>; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable> | AsyncIterable>; + /** + * Asynchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + * @return Fulfills with `undefined` upon success. + */ + function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise; +} +declare module 'node:fs/promises' { + export * from 'fs/promises'; +} diff --git a/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts new file mode 100755 index 0000000..1336d61 --- /dev/null +++ b/node_modules/@types/node/globals.d.ts @@ -0,0 +1,325 @@ +// Declare "static" methods in Error +interface ErrorConstructor { + /** Create .stack property on a target object */ + captureStackTrace(targetObject: object, constructorOpt?: Function): void; + + /** + * Optional override for formatting stack traces + * + * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces + */ + prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; + + stackTraceLimit: number; +} + +/*-----------------------------------------------* + * * + * GLOBAL * + * * + ------------------------------------------------*/ + +// For backwards compability +interface NodeRequire extends NodeJS.Require { } +interface RequireResolve extends NodeJS.RequireResolve { } +interface NodeModule extends NodeJS.Module { } + +declare var process: NodeJS.Process; +declare var console: Console; + +declare var __filename: string; +declare var __dirname: string; + +declare var require: NodeRequire; +declare var module: NodeModule; + +// Same as module.exports +declare var exports: any; + +/** + * Only available if `--expose-gc` is passed to the process. + */ +declare var gc: undefined | (() => void); + +//#region borrowed +// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib +/** A controller object that allows you to abort one or more DOM requests as and when desired. */ +interface AbortController { + /** + * Returns the AbortSignal object associated with this object. + */ + + readonly signal: AbortSignal; + /** + * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. + */ + abort(reason?: any): void; +} + +/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ +interface AbortSignal extends EventTarget { + /** + * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + */ + readonly aborted: boolean; + readonly reason: any; + onabort: null | ((this: AbortSignal, event: Event) => any); + throwIfAborted(): void; +} + +declare var AbortController: typeof globalThis extends {onmessage: any; AbortController: infer T} + ? T + : { + prototype: AbortController; + new(): AbortController; + }; + +declare var AbortSignal: typeof globalThis extends {onmessage: any; AbortSignal: infer T} + ? T + : { + prototype: AbortSignal; + new(): AbortSignal; + abort(reason?: any): AbortSignal; + timeout(milliseconds: number): AbortSignal; + }; +//#endregion borrowed + +//#region Disposable +interface SymbolConstructor { + /** + * A method that is used to release resources held by an object. Called by the semantics of the `using` statement. + */ + readonly dispose: unique symbol; + + /** + * A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement. + */ + readonly asyncDispose: unique symbol; +} + +interface Disposable { + [Symbol.dispose](): void; +} + +interface AsyncDisposable { + [Symbol.asyncDispose](): PromiseLike; +} +//#endregion Disposable + +//#region ArrayLike.at() +interface RelativeIndexable { + /** + * Takes an integer value and returns the item at that index, + * allowing for positive and negative integers. + * Negative integers count back from the last item in the array. + */ + at(index: number): T | undefined; +} +interface String extends RelativeIndexable {} +interface Array extends RelativeIndexable {} +interface ReadonlyArray extends RelativeIndexable {} +interface Int8Array extends RelativeIndexable {} +interface Uint8Array extends RelativeIndexable {} +interface Uint8ClampedArray extends RelativeIndexable {} +interface Int16Array extends RelativeIndexable {} +interface Uint16Array extends RelativeIndexable {} +interface Int32Array extends RelativeIndexable {} +interface Uint32Array extends RelativeIndexable {} +interface Float32Array extends RelativeIndexable {} +interface Float64Array extends RelativeIndexable {} +interface BigInt64Array extends RelativeIndexable {} +interface BigUint64Array extends RelativeIndexable {} +//#endregion ArrayLike.at() end + +/** + * @since v17.0.0 + * + * Creates a deep clone of an object. + */ +declare function structuredClone( + value: T, + transfer?: { transfer: ReadonlyArray }, +): T; + +/*----------------------------------------------* +* * +* GLOBAL INTERFACES * +* * +*-----------------------------------------------*/ +declare namespace NodeJS { + interface CallSite { + /** + * Value of "this" + */ + getThis(): unknown; + + /** + * Type of "this" as a string. + * This is the name of the function stored in the constructor field of + * "this", if available. Otherwise the object's [[Class]] internal + * property. + */ + getTypeName(): string | null; + + /** + * Current function + */ + getFunction(): Function | undefined; + + /** + * Name of the current function, typically its name property. + * If a name property is not available an attempt will be made to try + * to infer a name from the function's context. + */ + getFunctionName(): string | null; + + /** + * Name of the property [of "this" or one of its prototypes] that holds + * the current function + */ + getMethodName(): string | null; + + /** + * Name of the script [if this function was defined in a script] + */ + getFileName(): string | undefined; + + /** + * Current line number [if this function was defined in a script] + */ + getLineNumber(): number | null; + + /** + * Current column number [if this function was defined in a script] + */ + getColumnNumber(): number | null; + + /** + * A call site object representing the location where eval was called + * [if this function was created using a call to eval] + */ + getEvalOrigin(): string | undefined; + + /** + * Is this a toplevel invocation, that is, is "this" the global object? + */ + isToplevel(): boolean; + + /** + * Does this call take place in code defined by a call to eval? + */ + isEval(): boolean; + + /** + * Is this call in native V8 code? + */ + isNative(): boolean; + + /** + * Is this a constructor call? + */ + isConstructor(): boolean; + } + + interface ErrnoException extends Error { + errno?: number | undefined; + code?: string | undefined; + path?: string | undefined; + syscall?: string | undefined; + } + + interface ReadableStream extends EventEmitter { + readable: boolean; + read(size?: number): string | Buffer; + setEncoding(encoding: BufferEncoding): this; + pause(): this; + resume(): this; + isPaused(): boolean; + pipe(destination: T, options?: { end?: boolean | undefined; }): T; + unpipe(destination?: WritableStream): this; + unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; + wrap(oldStream: ReadableStream): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + + interface WritableStream extends EventEmitter { + writable: boolean; + write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; + write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; + end(cb?: () => void): this; + end(data: string | Uint8Array, cb?: () => void): this; + end(str: string, encoding?: BufferEncoding, cb?: () => void): this; + } + + interface ReadWriteStream extends ReadableStream, WritableStream { } + + interface RefCounted { + ref(): this; + unref(): this; + } + + type TypedArray = + | Uint8Array + | Uint8ClampedArray + | Uint16Array + | Uint32Array + | Int8Array + | Int16Array + | Int32Array + | BigUint64Array + | BigInt64Array + | Float32Array + | Float64Array; + type ArrayBufferView = TypedArray | DataView; + + interface Require { + (id: string): any; + resolve: RequireResolve; + cache: Dict; + /** + * @deprecated + */ + extensions: RequireExtensions; + main: Module | undefined; + } + + interface RequireResolve { + (id: string, options?: { paths?: string[] | undefined; }): string; + paths(request: string): string[] | null; + } + + interface RequireExtensions extends Dict<(m: Module, filename: string) => any> { + '.js': (m: Module, filename: string) => any; + '.json': (m: Module, filename: string) => any; + '.node': (m: Module, filename: string) => any; + } + interface Module { + /** + * `true` if the module is running during the Node.js preload + */ + isPreloading: boolean; + exports: any; + require: Require; + id: string; + filename: string; + loaded: boolean; + /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */ + parent: Module | null | undefined; + children: Module[]; + /** + * @since v11.14.0 + * + * The directory name of the module. This is usually the same as the path.dirname() of the module.id. + */ + path: string; + paths: string[]; + } + + interface Dict { + [key: string]: T | undefined; + } + + interface ReadOnlyDict { + readonly [key: string]: T | undefined; + } +} diff --git a/node_modules/@types/node/globals.global.d.ts b/node_modules/@types/node/globals.global.d.ts new file mode 100755 index 0000000..ef1198c --- /dev/null +++ b/node_modules/@types/node/globals.global.d.ts @@ -0,0 +1 @@ +declare var global: typeof globalThis; diff --git a/node_modules/@types/node/http.d.ts b/node_modules/@types/node/http.d.ts new file mode 100755 index 0000000..cb50335 --- /dev/null +++ b/node_modules/@types/node/http.d.ts @@ -0,0 +1,1724 @@ +/** + * To use the HTTP server and client one must `require('node:http')`. + * + * The HTTP interfaces in Node.js are designed to support many features + * of the protocol which have been traditionally difficult to use. + * In particular, large, possibly chunk-encoded, messages. The interface is + * careful to never buffer entire requests or responses, so the + * user is able to stream data. + * + * HTTP message headers are represented by an object like this: + * + * ```js + * { 'content-length': '123', + * 'content-type': 'text/plain', + * 'connection': 'keep-alive', + * 'host': 'example.com', + * 'accept': '*' } + * ``` + * + * Keys are lowercased. Values are not modified. + * + * In order to support the full spectrum of possible HTTP applications, the Node.js + * HTTP API is very low-level. It deals with stream handling and message + * parsing only. It parses a message into headers and body but it does not + * parse the actual headers or the body. + * + * See `message.headers` for details on how duplicate headers are handled. + * + * The raw headers as they were received are retained in the `rawHeaders`property, which is an array of `[key, value, key2, value2, ...]`. For + * example, the previous message header object might have a `rawHeaders`list like the following: + * + * ```js + * [ 'ConTent-Length', '123456', + * 'content-LENGTH', '123', + * 'content-type', 'text/plain', + * 'CONNECTION', 'keep-alive', + * 'Host', 'example.com', + * 'accepT', '*' ] + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http.js) + */ +declare module 'http' { + import * as stream from 'node:stream'; + import { URL } from 'node:url'; + import { LookupOptions } from 'node:dns'; + import { EventEmitter } from 'node:events'; + import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net'; + // incoming headers will never contain number + interface IncomingHttpHeaders extends NodeJS.Dict { + accept?: string | undefined; + 'accept-language'?: string | undefined; + 'accept-patch'?: string | undefined; + 'accept-ranges'?: string | undefined; + 'access-control-allow-credentials'?: string | undefined; + 'access-control-allow-headers'?: string | undefined; + 'access-control-allow-methods'?: string | undefined; + 'access-control-allow-origin'?: string | undefined; + 'access-control-expose-headers'?: string | undefined; + 'access-control-max-age'?: string | undefined; + 'access-control-request-headers'?: string | undefined; + 'access-control-request-method'?: string | undefined; + age?: string | undefined; + allow?: string | undefined; + 'alt-svc'?: string | undefined; + authorization?: string | undefined; + 'cache-control'?: string | undefined; + connection?: string | undefined; + 'content-disposition'?: string | undefined; + 'content-encoding'?: string | undefined; + 'content-language'?: string | undefined; + 'content-length'?: string | undefined; + 'content-location'?: string | undefined; + 'content-range'?: string | undefined; + 'content-type'?: string | undefined; + cookie?: string | undefined; + date?: string | undefined; + etag?: string | undefined; + expect?: string | undefined; + expires?: string | undefined; + forwarded?: string | undefined; + from?: string | undefined; + host?: string | undefined; + 'if-match'?: string | undefined; + 'if-modified-since'?: string | undefined; + 'if-none-match'?: string | undefined; + 'if-unmodified-since'?: string | undefined; + 'last-modified'?: string | undefined; + location?: string | undefined; + origin?: string | undefined; + pragma?: string | undefined; + 'proxy-authenticate'?: string | undefined; + 'proxy-authorization'?: string | undefined; + 'public-key-pins'?: string | undefined; + range?: string | undefined; + referer?: string | undefined; + 'retry-after'?: string | undefined; + 'sec-websocket-accept'?: string | undefined; + 'sec-websocket-extensions'?: string | undefined; + 'sec-websocket-key'?: string | undefined; + 'sec-websocket-protocol'?: string | undefined; + 'sec-websocket-version'?: string | undefined; + 'set-cookie'?: string[] | undefined; + 'strict-transport-security'?: string | undefined; + tk?: string | undefined; + trailer?: string | undefined; + 'transfer-encoding'?: string | undefined; + upgrade?: string | undefined; + 'user-agent'?: string | undefined; + vary?: string | undefined; + via?: string | undefined; + warning?: string | undefined; + 'www-authenticate'?: string | undefined; + } + // outgoing headers allows numbers (as they are converted internally to strings) + type OutgoingHttpHeader = number | string | string[]; + interface OutgoingHttpHeaders extends NodeJS.Dict {} + interface ClientRequestArgs { + _defaultAgent?: Agent | undefined; + agent?: Agent | boolean | undefined; + auth?: string | null | undefined; + // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 + createConnection?: + | ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) + | undefined; + defaultPort?: number | string | undefined; + family?: number | undefined; + headers?: OutgoingHttpHeaders | undefined; + hints?: LookupOptions['hints']; + host?: string | null | undefined; + hostname?: string | null | undefined; + insecureHTTPParser?: boolean | undefined; + localAddress?: string | undefined; + localPort?: number | undefined; + lookup?: LookupFunction | undefined; + /** + * @default 16384 + */ + maxHeaderSize?: number | undefined; + method?: string | undefined; + path?: string | null | undefined; + port?: number | string | null | undefined; + protocol?: string | null | undefined; + setHost?: boolean | undefined; + signal?: AbortSignal | undefined; + socketPath?: string | undefined; + timeout?: number | undefined; + uniqueHeaders?: Array | undefined; + joinDuplicateHeaders?: boolean; + } + interface ServerOptions< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + > { + /** + * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`. + */ + IncomingMessage?: Request | undefined; + /** + * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`. + */ + ServerResponse?: Response | undefined; + /** + * Sets the timeout value in milliseconds for receiving the entire request from the client. + * @see Server.requestTimeout for more information. + * @default 300000 + * @since v18.0.0 + */ + requestTimeout?: number | undefined; + /** + * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates. + * @default false + * @since v18.14.0 + */ + joinDuplicateHeaders?: boolean; + /** + * The number of milliseconds of inactivity a server needs to wait for additional incoming data, + * after it has finished writing the last response, before a socket will be destroyed. + * @see Server.keepAliveTimeout for more information. + * @default 5000 + * @since v18.0.0 + */ + keepAliveTimeout?: number | undefined; + /** + * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests. + * @default 30000 + */ + connectionsCheckingInterval?: number | undefined; + /** + * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. + * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. + * Default: @see stream.getDefaultHighWaterMark(). + * @since v20.1.0 + */ + highWaterMark?: number | undefined; + /** + * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`. + * Using the insecure parser should be avoided. + * See --insecure-http-parser for more information. + * @default false + */ + insecureHTTPParser?: boolean | undefined; + /** + * Optionally overrides the value of + * `--max-http-header-size` for requests received by this server, i.e. + * the maximum length of request headers in bytes. + * @default 16384 + * @since v13.3.0 + */ + maxHeaderSize?: number | undefined; + /** + * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. + * @default true + * @since v16.5.0 + */ + noDelay?: boolean | undefined; + /** + * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, + * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. + * @default false + * @since v16.5.0 + */ + keepAlive?: boolean | undefined; + /** + * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. + * @default 0 + * @since v16.5.0 + */ + keepAliveInitialDelay?: number | undefined; + /** + * A list of response headers that should be sent only once. + * If the header's value is an array, the items will be joined using `; `. + */ + uniqueHeaders?: Array | undefined; + } + type RequestListener< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + > = (req: InstanceType, res: InstanceType & { req: InstanceType }) => void; + /** + * @since v0.1.17 + */ + class Server< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + > extends NetServer { + constructor(requestListener?: RequestListener); + constructor(options: ServerOptions, requestListener?: RequestListener); + /** + * Sets the timeout value for sockets, and emits a `'timeout'` event on + * the Server object, passing the socket as an argument, if a timeout + * occurs. + * + * If there is a `'timeout'` event listener on the Server object, then it + * will be called with the timed-out socket as an argument. + * + * By default, the Server does not timeout sockets. However, if a callback + * is assigned to the Server's `'timeout'` event, timeouts must be handled + * explicitly. + * @since v0.9.12 + * @param [msecs=0 (no timeout)] + */ + setTimeout(msecs?: number, callback?: () => void): this; + setTimeout(callback: () => void): this; + /** + * Limits maximum incoming headers count. If set to 0, no limit will be applied. + * @since v0.7.0 + */ + maxHeadersCount: number | null; + /** + * The maximum number of requests socket can handle + * before closing keep alive connection. + * + * A value of `0` will disable the limit. + * + * When the limit is reached it will set the `Connection` header value to `close`, + * but will not actually close the connection, subsequent requests sent + * after the limit is reached will get `503 Service Unavailable` as a response. + * @since v16.10.0 + */ + maxRequestsPerSocket: number | null; + /** + * The number of milliseconds of inactivity before a socket is presumed + * to have timed out. + * + * A value of `0` will disable the timeout behavior on incoming connections. + * + * The socket timeout logic is set up on connection, so changing this + * value only affects new connections to the server, not any existing connections. + * @since v0.9.12 + */ + timeout: number; + /** + * Limit the amount of time the parser will wait to receive the complete HTTP + * headers. + * + * If the timeout expires, the server responds with status 408 without + * forwarding the request to the request listener and then closes the connection. + * + * It must be set to a non-zero value (e.g. 120 seconds) to protect against + * potential Denial-of-Service attacks in case the server is deployed without a + * reverse proxy in front. + * @since v11.3.0, v10.14.0 + */ + headersTimeout: number; + /** + * The number of milliseconds of inactivity a server needs to wait for additional + * incoming data, after it has finished writing the last response, before a socket + * will be destroyed. If the server receives new data before the keep-alive + * timeout has fired, it will reset the regular inactivity timeout, i.e.,`server.timeout`. + * + * A value of `0` will disable the keep-alive timeout behavior on incoming + * connections. + * A value of `0` makes the http server behave similarly to Node.js versions prior + * to 8.0.0, which did not have a keep-alive timeout. + * + * The socket timeout logic is set up on connection, so changing this value only + * affects new connections to the server, not any existing connections. + * @since v8.0.0 + */ + keepAliveTimeout: number; + /** + * Sets the timeout value in milliseconds for receiving the entire request from + * the client. + * + * If the timeout expires, the server responds with status 408 without + * forwarding the request to the request listener and then closes the connection. + * + * It must be set to a non-zero value (e.g. 120 seconds) to protect against + * potential Denial-of-Service attacks in case the server is deployed without a + * reverse proxy in front. + * @since v14.11.0 + */ + requestTimeout: number; + /** + * Closes all connections connected to this server. + * @since v18.2.0 + */ + closeAllConnections(): void; + /** + * Closes all connections connected to this server which are not sending a request + * or waiting for a response. + * @since v18.2.0 + */ + closeIdleConnections(): void; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'connection', listener: (socket: Socket) => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'listening', listener: () => void): this; + addListener(event: 'checkContinue', listener: RequestListener): this; + addListener(event: 'checkExpectation', listener: RequestListener): this; + addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + addListener(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + addListener(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + addListener(event: 'request', listener: RequestListener): this; + addListener(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + emit(event: string, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'connection', socket: Socket): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'listening'): boolean; + emit( + event: 'checkContinue', + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit( + event: 'checkExpectation', + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean; + emit(event: 'connect', req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; + emit(event: 'dropRequest', req: InstanceType, socket: stream.Duplex): boolean; + emit( + event: 'request', + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit(event: 'upgrade', req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'connection', listener: (socket: Socket) => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'listening', listener: () => void): this; + on(event: 'checkContinue', listener: RequestListener): this; + on(event: 'checkExpectation', listener: RequestListener): this; + on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + on(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + on(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + on(event: 'request', listener: RequestListener): this; + on(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'connection', listener: (socket: Socket) => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'listening', listener: () => void): this; + once(event: 'checkContinue', listener: RequestListener): this; + once(event: 'checkExpectation', listener: RequestListener): this; + once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + once(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + once(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + once(event: 'request', listener: RequestListener): this; + once(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'connection', listener: (socket: Socket) => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'listening', listener: () => void): this; + prependListener(event: 'checkContinue', listener: RequestListener): this; + prependListener(event: 'checkExpectation', listener: RequestListener): this; + prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + prependListener(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + prependListener(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + prependListener(event: 'request', listener: RequestListener): this; + prependListener(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'listening', listener: () => void): this; + prependOnceListener(event: 'checkContinue', listener: RequestListener): this; + prependOnceListener(event: 'checkExpectation', listener: RequestListener): this; + prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + prependOnceListener(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + prependOnceListener(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + prependOnceListener(event: 'request', listener: RequestListener): this; + prependOnceListener(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + } + /** + * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from + * the perspective of the participants of an HTTP transaction. + * @since v0.1.17 + */ + class OutgoingMessage extends stream.Writable { + readonly req: Request; + chunkedEncoding: boolean; + shouldKeepAlive: boolean; + useChunkedEncodingByDefault: boolean; + sendDate: boolean; + /** + * @deprecated Use `writableEnded` instead. + */ + finished: boolean; + /** + * Read-only. `true` if the headers were sent, otherwise `false`. + * @since v0.9.3 + */ + readonly headersSent: boolean; + /** + * Alias of `outgoingMessage.socket`. + * @since v0.3.0 + * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead. + */ + readonly connection: Socket | null; + /** + * Reference to the underlying socket. Usually, users will not want to access + * this property. + * + * After calling `outgoingMessage.end()`, this property will be nulled. + * @since v0.3.0 + */ + readonly socket: Socket | null; + constructor(); + /** + * Once a socket is associated with the message and is connected,`socket.setTimeout()` will be called with `msecs` as the first parameter. + * @since v0.9.12 + * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. + */ + setTimeout(msecs: number, callback?: () => void): this; + /** + * Sets a single header value. If the header already exists in the to-be-sent + * headers, its value will be replaced. Use an array of strings to send multiple + * headers with the same name. + * @since v0.4.0 + * @param name Header name + * @param value Header value + */ + setHeader(name: string, value: number | string | ReadonlyArray): this; + /** + * Append a single header value for the header object. + * + * If the value is an array, this is equivalent of calling this method multiple + * times. + * + * If there were no previous value for the header, this is equivalent of calling `outgoingMessage.setHeader(name, value)`. + * + * Depending of the value of `options.uniqueHeaders` when the client request or the + * server were created, this will end up in the header being sent multiple times or + * a single time with values joined using `; `. + * @since v18.3.0, v16.17.0 + * @param name Header name + * @param value Header value + */ + appendHeader(name: string, value: string | ReadonlyArray): this; + /** + * Gets the value of the HTTP header with the given name. If that header is not + * set, the returned value will be `undefined`. + * @since v0.4.0 + * @param name Name of header + */ + getHeader(name: string): number | string | string[] | undefined; + /** + * Returns a shallow copy of the current outgoing headers. Since a shallow + * copy is used, array values may be mutated without additional calls to + * various header-related HTTP module methods. The keys of the returned + * object are the header names and the values are the respective header + * values. All header names are lowercase. + * + * The object returned by the `outgoingMessage.getHeaders()` method does + * not prototypically inherit from the JavaScript `Object`. This means that + * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, + * and others are not defined and will not work. + * + * ```js + * outgoingMessage.setHeader('Foo', 'bar'); + * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headers = outgoingMessage.getHeaders(); + * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } + * ``` + * @since v7.7.0 + */ + getHeaders(): OutgoingHttpHeaders; + /** + * Returns an array containing the unique names of the current outgoing headers. + * All names are lowercase. + * @since v7.7.0 + */ + getHeaderNames(): string[]; + /** + * Returns `true` if the header identified by `name` is currently set in the + * outgoing headers. The header name is case-insensitive. + * + * ```js + * const hasContentType = outgoingMessage.hasHeader('content-type'); + * ``` + * @since v7.7.0 + */ + hasHeader(name: string): boolean; + /** + * Removes a header that is queued for implicit sending. + * + * ```js + * outgoingMessage.removeHeader('Content-Encoding'); + * ``` + * @since v0.4.0 + * @param name Header name + */ + removeHeader(name: string): void; + /** + * Adds HTTP trailers (headers but at the end of the message) to the message. + * + * Trailers will **only** be emitted if the message is chunked encoded. If not, + * the trailers will be silently discarded. + * + * HTTP requires the `Trailer` header to be sent to emit trailers, + * with a list of header field names in its value, e.g. + * + * ```js + * message.writeHead(200, { 'Content-Type': 'text/plain', + * 'Trailer': 'Content-MD5' }); + * message.write(fileData); + * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' }); + * message.end(); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v0.3.0 + */ + addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; + /** + * Flushes the message headers. + * + * For efficiency reason, Node.js normally buffers the message headers + * until `outgoingMessage.end()` is called or the first chunk of message data + * is written. It then tries to pack the headers and data into a single TCP + * packet. + * + * It is usually desired (it saves a TCP round-trip), but not when the first + * data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the message. + * @since v1.6.0 + */ + flushHeaders(): void; + } + /** + * This object is created internally by an HTTP server, not by the user. It is + * passed as the second parameter to the `'request'` event. + * @since v0.1.17 + */ + class ServerResponse extends OutgoingMessage { + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status code that will be sent to the client when + * the headers get flushed. + * + * ```js + * response.statusCode = 404; + * ``` + * + * After response header was sent to the client, this property indicates the + * status code which was sent out. + * @since v0.4.0 + */ + statusCode: number; + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status message that will be sent to the client when + * the headers get flushed. If this is left as `undefined` then the standard + * message for the status code will be used. + * + * ```js + * response.statusMessage = 'Not found'; + * ``` + * + * After response header was sent to the client, this property indicates the + * status message which was sent out. + * @since v0.11.8 + */ + statusMessage: string; + /** + * If set to `true`, Node.js will check whether the `Content-Length`header value and the size of the body, in bytes, are equal. + * Mismatching the `Content-Length` header value will result + * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. + * @since v18.10.0, v16.18.0 + */ + strictContentLength: boolean; + constructor(req: Request); + assignSocket(socket: Socket): void; + detachSocket(socket: Socket): void; + /** + * Sends an HTTP/1.1 100 Continue message to the client, indicating that + * the request body should be sent. See the `'checkContinue'` event on`Server`. + * @since v0.3.0 + */ + writeContinue(callback?: () => void): void; + /** + * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header, + * indicating that the user agent can preload/preconnect the linked resources. + * The `hints` is an object containing the values of headers to be sent with + * early hints message. The optional `callback` argument will be called when + * the response message has been written. + * + * **Example** + * + * ```js + * const earlyHintsLink = '; rel=preload; as=style'; + * response.writeEarlyHints({ + * 'link': earlyHintsLink, + * }); + * + * const earlyHintsLinks = [ + * '; rel=preload; as=style', + * '; rel=preload; as=script', + * ]; + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * 'x-trace-id': 'id for diagnostics', + * }); + * + * const earlyHintsCallback = () => console.log('early hints message sent'); + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * }, earlyHintsCallback); + * ``` + * @since v18.11.0 + * @param hints An object containing the values of headers + * @param callback Will be called when the response message has been written + */ + writeEarlyHints(hints: Record, callback?: () => void): void; + /** + * Sends a response header to the request. The status code is a 3-digit HTTP + * status code, like `404`. The last argument, `headers`, are the response headers. + * Optionally one can give a human-readable `statusMessage` as the second + * argument. + * + * `headers` may be an `Array` where the keys and values are in the same list. + * It is _not_ a list of tuples. So, the even-numbered offsets are key values, + * and the odd-numbered offsets are the associated values. The array is in the same + * format as `request.rawHeaders`. + * + * Returns a reference to the `ServerResponse`, so that calls can be chained. + * + * ```js + * const body = 'hello world'; + * response + * .writeHead(200, { + * 'Content-Length': Buffer.byteLength(body), + * 'Content-Type': 'text/plain', + * }) + * .end(body); + * ``` + * + * This method must only be called once on a message and it must + * be called before `response.end()` is called. + * + * If `response.write()` or `response.end()` are called before calling + * this, the implicit/mutable headers will be calculated and call this function. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * If this method is called and `response.setHeader()` has not been called, + * it will directly write the supplied header values onto the network channel + * without caching internally, and the `response.getHeader()` on the header + * will not yield the expected result. If progressive population of headers is + * desired with potential future retrieval and modification, use `response.setHeader()` instead. + * + * ```js + * // Returns content-type = text/plain + * const server = http.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain' }); + * res.end('ok'); + * }); + * ``` + * + * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js + * will check whether `Content-Length` and the length of the body which has + * been transmitted are equal or not. + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a \[`Error`\]\[\] being thrown. + * @since v0.1.30 + */ + writeHead( + statusCode: number, + statusMessage?: string, + headers?: OutgoingHttpHeaders | OutgoingHttpHeader[], + ): this; + writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; + /** + * Sends a HTTP/1.1 102 Processing message to the client, indicating that + * the request body should be sent. + * @since v10.0.0 + */ + writeProcessing(): void; + } + interface InformationEvent { + statusCode: number; + statusMessage: string; + httpVersion: string; + httpVersionMajor: number; + httpVersionMinor: number; + headers: IncomingHttpHeaders; + rawHeaders: string[]; + } + /** + * This object is created internally and returned from {@link request}. It + * represents an _in-progress_ request whose header has already been queued. The + * header is still mutable using the `setHeader(name, value)`,`getHeader(name)`, `removeHeader(name)` API. The actual header will + * be sent along with the first data chunk or when calling `request.end()`. + * + * To get the response, add a listener for `'response'` to the request object.`'response'` will be emitted from the request object when the response + * headers have been received. The `'response'` event is executed with one + * argument which is an instance of {@link IncomingMessage}. + * + * During the `'response'` event, one can add listeners to the + * response object; particularly to listen for the `'data'` event. + * + * If no `'response'` handler is added, then the response will be + * entirely discarded. However, if a `'response'` event handler is added, + * then the data from the response object **must** be consumed, either by + * calling `response.read()` whenever there is a `'readable'` event, or + * by adding a `'data'` handler, or by calling the `.resume()` method. + * Until the data is consumed, the `'end'` event will not fire. Also, until + * the data is read it will consume memory that can eventually lead to a + * 'process out of memory' error. + * + * For backward compatibility, `res` will only emit `'error'` if there is an`'error'` listener registered. + * + * Set `Content-Length` header to limit the response body size. + * If `response.strictContentLength` is set to `true`, mismatching the`Content-Length` header value will result in an `Error` being thrown, + * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. + * + * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. + * @since v0.1.17 + */ + class ClientRequest extends OutgoingMessage { + /** + * The `request.aborted` property will be `true` if the request has + * been aborted. + * @since v0.11.14 + * @deprecated Since v17.0.0,v16.12.0 - Check `destroyed` instead. + */ + aborted: boolean; + /** + * The request host. + * @since v14.5.0, v12.19.0 + */ + host: string; + /** + * The request protocol. + * @since v14.5.0, v12.19.0 + */ + protocol: string; + /** + * When sending request through a keep-alive enabled agent, the underlying socket + * might be reused. But if server closes connection at unfortunate time, client + * may run into a 'ECONNRESET' error. + * + * ```js + * const http = require('node:http'); + * + * // Server has a 5 seconds keep-alive timeout by default + * http + * .createServer((req, res) => { + * res.write('hello\n'); + * res.end(); + * }) + * .listen(3000); + * + * setInterval(() => { + * // Adapting a keep-alive agent + * http.get('http://localhost:3000', { agent }, (res) => { + * res.on('data', (data) => { + * // Do nothing + * }); + * }); + * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout + * ``` + * + * By marking a request whether it reused socket or not, we can do + * automatic error retry base on it. + * + * ```js + * const http = require('node:http'); + * const agent = new http.Agent({ keepAlive: true }); + * + * function retriableRequest() { + * const req = http + * .get('http://localhost:3000', { agent }, (res) => { + * // ... + * }) + * .on('error', (err) => { + * // Check if retry is needed + * if (req.reusedSocket && err.code === 'ECONNRESET') { + * retriableRequest(); + * } + * }); + * } + * + * retriableRequest(); + * ``` + * @since v13.0.0, v12.16.0 + */ + reusedSocket: boolean; + /** + * Limits maximum response headers count. If set to 0, no limit will be applied. + */ + maxHeadersCount: number; + constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); + /** + * The request method. + * @since v0.1.97 + */ + method: string; + /** + * The request path. + * @since v0.4.0 + */ + path: string; + /** + * Marks the request as aborting. Calling this will cause remaining data + * in the response to be dropped and the socket to be destroyed. + * @since v0.3.8 + * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead. + */ + abort(): void; + onSocket(socket: Socket): void; + /** + * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called. + * @since v0.5.9 + * @param timeout Milliseconds before a request times out. + * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event. + */ + setTimeout(timeout: number, callback?: () => void): this; + /** + * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called. + * @since v0.5.9 + */ + setNoDelay(noDelay?: boolean): void; + /** + * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called. + * @since v0.5.9 + */ + setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; + /** + * Returns an array containing the unique names of the current outgoing raw + * headers. Header names are returned with their exact casing being set. + * + * ```js + * request.setHeader('Foo', 'bar'); + * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headerNames = request.getRawHeaderNames(); + * // headerNames === ['Foo', 'Set-Cookie'] + * ``` + * @since v15.13.0, v14.17.0 + */ + getRawHeaderNames(): string[]; + /** + * @deprecated + */ + addListener(event: 'abort', listener: () => void): this; + addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + addListener(event: 'continue', listener: () => void): this; + addListener(event: 'information', listener: (info: InformationEvent) => void): this; + addListener(event: 'response', listener: (response: IncomingMessage) => void): this; + addListener(event: 'socket', listener: (socket: Socket) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + on(event: 'abort', listener: () => void): this; + on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + on(event: 'continue', listener: () => void): this; + on(event: 'information', listener: (info: InformationEvent) => void): this; + on(event: 'response', listener: (response: IncomingMessage) => void): this; + on(event: 'socket', listener: (socket: Socket) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + once(event: 'abort', listener: () => void): this; + once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + once(event: 'continue', listener: () => void): this; + once(event: 'information', listener: (info: InformationEvent) => void): this; + once(event: 'response', listener: (response: IncomingMessage) => void): this; + once(event: 'socket', listener: (socket: Socket) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'pipe', listener: (src: stream.Readable) => void): this; + once(event: 'unpipe', listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + prependListener(event: 'abort', listener: () => void): this; + prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + prependListener(event: 'continue', listener: () => void): this; + prependListener(event: 'information', listener: (info: InformationEvent) => void): this; + prependListener(event: 'response', listener: (response: IncomingMessage) => void): this; + prependListener(event: 'socket', listener: (socket: Socket) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + prependOnceListener(event: 'abort', listener: () => void): this; + prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + prependOnceListener(event: 'continue', listener: () => void): this; + prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this; + prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this; + prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to + * access response + * status, headers, and data. + * + * Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to + * parse and emit the incoming HTTP headers and payload, as the underlying socket + * may be reused multiple times in case of keep-alive. + * @since v0.1.17 + */ + class IncomingMessage extends stream.Readable { + constructor(socket: Socket); + /** + * The `message.aborted` property will be `true` if the request has + * been aborted. + * @since v10.1.0 + * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from stream.Readable. + */ + aborted: boolean; + /** + * In case of server request, the HTTP version sent by the client. In the case of + * client response, the HTTP version of the connected-to server. + * Probably either `'1.1'` or `'1.0'`. + * + * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second. + * @since v0.1.1 + */ + httpVersion: string; + httpVersionMajor: number; + httpVersionMinor: number; + /** + * The `message.complete` property will be `true` if a complete HTTP message has + * been received and successfully parsed. + * + * This property is particularly useful as a means of determining if a client or + * server fully transmitted a message before a connection was terminated: + * + * ```js + * const req = http.request({ + * host: '127.0.0.1', + * port: 8080, + * method: 'POST', + * }, (res) => { + * res.resume(); + * res.on('end', () => { + * if (!res.complete) + * console.error( + * 'The connection was terminated while the message was still being sent'); + * }); + * }); + * ``` + * @since v0.3.0 + */ + complete: boolean; + /** + * Alias for `message.socket`. + * @since v0.1.90 + * @deprecated Since v16.0.0 - Use `socket`. + */ + connection: Socket; + /** + * The `net.Socket` object associated with the connection. + * + * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the + * client's authentication details. + * + * This property is guaranteed to be an instance of the `net.Socket` class, + * a subclass of `stream.Duplex`, unless the user specified a socket + * type other than `net.Socket` or internally nulled. + * @since v0.3.0 + */ + socket: Socket; + /** + * The request/response headers object. + * + * Key-value pairs of header names and values. Header names are lower-cased. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': 'curl/7.22.0', + * // host: '127.0.0.1:8000', + * // accept: '*' } + * console.log(request.headers); + * ``` + * + * Duplicates in raw headers are handled in the following ways, depending on the + * header name: + * + * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,`last-modified`, `location`, + * `max-forwards`, `proxy-authorization`, `referer`,`retry-after`, `server`, or `user-agent` are discarded. + * To allow duplicate values of the headers listed above to be joined, + * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more + * information. + * * `set-cookie` is always an array. Duplicates are added to the array. + * * For duplicate `cookie` headers, the values are joined together with `; `. + * * For all other headers, the values are joined together with `, `. + * @since v0.1.5 + */ + headers: IncomingHttpHeaders; + /** + * Similar to `message.headers`, but there is no join logic and the values are + * always arrays of strings, even for headers received just once. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': ['curl/7.22.0'], + * // host: ['127.0.0.1:8000'], + * // accept: ['*'] } + * console.log(request.headersDistinct); + * ``` + * @since v18.3.0, v16.17.0 + */ + headersDistinct: NodeJS.Dict; + /** + * The raw request/response headers list exactly as they were received. + * + * The keys and values are in the same list. It is _not_ a + * list of tuples. So, the even-numbered offsets are key values, and the + * odd-numbered offsets are the associated values. + * + * Header names are not lowercased, and duplicates are not merged. + * + * ```js + * // Prints something like: + * // + * // [ 'user-agent', + * // 'this is invalid because there can be only one', + * // 'User-Agent', + * // 'curl/7.22.0', + * // 'Host', + * // '127.0.0.1:8000', + * // 'ACCEPT', + * // '*' ] + * console.log(request.rawHeaders); + * ``` + * @since v0.11.6 + */ + rawHeaders: string[]; + /** + * The request/response trailers object. Only populated at the `'end'` event. + * @since v0.3.0 + */ + trailers: NodeJS.Dict; + /** + * Similar to `message.trailers`, but there is no join logic and the values are + * always arrays of strings, even for headers received just once. + * Only populated at the `'end'` event. + * @since v18.3.0, v16.17.0 + */ + trailersDistinct: NodeJS.Dict; + /** + * The raw request/response trailer keys and values exactly as they were + * received. Only populated at the `'end'` event. + * @since v0.11.6 + */ + rawTrailers: string[]; + /** + * Calls `message.socket.setTimeout(msecs, callback)`. + * @since v0.5.9 + */ + setTimeout(msecs: number, callback?: () => void): this; + /** + * **Only valid for request obtained from {@link Server}.** + * + * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`. + * @since v0.1.1 + */ + method?: string | undefined; + /** + * **Only valid for request obtained from {@link Server}.** + * + * Request URL string. This contains only the URL that is present in the actual + * HTTP request. Take the following request: + * + * ```http + * GET /status?name=ryan HTTP/1.1 + * Accept: text/plain + * ``` + * + * To parse the URL into its parts: + * + * ```js + * new URL(request.url, `http://${request.headers.host}`); + * ``` + * + * When `request.url` is `'/status?name=ryan'` and `request.headers.host` is`'localhost:3000'`: + * + * ```console + * $ node + * > new URL(request.url, `http://${request.headers.host}`) + * URL { + * href: 'http://localhost:3000/status?name=ryan', + * origin: 'http://localhost:3000', + * protocol: 'http:', + * username: '', + * password: '', + * host: 'localhost:3000', + * hostname: 'localhost', + * port: '3000', + * pathname: '/status', + * search: '?name=ryan', + * searchParams: URLSearchParams { 'name' => 'ryan' }, + * hash: '' + * } + * ``` + * @since v0.1.90 + */ + url?: string | undefined; + /** + * **Only valid for response obtained from {@link ClientRequest}.** + * + * The 3-digit HTTP response status code. E.G. `404`. + * @since v0.1.1 + */ + statusCode?: number | undefined; + /** + * **Only valid for response obtained from {@link ClientRequest}.** + * + * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. + * @since v0.11.10 + */ + statusMessage?: string | undefined; + /** + * Calls `destroy()` on the socket that received the `IncomingMessage`. If `error`is provided, an `'error'` event is emitted on the socket and `error` is passed + * as an argument to any listeners on the event. + * @since v0.3.0 + */ + destroy(error?: Error): this; + } + interface AgentOptions extends Partial { + /** + * Keep sockets around in a pool to be used by other requests in the future. Default = false + */ + keepAlive?: boolean | undefined; + /** + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + */ + keepAliveMsecs?: number | undefined; + /** + * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity + */ + maxSockets?: number | undefined; + /** + * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity. + */ + maxTotalSockets?: number | undefined; + /** + * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. + */ + maxFreeSockets?: number | undefined; + /** + * Socket timeout in milliseconds. This will set the timeout after the socket is connected. + */ + timeout?: number | undefined; + /** + * Scheduling strategy to apply when picking the next free socket to use. + * @default `lifo` + */ + scheduling?: 'fifo' | 'lifo' | undefined; + } + /** + * An `Agent` is responsible for managing connection persistence + * and reuse for HTTP clients. It maintains a queue of pending requests + * for a given host and port, reusing a single socket connection for each + * until the queue is empty, at which time the socket is either destroyed + * or put into a pool where it is kept to be used again for requests to the + * same host and port. Whether it is destroyed or pooled depends on the`keepAlive` `option`. + * + * Pooled connections have TCP Keep-Alive enabled for them, but servers may + * still close idle connections, in which case they will be removed from the + * pool and a new connection will be made when a new HTTP request is made for + * that host and port. Servers may also refuse to allow multiple requests + * over the same connection, in which case the connection will have to be + * remade for every request and cannot be pooled. The `Agent` will still make + * the requests to that server, but each one will occur over a new connection. + * + * When a connection is closed by the client or the server, it is removed + * from the pool. Any unused sockets in the pool will be unrefed so as not + * to keep the Node.js process running when there are no outstanding requests. + * (see `socket.unref()`). + * + * It is good practice, to `destroy()` an `Agent` instance when it is no + * longer in use, because unused sockets consume OS resources. + * + * Sockets are removed from an agent when the socket emits either + * a `'close'` event or an `'agentRemove'` event. When intending to keep one + * HTTP request open for a long time without keeping it in the agent, something + * like the following may be done: + * + * ```js + * http.get(options, (res) => { + * // Do stuff + * }).on('socket', (socket) => { + * socket.emit('agentRemove'); + * }); + * ``` + * + * An agent may also be used for an individual request. By providing`{agent: false}` as an option to the `http.get()` or `http.request()`functions, a one-time use `Agent` with default options + * will be used + * for the client connection. + * + * `agent:false`: + * + * ```js + * http.get({ + * hostname: 'localhost', + * port: 80, + * path: '/', + * agent: false, // Create a new agent just for this one request + * }, (res) => { + * // Do stuff with response + * }); + * ``` + * @since v0.3.4 + */ + class Agent extends EventEmitter { + /** + * By default set to 256. For agents with `keepAlive` enabled, this + * sets the maximum number of sockets that will be left open in the free + * state. + * @since v0.11.7 + */ + maxFreeSockets: number; + /** + * By default set to `Infinity`. Determines how many concurrent sockets the agent + * can have open per origin. Origin is the returned value of `agent.getName()`. + * @since v0.3.6 + */ + maxSockets: number; + /** + * By default set to `Infinity`. Determines how many concurrent sockets the agent + * can have open. Unlike `maxSockets`, this parameter applies across all origins. + * @since v14.5.0, v12.19.0 + */ + maxTotalSockets: number; + /** + * An object which contains arrays of sockets currently awaiting use by + * the agent when `keepAlive` is enabled. Do not modify. + * + * Sockets in the `freeSockets` list will be automatically destroyed and + * removed from the array on `'timeout'`. + * @since v0.11.4 + */ + readonly freeSockets: NodeJS.ReadOnlyDict; + /** + * An object which contains arrays of sockets currently in use by the + * agent. Do not modify. + * @since v0.3.6 + */ + readonly sockets: NodeJS.ReadOnlyDict; + /** + * An object which contains queues of requests that have not yet been assigned to + * sockets. Do not modify. + * @since v0.5.9 + */ + readonly requests: NodeJS.ReadOnlyDict; + constructor(opts?: AgentOptions); + /** + * Destroy any sockets that are currently in use by the agent. + * + * It is usually not necessary to do this. However, if using an + * agent with `keepAlive` enabled, then it is best to explicitly shut down + * the agent when it is no longer needed. Otherwise, + * sockets might stay open for quite a long time before the server + * terminates them. + * @since v0.11.4 + */ + destroy(): void; + } + const METHODS: string[]; + const STATUS_CODES: { + [errorCode: number]: string | undefined; + [errorCode: string]: string | undefined; + }; + /** + * Returns a new instance of {@link Server}. + * + * The `requestListener` is a function which is automatically + * added to the `'request'` event. + * @since v0.1.13 + */ + function createServer< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + >(requestListener?: RequestListener): Server; + function createServer< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + >( + options: ServerOptions, + requestListener?: RequestListener, + ): Server; + // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, + // create interface RequestOptions would make the naming more clear to developers + interface RequestOptions extends ClientRequestArgs {} + /** + * `options` in `socket.connect()` are also supported. + * + * Node.js maintains several connections per server to make HTTP requests. + * This function allows one to transparently issue requests. + * + * `url` can be a string or a `URL` object. If `url` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * If both `url` and `options` are specified, the objects are merged, with the`options` properties taking precedence. + * + * The optional `callback` parameter will be added as a one-time listener for + * the `'response'` event. + * + * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to + * upload a file with a POST request, then write to the `ClientRequest` object. + * + * ```js + * const http = require('node:http'); + * + * const postData = JSON.stringify({ + * 'msg': 'Hello World!', + * }); + * + * const options = { + * hostname: 'www.google.com', + * port: 80, + * path: '/upload', + * method: 'POST', + * headers: { + * 'Content-Type': 'application/json', + * 'Content-Length': Buffer.byteLength(postData), + * }, + * }; + * + * const req = http.request(options, (res) => { + * console.log(`STATUS: ${res.statusCode}`); + * console.log(`HEADERS: ${JSON.stringify(res.headers)}`); + * res.setEncoding('utf8'); + * res.on('data', (chunk) => { + * console.log(`BODY: ${chunk}`); + * }); + * res.on('end', () => { + * console.log('No more data in response.'); + * }); + * }); + * + * req.on('error', (e) => { + * console.error(`problem with request: ${e.message}`); + * }); + * + * // Write data to request body + * req.write(postData); + * req.end(); + * ``` + * + * In the example `req.end()` was called. With `http.request()` one + * must always call `req.end()` to signify the end of the request - + * even if there is no data being written to the request body. + * + * If any error is encountered during the request (be that with DNS resolution, + * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted + * on the returned request object. As with all `'error'` events, if no listeners + * are registered the error will be thrown. + * + * There are a few special headers that should be noted. + * + * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to + * the server should be persisted until the next request. + * * Sending a 'Content-Length' header will disable the default chunked encoding. + * * Sending an 'Expect' header will immediately send the request headers. + * Usually, when sending 'Expect: 100-continue', both a timeout and a listener + * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more + * information. + * * Sending an Authorization header will override using the `auth` option + * to compute basic authentication. + * + * Example using a `URL` as `options`: + * + * ```js + * const options = new URL('http://abc:xyz@example.com'); + * + * const req = http.request(options, (res) => { + * // ... + * }); + * ``` + * + * In a successful request, the following events will be emitted in the following + * order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * (`'data'` will not be emitted at all if the response body is empty, for + * instance, in most redirects) + * * `'end'` on the `res` object + * * `'close'` + * + * In the case of a connection error, the following events will be emitted: + * + * * `'socket'` + * * `'error'` + * * `'close'` + * + * In the case of a premature connection close before the response is received, + * the following events will be emitted in the following order: + * + * * `'socket'` + * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'` + * * `'close'` + * + * In the case of a premature connection close after the response is received, + * the following events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (connection closed here) + * * `'aborted'` on the `res` object + * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'` + * * `'close'` + * * `'close'` on the `res` object + * + * If `req.destroy()` is called before a socket is assigned, the following + * events will be emitted in the following order: + * + * * (`req.destroy()` called here) + * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` + * + * If `req.destroy()` is called before the connection succeeds, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * (`req.destroy()` called here) + * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` + * + * If `req.destroy()` is called after the response is received, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (`req.destroy()` called here) + * * `'aborted'` on the `res` object + * * `'error'` on the `res` object with an error with message `'Error: aborted'`and code `'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` + * * `'close'` on the `res` object + * + * If `req.abort()` is called before a socket is assigned, the following + * events will be emitted in the following order: + * + * * (`req.abort()` called here) + * * `'abort'` + * * `'close'` + * + * If `req.abort()` is called before the connection succeeds, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * (`req.abort()` called here) + * * `'abort'` + * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'` + * * `'close'` + * + * If `req.abort()` is called after the response is received, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (`req.abort()` called here) + * * `'abort'` + * * `'aborted'` on the `res` object + * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`. + * * `'close'` + * * `'close'` on the `res` object + * + * Setting the `timeout` option or using the `setTimeout()` function will + * not abort the request or do anything besides add a `'timeout'` event. + * + * Passing an `AbortSignal` and then calling `abort()` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the + * request. Specifically, the `'error'` event will be emitted with an error with + * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`and the `cause`, if one was provided. + * @since v0.3.6 + */ + function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; + function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; + /** + * Since most requests are GET requests without bodies, Node.js provides this + * convenience method. The only difference between this method and {@link request} is that it sets the method to GET and calls `req.end()`automatically. The callback must take care to consume the + * response + * data for reasons stated in {@link ClientRequest} section. + * + * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}. + * + * JSON fetching example: + * + * ```js + * http.get('http://localhost:8000/', (res) => { + * const { statusCode } = res; + * const contentType = res.headers['content-type']; + * + * let error; + * // Any 2xx status code signals a successful response but + * // here we're only checking for 200. + * if (statusCode !== 200) { + * error = new Error('Request Failed.\n' + + * `Status Code: ${statusCode}`); + * } else if (!/^application\/json/.test(contentType)) { + * error = new Error('Invalid content-type.\n' + + * `Expected application/json but received ${contentType}`); + * } + * if (error) { + * console.error(error.message); + * // Consume response data to free up memory + * res.resume(); + * return; + * } + * + * res.setEncoding('utf8'); + * let rawData = ''; + * res.on('data', (chunk) => { rawData += chunk; }); + * res.on('end', () => { + * try { + * const parsedData = JSON.parse(rawData); + * console.log(parsedData); + * } catch (e) { + * console.error(e.message); + * } + * }); + * }).on('error', (e) => { + * console.error(`Got error: ${e.message}`); + * }); + * + * // Create a local server to receive data from + * const server = http.createServer((req, res) => { + * res.writeHead(200, { 'Content-Type': 'application/json' }); + * res.end(JSON.stringify({ + * data: 'Hello World!', + * })); + * }); + * + * server.listen(8000); + * ``` + * @since v0.3.6 + * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. Properties that are inherited from the prototype are ignored. + */ + function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; + function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; + /** + * Performs the low-level validations on the provided `name` that are done when`res.setHeader(name, value)` is called. + * + * Passing illegal value as `name` will result in a `TypeError` being thrown, + * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`. + * + * It is not necessary to use this method before passing headers to an HTTP request + * or response. The HTTP module will automatically validate such headers. + * Examples: + * + * Example: + * + * ```js + * const { validateHeaderName } = require('node:http'); + * + * try { + * validateHeaderName(''); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN' + * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]' + * } + * ``` + * @since v14.3.0 + * @param [label='Header name'] Label for error message. + */ + function validateHeaderName(name: string): void; + /** + * Performs the low-level validations on the provided `value` that are done when`res.setHeader(name, value)` is called. + * + * Passing illegal value as `value` will result in a `TypeError` being thrown. + * + * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`. + * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`. + * + * It is not necessary to use this method before passing headers to an HTTP request + * or response. The HTTP module will automatically validate such headers. + * + * Examples: + * + * ```js + * const { validateHeaderValue } = require('node:http'); + * + * try { + * validateHeaderValue('x-my-header', undefined); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true + * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"' + * } + * + * try { + * validateHeaderValue('x-my-header', 'oʊmɪɡə'); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true + * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]' + * } + * ``` + * @since v14.3.0 + * @param name Header name + * @param value Header value + */ + function validateHeaderValue(name: string, value: string): void; + /** + * Set the maximum number of idle HTTP parsers. + * @since v18.8.0, v16.18.0 + * @param [max=1000] + */ + function setMaxIdleHTTPParsers(max: number): void; + let globalAgent: Agent; + /** + * Read-only property specifying the maximum allowed size of HTTP headers in bytes. + * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option. + */ + const maxHeaderSize: number; +} +declare module 'node:http' { + export * from 'http'; +} diff --git a/node_modules/@types/node/http2.d.ts b/node_modules/@types/node/http2.d.ts new file mode 100755 index 0000000..1d29a2c --- /dev/null +++ b/node_modules/@types/node/http2.d.ts @@ -0,0 +1,2129 @@ +/** + * The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol. + * It can be accessed using: + * + * ```js + * const http2 = require('node:http2'); + * ``` + * @since v8.4.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http2.js) + */ +declare module 'http2' { + import EventEmitter = require('node:events'); + import * as fs from 'node:fs'; + import * as net from 'node:net'; + import * as stream from 'node:stream'; + import * as tls from 'node:tls'; + import * as url from 'node:url'; + import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http'; + export { OutgoingHttpHeaders } from 'node:http'; + export interface IncomingHttpStatusHeader { + ':status'?: number | undefined; + } + export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { + ':path'?: string | undefined; + ':method'?: string | undefined; + ':authority'?: string | undefined; + ':scheme'?: string | undefined; + } + // Http2Stream + export interface StreamPriorityOptions { + exclusive?: boolean | undefined; + parent?: number | undefined; + weight?: number | undefined; + silent?: boolean | undefined; + } + export interface StreamState { + localWindowSize?: number | undefined; + state?: number | undefined; + localClose?: number | undefined; + remoteClose?: number | undefined; + sumDependencyWeight?: number | undefined; + weight?: number | undefined; + } + export interface ServerStreamResponseOptions { + endStream?: boolean | undefined; + waitForTrailers?: boolean | undefined; + } + export interface StatOptions { + offset: number; + length: number; + } + export interface ServerStreamFileResponseOptions { + statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean; + waitForTrailers?: boolean | undefined; + offset?: number | undefined; + length?: number | undefined; + } + export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { + onError?(err: NodeJS.ErrnoException): void; + } + export interface Http2Stream extends stream.Duplex { + /** + * Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, + * the `'aborted'` event will have been emitted. + * @since v8.4.0 + */ + readonly aborted: boolean; + /** + * This property shows the number of characters currently buffered to be written. + * See `net.Socket.bufferSize` for details. + * @since v11.2.0, v10.16.0 + */ + readonly bufferSize: number; + /** + * Set to `true` if the `Http2Stream` instance has been closed. + * @since v9.4.0 + */ + readonly closed: boolean; + /** + * Set to `true` if the `Http2Stream` instance has been destroyed and is no longer + * usable. + * @since v8.4.0 + */ + readonly destroyed: boolean; + /** + * Set to `true` if the `END_STREAM` flag was set in the request or response + * HEADERS frame received, indicating that no additional data should be received + * and the readable side of the `Http2Stream` will be closed. + * @since v10.11.0 + */ + readonly endAfterHeaders: boolean; + /** + * The numeric stream identifier of this `Http2Stream` instance. Set to `undefined`if the stream identifier has not yet been assigned. + * @since v8.4.0 + */ + readonly id?: number | undefined; + /** + * Set to `true` if the `Http2Stream` instance has not yet been assigned a + * numeric stream identifier. + * @since v9.4.0 + */ + readonly pending: boolean; + /** + * Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is + * destroyed after either receiving an `RST_STREAM` frame from the connected peer, + * calling `http2stream.close()`, or `http2stream.destroy()`. Will be`undefined` if the `Http2Stream` has not been closed. + * @since v8.4.0 + */ + readonly rstCode: number; + /** + * An object containing the outbound headers sent for this `Http2Stream`. + * @since v9.5.0 + */ + readonly sentHeaders: OutgoingHttpHeaders; + /** + * An array of objects containing the outbound informational (additional) headers + * sent for this `Http2Stream`. + * @since v9.5.0 + */ + readonly sentInfoHeaders?: OutgoingHttpHeaders[] | undefined; + /** + * An object containing the outbound trailers sent for this `HttpStream`. + * @since v9.5.0 + */ + readonly sentTrailers?: OutgoingHttpHeaders | undefined; + /** + * A reference to the `Http2Session` instance that owns this `Http2Stream`. The + * value will be `undefined` after the `Http2Stream` instance is destroyed. + * @since v8.4.0 + */ + readonly session: Http2Session | undefined; + /** + * Provides miscellaneous information about the current state of the`Http2Stream`. + * + * A current state of this `Http2Stream`. + * @since v8.4.0 + */ + readonly state: StreamState; + /** + * Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the + * connected HTTP/2 peer. + * @since v8.4.0 + * @param [code=http2.constants.NGHTTP2_NO_ERROR] Unsigned 32-bit integer identifying the error code. + * @param callback An optional function registered to listen for the `'close'` event. + */ + close(code?: number, callback?: () => void): void; + /** + * Updates the priority for this `Http2Stream` instance. + * @since v8.4.0 + */ + priority(options: StreamPriorityOptions): void; + /** + * ```js + * const http2 = require('node:http2'); + * const client = http2.connect('http://example.org:8000'); + * const { NGHTTP2_CANCEL } = http2.constants; + * const req = client.request({ ':path': '/' }); + * + * // Cancel the stream if there's no activity after 5 seconds + * req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); + * ``` + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method + * will cause the `Http2Stream` to be immediately closed and must only be + * called after the `'wantTrailers'` event has been emitted. When sending a + * request or sending a response, the `options.waitForTrailers` option must be set + * in order to keep the `Http2Stream` open after the final `DATA` frame so that + * trailers can be sent. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond(undefined, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ xyz: 'abc' }); + * }); + * stream.end('Hello World'); + * }); + * ``` + * + * The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header + * fields (e.g. `':method'`, `':path'`, etc). + * @since v10.0.0 + */ + sendTrailers(headers: OutgoingHttpHeaders): void; + addListener(event: 'aborted', listener: () => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'streamClosed', listener: (code: number) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: 'wantTrailers', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'aborted'): boolean; + emit(event: 'close'): boolean; + emit(event: 'data', chunk: Buffer | string): boolean; + emit(event: 'drain'): boolean; + emit(event: 'end'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'finish'): boolean; + emit(event: 'frameError', frameType: number, errorCode: number): boolean; + emit(event: 'pipe', src: stream.Readable): boolean; + emit(event: 'unpipe', src: stream.Readable): boolean; + emit(event: 'streamClosed', code: number): boolean; + emit(event: 'timeout'): boolean; + emit(event: 'trailers', trailers: IncomingHttpHeaders, flags: number): boolean; + emit(event: 'wantTrailers'): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'aborted', listener: () => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: Buffer | string) => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: 'streamClosed', listener: (code: number) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + on(event: 'wantTrailers', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'aborted', listener: () => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: Buffer | string) => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + once(event: 'pipe', listener: (src: stream.Readable) => void): this; + once(event: 'unpipe', listener: (src: stream.Readable) => void): this; + once(event: 'streamClosed', listener: (code: number) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + once(event: 'wantTrailers', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'aborted', listener: () => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'streamClosed', listener: (code: number) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: 'wantTrailers', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'aborted', listener: () => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'streamClosed', listener: (code: number) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: 'wantTrailers', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ClientHttp2Stream extends Http2Stream { + addListener(event: 'continue', listener: () => {}): this; + addListener(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + addListener(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'continue'): boolean; + emit(event: 'headers', headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit(event: 'push', headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: 'response', headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'continue', listener: () => {}): this; + on(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + on(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + on(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'continue', listener: () => {}): this; + once(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + once(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + once(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'continue', listener: () => {}): this; + prependListener(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependListener(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'continue', listener: () => {}): this; + prependOnceListener(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependOnceListener(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ServerHttp2Stream extends Http2Stream { + /** + * True if headers were sent, false otherwise (read-only). + * @since v8.4.0 + */ + readonly headersSent: boolean; + /** + * Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote + * client's most recent `SETTINGS` frame. Will be `true` if the remote peer + * accepts push streams, `false` otherwise. Settings are the same for every`Http2Stream` in the same `Http2Session`. + * @since v8.4.0 + */ + readonly pushAllowed: boolean; + /** + * Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer. + * @since v8.4.0 + */ + additionalHeaders(headers: OutgoingHttpHeaders): void; + /** + * Initiates a push stream. The callback is invoked with the new `Http2Stream`instance created for the push stream passed as the second argument, or an`Error` passed as the first argument. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }); + * stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => { + * if (err) throw err; + * pushStream.respond({ ':status': 200 }); + * pushStream.end('some pushed data'); + * }); + * stream.end('some data'); + * }); + * ``` + * + * Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass + * a `weight` value to `http2stream.priority` with the `silent` option set to`true` to enable server-side bandwidth balancing between concurrent streams. + * + * Calling `http2stream.pushStream()` from within a pushed stream is not permitted + * and will throw an error. + * @since v8.4.0 + * @param callback Callback that is called once the push stream has been initiated. + */ + pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; + pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; + /** + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }); + * stream.end('some data'); + * }); + * ``` + * + * Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event will be emitted immediately after queuing the last chunk + * of payload data to be sent. The `http2stream.sendTrailers()` method can then be + * used to sent trailing header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * stream.end('some data'); + * }); + * ``` + * @since v8.4.0 + */ + respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; + /** + * Initiates a response whose data is read from the given file descriptor. No + * validation is performed on the given file descriptor. If an error occurs while + * attempting to read data using the file descriptor, the `Http2Stream` will be + * closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. + * + * When used, the `Http2Stream` object's `Duplex` interface will be closed + * automatically. + * + * ```js + * const http2 = require('node:http2'); + * const fs = require('node:fs'); + * + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * const fd = fs.openSync('/some/file', 'r'); + * + * const stat = fs.fstatSync(fd); + * const headers = { + * 'content-length': stat.size, + * 'last-modified': stat.mtime.toUTCString(), + * 'content-type': 'text/plain; charset=utf-8', + * }; + * stream.respondWithFD(fd, headers); + * stream.on('close', () => fs.closeSync(fd)); + * }); + * ``` + * + * The optional `options.statCheck` function may be specified to give user code + * an opportunity to set additional content headers based on the `fs.Stat` details + * of the given fd. If the `statCheck` function is provided, the`http2stream.respondWithFD()` method will perform an `fs.fstat()` call to + * collect details on the provided file descriptor. + * + * The `offset` and `length` options may be used to limit the response to a + * specific range subset. This can be used, for instance, to support HTTP Range + * requests. + * + * The file descriptor or `FileHandle` is not closed when the stream is closed, + * so it will need to be closed manually once it is no longer needed. + * Using the same file descriptor concurrently for multiple streams + * is not supported and may result in data loss. Re-using a file descriptor + * after a stream has finished is supported. + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * will be emitted immediately after queuing the last chunk of payload data to be + * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing + * header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code _must_ call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * ```js + * const http2 = require('node:http2'); + * const fs = require('node:fs'); + * + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * const fd = fs.openSync('/some/file', 'r'); + * + * const stat = fs.fstatSync(fd); + * const headers = { + * 'content-length': stat.size, + * 'last-modified': stat.mtime.toUTCString(), + * 'content-type': 'text/plain; charset=utf-8', + * }; + * stream.respondWithFD(fd, headers, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * + * stream.on('close', () => fs.closeSync(fd)); + * }); + * ``` + * @since v8.4.0 + * @param fd A readable file descriptor. + */ + respondWithFD(fd: number | fs.promises.FileHandle, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void; + /** + * Sends a regular file as the response. The `path` must specify a regular file + * or an `'error'` event will be emitted on the `Http2Stream` object. + * + * When used, the `Http2Stream` object's `Duplex` interface will be closed + * automatically. + * + * The optional `options.statCheck` function may be specified to give user code + * an opportunity to set additional content headers based on the `fs.Stat` details + * of the given file: + * + * If an error occurs while attempting to read the file data, the `Http2Stream`will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR`code. If the `onError` callback is + * defined, then it will be called. Otherwise + * the stream will be destroyed. + * + * Example using a file path: + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * function statCheck(stat, headers) { + * headers['last-modified'] = stat.mtime.toUTCString(); + * } + * + * function onError(err) { + * // stream.respond() can throw if the stream has been destroyed by + * // the other side. + * try { + * if (err.code === 'ENOENT') { + * stream.respond({ ':status': 404 }); + * } else { + * stream.respond({ ':status': 500 }); + * } + * } catch (err) { + * // Perform actual error handling. + * console.error(err); + * } + * stream.end(); + * } + * + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { statCheck, onError }); + * }); + * ``` + * + * The `options.statCheck` function may also be used to cancel the send operation + * by returning `false`. For instance, a conditional request may check the stat + * results to determine if the file has been modified to return an appropriate`304` response: + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * function statCheck(stat, headers) { + * // Check the stat here... + * stream.respond({ ':status': 304 }); + * return false; // Cancel the send operation + * } + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { statCheck }); + * }); + * ``` + * + * The `content-length` header field will be automatically set. + * + * The `offset` and `length` options may be used to limit the response to a + * specific range subset. This can be used, for instance, to support HTTP Range + * requests. + * + * The `options.onError` function may also be used to handle all the errors + * that could happen before the delivery of the file is initiated. The + * default behavior is to destroy the stream. + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * will be emitted immediately after queuing the last chunk of payload data to be + * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing + * header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * }); + * ``` + * @since v8.4.0 + */ + respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void; + } + // Http2Session + export interface Settings { + headerTableSize?: number | undefined; + enablePush?: boolean | undefined; + initialWindowSize?: number | undefined; + maxFrameSize?: number | undefined; + maxConcurrentStreams?: number | undefined; + maxHeaderListSize?: number | undefined; + enableConnectProtocol?: boolean | undefined; + } + export interface ClientSessionRequestOptions { + endStream?: boolean | undefined; + exclusive?: boolean | undefined; + parent?: number | undefined; + weight?: number | undefined; + waitForTrailers?: boolean | undefined; + signal?: AbortSignal | undefined; + } + export interface SessionState { + effectiveLocalWindowSize?: number | undefined; + effectiveRecvDataLength?: number | undefined; + nextStreamID?: number | undefined; + localWindowSize?: number | undefined; + lastProcStreamID?: number | undefined; + remoteWindowSize?: number | undefined; + outboundQueueSize?: number | undefined; + deflateDynamicTableSize?: number | undefined; + inflateDynamicTableSize?: number | undefined; + } + export interface Http2Session extends EventEmitter { + /** + * Value will be `undefined` if the `Http2Session` is not yet connected to a + * socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or + * will return the value of the connected `TLSSocket`'s own `alpnProtocol`property. + * @since v9.4.0 + */ + readonly alpnProtocol?: string | undefined; + /** + * Will be `true` if this `Http2Session` instance has been closed, otherwise`false`. + * @since v9.4.0 + */ + readonly closed: boolean; + /** + * Will be `true` if this `Http2Session` instance is still connecting, will be set + * to `false` before emitting `connect` event and/or calling the `http2.connect`callback. + * @since v10.0.0 + */ + readonly connecting: boolean; + /** + * Will be `true` if this `Http2Session` instance has been destroyed and must no + * longer be used, otherwise `false`. + * @since v8.4.0 + */ + readonly destroyed: boolean; + /** + * Value is `undefined` if the `Http2Session` session socket has not yet been + * connected, `true` if the `Http2Session` is connected with a `TLSSocket`, + * and `false` if the `Http2Session` is connected to any other kind of socket + * or stream. + * @since v9.4.0 + */ + readonly encrypted?: boolean | undefined; + /** + * A prototype-less object describing the current local settings of this`Http2Session`. The local settings are local to _this_`Http2Session` instance. + * @since v8.4.0 + */ + readonly localSettings: Settings; + /** + * If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property + * will return an `Array` of origins for which the `Http2Session` may be + * considered authoritative. + * + * The `originSet` property is only available when using a secure TLS connection. + * @since v9.4.0 + */ + readonly originSet?: string[] | undefined; + /** + * Indicates whether the `Http2Session` is currently waiting for acknowledgment of + * a sent `SETTINGS` frame. Will be `true` after calling the`http2session.settings()` method. Will be `false` once all sent `SETTINGS`frames have been acknowledged. + * @since v8.4.0 + */ + readonly pendingSettingsAck: boolean; + /** + * A prototype-less object describing the current remote settings of this`Http2Session`. The remote settings are set by the _connected_ HTTP/2 peer. + * @since v8.4.0 + */ + readonly remoteSettings: Settings; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * limits available methods to ones safe to use with HTTP/2. + * + * `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw + * an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for more information. + * + * `setTimeout` method will be called on this `Http2Session`. + * + * All other interactions will be routed directly to the socket. + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * Provides miscellaneous information about the current state of the`Http2Session`. + * + * An object describing the current status of this `Http2Session`. + * @since v8.4.0 + */ + readonly state: SessionState; + /** + * The `http2session.type` will be equal to`http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a + * server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a + * client. + * @since v8.4.0 + */ + readonly type: number; + /** + * Gracefully closes the `Http2Session`, allowing any existing streams to + * complete on their own and preventing new `Http2Stream` instances from being + * created. Once closed, `http2session.destroy()`_might_ be called if there + * are no open `Http2Stream` instances. + * + * If specified, the `callback` function is registered as a handler for the`'close'` event. + * @since v9.4.0 + */ + close(callback?: () => void): void; + /** + * Immediately terminates the `Http2Session` and the associated `net.Socket` or`tls.TLSSocket`. + * + * Once destroyed, the `Http2Session` will emit the `'close'` event. If `error`is not undefined, an `'error'` event will be emitted immediately before the`'close'` event. + * + * If there are any remaining open `Http2Streams` associated with the`Http2Session`, those will also be destroyed. + * @since v8.4.0 + * @param error An `Error` object if the `Http2Session` is being destroyed due to an error. + * @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`. + */ + destroy(error?: Error, code?: number): void; + /** + * Transmits a `GOAWAY` frame to the connected peer _without_ shutting down the`Http2Session`. + * @since v9.4.0 + * @param code An HTTP/2 error code + * @param lastStreamID The numeric ID of the last processed `Http2Stream` + * @param opaqueData A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame. + */ + goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; + /** + * Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must + * be provided. The method will return `true` if the `PING` was sent, `false`otherwise. + * + * The maximum number of outstanding (unacknowledged) pings is determined by the`maxOutstandingPings` configuration option. The default maximum is 10. + * + * If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView`containing 8 bytes of data that will be transmitted with the `PING` and + * returned with the ping acknowledgment. + * + * The callback will be invoked with three arguments: an error argument that will + * be `null` if the `PING` was successfully acknowledged, a `duration` argument + * that reports the number of milliseconds elapsed since the ping was sent and the + * acknowledgment was received, and a `Buffer` containing the 8-byte `PING`payload. + * + * ```js + * session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { + * if (!err) { + * console.log(`Ping acknowledged in ${duration} milliseconds`); + * console.log(`With payload '${payload.toString()}'`); + * } + * }); + * ``` + * + * If the `payload` argument is not specified, the default payload will be the + * 64-bit timestamp (little endian) marking the start of the `PING` duration. + * @since v8.9.3 + * @param payload Optional ping payload. + */ + ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; + ping(payload: NodeJS.ArrayBufferView, callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; + /** + * Calls `ref()` on this `Http2Session`instance's underlying `net.Socket`. + * @since v9.4.0 + */ + ref(): void; + /** + * Sets the local endpoint's window size. + * The `windowSize` is the total window size to set, not + * the delta. + * + * ```js + * const http2 = require('node:http2'); + * + * const server = http2.createServer(); + * const expectedWindowSize = 2 ** 20; + * server.on('connect', (session) => { + * + * // Set local window size to be 2 ** 20 + * session.setLocalWindowSize(expectedWindowSize); + * }); + * ``` + * @since v15.3.0, v14.18.0 + */ + setLocalWindowSize(windowSize: number): void; + /** + * Used to set a callback function that is called when there is no activity on + * the `Http2Session` after `msecs` milliseconds. The given `callback` is + * registered as a listener on the `'timeout'` event. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * Updates the current local settings for this `Http2Session` and sends a new`SETTINGS` frame to the connected HTTP/2 peer. + * + * Once called, the `http2session.pendingSettingsAck` property will be `true`while the session is waiting for the remote peer to acknowledge the new + * settings. + * + * The new settings will not become effective until the `SETTINGS` acknowledgment + * is received and the `'localSettings'` event is emitted. It is possible to send + * multiple `SETTINGS` frames while acknowledgment is still pending. + * @since v8.4.0 + * @param callback Callback that is called once the session is connected or right away if the session is already connected. + */ + settings(settings: Settings, callback?: (err: Error | null, settings: Settings, duration: number) => void): void; + /** + * Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`. + * @since v9.4.0 + */ + unref(): void; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + addListener(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + addListener(event: 'localSettings', listener: (settings: Settings) => void): this; + addListener(event: 'ping', listener: () => void): this; + addListener(event: 'remoteSettings', listener: (settings: Settings) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'frameError', frameType: number, errorCode: number, streamID: number): boolean; + emit(event: 'goaway', errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean; + emit(event: 'localSettings', settings: Settings): boolean; + emit(event: 'ping'): boolean; + emit(event: 'remoteSettings', settings: Settings): boolean; + emit(event: 'timeout'): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + on(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + on(event: 'localSettings', listener: (settings: Settings) => void): this; + on(event: 'ping', listener: () => void): this; + on(event: 'remoteSettings', listener: (settings: Settings) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + once(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + once(event: 'localSettings', listener: (settings: Settings) => void): this; + once(event: 'ping', listener: () => void): this; + once(event: 'remoteSettings', listener: (settings: Settings) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + prependListener(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + prependListener(event: 'localSettings', listener: (settings: Settings) => void): this; + prependListener(event: 'ping', listener: () => void): this; + prependListener(event: 'remoteSettings', listener: (settings: Settings) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + prependOnceListener(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + prependOnceListener(event: 'localSettings', listener: (settings: Settings) => void): this; + prependOnceListener(event: 'ping', listener: () => void): this; + prependOnceListener(event: 'remoteSettings', listener: (settings: Settings) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ClientHttp2Session extends Http2Session { + /** + * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an + * HTTP/2 request to the connected server. + * + * When a `ClientHttp2Session` is first created, the socket may not yet be + * connected. if `clienthttp2session.request()` is called during this time, the + * actual request will be deferred until the socket is ready to go. + * If the `session` is closed before the actual request be executed, an`ERR_HTTP2_GOAWAY_SESSION` is thrown. + * + * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`. + * + * ```js + * const http2 = require('node:http2'); + * const clientSession = http2.connect('https://localhost:1234'); + * const { + * HTTP2_HEADER_PATH, + * HTTP2_HEADER_STATUS, + * } = http2.constants; + * + * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); + * req.on('response', (headers) => { + * console.log(headers[HTTP2_HEADER_STATUS]); + * req.on('data', (chunk) => { // .. }); + * req.on('end', () => { // .. }); + * }); + * ``` + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * is emitted immediately after queuing the last chunk of payload data to be sent. + * The `http2stream.sendTrailers()` method can then be called to send trailing + * headers to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * When `options.signal` is set with an `AbortSignal` and then `abort` on the + * corresponding `AbortController` is called, the request will emit an `'error'`event with an `AbortError` error. + * + * The `:method` and `:path` pseudo-headers are not specified within `headers`, + * they respectively default to: + * + * * `:method` \= `'GET'` + * * `:path` \= `/` + * @since v8.4.0 + */ + request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; + addListener(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + addListener(event: 'origin', listener: (origins: string[]) => void): this; + addListener(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + addListener(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'altsvc', alt: string, origin: string, stream: number): boolean; + emit(event: 'origin', origins: ReadonlyArray): boolean; + emit(event: 'connect', session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; + emit(event: 'stream', stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + on(event: 'origin', listener: (origins: string[]) => void): this; + on(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + on(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + once(event: 'origin', listener: (origins: string[]) => void): this; + once(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + once(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + prependListener(event: 'origin', listener: (origins: string[]) => void): this; + prependListener(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + prependListener(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + prependOnceListener(event: 'origin', listener: (origins: string[]) => void): this; + prependOnceListener(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + prependOnceListener(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface AlternativeServiceOptions { + origin: number | string | url.URL; + } + export interface ServerHttp2Session extends Http2Session { + readonly server: Http2Server | Http2SecureServer; + /** + * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client. + * + * ```js + * const http2 = require('node:http2'); + * + * const server = http2.createServer(); + * server.on('session', (session) => { + * // Set altsvc for origin https://example.org:80 + * session.altsvc('h2=":8000"', 'https://example.org:80'); + * }); + * + * server.on('stream', (stream) => { + * // Set altsvc for a specific stream + * stream.session.altsvc('h2=":8000"', stream.id); + * }); + * ``` + * + * Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate + * service is associated with the origin of the given `Http2Stream`. + * + * The `alt` and origin string _must_ contain only ASCII bytes and are + * strictly interpreted as a sequence of ASCII bytes. The special value `'clear'`may be passed to clear any previously set alternative service for a given + * domain. + * + * When a string is passed for the `originOrStream` argument, it will be parsed as + * a URL and the origin will be derived. For instance, the origin for the + * HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string + * cannot be parsed as a URL or if a valid origin cannot be derived. + * + * A `URL` object, or any object with an `origin` property, may be passed as`originOrStream`, in which case the value of the `origin` property will be + * used. The value of the `origin` property _must_ be a properly serialized + * ASCII origin. + * @since v9.4.0 + * @param alt A description of the alternative service configuration as defined by `RFC 7838`. + * @param originOrStream Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the + * `http2stream.id` property. + */ + altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; + /** + * Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client + * to advertise the set of origins for which the server is capable of providing + * authoritative responses. + * + * ```js + * const http2 = require('node:http2'); + * const options = getSecureOptionsSomehow(); + * const server = http2.createSecureServer(options); + * server.on('stream', (stream) => { + * stream.respond(); + * stream.end('ok'); + * }); + * server.on('session', (session) => { + * session.origin('https://example.com', 'https://example.org'); + * }); + * ``` + * + * When a string is passed as an `origin`, it will be parsed as a URL and the + * origin will be derived. For instance, the origin for the HTTP URL`'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given + * string + * cannot be parsed as a URL or if a valid origin cannot be derived. + * + * A `URL` object, or any object with an `origin` property, may be passed as + * an `origin`, in which case the value of the `origin` property will be + * used. The value of the `origin` property _must_ be a properly serialized + * ASCII origin. + * + * Alternatively, the `origins` option may be used when creating a new HTTP/2 + * server using the `http2.createSecureServer()` method: + * + * ```js + * const http2 = require('node:http2'); + * const options = getSecureOptionsSomehow(); + * options.origins = ['https://example.com', 'https://example.org']; + * const server = http2.createSecureServer(options); + * server.on('stream', (stream) => { + * stream.respond(); + * stream.end('ok'); + * }); + * ``` + * @since v10.12.0 + * @param origins One or more URL Strings passed as separate arguments. + */ + origin( + ...origins: Array< + | string + | url.URL + | { + origin: string; + } + > + ): void; + addListener(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + addListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'connect', session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; + emit(event: 'stream', stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + on(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + once(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + prependListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + prependOnceListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + // Http2Server + export interface SessionOptions { + maxDeflateDynamicTableSize?: number | undefined; + maxSessionMemory?: number | undefined; + maxHeaderListPairs?: number | undefined; + maxOutstandingPings?: number | undefined; + maxSendHeaderBlockLength?: number | undefined; + paddingStrategy?: number | undefined; + peerMaxConcurrentStreams?: number | undefined; + settings?: Settings | undefined; + /** + * Specifies a timeout in milliseconds that + * a server should wait when an [`'unknownProtocol'`][] is emitted. If the + * socket has not been destroyed by that time the server will destroy it. + * @default 100000 + */ + unknownProtocolTimeout?: number | undefined; + selectPadding?(frameLen: number, maxFrameLen: number): number; + } + export interface ClientSessionOptions extends SessionOptions { + maxReservedRemoteStreams?: number | undefined; + createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined; + protocol?: 'http:' | 'https:' | undefined; + } + export interface ServerSessionOptions extends SessionOptions { + Http1IncomingMessage?: typeof IncomingMessage | undefined; + Http1ServerResponse?: typeof ServerResponse | undefined; + Http2ServerRequest?: typeof Http2ServerRequest | undefined; + Http2ServerResponse?: typeof Http2ServerResponse | undefined; + } + export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {} + export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {} + export interface ServerOptions extends ServerSessionOptions {} + export interface SecureServerOptions extends SecureServerSessionOptions { + allowHTTP1?: boolean | undefined; + origins?: string[] | undefined; + } + interface HTTP2ServerCommon { + setTimeout(msec?: number, callback?: () => void): this; + /** + * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values. + * Throws ERR_INVALID_ARG_TYPE for invalid settings argument. + */ + updateSettings(settings: Settings): void; + } + export interface Http2Server extends net.Server, HTTP2ServerCommon { + addListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + addListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + addListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + addListener(event: 'sessionError', listener: (err: Error) => void): this; + addListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'checkContinue', request: Http2ServerRequest, response: Http2ServerResponse): boolean; + emit(event: 'request', request: Http2ServerRequest, response: Http2ServerResponse): boolean; + emit(event: 'session', session: ServerHttp2Session): boolean; + emit(event: 'sessionError', err: Error): boolean; + emit(event: 'stream', stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: 'timeout'): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + on(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + on(event: 'session', listener: (session: ServerHttp2Session) => void): this; + on(event: 'sessionError', listener: (err: Error) => void): this; + on(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + once(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + once(event: 'session', listener: (session: ServerHttp2Session) => void): this; + once(event: 'sessionError', listener: (err: Error) => void): this; + once(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + prependListener(event: 'sessionError', listener: (err: Error) => void): this; + prependListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependOnceListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependOnceListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + prependOnceListener(event: 'sessionError', listener: (err: Error) => void): this; + prependOnceListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon { + addListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + addListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + addListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + addListener(event: 'sessionError', listener: (err: Error) => void): this; + addListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'checkContinue', request: Http2ServerRequest, response: Http2ServerResponse): boolean; + emit(event: 'request', request: Http2ServerRequest, response: Http2ServerResponse): boolean; + emit(event: 'session', session: ServerHttp2Session): boolean; + emit(event: 'sessionError', err: Error): boolean; + emit(event: 'stream', stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: 'timeout'): boolean; + emit(event: 'unknownProtocol', socket: tls.TLSSocket): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + on(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + on(event: 'session', listener: (session: ServerHttp2Session) => void): this; + on(event: 'sessionError', listener: (err: Error) => void): this; + on(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + once(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + once(event: 'session', listener: (session: ServerHttp2Session) => void): this; + once(event: 'sessionError', listener: (err: Error) => void): this; + once(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + prependListener(event: 'sessionError', listener: (err: Error) => void): this; + prependListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependOnceListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependOnceListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + prependOnceListener(event: 'sessionError', listener: (err: Error) => void): this; + prependOnceListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status, + * headers, and + * data. + * @since v8.4.0 + */ + export class Http2ServerRequest extends stream.Readable { + constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray); + /** + * The `request.aborted` property will be `true` if the request has + * been aborted. + * @since v10.1.0 + */ + readonly aborted: boolean; + /** + * The request authority pseudo header field. Because HTTP/2 allows requests + * to set either `:authority` or `host`, this value is derived from`req.headers[':authority']` if present. Otherwise, it is derived from`req.headers['host']`. + * @since v8.4.0 + */ + readonly authority: string; + /** + * See `request.socket`. + * @since v8.4.0 + * @deprecated Since v13.0.0 - Use `socket`. + */ + readonly connection: net.Socket | tls.TLSSocket; + /** + * The `request.complete` property will be `true` if the request has + * been completed, aborted, or destroyed. + * @since v12.10.0 + */ + readonly complete: boolean; + /** + * The request/response headers object. + * + * Key-value pairs of header names and values. Header names are lower-cased. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': 'curl/7.22.0', + * // host: '127.0.0.1:8000', + * // accept: '*' } + * console.log(request.headers); + * ``` + * + * See `HTTP/2 Headers Object`. + * + * In HTTP/2, the request path, host name, protocol, and method are represented as + * special headers prefixed with the `:` character (e.g. `':path'`). These special + * headers will be included in the `request.headers` object. Care must be taken not + * to inadvertently modify these special headers or errors may occur. For instance, + * removing all headers from the request will cause errors to occur: + * + * ```js + * removeAllHeaders(request.headers); + * assert(request.url); // Fails because the :path header has been removed + * ``` + * @since v8.4.0 + */ + readonly headers: IncomingHttpHeaders; + /** + * In case of server request, the HTTP version sent by the client. In the case of + * client response, the HTTP version of the connected-to server. Returns`'2.0'`. + * + * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second. + * @since v8.4.0 + */ + readonly httpVersion: string; + readonly httpVersionMinor: number; + readonly httpVersionMajor: number; + /** + * The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`. + * @since v8.4.0 + */ + readonly method: string; + /** + * The raw request/response headers list exactly as they were received. + * + * The keys and values are in the same list. It is _not_ a + * list of tuples. So, the even-numbered offsets are key values, and the + * odd-numbered offsets are the associated values. + * + * Header names are not lowercased, and duplicates are not merged. + * + * ```js + * // Prints something like: + * // + * // [ 'user-agent', + * // 'this is invalid because there can be only one', + * // 'User-Agent', + * // 'curl/7.22.0', + * // 'Host', + * // '127.0.0.1:8000', + * // 'ACCEPT', + * // '*' ] + * console.log(request.rawHeaders); + * ``` + * @since v8.4.0 + */ + readonly rawHeaders: string[]; + /** + * The raw request/response trailer keys and values exactly as they were + * received. Only populated at the `'end'` event. + * @since v8.4.0 + */ + readonly rawTrailers: string[]; + /** + * The request scheme pseudo header field indicating the scheme + * portion of the target URL. + * @since v8.4.0 + */ + readonly scheme: string; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * applies getters, setters, and methods based on HTTP/2 logic. + * + * `destroyed`, `readable`, and `writable` properties will be retrieved from and + * set on `request.stream`. + * + * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`request.stream`. + * + * `setTimeout` method will be called on `request.stream.session`. + * + * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for + * more information. + * + * All other interactions will be routed directly to the socket. With TLS support, + * use `request.socket.getPeerCertificate()` to obtain the client's + * authentication details. + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * The `Http2Stream` object backing the request. + * @since v8.4.0 + */ + readonly stream: ServerHttp2Stream; + /** + * The request/response trailers object. Only populated at the `'end'` event. + * @since v8.4.0 + */ + readonly trailers: IncomingHttpHeaders; + /** + * Request URL string. This contains only the URL that is present in the actual + * HTTP request. If the request is: + * + * ```http + * GET /status?name=ryan HTTP/1.1 + * Accept: text/plain + * ``` + * + * Then `request.url` will be: + * + * ```js + * '/status?name=ryan' + * ``` + * + * To parse the url into its parts, `new URL()` can be used: + * + * ```console + * $ node + * > new URL('/status?name=ryan', 'http://example.com') + * URL { + * href: 'http://example.com/status?name=ryan', + * origin: 'http://example.com', + * protocol: 'http:', + * username: '', + * password: '', + * host: 'example.com', + * hostname: 'example.com', + * port: '', + * pathname: '/status', + * search: '?name=ryan', + * searchParams: URLSearchParams { 'name' => 'ryan' }, + * hash: '' + * } + * ``` + * @since v8.4.0 + */ + url: string; + /** + * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is + * provided, then it is added as a listener on the `'timeout'` event on + * the response object. + * + * If no `'timeout'` listener is added to the request, the response, or + * the server, then `Http2Stream` s are destroyed when they time out. If a + * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + read(size?: number): Buffer | string | null; + addListener(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'readable', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'aborted', hadError: boolean, code: number): boolean; + emit(event: 'close'): boolean; + emit(event: 'data', chunk: Buffer | string): boolean; + emit(event: 'end'): boolean; + emit(event: 'readable'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: Buffer | string) => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'readable', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: Buffer | string) => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'readable', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'readable', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'readable', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * This object is created internally by an HTTP server, not by the user. It is + * passed as the second parameter to the `'request'` event. + * @since v8.4.0 + */ + export class Http2ServerResponse extends stream.Writable { + constructor(stream: ServerHttp2Stream); + /** + * See `response.socket`. + * @since v8.4.0 + * @deprecated Since v13.0.0 - Use `socket`. + */ + readonly connection: net.Socket | tls.TLSSocket; + /** + * Boolean value that indicates whether the response has completed. Starts + * as `false`. After `response.end()` executes, the value will be `true`. + * @since v8.4.0 + * @deprecated Since v13.4.0,v12.16.0 - Use `writableEnded`. + */ + readonly finished: boolean; + /** + * True if headers were sent, false otherwise (read-only). + * @since v8.4.0 + */ + readonly headersSent: boolean; + /** + * A reference to the original HTTP2 `request` object. + * @since v15.7.0 + */ + readonly req: Http2ServerRequest; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * applies getters, setters, and methods based on HTTP/2 logic. + * + * `destroyed`, `readable`, and `writable` properties will be retrieved from and + * set on `response.stream`. + * + * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`response.stream`. + * + * `setTimeout` method will be called on `response.stream.session`. + * + * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for + * more information. + * + * All other interactions will be routed directly to the socket. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer((req, res) => { + * const ip = req.socket.remoteAddress; + * const port = req.socket.remotePort; + * res.end(`Your IP address is ${ip} and your source port is ${port}.`); + * }).listen(3000); + * ``` + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * The `Http2Stream` object backing the response. + * @since v8.4.0 + */ + readonly stream: ServerHttp2Stream; + /** + * When true, the Date header will be automatically generated and sent in + * the response if it is not already present in the headers. Defaults to true. + * + * This should only be disabled for testing; HTTP requires the Date header + * in responses. + * @since v8.4.0 + */ + sendDate: boolean; + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status code that will be sent to the client when + * the headers get flushed. + * + * ```js + * response.statusCode = 404; + * ``` + * + * After response header was sent to the client, this property indicates the + * status code which was sent out. + * @since v8.4.0 + */ + statusCode: number; + /** + * Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns + * an empty string. + * @since v8.4.0 + */ + statusMessage: ''; + /** + * This method adds HTTP trailing headers (a header but at the end of the + * message) to the response. + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v8.4.0 + */ + addTrailers(trailers: OutgoingHttpHeaders): void; + /** + * This method signals to the server that all of the response headers and body + * have been sent; that server should consider this message complete. + * The method, `response.end()`, MUST be called on each response. + * + * If `data` is specified, it is equivalent to calling `response.write(data, encoding)` followed by `response.end(callback)`. + * + * If `callback` is specified, it will be called when the response stream + * is finished. + * @since v8.4.0 + */ + end(callback?: () => void): this; + end(data: string | Uint8Array, callback?: () => void): this; + end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): this; + /** + * Reads out a header that has already been queued but not sent to the client. + * The name is case-insensitive. + * + * ```js + * const contentType = response.getHeader('content-type'); + * ``` + * @since v8.4.0 + */ + getHeader(name: string): string; + /** + * Returns an array containing the unique names of the current outgoing headers. + * All header names are lowercase. + * + * ```js + * response.setHeader('Foo', 'bar'); + * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headerNames = response.getHeaderNames(); + * // headerNames === ['foo', 'set-cookie'] + * ``` + * @since v8.4.0 + */ + getHeaderNames(): string[]; + /** + * Returns a shallow copy of the current outgoing headers. Since a shallow copy + * is used, array values may be mutated without additional calls to various + * header-related http module methods. The keys of the returned object are the + * header names and the values are the respective header values. All header names + * are lowercase. + * + * The object returned by the `response.getHeaders()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`, + * `obj.hasOwnProperty()`, and others + * are not defined and _will not work_. + * + * ```js + * response.setHeader('Foo', 'bar'); + * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headers = response.getHeaders(); + * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } + * ``` + * @since v8.4.0 + */ + getHeaders(): OutgoingHttpHeaders; + /** + * Returns `true` if the header identified by `name` is currently set in the + * outgoing headers. The header name matching is case-insensitive. + * + * ```js + * const hasContentType = response.hasHeader('content-type'); + * ``` + * @since v8.4.0 + */ + hasHeader(name: string): boolean; + /** + * Removes a header that has been queued for implicit sending. + * + * ```js + * response.removeHeader('Content-Encoding'); + * ``` + * @since v8.4.0 + */ + removeHeader(name: string): void; + /** + * Sets a single header value for implicit headers. If this header already exists + * in the to-be-sent headers, its value will be replaced. Use an array of strings + * here to send multiple headers with the same name. + * + * ```js + * response.setHeader('Content-Type', 'text/html; charset=utf-8'); + * ``` + * + * or + * + * ```js + * response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * ```js + * // Returns content-type = text/plain + * const server = http2.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html; charset=utf-8'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); + * res.end('ok'); + * }); + * ``` + * @since v8.4.0 + */ + setHeader(name: string, value: number | string | ReadonlyArray): void; + /** + * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is + * provided, then it is added as a listener on the `'timeout'` event on + * the response object. + * + * If no `'timeout'` listener is added to the request, the response, or + * the server, then `Http2Stream` s are destroyed when they time out. If a + * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * If this method is called and `response.writeHead()` has not been called, + * it will switch to implicit header mode and flush the implicit headers. + * + * This sends a chunk of the response body. This method may + * be called multiple times to provide successive parts of the body. + * + * In the `node:http` module, the response body is omitted when the + * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body. + * + * `chunk` can be a string or a buffer. If `chunk` is a string, + * the second parameter specifies how to encode it into a byte stream. + * By default the `encoding` is `'utf8'`. `callback` will be called when this chunk + * of data is flushed. + * + * This is the raw HTTP body and has nothing to do with higher-level multi-part + * body encodings that may be used. + * + * The first time `response.write()` is called, it will send the buffered + * header information and the first chunk of the body to the client. The second + * time `response.write()` is called, Node.js assumes data will be streamed, + * and sends the new data separately. That is, the response is buffered up to the + * first chunk of the body. + * + * Returns `true` if the entire data was flushed successfully to the kernel + * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is free again. + * @since v8.4.0 + */ + write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; + write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean; + /** + * Sends a status `100 Continue` to the client, indicating that the request body + * should be sent. See the `'checkContinue'` event on `Http2Server` and`Http2SecureServer`. + * @since v8.4.0 + */ + writeContinue(): void; + /** + * Sends a status `103 Early Hints` to the client with a Link header, + * indicating that the user agent can preload/preconnect the linked resources. + * The `hints` is an object containing the values of headers to be sent with + * early hints message. + * + * **Example** + * + * ```js + * const earlyHintsLink = '; rel=preload; as=style'; + * response.writeEarlyHints({ + * 'link': earlyHintsLink, + * }); + * + * const earlyHintsLinks = [ + * '; rel=preload; as=style', + * '; rel=preload; as=script', + * ]; + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * }); + * ``` + * @since v18.11.0 + */ + writeEarlyHints(hints: Record): void; + /** + * Sends a response header to the request. The status code is a 3-digit HTTP + * status code, like `404`. The last argument, `headers`, are the response headers. + * + * Returns a reference to the `Http2ServerResponse`, so that calls can be chained. + * + * For compatibility with `HTTP/1`, a human-readable `statusMessage` may be + * passed as the second argument. However, because the `statusMessage` has no + * meaning within HTTP/2, the argument will have no effect and a process warning + * will be emitted. + * + * ```js + * const body = 'hello world'; + * response.writeHead(200, { + * 'Content-Length': Buffer.byteLength(body), + * 'Content-Type': 'text/plain; charset=utf-8', + * }); + * ``` + * + * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a + * given encoding. On outbound messages, Node.js does not check if Content-Length + * and the length of the body being transmitted are equal or not. However, when + * receiving messages, Node.js will automatically reject messages when the`Content-Length` does not match the actual payload size. + * + * This method may be called at most one time on a message before `response.end()` is called. + * + * If `response.write()` or `response.end()` are called before calling + * this, the implicit/mutable headers will be calculated and call this function. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * ```js + * // Returns content-type = text/plain + * const server = http2.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html; charset=utf-8'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); + * res.end('ok'); + * }); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v8.4.0 + */ + writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; + writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; + /** + * Call `http2stream.pushStream()` with the given headers, and wrap the + * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback + * parameter if successful. When `Http2ServerRequest` is closed, the callback is + * called with an error `ERR_HTTP2_INVALID_STREAM`. + * @since v8.4.0 + * @param headers An object describing the headers + * @param callback Called once `http2stream.pushStream()` is finished, or either when the attempt to create the pushed `Http2Stream` has failed or has been rejected, or the state of + * `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method + */ + createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'error', listener: (error: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'drain'): boolean; + emit(event: 'error', error: Error): boolean; + emit(event: 'finish'): boolean; + emit(event: 'pipe', src: stream.Readable): boolean; + emit(event: 'unpipe', src: stream.Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'error', listener: (error: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'error', listener: (error: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'pipe', listener: (src: stream.Readable) => void): this; + once(event: 'unpipe', listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'error', listener: (error: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'error', listener: (error: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export namespace constants { + const NGHTTP2_SESSION_SERVER: number; + const NGHTTP2_SESSION_CLIENT: number; + const NGHTTP2_STREAM_STATE_IDLE: number; + const NGHTTP2_STREAM_STATE_OPEN: number; + const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; + const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; + const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; + const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; + const NGHTTP2_STREAM_STATE_CLOSED: number; + const NGHTTP2_NO_ERROR: number; + const NGHTTP2_PROTOCOL_ERROR: number; + const NGHTTP2_INTERNAL_ERROR: number; + const NGHTTP2_FLOW_CONTROL_ERROR: number; + const NGHTTP2_SETTINGS_TIMEOUT: number; + const NGHTTP2_STREAM_CLOSED: number; + const NGHTTP2_FRAME_SIZE_ERROR: number; + const NGHTTP2_REFUSED_STREAM: number; + const NGHTTP2_CANCEL: number; + const NGHTTP2_COMPRESSION_ERROR: number; + const NGHTTP2_CONNECT_ERROR: number; + const NGHTTP2_ENHANCE_YOUR_CALM: number; + const NGHTTP2_INADEQUATE_SECURITY: number; + const NGHTTP2_HTTP_1_1_REQUIRED: number; + const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; + const NGHTTP2_FLAG_NONE: number; + const NGHTTP2_FLAG_END_STREAM: number; + const NGHTTP2_FLAG_END_HEADERS: number; + const NGHTTP2_FLAG_ACK: number; + const NGHTTP2_FLAG_PADDED: number; + const NGHTTP2_FLAG_PRIORITY: number; + const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; + const DEFAULT_SETTINGS_ENABLE_PUSH: number; + const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; + const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; + const MAX_MAX_FRAME_SIZE: number; + const MIN_MAX_FRAME_SIZE: number; + const MAX_INITIAL_WINDOW_SIZE: number; + const NGHTTP2_DEFAULT_WEIGHT: number; + const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; + const NGHTTP2_SETTINGS_ENABLE_PUSH: number; + const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; + const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; + const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; + const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; + const PADDING_STRATEGY_NONE: number; + const PADDING_STRATEGY_MAX: number; + const PADDING_STRATEGY_CALLBACK: number; + const HTTP2_HEADER_STATUS: string; + const HTTP2_HEADER_METHOD: string; + const HTTP2_HEADER_AUTHORITY: string; + const HTTP2_HEADER_SCHEME: string; + const HTTP2_HEADER_PATH: string; + const HTTP2_HEADER_ACCEPT_CHARSET: string; + const HTTP2_HEADER_ACCEPT_ENCODING: string; + const HTTP2_HEADER_ACCEPT_LANGUAGE: string; + const HTTP2_HEADER_ACCEPT_RANGES: string; + const HTTP2_HEADER_ACCEPT: string; + const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; + const HTTP2_HEADER_AGE: string; + const HTTP2_HEADER_ALLOW: string; + const HTTP2_HEADER_AUTHORIZATION: string; + const HTTP2_HEADER_CACHE_CONTROL: string; + const HTTP2_HEADER_CONNECTION: string; + const HTTP2_HEADER_CONTENT_DISPOSITION: string; + const HTTP2_HEADER_CONTENT_ENCODING: string; + const HTTP2_HEADER_CONTENT_LANGUAGE: string; + const HTTP2_HEADER_CONTENT_LENGTH: string; + const HTTP2_HEADER_CONTENT_LOCATION: string; + const HTTP2_HEADER_CONTENT_MD5: string; + const HTTP2_HEADER_CONTENT_RANGE: string; + const HTTP2_HEADER_CONTENT_TYPE: string; + const HTTP2_HEADER_COOKIE: string; + const HTTP2_HEADER_DATE: string; + const HTTP2_HEADER_ETAG: string; + const HTTP2_HEADER_EXPECT: string; + const HTTP2_HEADER_EXPIRES: string; + const HTTP2_HEADER_FROM: string; + const HTTP2_HEADER_HOST: string; + const HTTP2_HEADER_IF_MATCH: string; + const HTTP2_HEADER_IF_MODIFIED_SINCE: string; + const HTTP2_HEADER_IF_NONE_MATCH: string; + const HTTP2_HEADER_IF_RANGE: string; + const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; + const HTTP2_HEADER_LAST_MODIFIED: string; + const HTTP2_HEADER_LINK: string; + const HTTP2_HEADER_LOCATION: string; + const HTTP2_HEADER_MAX_FORWARDS: string; + const HTTP2_HEADER_PREFER: string; + const HTTP2_HEADER_PROXY_AUTHENTICATE: string; + const HTTP2_HEADER_PROXY_AUTHORIZATION: string; + const HTTP2_HEADER_RANGE: string; + const HTTP2_HEADER_REFERER: string; + const HTTP2_HEADER_REFRESH: string; + const HTTP2_HEADER_RETRY_AFTER: string; + const HTTP2_HEADER_SERVER: string; + const HTTP2_HEADER_SET_COOKIE: string; + const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; + const HTTP2_HEADER_TRANSFER_ENCODING: string; + const HTTP2_HEADER_TE: string; + const HTTP2_HEADER_UPGRADE: string; + const HTTP2_HEADER_USER_AGENT: string; + const HTTP2_HEADER_VARY: string; + const HTTP2_HEADER_VIA: string; + const HTTP2_HEADER_WWW_AUTHENTICATE: string; + const HTTP2_HEADER_HTTP2_SETTINGS: string; + const HTTP2_HEADER_KEEP_ALIVE: string; + const HTTP2_HEADER_PROXY_CONNECTION: string; + const HTTP2_METHOD_ACL: string; + const HTTP2_METHOD_BASELINE_CONTROL: string; + const HTTP2_METHOD_BIND: string; + const HTTP2_METHOD_CHECKIN: string; + const HTTP2_METHOD_CHECKOUT: string; + const HTTP2_METHOD_CONNECT: string; + const HTTP2_METHOD_COPY: string; + const HTTP2_METHOD_DELETE: string; + const HTTP2_METHOD_GET: string; + const HTTP2_METHOD_HEAD: string; + const HTTP2_METHOD_LABEL: string; + const HTTP2_METHOD_LINK: string; + const HTTP2_METHOD_LOCK: string; + const HTTP2_METHOD_MERGE: string; + const HTTP2_METHOD_MKACTIVITY: string; + const HTTP2_METHOD_MKCALENDAR: string; + const HTTP2_METHOD_MKCOL: string; + const HTTP2_METHOD_MKREDIRECTREF: string; + const HTTP2_METHOD_MKWORKSPACE: string; + const HTTP2_METHOD_MOVE: string; + const HTTP2_METHOD_OPTIONS: string; + const HTTP2_METHOD_ORDERPATCH: string; + const HTTP2_METHOD_PATCH: string; + const HTTP2_METHOD_POST: string; + const HTTP2_METHOD_PRI: string; + const HTTP2_METHOD_PROPFIND: string; + const HTTP2_METHOD_PROPPATCH: string; + const HTTP2_METHOD_PUT: string; + const HTTP2_METHOD_REBIND: string; + const HTTP2_METHOD_REPORT: string; + const HTTP2_METHOD_SEARCH: string; + const HTTP2_METHOD_TRACE: string; + const HTTP2_METHOD_UNBIND: string; + const HTTP2_METHOD_UNCHECKOUT: string; + const HTTP2_METHOD_UNLINK: string; + const HTTP2_METHOD_UNLOCK: string; + const HTTP2_METHOD_UPDATE: string; + const HTTP2_METHOD_UPDATEREDIRECTREF: string; + const HTTP2_METHOD_VERSION_CONTROL: string; + const HTTP_STATUS_CONTINUE: number; + const HTTP_STATUS_SWITCHING_PROTOCOLS: number; + const HTTP_STATUS_PROCESSING: number; + const HTTP_STATUS_OK: number; + const HTTP_STATUS_CREATED: number; + const HTTP_STATUS_ACCEPTED: number; + const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; + const HTTP_STATUS_NO_CONTENT: number; + const HTTP_STATUS_RESET_CONTENT: number; + const HTTP_STATUS_PARTIAL_CONTENT: number; + const HTTP_STATUS_MULTI_STATUS: number; + const HTTP_STATUS_ALREADY_REPORTED: number; + const HTTP_STATUS_IM_USED: number; + const HTTP_STATUS_MULTIPLE_CHOICES: number; + const HTTP_STATUS_MOVED_PERMANENTLY: number; + const HTTP_STATUS_FOUND: number; + const HTTP_STATUS_SEE_OTHER: number; + const HTTP_STATUS_NOT_MODIFIED: number; + const HTTP_STATUS_USE_PROXY: number; + const HTTP_STATUS_TEMPORARY_REDIRECT: number; + const HTTP_STATUS_PERMANENT_REDIRECT: number; + const HTTP_STATUS_BAD_REQUEST: number; + const HTTP_STATUS_UNAUTHORIZED: number; + const HTTP_STATUS_PAYMENT_REQUIRED: number; + const HTTP_STATUS_FORBIDDEN: number; + const HTTP_STATUS_NOT_FOUND: number; + const HTTP_STATUS_METHOD_NOT_ALLOWED: number; + const HTTP_STATUS_NOT_ACCEPTABLE: number; + const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; + const HTTP_STATUS_REQUEST_TIMEOUT: number; + const HTTP_STATUS_CONFLICT: number; + const HTTP_STATUS_GONE: number; + const HTTP_STATUS_LENGTH_REQUIRED: number; + const HTTP_STATUS_PRECONDITION_FAILED: number; + const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; + const HTTP_STATUS_URI_TOO_LONG: number; + const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; + const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; + const HTTP_STATUS_EXPECTATION_FAILED: number; + const HTTP_STATUS_TEAPOT: number; + const HTTP_STATUS_MISDIRECTED_REQUEST: number; + const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; + const HTTP_STATUS_LOCKED: number; + const HTTP_STATUS_FAILED_DEPENDENCY: number; + const HTTP_STATUS_UNORDERED_COLLECTION: number; + const HTTP_STATUS_UPGRADE_REQUIRED: number; + const HTTP_STATUS_PRECONDITION_REQUIRED: number; + const HTTP_STATUS_TOO_MANY_REQUESTS: number; + const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; + const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; + const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; + const HTTP_STATUS_NOT_IMPLEMENTED: number; + const HTTP_STATUS_BAD_GATEWAY: number; + const HTTP_STATUS_SERVICE_UNAVAILABLE: number; + const HTTP_STATUS_GATEWAY_TIMEOUT: number; + const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; + const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; + const HTTP_STATUS_INSUFFICIENT_STORAGE: number; + const HTTP_STATUS_LOOP_DETECTED: number; + const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; + const HTTP_STATUS_NOT_EXTENDED: number; + const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; + } + /** + * This symbol can be set as a property on the HTTP/2 headers object with + * an array value in order to provide a list of headers considered sensitive. + */ + export const sensitiveHeaders: symbol; + /** + * Returns an object containing the default settings for an `Http2Session`instance. This method returns a new object instance every time it is called + * so instances returned may be safely modified for use. + * @since v8.4.0 + */ + export function getDefaultSettings(): Settings; + /** + * Returns a `Buffer` instance containing serialized representation of the given + * HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended + * for use with the `HTTP2-Settings` header field. + * + * ```js + * const http2 = require('node:http2'); + * + * const packed = http2.getPackedSettings({ enablePush: false }); + * + * console.log(packed.toString('base64')); + * // Prints: AAIAAAAA + * ``` + * @since v8.4.0 + */ + export function getPackedSettings(settings: Settings): Buffer; + /** + * Returns a `HTTP/2 Settings Object` containing the deserialized settings from + * the given `Buffer` as generated by `http2.getPackedSettings()`. + * @since v8.4.0 + * @param buf The packed settings. + */ + export function getUnpackedSettings(buf: Uint8Array): Settings; + /** + * Returns a `net.Server` instance that creates and manages `Http2Session`instances. + * + * Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when + * communicating + * with browser clients. + * + * ```js + * const http2 = require('node:http2'); + * + * // Create an unencrypted HTTP/2 server. + * // Since there are no browsers known that support + * // unencrypted HTTP/2, the use of `http2.createSecureServer()` + * // is necessary when communicating with browser clients. + * const server = http2.createServer(); + * + * server.on('stream', (stream, headers) => { + * stream.respond({ + * 'content-type': 'text/html; charset=utf-8', + * ':status': 200, + * }); + * stream.end('

Hello World

'); + * }); + * + * server.listen(8000); + * ``` + * @since v8.4.0 + * @param onRequestHandler See `Compatibility API` + */ + export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; + export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; + /** + * Returns a `tls.Server` instance that creates and manages `Http2Session`instances. + * + * ```js + * const http2 = require('node:http2'); + * const fs = require('node:fs'); + * + * const options = { + * key: fs.readFileSync('server-key.pem'), + * cert: fs.readFileSync('server-cert.pem'), + * }; + * + * // Create a secure HTTP/2 server + * const server = http2.createSecureServer(options); + * + * server.on('stream', (stream, headers) => { + * stream.respond({ + * 'content-type': 'text/html; charset=utf-8', + * ':status': 200, + * }); + * stream.end('

Hello World

'); + * }); + * + * server.listen(8443); + * ``` + * @since v8.4.0 + * @param onRequestHandler See `Compatibility API` + */ + export function createSecureServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; + export function createSecureServer(options: SecureServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; + /** + * Returns a `ClientHttp2Session` instance. + * + * ```js + * const http2 = require('node:http2'); + * const client = http2.connect('https://localhost:1234'); + * + * // Use the client + * + * client.close(); + * ``` + * @since v8.4.0 + * @param authority The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the `http://` or `https://` prefix, host name, and IP port (if a non-default port + * is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored. + * @param listener Will be registered as a one-time listener of the {@link 'connect'} event. + */ + export function connect(authority: string | url.URL, listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): ClientHttp2Session; + export function connect( + authority: string | url.URL, + options?: ClientSessionOptions | SecureClientSessionOptions, + listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void + ): ClientHttp2Session; +} +declare module 'node:http2' { + export * from 'http2'; +} diff --git a/node_modules/@types/node/https.d.ts b/node_modules/@types/node/https.d.ts new file mode 100755 index 0000000..76fca92 --- /dev/null +++ b/node_modules/@types/node/https.d.ts @@ -0,0 +1,441 @@ +/** + * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a + * separate module. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/https.js) + */ +declare module 'https' { + import { Duplex } from 'node:stream'; + import * as tls from 'node:tls'; + import * as http from 'node:http'; + import { URL } from 'node:url'; + type ServerOptions< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; + type RequestOptions = http.RequestOptions & + tls.SecureContextOptions & { + checkServerIdentity?: typeof tls.checkServerIdentity | undefined; + rejectUnauthorized?: boolean | undefined; // Defaults to true + servername?: string | undefined; // SNI TLS Extension + }; + interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { + rejectUnauthorized?: boolean | undefined; + maxCachedSessions?: number | undefined; + } + /** + * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information. + * @since v0.4.5 + */ + class Agent extends http.Agent { + constructor(options?: AgentOptions); + options: AgentOptions; + } + interface Server< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + > extends http.Server {} + /** + * See `http.Server` for more information. + * @since v0.3.4 + */ + class Server< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + > extends tls.Server { + constructor(requestListener?: http.RequestListener); + constructor( + options: ServerOptions, + requestListener?: http.RequestListener, + ); + /** + * Closes all connections connected to this server. + * @since v18.2.0 + */ + closeAllConnections(): void; + /** + * Closes all connections connected to this server which are not sending a request or waiting for a response. + * @since v18.2.0 + */ + closeIdleConnections(): void; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + addListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + addListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'connection', listener: (socket: Duplex) => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'listening', listener: () => void): this; + addListener(event: 'checkContinue', listener: http.RequestListener): this; + addListener(event: 'checkExpectation', listener: http.RequestListener): this; + addListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + addListener(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + addListener(event: 'request', listener: http.RequestListener): this; + addListener(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + emit(event: string, ...args: any[]): boolean; + emit(event: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean; + emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean; + emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; + emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; + emit(event: 'secureConnection', tlsSocket: tls.TLSSocket): boolean; + emit(event: 'tlsClientError', err: Error, tlsSocket: tls.TLSSocket): boolean; + emit(event: 'close'): boolean; + emit(event: 'connection', socket: Duplex): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'listening'): boolean; + emit( + event: 'checkContinue', + req: InstanceType, + res: InstanceType & { + req: InstanceType; + } + ): boolean; + emit( + event: 'checkExpectation', + req: InstanceType, + res: InstanceType & { + req: InstanceType; + } + ): boolean; + emit(event: 'clientError', err: Error, socket: Duplex): boolean; + emit(event: 'connect', req: InstanceType, socket: Duplex, head: Buffer): boolean; + emit( + event: 'request', + req: InstanceType, + res: InstanceType & { + req: InstanceType; + } + ): boolean; + emit(event: 'upgrade', req: InstanceType, socket: Duplex, head: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + on(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + on(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'connection', listener: (socket: Duplex) => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'listening', listener: () => void): this; + on(event: 'checkContinue', listener: http.RequestListener): this; + on(event: 'checkExpectation', listener: http.RequestListener): this; + on(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + on(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + on(event: 'request', listener: http.RequestListener): this; + on(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + once(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + once(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'connection', listener: (socket: Duplex) => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'listening', listener: () => void): this; + once(event: 'checkContinue', listener: http.RequestListener): this; + once(event: 'checkExpectation', listener: http.RequestListener): this; + once(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + once(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + once(event: 'request', listener: http.RequestListener): this; + once(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + prependListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'connection', listener: (socket: Duplex) => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'listening', listener: () => void): this; + prependListener(event: 'checkContinue', listener: http.RequestListener): this; + prependListener(event: 'checkExpectation', listener: http.RequestListener): this; + prependListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + prependListener(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependListener(event: 'request', listener: http.RequestListener): this; + prependListener(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + prependOnceListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + prependOnceListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + prependOnceListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'connection', listener: (socket: Duplex) => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'listening', listener: () => void): this; + prependOnceListener(event: 'checkContinue', listener: http.RequestListener): this; + prependOnceListener(event: 'checkExpectation', listener: http.RequestListener): this; + prependOnceListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + prependOnceListener(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependOnceListener(event: 'request', listener: http.RequestListener): this; + prependOnceListener(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + } + /** + * ```js + * // curl -k https://localhost:8000/ + * const https = require('node:https'); + * const fs = require('node:fs'); + * + * const options = { + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * }; + * + * https.createServer(options, (req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * ``` + * + * Or + * + * ```js + * const https = require('node:https'); + * const fs = require('node:fs'); + * + * const options = { + * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'), + * passphrase: 'sample', + * }; + * + * https.createServer(options, (req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * ``` + * @since v0.3.4 + * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`. + * @param requestListener A listener to be added to the `'request'` event. + */ + function createServer< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + >(requestListener?: http.RequestListener): Server; + function createServer< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + >( + options: ServerOptions, + requestListener?: http.RequestListener, + ): Server; + /** + * Makes a request to a secure web server. + * + * The following additional `options` from `tls.connect()` are also accepted:`ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`,`honorCipherOrder`, `key`, `passphrase`, + * `pfx`, `rejectUnauthorized`,`secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`,`highWaterMark`. + * + * `options` can be an object, a string, or a `URL` object. If `options` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to + * upload a file with a POST request, then write to the `ClientRequest` object. + * + * ```js + * const https = require('node:https'); + * + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * }; + * + * const req = https.request(options, (res) => { + * console.log('statusCode:', res.statusCode); + * console.log('headers:', res.headers); + * + * res.on('data', (d) => { + * process.stdout.write(d); + * }); + * }); + * + * req.on('error', (e) => { + * console.error(e); + * }); + * req.end(); + * ``` + * + * Example using options from `tls.connect()`: + * + * ```js + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * }; + * options.agent = new https.Agent(options); + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Alternatively, opt out of connection pooling by not using an `Agent`. + * + * ```js + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * agent: false, + * }; + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Example using a `URL` as `options`: + * + * ```js + * const options = new URL('https://abc:xyz@example.com'); + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`): + * + * ```js + * const tls = require('node:tls'); + * const https = require('node:https'); + * const crypto = require('node:crypto'); + * + * function sha256(s) { + * return crypto.createHash('sha256').update(s).digest('base64'); + * } + * const options = { + * hostname: 'github.com', + * port: 443, + * path: '/', + * method: 'GET', + * checkServerIdentity: function(host, cert) { + * // Make sure the certificate is issued to the host we are connected to + * const err = tls.checkServerIdentity(host, cert); + * if (err) { + * return err; + * } + * + * // Pin the public key, similar to HPKP pin-sha256 pinning + * const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU='; + * if (sha256(cert.pubkey) !== pubkey256) { + * const msg = 'Certificate verification error: ' + + * `The public key of '${cert.subject.CN}' ` + + * 'does not match our pinned fingerprint'; + * return new Error(msg); + * } + * + * // Pin the exact certificate, rather than the pub key + * const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' + + * 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16'; + * if (cert.fingerprint256 !== cert256) { + * const msg = 'Certificate verification error: ' + + * `The certificate of '${cert.subject.CN}' ` + + * 'does not match our pinned fingerprint'; + * return new Error(msg); + * } + * + * // This loop is informational only. + * // Print the certificate and public key fingerprints of all certs in the + * // chain. Its common to pin the public key of the issuer on the public + * // internet, while pinning the public key of the service in sensitive + * // environments. + * do { + * console.log('Subject Common Name:', cert.subject.CN); + * console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256); + * + * hash = crypto.createHash('sha256'); + * console.log(' Public key ping-sha256:', sha256(cert.pubkey)); + * + * lastprint256 = cert.fingerprint256; + * cert = cert.issuerCertificate; + * } while (cert.fingerprint256 !== lastprint256); + * + * }, + * }; + * + * options.agent = new https.Agent(options); + * const req = https.request(options, (res) => { + * console.log('All OK. Server matched our pinned cert or public key'); + * console.log('statusCode:', res.statusCode); + * // Print the HPKP values + * console.log('headers:', res.headers['public-key-pins']); + * + * res.on('data', (d) => {}); + * }); + * + * req.on('error', (e) => { + * console.error(e.message); + * }); + * req.end(); + * ``` + * + * Outputs for example: + * + * ```text + * Subject Common Name: github.com + * Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16 + * Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU= + * Subject Common Name: DigiCert SHA2 Extended Validation Server CA + * Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A + * Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho= + * Subject Common Name: DigiCert High Assurance EV Root CA + * Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF + * Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18= + * All OK. Server matched our pinned cert or public key + * statusCode: 200 + * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho="; + * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4="; + * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains + * ``` + * @since v0.3.6 + * @param options Accepts all `options` from `request`, with some differences in default values: + */ + function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + /** + * Like `http.get()` but for HTTPS. + * + * `options` can be an object, a string, or a `URL` object. If `options` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * ```js + * const https = require('node:https'); + * + * https.get('https://encrypted.google.com/', (res) => { + * console.log('statusCode:', res.statusCode); + * console.log('headers:', res.headers); + * + * res.on('data', (d) => { + * process.stdout.write(d); + * }); + * + * }).on('error', (e) => { + * console.error(e); + * }); + * ``` + * @since v0.3.6 + * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. + */ + function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + let globalAgent: Agent; +} +declare module 'node:https' { + export * from 'https'; +} diff --git a/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts new file mode 100755 index 0000000..baadcd8 --- /dev/null +++ b/node_modules/@types/node/index.d.ts @@ -0,0 +1,133 @@ +// Type definitions for non-npm package Node.js 20.5 +// Project: https://nodejs.org/ +// Definitions by: Microsoft TypeScript +// DefinitelyTyped +// Alberto Schiabel +// Alvis HT Tang +// Andrew Makarov +// Benjamin Toueg +// Chigozirim C. +// David Junger +// Deividas Bakanas +// Eugene Y. Q. Shen +// Hannes Magnusson +// Huw +// Kelvin Jin +// Klaus Meinhardt +// Lishude +// Mariusz Wiktorczyk +// Mohsen Azimi +// Nicolas Even +// Nikita Galkin +// Parambir Singh +// Sebastian Silbermann +// Thomas den Hollander +// Wilco Bakker +// wwwy3y3 +// Samuel Ainsworth +// Kyle Uehlein +// Thanik Bhongbhibhat +// Marcin Kopacz +// Trivikram Kamat +// Junxiao Shi +// Ilia Baryshnikov +// ExE Boss +// Piotr Błażejewicz +// Anna Henningsen +// Victor Perin +// Yongsheng Zhang +// NodeJS Contributors +// Linus Unnebäck +// wafuwafu13 +// Matteo Collina +// Dmitry Semigradsky +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * License for programmatically and manually incorporated + * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc + * + * Copyright Node.js contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +// NOTE: These definitions support NodeJS and TypeScript 4.9+. + +// Reference required types from the default lib: +/// +/// +/// +/// + +// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + +/// diff --git a/node_modules/@types/node/inspector.d.ts b/node_modules/@types/node/inspector.d.ts new file mode 100755 index 0000000..dbe0374 --- /dev/null +++ b/node_modules/@types/node/inspector.d.ts @@ -0,0 +1,2747 @@ +// eslint-disable-next-line @definitelytyped/dt-header +// Type definitions for inspector + +// These definitions are auto-generated. +// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330 +// for more information. + + +/** + * The `node:inspector` module provides an API for interacting with the V8 + * inspector. + * + * It can be accessed using: + * + * ```js + * import * as inspector from 'node:inspector/promises'; + * ``` + * + * or + * + * ```js + * import * as inspector from 'node:inspector'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/inspector.js) + */ +declare module 'inspector' { + import EventEmitter = require('node:events'); + interface InspectorNotification { + method: string; + params: T; + } + namespace Schema { + /** + * Description of the protocol domain. + */ + interface Domain { + /** + * Domain name. + */ + name: string; + /** + * Domain version. + */ + version: string; + } + interface GetDomainsReturnType { + /** + * List of supported domains. + */ + domains: Domain[]; + } + } + namespace Runtime { + /** + * Unique script identifier. + */ + type ScriptId = string; + /** + * Unique object identifier. + */ + type RemoteObjectId = string; + /** + * Primitive value which cannot be JSON-stringified. + */ + type UnserializableValue = string; + /** + * Mirror object referencing original JavaScript object. + */ + interface RemoteObject { + /** + * Object type. + */ + type: string; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + /** + * Object class (constructor) name. Specified for object type values only. + */ + className?: string | undefined; + /** + * Remote object value in case of primitive values or JSON values (if it was requested). + */ + value?: any; + /** + * Primitive value which can not be JSON-stringified does not have value, but gets this property. + */ + unserializableValue?: UnserializableValue | undefined; + /** + * String representation of the object. + */ + description?: string | undefined; + /** + * Unique object identifier (for non-primitive values). + */ + objectId?: RemoteObjectId | undefined; + /** + * Preview containing abbreviated property values. Specified for object type values only. + * @experimental + */ + preview?: ObjectPreview | undefined; + /** + * @experimental + */ + customPreview?: CustomPreview | undefined; + } + /** + * @experimental + */ + interface CustomPreview { + header: string; + hasBody: boolean; + formatterObjectId: RemoteObjectId; + bindRemoteObjectFunctionId: RemoteObjectId; + configObjectId?: RemoteObjectId | undefined; + } + /** + * Object containing abbreviated remote object value. + * @experimental + */ + interface ObjectPreview { + /** + * Object type. + */ + type: string; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + /** + * String representation of the object. + */ + description?: string | undefined; + /** + * True iff some of the properties or entries of the original object did not fit. + */ + overflow: boolean; + /** + * List of the properties. + */ + properties: PropertyPreview[]; + /** + * List of the entries. Specified for map and set subtype values only. + */ + entries?: EntryPreview[] | undefined; + } + /** + * @experimental + */ + interface PropertyPreview { + /** + * Property name. + */ + name: string; + /** + * Object type. Accessor means that the property itself is an accessor property. + */ + type: string; + /** + * User-friendly property value string. + */ + value?: string | undefined; + /** + * Nested value preview. + */ + valuePreview?: ObjectPreview | undefined; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + } + /** + * @experimental + */ + interface EntryPreview { + /** + * Preview of the key. Specified for map-like collection entries. + */ + key?: ObjectPreview | undefined; + /** + * Preview of the value. + */ + value: ObjectPreview; + } + /** + * Object property descriptor. + */ + interface PropertyDescriptor { + /** + * Property name or symbol description. + */ + name: string; + /** + * The value associated with the property. + */ + value?: RemoteObject | undefined; + /** + * True if the value associated with the property may be changed (data descriptors only). + */ + writable?: boolean | undefined; + /** + * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). + */ + get?: RemoteObject | undefined; + /** + * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). + */ + set?: RemoteObject | undefined; + /** + * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. + */ + configurable: boolean; + /** + * True if this property shows up during enumeration of the properties on the corresponding object. + */ + enumerable: boolean; + /** + * True if the result was thrown during the evaluation. + */ + wasThrown?: boolean | undefined; + /** + * True if the property is owned for the object. + */ + isOwn?: boolean | undefined; + /** + * Property symbol object, if the property is of the symbol type. + */ + symbol?: RemoteObject | undefined; + } + /** + * Object internal property descriptor. This property isn't normally visible in JavaScript code. + */ + interface InternalPropertyDescriptor { + /** + * Conventional property name. + */ + name: string; + /** + * The value associated with the property. + */ + value?: RemoteObject | undefined; + } + /** + * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. + */ + interface CallArgument { + /** + * Primitive value or serializable javascript object. + */ + value?: any; + /** + * Primitive value which can not be JSON-stringified. + */ + unserializableValue?: UnserializableValue | undefined; + /** + * Remote object handle. + */ + objectId?: RemoteObjectId | undefined; + } + /** + * Id of an execution context. + */ + type ExecutionContextId = number; + /** + * Description of an isolated world. + */ + interface ExecutionContextDescription { + /** + * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. + */ + id: ExecutionContextId; + /** + * Execution context origin. + */ + origin: string; + /** + * Human readable name describing given context. + */ + name: string; + /** + * Embedder-specific auxiliary data. + */ + auxData?: {} | undefined; + } + /** + * Detailed information about exception (or error) that was thrown during script compilation or execution. + */ + interface ExceptionDetails { + /** + * Exception id. + */ + exceptionId: number; + /** + * Exception text, which should be used together with exception object when available. + */ + text: string; + /** + * Line number of the exception location (0-based). + */ + lineNumber: number; + /** + * Column number of the exception location (0-based). + */ + columnNumber: number; + /** + * Script ID of the exception location. + */ + scriptId?: ScriptId | undefined; + /** + * URL of the exception location, to be used when the script was not reported. + */ + url?: string | undefined; + /** + * JavaScript stack trace if available. + */ + stackTrace?: StackTrace | undefined; + /** + * Exception object if available. + */ + exception?: RemoteObject | undefined; + /** + * Identifier of the context where exception happened. + */ + executionContextId?: ExecutionContextId | undefined; + } + /** + * Number of milliseconds since epoch. + */ + type Timestamp = number; + /** + * Stack entry for runtime errors and assertions. + */ + interface CallFrame { + /** + * JavaScript function name. + */ + functionName: string; + /** + * JavaScript script id. + */ + scriptId: ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * JavaScript script line number (0-based). + */ + lineNumber: number; + /** + * JavaScript script column number (0-based). + */ + columnNumber: number; + } + /** + * Call frames for assertions or error messages. + */ + interface StackTrace { + /** + * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. + */ + description?: string | undefined; + /** + * JavaScript function name. + */ + callFrames: CallFrame[]; + /** + * Asynchronous JavaScript stack trace that preceded this stack, if available. + */ + parent?: StackTrace | undefined; + /** + * Asynchronous JavaScript stack trace that preceded this stack, if available. + * @experimental + */ + parentId?: StackTraceId | undefined; + } + /** + * Unique identifier of current debugger. + * @experimental + */ + type UniqueDebuggerId = string; + /** + * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. + * @experimental + */ + interface StackTraceId { + id: string; + debuggerId?: UniqueDebuggerId | undefined; + } + interface EvaluateParameterType { + /** + * Expression to evaluate. + */ + expression: string; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + /** + * Determines whether Command Line API should be available during the evaluation. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + contextId?: ExecutionContextId | undefined; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should be treated as initiated by user in the UI. + */ + userGesture?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + } + interface AwaitPromiseParameterType { + /** + * Identifier of the promise. + */ + promiseObjectId: RemoteObjectId; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + */ + generatePreview?: boolean | undefined; + } + interface CallFunctionOnParameterType { + /** + * Declaration of the function to call. + */ + functionDeclaration: string; + /** + * Identifier of the object to call function on. Either objectId or executionContextId should be specified. + */ + objectId?: RemoteObjectId | undefined; + /** + * Call arguments. All call arguments must belong to the same JavaScript world as the target object. + */ + arguments?: CallArgument[] | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object which should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should be treated as initiated by user in the UI. + */ + userGesture?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + /** + * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. + */ + executionContextId?: ExecutionContextId | undefined; + /** + * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. + */ + objectGroup?: string | undefined; + } + interface GetPropertiesParameterType { + /** + * Identifier of the object to return properties for. + */ + objectId: RemoteObjectId; + /** + * If true, returns properties belonging only to the element itself, not to its prototype chain. + */ + ownProperties?: boolean | undefined; + /** + * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. + * @experimental + */ + accessorPropertiesOnly?: boolean | undefined; + /** + * Whether preview should be generated for the results. + * @experimental + */ + generatePreview?: boolean | undefined; + } + interface ReleaseObjectParameterType { + /** + * Identifier of the object to release. + */ + objectId: RemoteObjectId; + } + interface ReleaseObjectGroupParameterType { + /** + * Symbolic object group name. + */ + objectGroup: string; + } + interface SetCustomObjectFormatterEnabledParameterType { + enabled: boolean; + } + interface CompileScriptParameterType { + /** + * Expression to compile. + */ + expression: string; + /** + * Source url to be set for the script. + */ + sourceURL: string; + /** + * Specifies whether the compiled script should be persisted. + */ + persistScript: boolean; + /** + * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + executionContextId?: ExecutionContextId | undefined; + } + interface RunScriptParameterType { + /** + * Id of the script to run. + */ + scriptId: ScriptId; + /** + * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + executionContextId?: ExecutionContextId | undefined; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Determines whether Command Line API should be available during the evaluation. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object which should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + } + interface QueryObjectsParameterType { + /** + * Identifier of the prototype to return objects for. + */ + prototypeObjectId: RemoteObjectId; + } + interface GlobalLexicalScopeNamesParameterType { + /** + * Specifies in which execution context to lookup global scope variables. + */ + executionContextId?: ExecutionContextId | undefined; + } + interface EvaluateReturnType { + /** + * Evaluation result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface AwaitPromiseReturnType { + /** + * Promise result. Will contain rejected value if promise was rejected. + */ + result: RemoteObject; + /** + * Exception details if stack strace is available. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface CallFunctionOnReturnType { + /** + * Call result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface GetPropertiesReturnType { + /** + * Object properties. + */ + result: PropertyDescriptor[]; + /** + * Internal object properties (only of the element itself). + */ + internalProperties?: InternalPropertyDescriptor[] | undefined; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface CompileScriptReturnType { + /** + * Id of the script. + */ + scriptId?: ScriptId | undefined; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface RunScriptReturnType { + /** + * Run result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface QueryObjectsReturnType { + /** + * Array with objects. + */ + objects: RemoteObject; + } + interface GlobalLexicalScopeNamesReturnType { + names: string[]; + } + interface ExecutionContextCreatedEventDataType { + /** + * A newly created execution context. + */ + context: ExecutionContextDescription; + } + interface ExecutionContextDestroyedEventDataType { + /** + * Id of the destroyed context + */ + executionContextId: ExecutionContextId; + } + interface ExceptionThrownEventDataType { + /** + * Timestamp of the exception. + */ + timestamp: Timestamp; + exceptionDetails: ExceptionDetails; + } + interface ExceptionRevokedEventDataType { + /** + * Reason describing why exception was revoked. + */ + reason: string; + /** + * The id of revoked exception, as reported in exceptionThrown. + */ + exceptionId: number; + } + interface ConsoleAPICalledEventDataType { + /** + * Type of the call. + */ + type: string; + /** + * Call arguments. + */ + args: RemoteObject[]; + /** + * Identifier of the context where the call was made. + */ + executionContextId: ExecutionContextId; + /** + * Call timestamp. + */ + timestamp: Timestamp; + /** + * Stack trace captured when the call was made. + */ + stackTrace?: StackTrace | undefined; + /** + * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. + * @experimental + */ + context?: string | undefined; + } + interface InspectRequestedEventDataType { + object: RemoteObject; + hints: {}; + } + } + namespace Debugger { + /** + * Breakpoint identifier. + */ + type BreakpointId = string; + /** + * Call frame identifier. + */ + type CallFrameId = string; + /** + * Location in the source code. + */ + interface Location { + /** + * Script identifier as reported in the Debugger.scriptParsed. + */ + scriptId: Runtime.ScriptId; + /** + * Line number in the script (0-based). + */ + lineNumber: number; + /** + * Column number in the script (0-based). + */ + columnNumber?: number | undefined; + } + /** + * Location in the source code. + * @experimental + */ + interface ScriptPosition { + lineNumber: number; + columnNumber: number; + } + /** + * JavaScript call frame. Array of call frames form the call stack. + */ + interface CallFrame { + /** + * Call frame identifier. This identifier is only valid while the virtual machine is paused. + */ + callFrameId: CallFrameId; + /** + * Name of the JavaScript function called on this call frame. + */ + functionName: string; + /** + * Location in the source code. + */ + functionLocation?: Location | undefined; + /** + * Location in the source code. + */ + location: Location; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Scope chain for this call frame. + */ + scopeChain: Scope[]; + /** + * this object for this call frame. + */ + this: Runtime.RemoteObject; + /** + * The value being returned, if the function is at return point. + */ + returnValue?: Runtime.RemoteObject | undefined; + } + /** + * Scope description. + */ + interface Scope { + /** + * Scope type. + */ + type: string; + /** + * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. + */ + object: Runtime.RemoteObject; + name?: string | undefined; + /** + * Location in the source code where scope starts + */ + startLocation?: Location | undefined; + /** + * Location in the source code where scope ends + */ + endLocation?: Location | undefined; + } + /** + * Search match for resource. + */ + interface SearchMatch { + /** + * Line number in resource content. + */ + lineNumber: number; + /** + * Line with match content. + */ + lineContent: string; + } + interface BreakLocation { + /** + * Script identifier as reported in the Debugger.scriptParsed. + */ + scriptId: Runtime.ScriptId; + /** + * Line number in the script (0-based). + */ + lineNumber: number; + /** + * Column number in the script (0-based). + */ + columnNumber?: number | undefined; + type?: string | undefined; + } + interface SetBreakpointsActiveParameterType { + /** + * New value for breakpoints active state. + */ + active: boolean; + } + interface SetSkipAllPausesParameterType { + /** + * New value for skip pauses state. + */ + skip: boolean; + } + interface SetBreakpointByUrlParameterType { + /** + * Line number to set breakpoint at. + */ + lineNumber: number; + /** + * URL of the resources to set breakpoint on. + */ + url?: string | undefined; + /** + * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. + */ + urlRegex?: string | undefined; + /** + * Script hash of the resources to set breakpoint on. + */ + scriptHash?: string | undefined; + /** + * Offset in the line to set breakpoint at. + */ + columnNumber?: number | undefined; + /** + * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. + */ + condition?: string | undefined; + } + interface SetBreakpointParameterType { + /** + * Location to set breakpoint in. + */ + location: Location; + /** + * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. + */ + condition?: string | undefined; + } + interface RemoveBreakpointParameterType { + breakpointId: BreakpointId; + } + interface GetPossibleBreakpointsParameterType { + /** + * Start of range to search possible breakpoint locations in. + */ + start: Location; + /** + * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. + */ + end?: Location | undefined; + /** + * Only consider locations which are in the same (non-nested) function as start. + */ + restrictToFunction?: boolean | undefined; + } + interface ContinueToLocationParameterType { + /** + * Location to continue to. + */ + location: Location; + targetCallFrames?: string | undefined; + } + interface PauseOnAsyncCallParameterType { + /** + * Debugger will pause when async call with given stack trace is started. + */ + parentStackTraceId: Runtime.StackTraceId; + } + interface StepIntoParameterType { + /** + * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. + * @experimental + */ + breakOnAsyncCall?: boolean | undefined; + } + interface GetStackTraceParameterType { + stackTraceId: Runtime.StackTraceId; + } + interface SearchInContentParameterType { + /** + * Id of the script to search in. + */ + scriptId: Runtime.ScriptId; + /** + * String to search for. + */ + query: string; + /** + * If true, search is case sensitive. + */ + caseSensitive?: boolean | undefined; + /** + * If true, treats string parameter as regex. + */ + isRegex?: boolean | undefined; + } + interface SetScriptSourceParameterType { + /** + * Id of the script to edit. + */ + scriptId: Runtime.ScriptId; + /** + * New content of the script. + */ + scriptSource: string; + /** + * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. + */ + dryRun?: boolean | undefined; + } + interface RestartFrameParameterType { + /** + * Call frame identifier to evaluate on. + */ + callFrameId: CallFrameId; + } + interface GetScriptSourceParameterType { + /** + * Id of the script to get source for. + */ + scriptId: Runtime.ScriptId; + } + interface SetPauseOnExceptionsParameterType { + /** + * Pause on exceptions mode. + */ + state: string; + } + interface EvaluateOnCallFrameParameterType { + /** + * Call frame identifier to evaluate on. + */ + callFrameId: CallFrameId; + /** + * Expression to evaluate. + */ + expression: string; + /** + * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). + */ + objectGroup?: string | undefined; + /** + * Specifies whether command line API should be available to the evaluated expression, defaults to false. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether to throw an exception if side effect cannot be ruled out during evaluation. + */ + throwOnSideEffect?: boolean | undefined; + } + interface SetVariableValueParameterType { + /** + * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. + */ + scopeNumber: number; + /** + * Variable name. + */ + variableName: string; + /** + * New variable value. + */ + newValue: Runtime.CallArgument; + /** + * Id of callframe that holds variable. + */ + callFrameId: CallFrameId; + } + interface SetReturnValueParameterType { + /** + * New return value. + */ + newValue: Runtime.CallArgument; + } + interface SetAsyncCallStackDepthParameterType { + /** + * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). + */ + maxDepth: number; + } + interface SetBlackboxPatternsParameterType { + /** + * Array of regexps that will be used to check script url for blackbox state. + */ + patterns: string[]; + } + interface SetBlackboxedRangesParameterType { + /** + * Id of the script. + */ + scriptId: Runtime.ScriptId; + positions: ScriptPosition[]; + } + interface EnableReturnType { + /** + * Unique identifier of the debugger. + * @experimental + */ + debuggerId: Runtime.UniqueDebuggerId; + } + interface SetBreakpointByUrlReturnType { + /** + * Id of the created breakpoint for further reference. + */ + breakpointId: BreakpointId; + /** + * List of the locations this breakpoint resolved into upon addition. + */ + locations: Location[]; + } + interface SetBreakpointReturnType { + /** + * Id of the created breakpoint for further reference. + */ + breakpointId: BreakpointId; + /** + * Location this breakpoint resolved into. + */ + actualLocation: Location; + } + interface GetPossibleBreakpointsReturnType { + /** + * List of the possible breakpoint locations. + */ + locations: BreakLocation[]; + } + interface GetStackTraceReturnType { + stackTrace: Runtime.StackTrace; + } + interface SearchInContentReturnType { + /** + * List of search matches. + */ + result: SearchMatch[]; + } + interface SetScriptSourceReturnType { + /** + * New stack trace in case editing has happened while VM was stopped. + */ + callFrames?: CallFrame[] | undefined; + /** + * Whether current call stack was modified after applying the changes. + */ + stackChanged?: boolean | undefined; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + /** + * Exception details if any. + */ + exceptionDetails?: Runtime.ExceptionDetails | undefined; + } + interface RestartFrameReturnType { + /** + * New stack trace. + */ + callFrames: CallFrame[]; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + } + interface GetScriptSourceReturnType { + /** + * Script source. + */ + scriptSource: string; + } + interface EvaluateOnCallFrameReturnType { + /** + * Object wrapper for the evaluation result. + */ + result: Runtime.RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: Runtime.ExceptionDetails | undefined; + } + interface ScriptParsedEventDataType { + /** + * Identifier of the script parsed. + */ + scriptId: Runtime.ScriptId; + /** + * URL or name of the script parsed (if any). + */ + url: string; + /** + * Line offset of the script within the resource with given URL (for script tags). + */ + startLine: number; + /** + * Column offset of the script within the resource with given URL. + */ + startColumn: number; + /** + * Last line of the script. + */ + endLine: number; + /** + * Length of the last line of the script. + */ + endColumn: number; + /** + * Specifies script creation context. + */ + executionContextId: Runtime.ExecutionContextId; + /** + * Content hash of the script. + */ + hash: string; + /** + * Embedder-specific auxiliary data. + */ + executionContextAuxData?: {} | undefined; + /** + * True, if this script is generated as a result of the live edit operation. + * @experimental + */ + isLiveEdit?: boolean | undefined; + /** + * URL of source map associated with script (if any). + */ + sourceMapURL?: string | undefined; + /** + * True, if this script has sourceURL. + */ + hasSourceURL?: boolean | undefined; + /** + * True, if this script is ES6 module. + */ + isModule?: boolean | undefined; + /** + * This script length. + */ + length?: number | undefined; + /** + * JavaScript top stack frame of where the script parsed event was triggered if available. + * @experimental + */ + stackTrace?: Runtime.StackTrace | undefined; + } + interface ScriptFailedToParseEventDataType { + /** + * Identifier of the script parsed. + */ + scriptId: Runtime.ScriptId; + /** + * URL or name of the script parsed (if any). + */ + url: string; + /** + * Line offset of the script within the resource with given URL (for script tags). + */ + startLine: number; + /** + * Column offset of the script within the resource with given URL. + */ + startColumn: number; + /** + * Last line of the script. + */ + endLine: number; + /** + * Length of the last line of the script. + */ + endColumn: number; + /** + * Specifies script creation context. + */ + executionContextId: Runtime.ExecutionContextId; + /** + * Content hash of the script. + */ + hash: string; + /** + * Embedder-specific auxiliary data. + */ + executionContextAuxData?: {} | undefined; + /** + * URL of source map associated with script (if any). + */ + sourceMapURL?: string | undefined; + /** + * True, if this script has sourceURL. + */ + hasSourceURL?: boolean | undefined; + /** + * True, if this script is ES6 module. + */ + isModule?: boolean | undefined; + /** + * This script length. + */ + length?: number | undefined; + /** + * JavaScript top stack frame of where the script parsed event was triggered if available. + * @experimental + */ + stackTrace?: Runtime.StackTrace | undefined; + } + interface BreakpointResolvedEventDataType { + /** + * Breakpoint unique identifier. + */ + breakpointId: BreakpointId; + /** + * Actual breakpoint location. + */ + location: Location; + } + interface PausedEventDataType { + /** + * Call stack the virtual machine stopped on. + */ + callFrames: CallFrame[]; + /** + * Pause reason. + */ + reason: string; + /** + * Object containing break-specific auxiliary properties. + */ + data?: {} | undefined; + /** + * Hit breakpoints IDs + */ + hitBreakpoints?: string[] | undefined; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + /** + * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. + * @experimental + */ + asyncCallStackTraceId?: Runtime.StackTraceId | undefined; + } + } + namespace Console { + /** + * Console message. + */ + interface ConsoleMessage { + /** + * Message source. + */ + source: string; + /** + * Message severity. + */ + level: string; + /** + * Message text. + */ + text: string; + /** + * URL of the message origin. + */ + url?: string | undefined; + /** + * Line number in the resource that generated this message (1-based). + */ + line?: number | undefined; + /** + * Column number in the resource that generated this message (1-based). + */ + column?: number | undefined; + } + interface MessageAddedEventDataType { + /** + * Console message that has been added. + */ + message: ConsoleMessage; + } + } + namespace Profiler { + /** + * Profile node. Holds callsite information, execution statistics and child nodes. + */ + interface ProfileNode { + /** + * Unique id of the node. + */ + id: number; + /** + * Function location. + */ + callFrame: Runtime.CallFrame; + /** + * Number of samples where this node was on top of the call stack. + */ + hitCount?: number | undefined; + /** + * Child node ids. + */ + children?: number[] | undefined; + /** + * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. + */ + deoptReason?: string | undefined; + /** + * An array of source position ticks. + */ + positionTicks?: PositionTickInfo[] | undefined; + } + /** + * Profile. + */ + interface Profile { + /** + * The list of profile nodes. First item is the root node. + */ + nodes: ProfileNode[]; + /** + * Profiling start timestamp in microseconds. + */ + startTime: number; + /** + * Profiling end timestamp in microseconds. + */ + endTime: number; + /** + * Ids of samples top nodes. + */ + samples?: number[] | undefined; + /** + * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. + */ + timeDeltas?: number[] | undefined; + } + /** + * Specifies a number of samples attributed to a certain source position. + */ + interface PositionTickInfo { + /** + * Source line number (1-based). + */ + line: number; + /** + * Number of samples attributed to the source line. + */ + ticks: number; + } + /** + * Coverage data for a source range. + */ + interface CoverageRange { + /** + * JavaScript script source offset for the range start. + */ + startOffset: number; + /** + * JavaScript script source offset for the range end. + */ + endOffset: number; + /** + * Collected execution count of the source range. + */ + count: number; + } + /** + * Coverage data for a JavaScript function. + */ + interface FunctionCoverage { + /** + * JavaScript function name. + */ + functionName: string; + /** + * Source ranges inside the function with coverage data. + */ + ranges: CoverageRange[]; + /** + * Whether coverage data for this function has block granularity. + */ + isBlockCoverage: boolean; + } + /** + * Coverage data for a JavaScript script. + */ + interface ScriptCoverage { + /** + * JavaScript script id. + */ + scriptId: Runtime.ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Functions contained in the script that has coverage data. + */ + functions: FunctionCoverage[]; + } + /** + * Describes a type collected during runtime. + * @experimental + */ + interface TypeObject { + /** + * Name of a type collected with type profiling. + */ + name: string; + } + /** + * Source offset and types for a parameter or return value. + * @experimental + */ + interface TypeProfileEntry { + /** + * Source offset of the parameter or end of function for return values. + */ + offset: number; + /** + * The types for this parameter or return value. + */ + types: TypeObject[]; + } + /** + * Type profile data collected during runtime for a JavaScript script. + * @experimental + */ + interface ScriptTypeProfile { + /** + * JavaScript script id. + */ + scriptId: Runtime.ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Type profile entries for parameters and return values of the functions in the script. + */ + entries: TypeProfileEntry[]; + } + interface SetSamplingIntervalParameterType { + /** + * New sampling interval in microseconds. + */ + interval: number; + } + interface StartPreciseCoverageParameterType { + /** + * Collect accurate call counts beyond simple 'covered' or 'not covered'. + */ + callCount?: boolean | undefined; + /** + * Collect block-based coverage. + */ + detailed?: boolean | undefined; + } + interface StopReturnType { + /** + * Recorded profile. + */ + profile: Profile; + } + interface TakePreciseCoverageReturnType { + /** + * Coverage data for the current isolate. + */ + result: ScriptCoverage[]; + } + interface GetBestEffortCoverageReturnType { + /** + * Coverage data for the current isolate. + */ + result: ScriptCoverage[]; + } + interface TakeTypeProfileReturnType { + /** + * Type profile for all scripts since startTypeProfile() was turned on. + */ + result: ScriptTypeProfile[]; + } + interface ConsoleProfileStartedEventDataType { + id: string; + /** + * Location of console.profile(). + */ + location: Debugger.Location; + /** + * Profile title passed as an argument to console.profile(). + */ + title?: string | undefined; + } + interface ConsoleProfileFinishedEventDataType { + id: string; + /** + * Location of console.profileEnd(). + */ + location: Debugger.Location; + profile: Profile; + /** + * Profile title passed as an argument to console.profile(). + */ + title?: string | undefined; + } + } + namespace HeapProfiler { + /** + * Heap snapshot object id. + */ + type HeapSnapshotObjectId = string; + /** + * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. + */ + interface SamplingHeapProfileNode { + /** + * Function location. + */ + callFrame: Runtime.CallFrame; + /** + * Allocations size in bytes for the node excluding children. + */ + selfSize: number; + /** + * Child nodes. + */ + children: SamplingHeapProfileNode[]; + } + /** + * Profile. + */ + interface SamplingHeapProfile { + head: SamplingHeapProfileNode; + } + interface StartTrackingHeapObjectsParameterType { + trackAllocations?: boolean | undefined; + } + interface StopTrackingHeapObjectsParameterType { + /** + * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. + */ + reportProgress?: boolean | undefined; + } + interface TakeHeapSnapshotParameterType { + /** + * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. + */ + reportProgress?: boolean | undefined; + } + interface GetObjectByHeapObjectIdParameterType { + objectId: HeapSnapshotObjectId; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + } + interface AddInspectedHeapObjectParameterType { + /** + * Heap snapshot object id to be accessible by means of $x command line API. + */ + heapObjectId: HeapSnapshotObjectId; + } + interface GetHeapObjectIdParameterType { + /** + * Identifier of the object to get heap object id for. + */ + objectId: Runtime.RemoteObjectId; + } + interface StartSamplingParameterType { + /** + * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. + */ + samplingInterval?: number | undefined; + } + interface GetObjectByHeapObjectIdReturnType { + /** + * Evaluation result. + */ + result: Runtime.RemoteObject; + } + interface GetHeapObjectIdReturnType { + /** + * Id of the heap snapshot object corresponding to the passed remote object id. + */ + heapSnapshotObjectId: HeapSnapshotObjectId; + } + interface StopSamplingReturnType { + /** + * Recorded sampling heap profile. + */ + profile: SamplingHeapProfile; + } + interface GetSamplingProfileReturnType { + /** + * Return the sampling profile being collected. + */ + profile: SamplingHeapProfile; + } + interface AddHeapSnapshotChunkEventDataType { + chunk: string; + } + interface ReportHeapSnapshotProgressEventDataType { + done: number; + total: number; + finished?: boolean | undefined; + } + interface LastSeenObjectIdEventDataType { + lastSeenObjectId: number; + timestamp: number; + } + interface HeapStatsUpdateEventDataType { + /** + * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. + */ + statsUpdate: number[]; + } + } + namespace NodeTracing { + interface TraceConfig { + /** + * Controls how the trace buffer stores data. + */ + recordMode?: string | undefined; + /** + * Included category filters. + */ + includedCategories: string[]; + } + interface StartParameterType { + traceConfig: TraceConfig; + } + interface GetCategoriesReturnType { + /** + * A list of supported tracing categories. + */ + categories: string[]; + } + interface DataCollectedEventDataType { + value: Array<{}>; + } + } + namespace NodeWorker { + type WorkerID = string; + /** + * Unique identifier of attached debugging session. + */ + type SessionID = string; + interface WorkerInfo { + workerId: WorkerID; + type: string; + title: string; + url: string; + } + interface SendMessageToWorkerParameterType { + message: string; + /** + * Identifier of the session. + */ + sessionId: SessionID; + } + interface EnableParameterType { + /** + * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` + * message to run them. + */ + waitForDebuggerOnStart: boolean; + } + interface DetachParameterType { + sessionId: SessionID; + } + interface AttachedToWorkerEventDataType { + /** + * Identifier assigned to the session used to send/receive messages. + */ + sessionId: SessionID; + workerInfo: WorkerInfo; + waitingForDebugger: boolean; + } + interface DetachedFromWorkerEventDataType { + /** + * Detached session identifier. + */ + sessionId: SessionID; + } + interface ReceivedMessageFromWorkerEventDataType { + /** + * Identifier of a session which sends a message. + */ + sessionId: SessionID; + message: string; + } + } + namespace NodeRuntime { + interface NotifyWhenWaitingForDisconnectParameterType { + enabled: boolean; + } + } + /** + * The `inspector.Session` is used for dispatching messages to the V8 inspector + * back-end and receiving message responses and notifications. + */ + class Session extends EventEmitter { + /** + * Create a new instance of the inspector.Session class. + * The inspector session needs to be connected through session.connect() before the messages can be dispatched to the inspector backend. + */ + constructor(); + /** + * Connects a session to the inspector back-end. + * @since v8.0.0 + */ + connect(): void; + /** + * Immediately close the session. All pending message callbacks will be called + * with an error. `session.connect()` will need to be called to be able to send + * messages again. Reconnected session will lose all inspector state, such as + * enabled agents or configured breakpoints. + * @since v8.0.0 + */ + disconnect(): void; + /** + * Posts a message to the inspector back-end. `callback` will be notified when + * a response is received. `callback` is a function that accepts two optional + * arguments: error and message-specific result. + * + * ```js + * session.post('Runtime.evaluate', { expression: '2 + 2' }, + * (error, { result }) => console.log(result)); + * // Output: { type: 'number', value: 4, description: '4' } + * ``` + * + * The latest version of the V8 inspector protocol is published on the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/). + * + * Node.js inspector supports all the Chrome DevTools Protocol domains declared + * by V8\. Chrome DevTools Protocol domain provides an interface for interacting + * with one of the runtime agents used to inspect the application state and listen + * to the run-time events. + * + * ## Example usage + * + * Apart from the debugger, various V8 Profilers are available through the DevTools + * protocol. + * @since v8.0.0 + */ + post(method: string, params?: {}, callback?: (err: Error | null, params?: {}) => void): void; + post(method: string, callback?: (err: Error | null, params?: {}) => void): void; + /** + * Returns supported domains. + */ + post(method: 'Schema.getDomains', callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; + /** + * Evaluates expression on global object. + */ + post(method: 'Runtime.evaluate', params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + post(method: 'Runtime.evaluate', callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + /** + * Add handler to promise with given promise object id. + */ + post(method: 'Runtime.awaitPromise', params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; + post(method: 'Runtime.awaitPromise', callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; + /** + * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. + */ + post(method: 'Runtime.callFunctionOn', params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; + post(method: 'Runtime.callFunctionOn', callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; + /** + * Returns properties of a given object. Object group of the result is inherited from the target object. + */ + post(method: 'Runtime.getProperties', params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; + post(method: 'Runtime.getProperties', callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; + /** + * Releases remote object with given id. + */ + post(method: 'Runtime.releaseObject', params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.releaseObject', callback?: (err: Error | null) => void): void; + /** + * Releases all remote objects that belong to a given group. + */ + post(method: 'Runtime.releaseObjectGroup', params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.releaseObjectGroup', callback?: (err: Error | null) => void): void; + /** + * Tells inspected instance to run if it was waiting for debugger to attach. + */ + post(method: 'Runtime.runIfWaitingForDebugger', callback?: (err: Error | null) => void): void; + /** + * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. + */ + post(method: 'Runtime.enable', callback?: (err: Error | null) => void): void; + /** + * Disables reporting of execution contexts creation. + */ + post(method: 'Runtime.disable', callback?: (err: Error | null) => void): void; + /** + * Discards collected exceptions and console API calls. + */ + post(method: 'Runtime.discardConsoleEntries', callback?: (err: Error | null) => void): void; + /** + * @experimental + */ + post(method: 'Runtime.setCustomObjectFormatterEnabled', params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.setCustomObjectFormatterEnabled', callback?: (err: Error | null) => void): void; + /** + * Compiles expression. + */ + post(method: 'Runtime.compileScript', params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; + post(method: 'Runtime.compileScript', callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; + /** + * Runs script with given id in a given context. + */ + post(method: 'Runtime.runScript', params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + post(method: 'Runtime.runScript', callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + post(method: 'Runtime.queryObjects', params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + post(method: 'Runtime.queryObjects', callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + /** + * Returns all let, const and class variables from global scope. + */ + post( + method: 'Runtime.globalLexicalScopeNames', + params?: Runtime.GlobalLexicalScopeNamesParameterType, + callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void + ): void; + post(method: 'Runtime.globalLexicalScopeNames', callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; + /** + * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. + */ + post(method: 'Debugger.enable', callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; + /** + * Disables debugger for given page. + */ + post(method: 'Debugger.disable', callback?: (err: Error | null) => void): void; + /** + * Activates / deactivates all breakpoints on the page. + */ + post(method: 'Debugger.setBreakpointsActive', params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBreakpointsActive', callback?: (err: Error | null) => void): void; + /** + * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). + */ + post(method: 'Debugger.setSkipAllPauses', params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setSkipAllPauses', callback?: (err: Error | null) => void): void; + /** + * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. + */ + post(method: 'Debugger.setBreakpointByUrl', params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; + post(method: 'Debugger.setBreakpointByUrl', callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; + /** + * Sets JavaScript breakpoint at a given location. + */ + post(method: 'Debugger.setBreakpoint', params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; + post(method: 'Debugger.setBreakpoint', callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; + /** + * Removes JavaScript breakpoint. + */ + post(method: 'Debugger.removeBreakpoint', params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.removeBreakpoint', callback?: (err: Error | null) => void): void; + /** + * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. + */ + post( + method: 'Debugger.getPossibleBreakpoints', + params?: Debugger.GetPossibleBreakpointsParameterType, + callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void + ): void; + post(method: 'Debugger.getPossibleBreakpoints', callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; + /** + * Continues execution until specific location is reached. + */ + post(method: 'Debugger.continueToLocation', params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.continueToLocation', callback?: (err: Error | null) => void): void; + /** + * @experimental + */ + post(method: 'Debugger.pauseOnAsyncCall', params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.pauseOnAsyncCall', callback?: (err: Error | null) => void): void; + /** + * Steps over the statement. + */ + post(method: 'Debugger.stepOver', callback?: (err: Error | null) => void): void; + /** + * Steps into the function call. + */ + post(method: 'Debugger.stepInto', params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.stepInto', callback?: (err: Error | null) => void): void; + /** + * Steps out of the function call. + */ + post(method: 'Debugger.stepOut', callback?: (err: Error | null) => void): void; + /** + * Stops on the next JavaScript statement. + */ + post(method: 'Debugger.pause', callback?: (err: Error | null) => void): void; + /** + * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. + * @experimental + */ + post(method: 'Debugger.scheduleStepIntoAsync', callback?: (err: Error | null) => void): void; + /** + * Resumes JavaScript execution. + */ + post(method: 'Debugger.resume', callback?: (err: Error | null) => void): void; + /** + * Returns stack trace with given stackTraceId. + * @experimental + */ + post(method: 'Debugger.getStackTrace', params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; + post(method: 'Debugger.getStackTrace', callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; + /** + * Searches for given string in script content. + */ + post(method: 'Debugger.searchInContent', params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; + post(method: 'Debugger.searchInContent', callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; + /** + * Edits JavaScript source live. + */ + post(method: 'Debugger.setScriptSource', params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; + post(method: 'Debugger.setScriptSource', callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; + /** + * Restarts particular call frame from the beginning. + */ + post(method: 'Debugger.restartFrame', params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; + post(method: 'Debugger.restartFrame', callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; + /** + * Returns source for the script with given id. + */ + post(method: 'Debugger.getScriptSource', params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; + post(method: 'Debugger.getScriptSource', callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; + /** + * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. + */ + post(method: 'Debugger.setPauseOnExceptions', params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setPauseOnExceptions', callback?: (err: Error | null) => void): void; + /** + * Evaluates expression on a given call frame. + */ + post(method: 'Debugger.evaluateOnCallFrame', params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; + post(method: 'Debugger.evaluateOnCallFrame', callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; + /** + * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. + */ + post(method: 'Debugger.setVariableValue', params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setVariableValue', callback?: (err: Error | null) => void): void; + /** + * Changes return value in top frame. Available only at return break position. + * @experimental + */ + post(method: 'Debugger.setReturnValue', params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setReturnValue', callback?: (err: Error | null) => void): void; + /** + * Enables or disables async call stacks tracking. + */ + post(method: 'Debugger.setAsyncCallStackDepth', params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setAsyncCallStackDepth', callback?: (err: Error | null) => void): void; + /** + * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. + * @experimental + */ + post(method: 'Debugger.setBlackboxPatterns', params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBlackboxPatterns', callback?: (err: Error | null) => void): void; + /** + * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. + * @experimental + */ + post(method: 'Debugger.setBlackboxedRanges', params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBlackboxedRanges', callback?: (err: Error | null) => void): void; + /** + * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. + */ + post(method: 'Console.enable', callback?: (err: Error | null) => void): void; + /** + * Disables console domain, prevents further console messages from being reported to the client. + */ + post(method: 'Console.disable', callback?: (err: Error | null) => void): void; + /** + * Does nothing. + */ + post(method: 'Console.clearMessages', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.enable', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.disable', callback?: (err: Error | null) => void): void; + /** + * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. + */ + post(method: 'Profiler.setSamplingInterval', params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Profiler.setSamplingInterval', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.start', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.stop', callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; + /** + * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. + */ + post(method: 'Profiler.startPreciseCoverage', params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Profiler.startPreciseCoverage', callback?: (err: Error | null) => void): void; + /** + * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. + */ + post(method: 'Profiler.stopPreciseCoverage', callback?: (err: Error | null) => void): void; + /** + * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. + */ + post(method: 'Profiler.takePreciseCoverage', callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; + /** + * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. + */ + post(method: 'Profiler.getBestEffortCoverage', callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; + /** + * Enable type profile. + * @experimental + */ + post(method: 'Profiler.startTypeProfile', callback?: (err: Error | null) => void): void; + /** + * Disable type profile. Disabling releases type profile data collected so far. + * @experimental + */ + post(method: 'Profiler.stopTypeProfile', callback?: (err: Error | null) => void): void; + /** + * Collect type profile. + * @experimental + */ + post(method: 'Profiler.takeTypeProfile', callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void; + post(method: 'HeapProfiler.enable', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.disable', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startTrackingHeapObjects', params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startTrackingHeapObjects', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopTrackingHeapObjects', params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopTrackingHeapObjects', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.takeHeapSnapshot', params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.takeHeapSnapshot', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.collectGarbage', callback?: (err: Error | null) => void): void; + post( + method: 'HeapProfiler.getObjectByHeapObjectId', + params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, + callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void + ): void; + post(method: 'HeapProfiler.getObjectByHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; + /** + * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). + */ + post(method: 'HeapProfiler.addInspectedHeapObject', params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.addInspectedHeapObject', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.getHeapObjectId', params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; + post(method: 'HeapProfiler.getHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; + post(method: 'HeapProfiler.startSampling', params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startSampling', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopSampling', callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; + post(method: 'HeapProfiler.getSamplingProfile', callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; + /** + * Gets supported tracing categories. + */ + post(method: 'NodeTracing.getCategories', callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; + /** + * Start trace events collection. + */ + post(method: 'NodeTracing.start', params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeTracing.start', callback?: (err: Error | null) => void): void; + /** + * Stop trace events collection. Remaining collected events will be sent as a sequence of + * dataCollected events followed by tracingComplete event. + */ + post(method: 'NodeTracing.stop', callback?: (err: Error | null) => void): void; + /** + * Sends protocol message over session with given id. + */ + post(method: 'NodeWorker.sendMessageToWorker', params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.sendMessageToWorker', callback?: (err: Error | null) => void): void; + /** + * Instructs the inspector to attach to running workers. Will also attach to new workers + * as they start + */ + post(method: 'NodeWorker.enable', params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.enable', callback?: (err: Error | null) => void): void; + /** + * Detaches from all running workers and disables attaching to new workers as they are started. + */ + post(method: 'NodeWorker.disable', callback?: (err: Error | null) => void): void; + /** + * Detached from the worker with given sessionId. + */ + post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.detach', callback?: (err: Error | null) => void): void; + /** + * Enable the `NodeRuntime.waitingForDisconnect`. + */ + post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', callback?: (err: Error | null) => void): void; + // Events + addListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + addListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + addListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + addListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + addListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + addListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + addListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + addListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + addListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + addListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + addListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + addListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + addListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + addListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + addListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + addListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + addListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + addListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + addListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + addListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + addListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + addListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + addListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + addListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + addListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + addListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'inspectorNotification', message: InspectorNotification<{}>): boolean; + emit(event: 'Runtime.executionContextCreated', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextDestroyed', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextsCleared'): boolean; + emit(event: 'Runtime.exceptionThrown', message: InspectorNotification): boolean; + emit(event: 'Runtime.exceptionRevoked', message: InspectorNotification): boolean; + emit(event: 'Runtime.consoleAPICalled', message: InspectorNotification): boolean; + emit(event: 'Runtime.inspectRequested', message: InspectorNotification): boolean; + emit(event: 'Debugger.scriptParsed', message: InspectorNotification): boolean; + emit(event: 'Debugger.scriptFailedToParse', message: InspectorNotification): boolean; + emit(event: 'Debugger.breakpointResolved', message: InspectorNotification): boolean; + emit(event: 'Debugger.paused', message: InspectorNotification): boolean; + emit(event: 'Debugger.resumed'): boolean; + emit(event: 'Console.messageAdded', message: InspectorNotification): boolean; + emit(event: 'Profiler.consoleProfileStarted', message: InspectorNotification): boolean; + emit(event: 'Profiler.consoleProfileFinished', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.addHeapSnapshotChunk', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.resetProfiles'): boolean; + emit(event: 'HeapProfiler.reportHeapSnapshotProgress', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.lastSeenObjectId', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.heapStatsUpdate', message: InspectorNotification): boolean; + emit(event: 'NodeTracing.dataCollected', message: InspectorNotification): boolean; + emit(event: 'NodeTracing.tracingComplete'): boolean; + emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification): boolean; + emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification): boolean; + emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification): boolean; + emit(event: 'NodeRuntime.waitingForDisconnect'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + on(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + on(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + on(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + on(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + on(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + on(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + on(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + on(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + on(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + on(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + on(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + on(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + on(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + on(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + on(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + on(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + on(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + on(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + on(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + on(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + on(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + on(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + on(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + on(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + on(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + on(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + once(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + once(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + once(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + once(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + once(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + once(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + once(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + once(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + once(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + once(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + once(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + once(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + once(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + once(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + once(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + once(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + once(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + once(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + once(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + once(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + once(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + once(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + once(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + once(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + once(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + once(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + prependListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + prependListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + prependListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + prependListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + prependListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + prependListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + prependListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + prependListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + prependListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + prependListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + prependListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + prependListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + prependListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + prependListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + prependListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + prependListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + prependOnceListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + prependOnceListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + prependOnceListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + prependOnceListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + prependOnceListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + prependOnceListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependOnceListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + prependOnceListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + prependOnceListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + prependOnceListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + prependOnceListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + prependOnceListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + prependOnceListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + prependOnceListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + prependOnceListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + prependOnceListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependOnceListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependOnceListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependOnceListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependOnceListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependOnceListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependOnceListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + } + /** + * Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has + * started. + * + * If wait is `true`, will block until a client has connected to the inspect port + * and flow control has been passed to the debugger client. + * + * See the `security warning` regarding the `host`parameter usage. + * @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional. + * @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional. + * @param [wait=false] Block until a client has connected. Optional. + */ + function open(port?: number, host?: string, wait?: boolean): void; + /** + * Deactivate the inspector. Blocks until there are no active connections. + */ + function close(): void; + /** + * Return the URL of the active inspector, or `undefined` if there is none. + * + * ```console + * $ node --inspect -p 'inspector.url()' + * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 + * For help, see: https://nodejs.org/en/docs/inspector + * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 + * + * $ node --inspect=localhost:3000 -p 'inspector.url()' + * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a + * For help, see: https://nodejs.org/en/docs/inspector + * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a + * + * $ node -p 'inspector.url()' + * undefined + * ``` + */ + function url(): string | undefined; + /** + * Blocks until a client (existing or connected later) has sent`Runtime.runIfWaitingForDebugger` command. + * + * An exception will be thrown if there is no active inspector. + * @since v12.7.0 + */ + function waitForDebugger(): void; +} +/** + * The inspector module provides an API for interacting with the V8 inspector. + */ +declare module 'node:inspector' { + import inspector = require('inspector'); + export = inspector; +} diff --git a/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts new file mode 100755 index 0000000..58847a8 --- /dev/null +++ b/node_modules/@types/node/module.d.ts @@ -0,0 +1,232 @@ +/** + * @since v0.3.7 + */ +declare module 'module' { + import { URL } from 'node:url'; + import { MessagePort } from 'node:worker_threads'; + namespace Module { + /** + * The `module.syncBuiltinESMExports()` method updates all the live bindings for + * builtin `ES Modules` to match the properties of the `CommonJS` exports. It + * does not add or remove exported names from the `ES Modules`. + * + * ```js + * const fs = require('node:fs'); + * const assert = require('node:assert'); + * const { syncBuiltinESMExports } = require('node:module'); + * + * fs.readFile = newAPI; + * + * delete fs.readFileSync; + * + * function newAPI() { + * // ... + * } + * + * fs.newAPI = newAPI; + * + * syncBuiltinESMExports(); + * + * import('node:fs').then((esmFS) => { + * // It syncs the existing readFile property with the new value + * assert.strictEqual(esmFS.readFile, newAPI); + * // readFileSync has been deleted from the required fs + * assert.strictEqual('readFileSync' in fs, false); + * // syncBuiltinESMExports() does not remove readFileSync from esmFS + * assert.strictEqual('readFileSync' in esmFS, true); + * // syncBuiltinESMExports() does not add names + * assert.strictEqual(esmFS.newAPI, undefined); + * }); + * ``` + * @since v12.12.0 + */ + function syncBuiltinESMExports(): void; + /** + * `path` is the resolved path for the file for which a corresponding source map + * should be fetched. + * @since v13.7.0, v12.17.0 + * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise. + */ + function findSourceMap(path: string, error?: Error): SourceMap; + interface SourceMapPayload { + file: string; + version: number; + sources: string[]; + sourcesContent: string[]; + names: string[]; + mappings: string; + sourceRoot: string; + } + interface SourceMapping { + generatedLine: number; + generatedColumn: number; + originalSource: string; + originalLine: number; + originalColumn: number; + } + /** + * @since v13.7.0, v12.17.0 + */ + class SourceMap { + /** + * Getter for the payload used to construct the `SourceMap` instance. + */ + readonly payload: SourceMapPayload; + constructor(payload: SourceMapPayload); + /** + * Given a line offset and column offset in the generated source + * file, returns an object representing the SourceMap range in the + * original file if found, or an empty object if not. + * + * The object returned contains the following keys: + * + * The returned value represents the raw range as it appears in the + * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and + * column numbers as they appear in Error messages and CallSite + * objects. + * + * To get the corresponding 1-indexed line and column numbers from a + * lineNumber and columnNumber as they are reported by Error stacks + * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)` + * @param lineOffset The zero-indexed line number offset in the generated source + * @param columnOffset The zero-indexed column number offset in the generated source + */ + findEntry(lineOffset: number, columnOffset: number): SourceMapping; + } + interface ImportAssertions extends NodeJS.Dict { + type?: string | undefined; + } + type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm'; + type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray; + interface GlobalPreloadContext { + port: MessagePort; + } + /** + * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in. + * This hook allows the return of a string that is run as a sloppy-mode script on startup. + * + * @param context Information to assist the preload code + * @return Code to run before application startup + */ + type GlobalPreloadHook = (context: GlobalPreloadContext) => string; + interface ResolveHookContext { + /** + * Export conditions of the relevant `package.json` + */ + conditions: string[]; + /** + * An object whose key-value pairs represent the assertions for the module to import + */ + importAssertions: ImportAssertions; + /** + * The module importing this one, or undefined if this is the Node.js entry point + */ + parentURL: string | undefined; + } + interface ResolveFnOutput { + /** + * A hint to the load hook (it might be ignored) + */ + format?: ModuleFormat | null | undefined; + /** + * The import assertions to use when caching the module (optional; if excluded the input will be used) + */ + importAssertions?: ImportAssertions | undefined; + /** + * A signal that this hook intends to terminate the chain of `resolve` hooks. + * @default false + */ + shortCircuit?: boolean | undefined; + /** + * The absolute URL to which this input resolves + */ + url: string; + } + /** + * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook. + * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`); + * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook. + * + * @param specifier The specified URL path of the module to be resolved + * @param context + * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook + */ + type ResolveHook = ( + specifier: string, + context: ResolveHookContext, + nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput | Promise + ) => ResolveFnOutput | Promise; + interface LoadHookContext { + /** + * Export conditions of the relevant `package.json` + */ + conditions: string[]; + /** + * The format optionally supplied by the `resolve` hook chain + */ + format: ModuleFormat; + /** + * An object whose key-value pairs represent the assertions for the module to import + */ + importAssertions: ImportAssertions; + } + interface LoadFnOutput { + format: ModuleFormat; + /** + * A signal that this hook intends to terminate the chain of `resolve` hooks. + * @default false + */ + shortCircuit?: boolean | undefined; + /** + * The source for Node.js to evaluate + */ + source?: ModuleSource; + } + /** + * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed. + * It is also in charge of validating the import assertion. + * + * @param url The URL/path of the module to be loaded + * @param context Metadata about the module + * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook + */ + type LoadHook = ( + url: string, + context: LoadHookContext, + nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise + ) => LoadFnOutput | Promise; + } + interface Module extends NodeModule {} + class Module { + static runMain(): void; + static wrap(code: string): string; + static createRequire(path: string | URL): NodeRequire; + static builtinModules: string[]; + static isBuiltin(moduleName: string): boolean; + static Module: typeof Module; + constructor(id: string, parent?: Module); + } + global { + interface ImportMeta { + url: string; + /** + * @experimental + * This feature is only available with the `--experimental-import-meta-resolve` + * command flag enabled. + * + * Provides a module-relative resolution function scoped to each module, returning + * the URL string. + * + * @param specified The module specifier to resolve relative to `parent`. + * @param parent The absolute parent module URL to resolve from. If none + * is specified, the value of `import.meta.url` is used as the default. + */ + resolve?(specified: string, parent?: string | URL): Promise; + } + } + export = Module; +} +declare module 'node:module' { + import module = require('module'); + export = module; +} diff --git a/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts new file mode 100755 index 0000000..92190b6 --- /dev/null +++ b/node_modules/@types/node/net.d.ts @@ -0,0 +1,893 @@ +/** + * > Stability: 2 - Stable + * + * The `node:net` module provides an asynchronous network API for creating stream-based + * TCP or `IPC` servers ({@link createServer}) and clients + * ({@link createConnection}). + * + * It can be accessed using: + * + * ```js + * const net = require('node:net'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/net.js) + */ +declare module 'net' { + import * as stream from 'node:stream'; + import { Abortable, EventEmitter } from 'node:events'; + import * as dns from 'node:dns'; + type LookupFunction = (hostname: string, options: dns.LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => void) => void; + interface AddressInfo { + address: string; + family: string; + port: number; + } + interface SocketConstructorOpts { + fd?: number | undefined; + allowHalfOpen?: boolean | undefined; + readable?: boolean | undefined; + writable?: boolean | undefined; + signal?: AbortSignal; + } + interface OnReadOpts { + buffer: Uint8Array | (() => Uint8Array); + /** + * This function is called for every chunk of incoming data. + * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer. + * Return false from this function to implicitly pause() the socket. + */ + callback(bytesWritten: number, buf: Uint8Array): boolean; + } + interface ConnectOpts { + /** + * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket. + * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will + * still be emitted as normal and methods like pause() and resume() will also behave as expected. + */ + onread?: OnReadOpts | undefined; + } + interface TcpSocketConnectOpts extends ConnectOpts { + port: number; + host?: string | undefined; + localAddress?: string | undefined; + localPort?: number | undefined; + hints?: number | undefined; + family?: number | undefined; + lookup?: LookupFunction | undefined; + noDelay?: boolean | undefined; + keepAlive?: boolean | undefined; + keepAliveInitialDelay?: number | undefined; + /** + * @since v18.13.0 + */ + autoSelectFamily?: boolean | undefined; + /** + * @since v18.13.0 + */ + autoSelectFamilyAttemptTimeout?: number | undefined; + } + interface IpcSocketConnectOpts extends ConnectOpts { + path: string; + } + type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; + type SocketReadyState = 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed'; + /** + * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint + * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also + * an `EventEmitter`. + * + * A `net.Socket` can be created by the user and used directly to interact with + * a server. For example, it is returned by {@link createConnection}, + * so the user can use it to talk to the server. + * + * It can also be created by Node.js and passed to the user when a connection + * is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use + * it to interact with the client. + * @since v0.3.4 + */ + class Socket extends stream.Duplex { + constructor(options?: SocketConstructorOpts); + /** + * Sends data on the socket. The second parameter specifies the encoding in the + * case of a string. It defaults to UTF8 encoding. + * + * Returns `true` if the entire data was flushed successfully to the kernel + * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free. + * + * The optional `callback` parameter will be executed when the data is finally + * written out, which may not be immediately. + * + * See `Writable` stream `write()` method for more + * information. + * @since v0.1.90 + * @param [encoding='utf8'] Only used when data is `string`. + */ + write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean; + write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean; + /** + * Initiate a connection on a given socket. + * + * Possible signatures: + * + * * `socket.connect(options[, connectListener])` + * * `socket.connect(path[, connectListener])` for `IPC` connections. + * * `socket.connect(port[, host][, connectListener])` for TCP connections. + * * Returns: `net.Socket` The socket itself. + * + * This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting, + * instead of a `'connect'` event, an `'error'` event will be emitted with + * the error passed to the `'error'` listener. + * The last parameter `connectListener`, if supplied, will be added as a listener + * for the `'connect'` event **once**. + * + * This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined + * behavior. + */ + connect(options: SocketConnectOpts, connectionListener?: () => void): this; + connect(port: number, host: string, connectionListener?: () => void): this; + connect(port: number, connectionListener?: () => void): this; + connect(path: string, connectionListener?: () => void): this; + /** + * Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information. + * @since v0.1.90 + * @return The socket itself. + */ + setEncoding(encoding?: BufferEncoding): this; + /** + * Pauses the reading of data. That is, `'data'` events will not be emitted. + * Useful to throttle back an upload. + * @return The socket itself. + */ + pause(): this; + /** + * Close the TCP connection by sending an RST packet and destroy the stream. + * If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected. + * Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. + * If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error. + * @since v18.3.0, v16.17.0 + */ + resetAndDestroy(): this; + /** + * Resumes reading after a call to `socket.pause()`. + * @return The socket itself. + */ + resume(): this; + /** + * Sets the socket to timeout after `timeout` milliseconds of inactivity on + * the socket. By default `net.Socket` do not have a timeout. + * + * When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to + * end the connection. + * + * ```js + * socket.setTimeout(3000); + * socket.on('timeout', () => { + * console.log('socket timeout'); + * socket.end(); + * }); + * ``` + * + * If `timeout` is 0, then the existing idle timeout is disabled. + * + * The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event. + * @since v0.1.90 + * @return The socket itself. + */ + setTimeout(timeout: number, callback?: () => void): this; + /** + * Enable/disable the use of Nagle's algorithm. + * + * When a TCP connection is created, it will have Nagle's algorithm enabled. + * + * Nagle's algorithm delays data before it is sent via the network. It attempts + * to optimize throughput at the expense of latency. + * + * Passing `true` for `noDelay` or not passing an argument will disable Nagle's + * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's + * algorithm. + * @since v0.1.90 + * @param [noDelay=true] + * @return The socket itself. + */ + setNoDelay(noDelay?: boolean): this; + /** + * Enable/disable keep-alive functionality, and optionally set the initial + * delay before the first keepalive probe is sent on an idle socket. + * + * Set `initialDelay` (in milliseconds) to set the delay between the last + * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default + * (or previous) setting. + * + * Enabling the keep-alive functionality will set the following socket options: + * + * * `SO_KEEPALIVE=1` + * * `TCP_KEEPIDLE=initialDelay` + * * `TCP_KEEPCNT=10` + * * `TCP_KEEPINTVL=1` + * @since v0.1.92 + * @param [enable=false] + * @param [initialDelay=0] + * @return The socket itself. + */ + setKeepAlive(enable?: boolean, initialDelay?: number): this; + /** + * Returns the bound `address`, the address `family` name and `port` of the + * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + * @since v0.1.90 + */ + address(): AddressInfo | {}; + /** + * Calling `unref()` on a socket will allow the program to exit if this is the only + * active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect. + * @since v0.9.1 + * @return The socket itself. + */ + unref(): this; + /** + * Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior). + * If the socket is `ref`ed calling `ref` again will have no effect. + * @since v0.9.1 + * @return The socket itself. + */ + ref(): this; + /** + * This property shows the number of characters buffered for writing. The buffer + * may contain strings whose length after encoding is not yet known. So this number + * is only an approximation of the number of bytes in the buffer. + * + * `net.Socket` has the property that `socket.write()` always works. This is to + * help users get up and running quickly. The computer cannot always keep up + * with the amount of data that is written to a socket. The network connection + * simply might be too slow. Node.js will internally queue up the data written to a + * socket and send it out over the wire when it is possible. + * + * The consequence of this internal buffering is that memory may grow. + * Users who experience large or growing `bufferSize` should attempt to + * "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`. + * @since v0.3.8 + * @deprecated Since v14.6.0 - Use `writableLength` instead. + */ + readonly bufferSize: number; + /** + * The amount of received bytes. + * @since v0.5.3 + */ + readonly bytesRead: number; + /** + * The amount of bytes sent. + * @since v0.5.3 + */ + readonly bytesWritten: number; + /** + * If `true`,`socket.connect(options[, connectListener])` was + * called and has not yet finished. It will stay `true` until the socket becomes + * connected, then it is set to `false` and the `'connect'` event is emitted. Note + * that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event. + * @since v6.1.0 + */ + readonly connecting: boolean; + /** + * This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting + * (see `socket.connecting`). + * @since v11.2.0, v10.16.0 + */ + readonly pending: boolean; + /** + * See `writable.destroyed` for further details. + */ + readonly destroyed: boolean; + /** + * The string representation of the local IP address the remote client is + * connecting on. For example, in a server listening on `'0.0.0.0'`, if a client + * connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`. + * @since v0.9.6 + */ + readonly localAddress?: string; + /** + * The numeric representation of the local port. For example, `80` or `21`. + * @since v0.9.6 + */ + readonly localPort?: number; + /** + * The string representation of the local IP family. `'IPv4'` or `'IPv6'`. + * @since v18.8.0, v16.18.0 + */ + readonly localFamily?: string; + /** + * This property represents the state of the connection as a string. + * + * * If the stream is connecting `socket.readyState` is `opening`. + * * If the stream is readable and writable, it is `open`. + * * If the stream is readable and not writable, it is `readOnly`. + * * If the stream is not readable and writable, it is `writeOnly`. + * @since v0.5.0 + */ + readonly readyState: SocketReadyState; + /** + * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.5.10 + */ + readonly remoteAddress?: string | undefined; + /** + * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.11.14 + */ + readonly remoteFamily?: string | undefined; + /** + * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.5.10 + */ + readonly remotePort?: number | undefined; + /** + * The socket timeout in milliseconds as set by `socket.setTimeout()`. + * It is `undefined` if a timeout has not been set. + * @since v10.7.0 + */ + readonly timeout?: number | undefined; + /** + * Half-closes the socket. i.e., it sends a FIN packet. It is possible the + * server will still send some data. + * + * See `writable.end()` for further details. + * @since v0.1.90 + * @param [encoding='utf8'] Only used when data is `string`. + * @param callback Optional callback for when the socket is finished. + * @return The socket itself. + */ + end(callback?: () => void): this; + end(buffer: Uint8Array | string, callback?: () => void): this; + end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this; + /** + * events.EventEmitter + * 1. close + * 2. connect + * 3. data + * 4. drain + * 5. end + * 6. error + * 7. lookup + * 8. ready + * 9. timeout + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: (hadError: boolean) => void): this; + addListener(event: 'connect', listener: () => void): this; + addListener(event: 'data', listener: (data: Buffer) => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + addListener(event: 'ready', listener: () => void): this; + addListener(event: 'timeout', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close', hadError: boolean): boolean; + emit(event: 'connect'): boolean; + emit(event: 'data', data: Buffer): boolean; + emit(event: 'drain'): boolean; + emit(event: 'end'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'lookup', err: Error, address: string, family: string | number, host: string): boolean; + emit(event: 'ready'): boolean; + emit(event: 'timeout'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: (hadError: boolean) => void): this; + on(event: 'connect', listener: () => void): this; + on(event: 'data', listener: (data: Buffer) => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + on(event: 'ready', listener: () => void): this; + on(event: 'timeout', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: (hadError: boolean) => void): this; + once(event: 'connect', listener: () => void): this; + once(event: 'data', listener: (data: Buffer) => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + once(event: 'ready', listener: () => void): this; + once(event: 'timeout', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: (hadError: boolean) => void): this; + prependListener(event: 'connect', listener: () => void): this; + prependListener(event: 'data', listener: (data: Buffer) => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + prependListener(event: 'ready', listener: () => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: (hadError: boolean) => void): this; + prependOnceListener(event: 'connect', listener: () => void): this; + prependOnceListener(event: 'data', listener: (data: Buffer) => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + prependOnceListener(event: 'ready', listener: () => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + } + interface ListenOptions extends Abortable { + port?: number | undefined; + host?: string | undefined; + backlog?: number | undefined; + path?: string | undefined; + exclusive?: boolean | undefined; + readableAll?: boolean | undefined; + writableAll?: boolean | undefined; + /** + * @default false + */ + ipv6Only?: boolean | undefined; + } + interface ServerOpts { + /** + * Indicates whether half-opened TCP connections are allowed. + * @default false + */ + allowHalfOpen?: boolean | undefined; + /** + * Indicates whether the socket should be paused on incoming connections. + * @default false + */ + pauseOnConnect?: boolean | undefined; + /** + * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. + * @default false + * @since v16.5.0 + */ + noDelay?: boolean | undefined; + /** + * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, + * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. + * @default false + * @since v16.5.0 + */ + keepAlive?: boolean | undefined; + /** + * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. + * @default 0 + * @since v16.5.0 + */ + keepAliveInitialDelay?: number | undefined; + } + interface DropArgument { + localAddress?: string; + localPort?: number; + localFamily?: string; + remoteAddress?: string; + remotePort?: number; + remoteFamily?: string; + } + /** + * This class is used to create a TCP or `IPC` server. + * @since v0.1.90 + */ + class Server extends EventEmitter { + constructor(connectionListener?: (socket: Socket) => void); + constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void); + /** + * Start a server listening for connections. A `net.Server` can be a TCP or + * an `IPC` server depending on what it listens to. + * + * Possible signatures: + * + * * `server.listen(handle[, backlog][, callback])` + * * `server.listen(options[, callback])` + * * `server.listen(path[, backlog][, callback])` for `IPC` servers + * * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers + * + * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'` + * event. + * + * All `listen()` methods can take a `backlog` parameter to specify the maximum + * length of the queue of pending connections. The actual length will be determined + * by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn`on Linux. The default value of this parameter is 511 (not 512). + * + * All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for + * details). + * + * The `server.listen()` method can be called again if and only if there was an + * error during the first `server.listen()` call or `server.close()` has been + * called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. + * + * One of the most common errors raised when listening is `EADDRINUSE`. + * This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry + * after a certain amount of time: + * + * ```js + * server.on('error', (e) => { + * if (e.code === 'EADDRINUSE') { + * console.error('Address in use, retrying...'); + * setTimeout(() => { + * server.close(); + * server.listen(PORT, HOST); + * }, 1000); + * } + * }); + * ``` + */ + listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; + listen(port?: number, hostname?: string, listeningListener?: () => void): this; + listen(port?: number, backlog?: number, listeningListener?: () => void): this; + listen(port?: number, listeningListener?: () => void): this; + listen(path: string, backlog?: number, listeningListener?: () => void): this; + listen(path: string, listeningListener?: () => void): this; + listen(options: ListenOptions, listeningListener?: () => void): this; + listen(handle: any, backlog?: number, listeningListener?: () => void): this; + listen(handle: any, listeningListener?: () => void): this; + /** + * Stops the server from accepting new connections and keeps existing + * connections. This function is asynchronous, the server is finally closed + * when all connections are ended and the server emits a `'close'` event. + * The optional `callback` will be called once the `'close'` event occurs. Unlike + * that event, it will be called with an `Error` as its only argument if the server + * was not open when it was closed. + * @since v0.1.90 + * @param callback Called when the server is closed. + */ + close(callback?: (err?: Error) => void): this; + /** + * Returns the bound `address`, the address `family` name, and `port` of the server + * as reported by the operating system if listening on an IP socket + * (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. + * + * For a server listening on a pipe or Unix domain socket, the name is returned + * as a string. + * + * ```js + * const server = net.createServer((socket) => { + * socket.end('goodbye\n'); + * }).on('error', (err) => { + * // Handle errors here. + * throw err; + * }); + * + * // Grab an arbitrary unused port. + * server.listen(() => { + * console.log('opened server on', server.address()); + * }); + * ``` + * + * `server.address()` returns `null` before the `'listening'` event has been + * emitted or after calling `server.close()`. + * @since v0.1.90 + */ + address(): AddressInfo | string | null; + /** + * Asynchronously get the number of concurrent connections on the server. Works + * when sockets were sent to forks. + * + * Callback should take two arguments `err` and `count`. + * @since v0.9.7 + */ + getConnections(cb: (error: Error | null, count: number) => void): void; + /** + * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior). + * If the server is `ref`ed calling `ref()` again will have no effect. + * @since v0.9.1 + */ + ref(): this; + /** + * Calling `unref()` on a server will allow the program to exit if this is the only + * active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect. + * @since v0.9.1 + */ + unref(): this; + /** + * Set this property to reject connections when the server's connection count gets + * high. + * + * It is not recommended to use this option once a socket has been sent to a child + * with `child_process.fork()`. + * @since v0.2.0 + */ + maxConnections: number; + connections: number; + /** + * Indicates whether or not the server is listening for connections. + * @since v5.7.0 + */ + listening: boolean; + /** + * events.EventEmitter + * 1. close + * 2. connection + * 3. error + * 4. listening + * 5. drop + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'connection', listener: (socket: Socket) => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'listening', listener: () => void): this; + addListener(event: 'drop', listener: (data?: DropArgument) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'connection', socket: Socket): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'listening'): boolean; + emit(event: 'drop', data?: DropArgument): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'connection', listener: (socket: Socket) => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'listening', listener: () => void): this; + on(event: 'drop', listener: (data?: DropArgument) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'connection', listener: (socket: Socket) => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'listening', listener: () => void): this; + once(event: 'drop', listener: (data?: DropArgument) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'connection', listener: (socket: Socket) => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'listening', listener: () => void): this; + prependListener(event: 'drop', listener: (data?: DropArgument) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'listening', listener: () => void): this; + prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this; + /** + * Calls {@link Server.close()} and returns a promise that fulfills when the server has closed. + * @since v20.5.0 + */ + [Symbol.asyncDispose](): Promise; + } + type IPVersion = 'ipv4' | 'ipv6'; + /** + * The `BlockList` object can be used with some network APIs to specify rules for + * disabling inbound or outbound access to specific IP addresses, IP ranges, or + * IP subnets. + * @since v15.0.0, v14.18.0 + */ + class BlockList { + /** + * Adds a rule to block the given IP address. + * @since v15.0.0, v14.18.0 + * @param address An IPv4 or IPv6 address. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addAddress(address: string, type?: IPVersion): void; + addAddress(address: SocketAddress): void; + /** + * Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive). + * @since v15.0.0, v14.18.0 + * @param start The starting IPv4 or IPv6 address in the range. + * @param end The ending IPv4 or IPv6 address in the range. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addRange(start: string, end: string, type?: IPVersion): void; + addRange(start: SocketAddress, end: SocketAddress): void; + /** + * Adds a rule to block a range of IP addresses specified as a subnet mask. + * @since v15.0.0, v14.18.0 + * @param net The network IPv4 or IPv6 address. + * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addSubnet(net: SocketAddress, prefix: number): void; + addSubnet(net: string, prefix: number, type?: IPVersion): void; + /** + * Returns `true` if the given IP address matches any of the rules added to the`BlockList`. + * + * ```js + * const blockList = new net.BlockList(); + * blockList.addAddress('123.123.123.123'); + * blockList.addRange('10.0.0.1', '10.0.0.10'); + * blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6'); + * + * console.log(blockList.check('123.123.123.123')); // Prints: true + * console.log(blockList.check('10.0.0.3')); // Prints: true + * console.log(blockList.check('222.111.111.222')); // Prints: false + * + * // IPv6 notation for IPv4 addresses works: + * console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true + * console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true + * ``` + * @since v15.0.0, v14.18.0 + * @param address The IP address to check + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + check(address: SocketAddress): boolean; + check(address: string, type?: IPVersion): boolean; + } + interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { + timeout?: number | undefined; + } + interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { + timeout?: number | undefined; + } + type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; + /** + * Creates a new TCP or `IPC` server. + * + * If `allowHalfOpen` is set to `true`, when the other end of the socket + * signals the end of transmission, the server will only send back the end of + * transmission when `socket.end()` is explicitly called. For example, in the + * context of TCP, when a FIN packed is received, a FIN packed is sent + * back only when `socket.end()` is explicitly called. Until then the + * connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information. + * + * If `pauseOnConnect` is set to `true`, then the socket associated with each + * incoming connection will be paused, and no data will be read from its handle. + * This allows connections to be passed between processes without any data being + * read by the original process. To begin reading data from a paused socket, call `socket.resume()`. + * + * The server can be a TCP server or an `IPC` server, depending on what it `listen()` to. + * + * Here is an example of a TCP echo server which listens for connections + * on port 8124: + * + * ```js + * const net = require('node:net'); + * const server = net.createServer((c) => { + * // 'connection' listener. + * console.log('client connected'); + * c.on('end', () => { + * console.log('client disconnected'); + * }); + * c.write('hello\r\n'); + * c.pipe(c); + * }); + * server.on('error', (err) => { + * throw err; + * }); + * server.listen(8124, () => { + * console.log('server bound'); + * }); + * ``` + * + * Test this by using `telnet`: + * + * ```bash + * telnet localhost 8124 + * ``` + * + * To listen on the socket `/tmp/echo.sock`: + * + * ```js + * server.listen('/tmp/echo.sock', () => { + * console.log('server bound'); + * }); + * ``` + * + * Use `nc` to connect to a Unix domain socket server: + * + * ```bash + * nc -U /tmp/echo.sock + * ``` + * @since v0.5.0 + * @param connectionListener Automatically set as a listener for the {@link 'connection'} event. + */ + function createServer(connectionListener?: (socket: Socket) => void): Server; + function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server; + /** + * Aliases to {@link createConnection}. + * + * Possible signatures: + * + * * {@link connect} + * * {@link connect} for `IPC` connections. + * * {@link connect} for TCP connections. + */ + function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; + function connect(port: number, host?: string, connectionListener?: () => void): Socket; + function connect(path: string, connectionListener?: () => void): Socket; + /** + * A factory function, which creates a new {@link Socket}, + * immediately initiates connection with `socket.connect()`, + * then returns the `net.Socket` that starts the connection. + * + * When the connection is established, a `'connect'` event will be emitted + * on the returned socket. The last parameter `connectListener`, if supplied, + * will be added as a listener for the `'connect'` event **once**. + * + * Possible signatures: + * + * * {@link createConnection} + * * {@link createConnection} for `IPC` connections. + * * {@link createConnection} for TCP connections. + * + * The {@link connect} function is an alias to this function. + */ + function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; + function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; + function createConnection(path: string, connectionListener?: () => void): Socket; + /** + * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4 + * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`. + * + * ```js + * net.isIP('::1'); // returns 6 + * net.isIP('127.0.0.1'); // returns 4 + * net.isIP('127.000.000.001'); // returns 0 + * net.isIP('127.0.0.1/24'); // returns 0 + * net.isIP('fhqwhgads'); // returns 0 + * ``` + * @since v0.3.0 + */ + function isIP(input: string): number; + /** + * Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no + * leading zeroes. Otherwise, returns `false`. + * + * ```js + * net.isIPv4('127.0.0.1'); // returns true + * net.isIPv4('127.000.000.001'); // returns false + * net.isIPv4('127.0.0.1/24'); // returns false + * net.isIPv4('fhqwhgads'); // returns false + * ``` + * @since v0.3.0 + */ + function isIPv4(input: string): boolean; + /** + * Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`. + * + * ```js + * net.isIPv6('::1'); // returns true + * net.isIPv6('fhqwhgads'); // returns false + * ``` + * @since v0.3.0 + */ + function isIPv6(input: string): boolean; + interface SocketAddressInitOptions { + /** + * The network address as either an IPv4 or IPv6 string. + * @default 127.0.0.1 + */ + address?: string | undefined; + /** + * @default `'ipv4'` + */ + family?: IPVersion | undefined; + /** + * An IPv6 flow-label used only if `family` is `'ipv6'`. + * @default 0 + */ + flowlabel?: number | undefined; + /** + * An IP port. + * @default 0 + */ + port?: number | undefined; + } + /** + * @since v15.14.0, v14.18.0 + */ + class SocketAddress { + constructor(options: SocketAddressInitOptions); + /** + * Either \`'ipv4'\` or \`'ipv6'\`. + * @since v15.14.0, v14.18.0 + */ + readonly address: string; + /** + * Either \`'ipv4'\` or \`'ipv6'\`. + * @since v15.14.0, v14.18.0 + */ + readonly family: IPVersion; + /** + * @since v15.14.0, v14.18.0 + */ + readonly port: number; + /** + * @since v15.14.0, v14.18.0 + */ + readonly flowlabel: number; + } +} +declare module 'node:net' { + export * from 'net'; +} diff --git a/node_modules/@types/node/os.d.ts b/node_modules/@types/node/os.d.ts new file mode 100755 index 0000000..3d20864 --- /dev/null +++ b/node_modules/@types/node/os.d.ts @@ -0,0 +1,477 @@ +/** + * The `node:os` module provides operating system-related utility methods and + * properties. It can be accessed using: + * + * ```js + * const os = require('node:os'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/os.js) + */ +declare module 'os' { + interface CpuInfo { + model: string; + speed: number; + times: { + user: number; + nice: number; + sys: number; + idle: number; + irq: number; + }; + } + interface NetworkInterfaceBase { + address: string; + netmask: string; + mac: string; + internal: boolean; + cidr: string | null; + } + interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { + family: 'IPv4'; + scopeid?: undefined; + } + interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { + family: 'IPv6'; + scopeid: number; + } + interface UserInfo { + username: T; + uid: number; + gid: number; + shell: T; + homedir: T; + } + type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; + /** + * Returns the host name of the operating system as a string. + * @since v0.3.3 + */ + function hostname(): string; + /** + * Returns an array containing the 1, 5, and 15 minute load averages. + * + * The load average is a measure of system activity calculated by the operating + * system and expressed as a fractional number. + * + * The load average is a Unix-specific concept. On Windows, the return value is + * always `[0, 0, 0]`. + * @since v0.3.3 + */ + function loadavg(): number[]; + /** + * Returns the system uptime in number of seconds. + * @since v0.3.3 + */ + function uptime(): number; + /** + * Returns the amount of free system memory in bytes as an integer. + * @since v0.3.3 + */ + function freemem(): number; + /** + * Returns the total amount of system memory in bytes as an integer. + * @since v0.3.3 + */ + function totalmem(): number; + /** + * Returns an array of objects containing information about each logical CPU core. + * The array will be empty if no CPU information is available, such as if the`/proc` file system is unavailable. + * + * The properties included on each object include: + * + * ```js + * [ + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 252020, + * nice: 0, + * sys: 30340, + * idle: 1070356870, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 306960, + * nice: 0, + * sys: 26980, + * idle: 1071569080, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 248450, + * nice: 0, + * sys: 21750, + * idle: 1070919370, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 256880, + * nice: 0, + * sys: 19430, + * idle: 1070905480, + * irq: 20, + * }, + * }, + * ] + * ``` + * + * `nice` values are POSIX-only. On Windows, the `nice` values of all processors + * are always 0. + * + * `os.cpus().length` should not be used to calculate the amount of parallelism + * available to an application. Use {@link availableParallelism} for this purpose. + * @since v0.3.3 + */ + function cpus(): CpuInfo[]; + /** + * Returns an estimate of the default amount of parallelism a program should use. + * Always returns a value greater than zero. + * + * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism). + * @since v19.4.0, v18.14.0 + */ + function availableParallelism(): number; + /** + * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it + * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows. + * + * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information + * about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems. + * @since v0.3.3 + */ + function type(): string; + /** + * Returns the operating system as a string. + * + * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See + * [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v0.3.3 + */ + function release(): string; + /** + * Returns an object containing network interfaces that have been assigned a + * network address. + * + * Each key on the returned object identifies a network interface. The associated + * value is an array of objects that each describe an assigned network address. + * + * The properties available on the assigned network address object include: + * + * ```js + * { + * lo: [ + * { + * address: '127.0.0.1', + * netmask: '255.0.0.0', + * family: 'IPv4', + * mac: '00:00:00:00:00:00', + * internal: true, + * cidr: '127.0.0.1/8' + * }, + * { + * address: '::1', + * netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', + * family: 'IPv6', + * mac: '00:00:00:00:00:00', + * scopeid: 0, + * internal: true, + * cidr: '::1/128' + * } + * ], + * eth0: [ + * { + * address: '192.168.1.108', + * netmask: '255.255.255.0', + * family: 'IPv4', + * mac: '01:02:03:0a:0b:0c', + * internal: false, + * cidr: '192.168.1.108/24' + * }, + * { + * address: 'fe80::a00:27ff:fe4e:66a1', + * netmask: 'ffff:ffff:ffff:ffff::', + * family: 'IPv6', + * mac: '01:02:03:0a:0b:0c', + * scopeid: 1, + * internal: false, + * cidr: 'fe80::a00:27ff:fe4e:66a1/64' + * } + * ] + * } + * ``` + * @since v0.6.0 + */ + function networkInterfaces(): NodeJS.Dict; + /** + * Returns the string path of the current user's home directory. + * + * On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it + * uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory. + * + * On Windows, it uses the `USERPROFILE` environment variable if defined. + * Otherwise it uses the path to the profile directory of the current user. + * @since v2.3.0 + */ + function homedir(): string; + /** + * Returns information about the currently effective user. On POSIX platforms, + * this is typically a subset of the password file. The returned object includes + * the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and`gid` fields are `-1`, and `shell` is `null`. + * + * The value of `homedir` returned by `os.userInfo()` is provided by the operating + * system. This differs from the result of `os.homedir()`, which queries + * environment variables for the home directory before falling back to the + * operating system response. + * + * Throws a `SystemError` if a user has no `username` or `homedir`. + * @since v6.0.0 + */ + function userInfo(options: { encoding: 'buffer' }): UserInfo; + function userInfo(options?: { encoding: BufferEncoding }): UserInfo; + type SignalConstants = { + [key in NodeJS.Signals]: number; + }; + namespace constants { + const UV_UDP_REUSEADDR: number; + namespace signals {} + const signals: SignalConstants; + namespace errno { + const E2BIG: number; + const EACCES: number; + const EADDRINUSE: number; + const EADDRNOTAVAIL: number; + const EAFNOSUPPORT: number; + const EAGAIN: number; + const EALREADY: number; + const EBADF: number; + const EBADMSG: number; + const EBUSY: number; + const ECANCELED: number; + const ECHILD: number; + const ECONNABORTED: number; + const ECONNREFUSED: number; + const ECONNRESET: number; + const EDEADLK: number; + const EDESTADDRREQ: number; + const EDOM: number; + const EDQUOT: number; + const EEXIST: number; + const EFAULT: number; + const EFBIG: number; + const EHOSTUNREACH: number; + const EIDRM: number; + const EILSEQ: number; + const EINPROGRESS: number; + const EINTR: number; + const EINVAL: number; + const EIO: number; + const EISCONN: number; + const EISDIR: number; + const ELOOP: number; + const EMFILE: number; + const EMLINK: number; + const EMSGSIZE: number; + const EMULTIHOP: number; + const ENAMETOOLONG: number; + const ENETDOWN: number; + const ENETRESET: number; + const ENETUNREACH: number; + const ENFILE: number; + const ENOBUFS: number; + const ENODATA: number; + const ENODEV: number; + const ENOENT: number; + const ENOEXEC: number; + const ENOLCK: number; + const ENOLINK: number; + const ENOMEM: number; + const ENOMSG: number; + const ENOPROTOOPT: number; + const ENOSPC: number; + const ENOSR: number; + const ENOSTR: number; + const ENOSYS: number; + const ENOTCONN: number; + const ENOTDIR: number; + const ENOTEMPTY: number; + const ENOTSOCK: number; + const ENOTSUP: number; + const ENOTTY: number; + const ENXIO: number; + const EOPNOTSUPP: number; + const EOVERFLOW: number; + const EPERM: number; + const EPIPE: number; + const EPROTO: number; + const EPROTONOSUPPORT: number; + const EPROTOTYPE: number; + const ERANGE: number; + const EROFS: number; + const ESPIPE: number; + const ESRCH: number; + const ESTALE: number; + const ETIME: number; + const ETIMEDOUT: number; + const ETXTBSY: number; + const EWOULDBLOCK: number; + const EXDEV: number; + const WSAEINTR: number; + const WSAEBADF: number; + const WSAEACCES: number; + const WSAEFAULT: number; + const WSAEINVAL: number; + const WSAEMFILE: number; + const WSAEWOULDBLOCK: number; + const WSAEINPROGRESS: number; + const WSAEALREADY: number; + const WSAENOTSOCK: number; + const WSAEDESTADDRREQ: number; + const WSAEMSGSIZE: number; + const WSAEPROTOTYPE: number; + const WSAENOPROTOOPT: number; + const WSAEPROTONOSUPPORT: number; + const WSAESOCKTNOSUPPORT: number; + const WSAEOPNOTSUPP: number; + const WSAEPFNOSUPPORT: number; + const WSAEAFNOSUPPORT: number; + const WSAEADDRINUSE: number; + const WSAEADDRNOTAVAIL: number; + const WSAENETDOWN: number; + const WSAENETUNREACH: number; + const WSAENETRESET: number; + const WSAECONNABORTED: number; + const WSAECONNRESET: number; + const WSAENOBUFS: number; + const WSAEISCONN: number; + const WSAENOTCONN: number; + const WSAESHUTDOWN: number; + const WSAETOOMANYREFS: number; + const WSAETIMEDOUT: number; + const WSAECONNREFUSED: number; + const WSAELOOP: number; + const WSAENAMETOOLONG: number; + const WSAEHOSTDOWN: number; + const WSAEHOSTUNREACH: number; + const WSAENOTEMPTY: number; + const WSAEPROCLIM: number; + const WSAEUSERS: number; + const WSAEDQUOT: number; + const WSAESTALE: number; + const WSAEREMOTE: number; + const WSASYSNOTREADY: number; + const WSAVERNOTSUPPORTED: number; + const WSANOTINITIALISED: number; + const WSAEDISCON: number; + const WSAENOMORE: number; + const WSAECANCELLED: number; + const WSAEINVALIDPROCTABLE: number; + const WSAEINVALIDPROVIDER: number; + const WSAEPROVIDERFAILEDINIT: number; + const WSASYSCALLFAILURE: number; + const WSASERVICE_NOT_FOUND: number; + const WSATYPE_NOT_FOUND: number; + const WSA_E_NO_MORE: number; + const WSA_E_CANCELLED: number; + const WSAEREFUSED: number; + } + namespace priority { + const PRIORITY_LOW: number; + const PRIORITY_BELOW_NORMAL: number; + const PRIORITY_NORMAL: number; + const PRIORITY_ABOVE_NORMAL: number; + const PRIORITY_HIGH: number; + const PRIORITY_HIGHEST: number; + } + } + const devNull: string; + const EOL: string; + /** + * Returns the operating system CPU architecture for which the Node.js binary was + * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`. + * + * The return value is equivalent to `process.arch`. + * @since v0.5.0 + */ + function arch(): string; + /** + * Returns a string identifying the kernel version. + * + * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not + * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v13.11.0, v12.17.0 + */ + function version(): string; + /** + * Returns a string identifying the operating system platform for which + * the Node.js binary was compiled. The value is set at compile time. + * Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`,`'openbsd'`, `'sunos'`, and `'win32'`. + * + * The return value is equivalent to `process.platform`. + * + * The value `'android'` may also be returned if Node.js is built on the Android + * operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). + * @since v0.5.0 + */ + function platform(): NodeJS.Platform; + /** + * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`,`mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`. + * + * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not + * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v18.9.0, v16.18.0 + */ + function machine(): string; + /** + * Returns the operating system's default directory for temporary files as a + * string. + * @since v0.9.9 + */ + function tmpdir(): string; + /** + * Returns a string identifying the endianness of the CPU for which the Node.js + * binary was compiled. + * + * Possible values are `'BE'` for big endian and `'LE'` for little endian. + * @since v0.9.4 + */ + function endianness(): 'BE' | 'LE'; + /** + * Returns the scheduling priority for the process specified by `pid`. If `pid` is + * not provided or is `0`, the priority of the current process is returned. + * @since v10.10.0 + * @param [pid=0] The process ID to retrieve scheduling priority for. + */ + function getPriority(pid?: number): number; + /** + * Attempts to set the scheduling priority for the process specified by `pid`. If`pid` is not provided or is `0`, the process ID of the current process is used. + * + * The `priority` input must be an integer between `-20` (high priority) and `19`(low priority). Due to differences between Unix priority levels and Windows + * priority classes, `priority` is mapped to one of six priority constants in`os.constants.priority`. When retrieving a process priority level, this range + * mapping may cause the return value to be slightly different on Windows. To avoid + * confusion, set `priority` to one of the priority constants. + * + * On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user + * privileges. Otherwise the set priority will be silently reduced to`PRIORITY_HIGH`. + * @since v10.10.0 + * @param [pid=0] The process ID to set scheduling priority for. + * @param priority The scheduling priority to assign to the process. + */ + function setPriority(priority: number): void; + function setPriority(pid: number, priority: number): void; +} +declare module 'node:os' { + export * from 'os'; +} diff --git a/node_modules/@types/node/package.json b/node_modules/@types/node/package.json new file mode 100755 index 0000000..1ca8c61 --- /dev/null +++ b/node_modules/@types/node/package.json @@ -0,0 +1,232 @@ +{ + "name": "@types/node", + "version": "20.5.9", + "description": "TypeScript definitions for Node.js", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", + "license": "MIT", + "contributors": [ + { + "name": "Microsoft TypeScript", + "url": "https://github.com/Microsoft", + "githubUsername": "Microsoft" + }, + { + "name": "DefinitelyTyped", + "url": "https://github.com/DefinitelyTyped", + "githubUsername": "DefinitelyTyped" + }, + { + "name": "Alberto Schiabel", + "url": "https://github.com/jkomyno", + "githubUsername": "jkomyno" + }, + { + "name": "Alvis HT Tang", + "url": "https://github.com/alvis", + "githubUsername": "alvis" + }, + { + "name": "Andrew Makarov", + "url": "https://github.com/r3nya", + "githubUsername": "r3nya" + }, + { + "name": "Benjamin Toueg", + "url": "https://github.com/btoueg", + "githubUsername": "btoueg" + }, + { + "name": "Chigozirim C.", + "url": "https://github.com/smac89", + "githubUsername": "smac89" + }, + { + "name": "David Junger", + "url": "https://github.com/touffy", + "githubUsername": "touffy" + }, + { + "name": "Deividas Bakanas", + "url": "https://github.com/DeividasBakanas", + "githubUsername": "DeividasBakanas" + }, + { + "name": "Eugene Y. Q. Shen", + "url": "https://github.com/eyqs", + "githubUsername": "eyqs" + }, + { + "name": "Hannes Magnusson", + "url": "https://github.com/Hannes-Magnusson-CK", + "githubUsername": "Hannes-Magnusson-CK" + }, + { + "name": "Huw", + "url": "https://github.com/hoo29", + "githubUsername": "hoo29" + }, + { + "name": "Kelvin Jin", + "url": "https://github.com/kjin", + "githubUsername": "kjin" + }, + { + "name": "Klaus Meinhardt", + "url": "https://github.com/ajafff", + "githubUsername": "ajafff" + }, + { + "name": "Lishude", + "url": "https://github.com/islishude", + "githubUsername": "islishude" + }, + { + "name": "Mariusz Wiktorczyk", + "url": "https://github.com/mwiktorczyk", + "githubUsername": "mwiktorczyk" + }, + { + "name": "Mohsen Azimi", + "url": "https://github.com/mohsen1", + "githubUsername": "mohsen1" + }, + { + "name": "Nicolas Even", + "url": "https://github.com/n-e", + "githubUsername": "n-e" + }, + { + "name": "Nikita Galkin", + "url": "https://github.com/galkin", + "githubUsername": "galkin" + }, + { + "name": "Parambir Singh", + "url": "https://github.com/parambirs", + "githubUsername": "parambirs" + }, + { + "name": "Sebastian Silbermann", + "url": "https://github.com/eps1lon", + "githubUsername": "eps1lon" + }, + { + "name": "Thomas den Hollander", + "url": "https://github.com/ThomasdenH", + "githubUsername": "ThomasdenH" + }, + { + "name": "Wilco Bakker", + "url": "https://github.com/WilcoBakker", + "githubUsername": "WilcoBakker" + }, + { + "name": "wwwy3y3", + "url": "https://github.com/wwwy3y3", + "githubUsername": "wwwy3y3" + }, + { + "name": "Samuel Ainsworth", + "url": "https://github.com/samuela", + "githubUsername": "samuela" + }, + { + "name": "Kyle Uehlein", + "url": "https://github.com/kuehlein", + "githubUsername": "kuehlein" + }, + { + "name": "Thanik Bhongbhibhat", + "url": "https://github.com/bhongy", + "githubUsername": "bhongy" + }, + { + "name": "Marcin Kopacz", + "url": "https://github.com/chyzwar", + "githubUsername": "chyzwar" + }, + { + "name": "Trivikram Kamat", + "url": "https://github.com/trivikr", + "githubUsername": "trivikr" + }, + { + "name": "Junxiao Shi", + "url": "https://github.com/yoursunny", + "githubUsername": "yoursunny" + }, + { + "name": "Ilia Baryshnikov", + "url": "https://github.com/qwelias", + "githubUsername": "qwelias" + }, + { + "name": "ExE Boss", + "url": "https://github.com/ExE-Boss", + "githubUsername": "ExE-Boss" + }, + { + "name": "Piotr Błażejewicz", + "url": "https://github.com/peterblazejewicz", + "githubUsername": "peterblazejewicz" + }, + { + "name": "Anna Henningsen", + "url": "https://github.com/addaleax", + "githubUsername": "addaleax" + }, + { + "name": "Victor Perin", + "url": "https://github.com/victorperin", + "githubUsername": "victorperin" + }, + { + "name": "Yongsheng Zhang", + "url": "https://github.com/ZYSzys", + "githubUsername": "ZYSzys" + }, + { + "name": "NodeJS Contributors", + "url": "https://github.com/NodeJS", + "githubUsername": "NodeJS" + }, + { + "name": "Linus Unnebäck", + "url": "https://github.com/LinusU", + "githubUsername": "LinusU" + }, + { + "name": "wafuwafu13", + "url": "https://github.com/wafuwafu13", + "githubUsername": "wafuwafu13" + }, + { + "name": "Matteo Collina", + "url": "https://github.com/mcollina", + "githubUsername": "mcollina" + }, + { + "name": "Dmitry Semigradsky", + "url": "https://github.com/Semigradsky", + "githubUsername": "Semigradsky" + } + ], + "main": "", + "types": "index.d.ts", + "typesVersions": { + "<=4.8": { + "*": [ + "ts4.8/*" + ] + } + }, + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/node" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "b81b4a667392c6db4f92b6520158fccbce2770eefa3b0e03de5624b811f81649", + "typeScriptVersion": "4.3" +} \ No newline at end of file diff --git a/node_modules/@types/node/path.d.ts b/node_modules/@types/node/path.d.ts new file mode 100755 index 0000000..723d5da --- /dev/null +++ b/node_modules/@types/node/path.d.ts @@ -0,0 +1,191 @@ +declare module 'path/posix' { + import path = require('path'); + export = path; +} +declare module 'path/win32' { + import path = require('path'); + export = path; +} +/** + * The `node:path` module provides utilities for working with file and directory + * paths. It can be accessed using: + * + * ```js + * const path = require('node:path'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/path.js) + */ +declare module 'path' { + namespace path { + /** + * A parsed path object generated by path.parse() or consumed by path.format(). + */ + interface ParsedPath { + /** + * The root of the path such as '/' or 'c:\' + */ + root: string; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir: string; + /** + * The file name including extension (if any) such as 'index.html' + */ + base: string; + /** + * The file extension (if any) such as '.html' + */ + ext: string; + /** + * The file name without extension (if any) such as 'index' + */ + name: string; + } + interface FormatInputPathObject { + /** + * The root of the path such as '/' or 'c:\' + */ + root?: string | undefined; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir?: string | undefined; + /** + * The file name including extension (if any) such as 'index.html' + */ + base?: string | undefined; + /** + * The file extension (if any) such as '.html' + */ + ext?: string | undefined; + /** + * The file name without extension (if any) such as 'index' + */ + name?: string | undefined; + } + interface PlatformPath { + /** + * Normalize a string path, reducing '..' and '.' parts. + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + * + * @param path string path to normalize. + * @throws {TypeError} if `path` is not a string. + */ + normalize(path: string): string; + /** + * Join all arguments together and normalize the resulting path. + * + * @param paths paths to join. + * @throws {TypeError} if any of the path segments is not a string. + */ + join(...paths: string[]): string; + /** + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + * + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. + * + * If {to} isn't already absolute, {from} arguments are prepended in right to left order, + * until an absolute path is found. If after using all {from} paths still no absolute path is found, + * the current working directory is used as well. The resulting path is normalized, + * and trailing slashes are removed unless the path gets resolved to the root directory. + * + * @param paths A sequence of paths or path segments. + * @throws {TypeError} if any of the arguments is not a string. + */ + resolve(...paths: string[]): string; + /** + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + * + * If the given {path} is a zero-length string, `false` will be returned. + * + * @param path path to test. + * @throws {TypeError} if `path` is not a string. + */ + isAbsolute(path: string): boolean; + /** + * Solve the relative path from {from} to {to} based on the current working directory. + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. + * + * @throws {TypeError} if either `from` or `to` is not a string. + */ + relative(from: string, to: string): string; + /** + * Return the directory name of a path. Similar to the Unix dirname command. + * + * @param path the path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + dirname(path: string): string; + /** + * Return the last portion of a path. Similar to the Unix basename command. + * Often used to extract the file name from a fully qualified path. + * + * @param path the path to evaluate. + * @param suffix optionally, an extension to remove from the result. + * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string. + */ + basename(path: string, suffix?: string): string; + /** + * Return the extension of the path, from the last '.' to end of string in the last portion of the path. + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. + * + * @param path the path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + extname(path: string): string; + /** + * The platform-specific file separator. '\\' or '/'. + */ + readonly sep: '\\' | '/'; + /** + * The platform-specific file delimiter. ';' or ':'. + */ + readonly delimiter: ';' | ':'; + /** + * Returns an object from a path string - the opposite of format(). + * + * @param path path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + parse(path: string): ParsedPath; + /** + * Returns a path string from an object - the opposite of parse(). + * + * @param pathObject path to evaluate. + */ + format(pathObject: FormatInputPathObject): string; + /** + * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. + * If path is not a string, path will be returned without modifications. + * This method is meaningful only on Windows system. + * On POSIX systems, the method is non-operational and always returns path without modifications. + */ + toNamespacedPath(path: string): string; + /** + * Posix specific pathing. + * Same as parent object on posix. + */ + readonly posix: PlatformPath; + /** + * Windows specific pathing. + * Same as parent object on windows + */ + readonly win32: PlatformPath; + } + } + const path: path.PlatformPath; + export = path; +} +declare module 'node:path' { + import path = require('path'); + export = path; +} +declare module 'node:path/posix' { + import path = require('path/posix'); + export = path; +} +declare module 'node:path/win32' { + import path = require('path/win32'); + export = path; +} diff --git a/node_modules/@types/node/perf_hooks.d.ts b/node_modules/@types/node/perf_hooks.d.ts new file mode 100755 index 0000000..48d1848 --- /dev/null +++ b/node_modules/@types/node/perf_hooks.d.ts @@ -0,0 +1,638 @@ +/** + * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for + * Node.js-specific performance measurements. + * + * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/): + * + * * [High Resolution Time](https://www.w3.org/TR/hr-time-2) + * * [Performance Timeline](https://w3c.github.io/performance-timeline/) + * * [User Timing](https://www.w3.org/TR/user-timing/) + * * [Resource Timing](https://www.w3.org/TR/resource-timing-2/) + * + * ```js + * const { PerformanceObserver, performance } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((items) => { + * console.log(items.getEntries()[0].duration); + * performance.clearMarks(); + * }); + * obs.observe({ type: 'measure' }); + * performance.measure('Start to Now'); + * + * performance.mark('A'); + * doSomeLongRunningProcess(() => { + * performance.measure('A to Now', 'A'); + * + * performance.mark('B'); + * performance.measure('A to B', 'A', 'B'); + * }); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/perf_hooks.js) + */ +declare module 'perf_hooks' { + import { AsyncResource } from 'node:async_hooks'; + type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http' | 'dns'; + interface NodeGCPerformanceDetail { + /** + * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies + * the type of garbage collection operation that occurred. + * See perf_hooks.constants for valid values. + */ + readonly kind?: number | undefined; + /** + * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags` + * property contains additional information about garbage collection operation. + * See perf_hooks.constants for valid values. + */ + readonly flags?: number | undefined; + } + /** + * The constructor of this class is not exposed to users directly. + * @since v8.5.0 + */ + class PerformanceEntry { + protected constructor(); + /** + * The total number of milliseconds elapsed for this entry. This value will not + * be meaningful for all Performance Entry types. + * @since v8.5.0 + */ + readonly duration: number; + /** + * The name of the performance entry. + * @since v8.5.0 + */ + readonly name: string; + /** + * The high resolution millisecond timestamp marking the starting time of the + * Performance Entry. + * @since v8.5.0 + */ + readonly startTime: number; + /** + * The type of the performance entry. It may be one of: + * + * * `'node'` (Node.js only) + * * `'mark'` (available on the Web) + * * `'measure'` (available on the Web) + * * `'gc'` (Node.js only) + * * `'function'` (Node.js only) + * * `'http2'` (Node.js only) + * * `'http'` (Node.js only) + * @since v8.5.0 + */ + readonly entryType: EntryType; + /** + * Additional detail specific to the `entryType`. + * @since v16.0.0 + */ + readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type. + toJSON(): any; + } + /** + * Exposes marks created via the `Performance.mark()` method. + * @since v18.2.0, v16.17.0 + */ + class PerformanceMark extends PerformanceEntry { + readonly duration: 0; + readonly entryType: 'mark'; + } + /** + * Exposes measures created via the `Performance.measure()` method. + * + * The constructor of this class is not exposed to users directly. + * @since v18.2.0, v16.17.0 + */ + class PerformanceMeasure extends PerformanceEntry { + readonly entryType: 'measure'; + } + /** + * _This property is an extension by Node.js. It is not available in Web browsers._ + * + * Provides timing details for Node.js itself. The constructor of this class + * is not exposed to users. + * @since v8.5.0 + */ + class PerformanceNodeTiming extends PerformanceEntry { + /** + * The high resolution millisecond timestamp at which the Node.js process + * completed bootstrapping. If bootstrapping has not yet finished, the property + * has the value of -1. + * @since v8.5.0 + */ + readonly bootstrapComplete: number; + /** + * The high resolution millisecond timestamp at which the Node.js environment was + * initialized. + * @since v8.5.0 + */ + readonly environment: number; + /** + * The high resolution millisecond timestamp of the amount of time the event loop + * has been idle within the event loop's event provider (e.g. `epoll_wait`). This + * does not take CPU usage into consideration. If the event loop has not yet + * started (e.g., in the first tick of the main script), the property has the + * value of 0. + * @since v14.10.0, v12.19.0 + */ + readonly idleTime: number; + /** + * The high resolution millisecond timestamp at which the Node.js event loop + * exited. If the event loop has not yet exited, the property has the value of -1\. + * It can only have a value of not -1 in a handler of the `'exit'` event. + * @since v8.5.0 + */ + readonly loopExit: number; + /** + * The high resolution millisecond timestamp at which the Node.js event loop + * started. If the event loop has not yet started (e.g., in the first tick of the + * main script), the property has the value of -1. + * @since v8.5.0 + */ + readonly loopStart: number; + /** + * The high resolution millisecond timestamp at which the V8 platform was + * initialized. + * @since v8.5.0 + */ + readonly v8Start: number; + } + interface EventLoopUtilization { + idle: number; + active: number; + utilization: number; + } + /** + * @param util1 The result of a previous call to eventLoopUtilization() + * @param util2 The result of a previous call to eventLoopUtilization() prior to util1 + */ + type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization; + interface MarkOptions { + /** + * Additional optional detail to include with the mark. + */ + detail?: unknown | undefined; + /** + * An optional timestamp to be used as the mark time. + * @default `performance.now()`. + */ + startTime?: number | undefined; + } + interface MeasureOptions { + /** + * Additional optional detail to include with the mark. + */ + detail?: unknown | undefined; + /** + * Duration between start and end times. + */ + duration?: number | undefined; + /** + * Timestamp to be used as the end time, or a string identifying a previously recorded mark. + */ + end?: number | string | undefined; + /** + * Timestamp to be used as the start time, or a string identifying a previously recorded mark. + */ + start?: number | string | undefined; + } + interface TimerifyOptions { + /** + * A histogram object created using + * `perf_hooks.createHistogram()` that will record runtime durations in + * nanoseconds. + */ + histogram?: RecordableHistogram | undefined; + } + interface Performance { + /** + * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. + * If name is provided, removes only the named mark. + * @param name + */ + clearMarks(name?: string): void; + /** + * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline. + * If name is provided, removes only the named measure. + * @param name + * @since v16.7.0 + */ + clearMeasures(name?: string): void; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`. + * If you are only interested in performance entries of certain types or that have certain names, see + * `performance.getEntriesByType()` and `performance.getEntriesByName()`. + * @since v16.7.0 + */ + getEntries(): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` + * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`. + * @param name + * @param type + * @since v16.7.0 + */ + getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` + * whose `performanceEntry.entryType` is equal to `type`. + * @param type + * @since v16.7.0 + */ + getEntriesByType(type: EntryType): PerformanceEntry[]; + /** + * Creates a new PerformanceMark entry in the Performance Timeline. + * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', + * and whose performanceEntry.duration is always 0. + * Performance marks are used to mark specific significant moments in the Performance Timeline. + * @param name + * @return The PerformanceMark entry that was created + */ + mark(name?: string, options?: MarkOptions): PerformanceMark; + /** + * Creates a new PerformanceMeasure entry in the Performance Timeline. + * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', + * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. + * + * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify + * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, + * then startMark is set to timeOrigin by default. + * + * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp + * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. + * @param name + * @param startMark + * @param endMark + * @return The PerformanceMeasure entry that was created + */ + measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure; + measure(name: string, options: MeasureOptions): PerformanceMeasure; + /** + * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. + */ + readonly nodeTiming: PerformanceNodeTiming; + /** + * @return the current high resolution millisecond timestamp + */ + now(): number; + /** + * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. + */ + readonly timeOrigin: number; + /** + * Wraps a function within a new function that measures the running time of the wrapped function. + * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. + * @param fn + */ + timerify any>(fn: T, options?: TimerifyOptions): T; + /** + * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time. + * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait). + * No other CPU idle time is taken into consideration. + */ + eventLoopUtilization: EventLoopUtilityFunction; + } + interface PerformanceObserverEntryList { + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime`. + * + * ```js + * const { + * performance, + * PerformanceObserver, + * } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntries()); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 81.465639, + * * duration: 0 + * * }, + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 81.860064, + * * duration: 0 + * * } + * * ] + * + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ type: 'mark' }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntries(): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is + * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`. + * + * ```js + * const { + * performance, + * PerformanceObserver, + * } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntriesByName('meow')); + * + * * [ + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 98.545991, + * * duration: 0 + * * } + * * ] + * + * console.log(perfObserverList.getEntriesByName('nope')); // [] + * + * console.log(perfObserverList.getEntriesByName('test', 'mark')); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 63.518931, + * * duration: 0 + * * } + * * ] + * + * console.log(perfObserverList.getEntriesByName('test', 'measure')); // [] + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ entryTypes: ['mark', 'measure'] }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`. + * + * ```js + * const { + * performance, + * PerformanceObserver, + * } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntriesByType('mark')); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 55.897834, + * * duration: 0 + * * }, + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 56.350146, + * * duration: 0 + * * } + * * ] + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ type: 'mark' }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntriesByType(type: EntryType): PerformanceEntry[]; + } + type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; + /** + * @since v8.5.0 + */ + class PerformanceObserver extends AsyncResource { + constructor(callback: PerformanceObserverCallback); + /** + * Disconnects the `PerformanceObserver` instance from all notifications. + * @since v8.5.0 + */ + disconnect(): void; + /** + * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`: + * + * ```js + * const { + * performance, + * PerformanceObserver, + * } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((list, observer) => { + * // Called once asynchronously. `list` contains three items. + * }); + * obs.observe({ type: 'mark' }); + * + * for (let n = 0; n < 3; n++) + * performance.mark(`test${n}`); + * ``` + * @since v8.5.0 + */ + observe( + options: + | { + entryTypes: ReadonlyArray; + buffered?: boolean | undefined; + } + | { + type: EntryType; + buffered?: boolean | undefined; + } + ): void; + } + namespace constants { + const NODE_PERFORMANCE_GC_MAJOR: number; + const NODE_PERFORMANCE_GC_MINOR: number; + const NODE_PERFORMANCE_GC_INCREMENTAL: number; + const NODE_PERFORMANCE_GC_WEAKCB: number; + const NODE_PERFORMANCE_GC_FLAGS_NO: number; + const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number; + const NODE_PERFORMANCE_GC_FLAGS_FORCED: number; + const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number; + const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number; + const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number; + const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number; + } + const performance: Performance; + interface EventLoopMonitorOptions { + /** + * The sampling rate in milliseconds. + * Must be greater than zero. + * @default 10 + */ + resolution?: number | undefined; + } + interface Histogram { + /** + * Returns a `Map` object detailing the accumulated percentile distribution. + * @since v11.10.0 + */ + readonly percentiles: Map; + /** + * The number of times the event loop delay exceeded the maximum 1 hour event + * loop delay threshold. + * @since v11.10.0 + */ + readonly exceeds: number; + /** + * The minimum recorded event loop delay. + * @since v11.10.0 + */ + readonly min: number; + /** + * The maximum recorded event loop delay. + * @since v11.10.0 + */ + readonly max: number; + /** + * The mean of the recorded event loop delays. + * @since v11.10.0 + */ + readonly mean: number; + /** + * The standard deviation of the recorded event loop delays. + * @since v11.10.0 + */ + readonly stddev: number; + /** + * Resets the collected histogram data. + * @since v11.10.0 + */ + reset(): void; + /** + * Returns the value at the given percentile. + * @since v11.10.0 + * @param percentile A percentile value in the range (0, 100]. + */ + percentile(percentile: number): number; + } + interface IntervalHistogram extends Histogram { + /** + * Enables the update interval timer. Returns `true` if the timer was + * started, `false` if it was already started. + * @since v11.10.0 + */ + enable(): boolean; + /** + * Disables the update interval timer. Returns `true` if the timer was + * stopped, `false` if it was already stopped. + * @since v11.10.0 + */ + disable(): boolean; + } + interface RecordableHistogram extends Histogram { + /** + * @since v15.9.0, v14.18.0 + * @param val The amount to record in the histogram. + */ + record(val: number | bigint): void; + /** + * Calculates the amount of time (in nanoseconds) that has passed since the + * previous call to `recordDelta()` and records that amount in the histogram. + * + * ## Examples + * @since v15.9.0, v14.18.0 + */ + recordDelta(): void; + /** + * Adds the values from `other` to this histogram. + * @since v17.4.0, v16.14.0 + */ + add(other: RecordableHistogram): void; + } + /** + * _This property is an extension by Node.js. It is not available in Web browsers._ + * + * Creates an `IntervalHistogram` object that samples and reports the event loop + * delay over time. The delays will be reported in nanoseconds. + * + * Using a timer to detect approximate event loop delay works because the + * execution of timers is tied specifically to the lifecycle of the libuv + * event loop. That is, a delay in the loop will cause a delay in the execution + * of the timer, and those delays are specifically what this API is intended to + * detect. + * + * ```js + * const { monitorEventLoopDelay } = require('node:perf_hooks'); + * const h = monitorEventLoopDelay({ resolution: 20 }); + * h.enable(); + * // Do something. + * h.disable(); + * console.log(h.min); + * console.log(h.max); + * console.log(h.mean); + * console.log(h.stddev); + * console.log(h.percentiles); + * console.log(h.percentile(50)); + * console.log(h.percentile(99)); + * ``` + * @since v11.10.0 + */ + function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram; + interface CreateHistogramOptions { + /** + * The minimum recordable value. Must be an integer value greater than 0. + * @default 1 + */ + min?: number | bigint | undefined; + /** + * The maximum recordable value. Must be an integer value greater than min. + * @default Number.MAX_SAFE_INTEGER + */ + max?: number | bigint | undefined; + /** + * The number of accuracy digits. Must be a number between 1 and 5. + * @default 3 + */ + figures?: number | undefined; + } + /** + * Returns a `RecordableHistogram`. + * @since v15.9.0, v14.18.0 + */ + function createHistogram(options?: CreateHistogramOptions): RecordableHistogram; + import { performance as _performance } from 'perf_hooks'; + global { + /** + * `performance` is a global reference for `require('perf_hooks').performance` + * https://nodejs.org/api/globals.html#performance + * @since v16.0.0 + */ + var performance: typeof globalThis extends { + onmessage: any; + performance: infer T; + } + ? T + : typeof _performance; + } +} +declare module 'node:perf_hooks' { + export * from 'perf_hooks'; +} diff --git a/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts new file mode 100755 index 0000000..f122546 --- /dev/null +++ b/node_modules/@types/node/process.d.ts @@ -0,0 +1,1494 @@ +declare module 'process' { + import * as tty from 'node:tty'; + import { Worker } from 'node:worker_threads'; + global { + var process: NodeJS.Process; + namespace NodeJS { + // this namespace merge is here because these are specifically used + // as the type for process.stdin, process.stdout, and process.stderr. + // they can't live in tty.d.ts because we need to disambiguate the imported name. + interface ReadStream extends tty.ReadStream {} + interface WriteStream extends tty.WriteStream {} + interface MemoryUsageFn { + /** + * The `process.memoryUsage()` method iterate over each page to gather informations about memory + * usage which can be slow depending on the program memory allocations. + */ + (): MemoryUsage; + /** + * method returns an integer representing the Resident Set Size (RSS) in bytes. + */ + rss(): number; + } + interface MemoryUsage { + rss: number; + heapTotal: number; + heapUsed: number; + external: number; + arrayBuffers: number; + } + interface CpuUsage { + user: number; + system: number; + } + interface ProcessRelease { + name: string; + sourceUrl?: string | undefined; + headersUrl?: string | undefined; + libUrl?: string | undefined; + lts?: string | undefined; + } + interface ProcessVersions extends Dict { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + modules: string; + openssl: string; + } + type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd'; + type Architecture = 'arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x64'; + type Signals = + | 'SIGABRT' + | 'SIGALRM' + | 'SIGBUS' + | 'SIGCHLD' + | 'SIGCONT' + | 'SIGFPE' + | 'SIGHUP' + | 'SIGILL' + | 'SIGINT' + | 'SIGIO' + | 'SIGIOT' + | 'SIGKILL' + | 'SIGPIPE' + | 'SIGPOLL' + | 'SIGPROF' + | 'SIGPWR' + | 'SIGQUIT' + | 'SIGSEGV' + | 'SIGSTKFLT' + | 'SIGSTOP' + | 'SIGSYS' + | 'SIGTERM' + | 'SIGTRAP' + | 'SIGTSTP' + | 'SIGTTIN' + | 'SIGTTOU' + | 'SIGUNUSED' + | 'SIGURG' + | 'SIGUSR1' + | 'SIGUSR2' + | 'SIGVTALRM' + | 'SIGWINCH' + | 'SIGXCPU' + | 'SIGXFSZ' + | 'SIGBREAK' + | 'SIGLOST' + | 'SIGINFO'; + type UncaughtExceptionOrigin = 'uncaughtException' | 'unhandledRejection'; + type MultipleResolveType = 'resolve' | 'reject'; + type BeforeExitListener = (code: number) => void; + type DisconnectListener = () => void; + type ExitListener = (code: number) => void; + type RejectionHandledListener = (promise: Promise) => void; + type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void; + /** + * Most of the time the unhandledRejection will be an Error, but this should not be relied upon + * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error. + */ + type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; + type WarningListener = (warning: Error) => void; + type MessageListener = (message: unknown, sendHandle: unknown) => void; + type SignalsListener = (signal: Signals) => void; + type MultipleResolveListener = (type: MultipleResolveType, promise: Promise, value: unknown) => void; + type WorkerListener = (worker: Worker) => void; + interface Socket extends ReadWriteStream { + isTTY?: true | undefined; + } + // Alias for compatibility + interface ProcessEnv extends Dict { + /** + * Can be used to change the default timezone at runtime + */ + TZ?: string; + } + interface HRTime { + (time?: [number, number]): [number, number]; + bigint(): bigint; + } + interface ProcessReport { + /** + * Directory where the report is written. + * working directory of the Node.js process. + * @default '' indicating that reports are written to the current + */ + directory: string; + /** + * Filename where the report is written. + * The default value is the empty string. + * @default '' the output filename will be comprised of a timestamp, + * PID, and sequence number. + */ + filename: string; + /** + * Returns a JSON-formatted diagnostic report for the running process. + * The report's JavaScript stack trace is taken from err, if present. + */ + getReport(err?: Error): string; + /** + * If true, a diagnostic report is generated on fatal errors, + * such as out of memory errors or failed C++ assertions. + * @default false + */ + reportOnFatalError: boolean; + /** + * If true, a diagnostic report is generated when the process + * receives the signal specified by process.report.signal. + * @default false + */ + reportOnSignal: boolean; + /** + * If true, a diagnostic report is generated on uncaught exception. + * @default false + */ + reportOnUncaughtException: boolean; + /** + * The signal used to trigger the creation of a diagnostic report. + * @default 'SIGUSR2' + */ + signal: Signals; + /** + * Writes a diagnostic report to a file. If filename is not provided, the default filename + * includes the date, time, PID, and a sequence number. + * The report's JavaScript stack trace is taken from err, if present. + * + * @param fileName Name of the file where the report is written. + * This should be a relative path, that will be appended to the directory specified in + * `process.report.directory`, or the current working directory of the Node.js process, + * if unspecified. + * @param error A custom error used for reporting the JavaScript stack. + * @return Filename of the generated report. + */ + writeReport(fileName?: string): string; + writeReport(error?: Error): string; + writeReport(fileName?: string, err?: Error): string; + } + interface ResourceUsage { + fsRead: number; + fsWrite: number; + involuntaryContextSwitches: number; + ipcReceived: number; + ipcSent: number; + majorPageFault: number; + maxRSS: number; + minorPageFault: number; + sharedMemorySize: number; + signalsCount: number; + swappedOut: number; + systemCPUTime: number; + unsharedDataSize: number; + unsharedStackSize: number; + userCPUTime: number; + voluntaryContextSwitches: number; + } + interface EmitWarningOptions { + /** + * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. + * + * @default 'Warning' + */ + type?: string | undefined; + /** + * A unique identifier for the warning instance being emitted. + */ + code?: string | undefined; + /** + * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. + * + * @default process.emitWarning + */ + ctor?: Function | undefined; + /** + * Additional text to include with the error. + */ + detail?: string | undefined; + } + interface ProcessConfig { + readonly target_defaults: { + readonly cflags: any[]; + readonly default_configuration: string; + readonly defines: string[]; + readonly include_dirs: string[]; + readonly libraries: string[]; + }; + readonly variables: { + readonly clang: number; + readonly host_arch: string; + readonly node_install_npm: boolean; + readonly node_install_waf: boolean; + readonly node_prefix: string; + readonly node_shared_openssl: boolean; + readonly node_shared_v8: boolean; + readonly node_shared_zlib: boolean; + readonly node_use_dtrace: boolean; + readonly node_use_etw: boolean; + readonly node_use_openssl: boolean; + readonly target_arch: string; + readonly v8_no_strict_aliasing: number; + readonly v8_use_snapshot: boolean; + readonly visibility: string; + }; + } + interface Process extends EventEmitter { + /** + * The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is + * a `Writable` stream. + * + * For example, to copy `process.stdin` to `process.stdout`: + * + * ```js + * import { stdin, stdout } from 'node:process'; + * + * stdin.pipe(stdout); + * ``` + * + * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information. + */ + stdout: WriteStream & { + fd: 1; + }; + /** + * The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is + * a `Writable` stream. + * + * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information. + */ + stderr: WriteStream & { + fd: 2; + }; + /** + * The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is + * a `Readable` stream. + * + * For details of how to read from `stdin` see `readable.read()`. + * + * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that + * is compatible with scripts written for Node.js prior to v0.10\. + * For more information see `Stream compatibility`. + * + * In "old" streams mode the `stdin` stream is paused by default, so one + * must call `process.stdin.resume()` to read from it. Note also that calling`process.stdin.resume()` itself would switch stream to "old" mode. + */ + stdin: ReadStream & { + fd: 0; + }; + openStdin(): Socket; + /** + * The `process.argv` property returns an array containing the command-line + * arguments passed when the Node.js process was launched. The first element will + * be {@link execPath}. See `process.argv0` if access to the original value + * of `argv[0]` is needed. The second element will be the path to the JavaScript + * file being executed. The remaining elements will be any additional command-line + * arguments. + * + * For example, assuming the following script for `process-args.js`: + * + * ```js + * import { argv } from 'node:process'; + * + * // print process.argv + * argv.forEach((val, index) => { + * console.log(`${index}: ${val}`); + * }); + * ``` + * + * Launching the Node.js process as: + * + * ```bash + * node process-args.js one two=three four + * ``` + * + * Would generate the output: + * + * ```text + * 0: /usr/local/bin/node + * 1: /Users/mjr/work/node/process-args.js + * 2: one + * 3: two=three + * 4: four + * ``` + * @since v0.1.27 + */ + argv: string[]; + /** + * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts. + * + * ```console + * $ bash -c 'exec -a customArgv0 ./node' + * > process.argv[0] + * '/Volumes/code/external/node/out/Release/node' + * > process.argv0 + * 'customArgv0' + * ``` + * @since v6.4.0 + */ + argv0: string; + /** + * The `process.execArgv` property returns the set of Node.js-specific command-line + * options passed when the Node.js process was launched. These options do not + * appear in the array returned by the {@link argv} property, and do not + * include the Node.js executable, the name of the script, or any options following + * the script name. These options are useful in order to spawn child processes with + * the same execution environment as the parent. + * + * ```bash + * node --harmony script.js --version + * ``` + * + * Results in `process.execArgv`: + * + * ```js + * ['--harmony'] + * ``` + * + * And `process.argv`: + * + * ```js + * ['/usr/local/bin/node', 'script.js', '--version'] + * ``` + * + * Refer to `Worker constructor` for the detailed behavior of worker + * threads with this property. + * @since v0.7.7 + */ + execArgv: string[]; + /** + * The `process.execPath` property returns the absolute pathname of the executable + * that started the Node.js process. Symbolic links, if any, are resolved. + * + * ```js + * '/usr/local/bin/node' + * ``` + * @since v0.1.100 + */ + execPath: string; + /** + * The `process.abort()` method causes the Node.js process to exit immediately and + * generate a core file. + * + * This feature is not available in `Worker` threads. + * @since v0.7.0 + */ + abort(): never; + /** + * The `process.chdir()` method changes the current working directory of the + * Node.js process or throws an exception if doing so fails (for instance, if + * the specified `directory` does not exist). + * + * ```js + * import { chdir, cwd } from 'node:process'; + * + * console.log(`Starting directory: ${cwd()}`); + * try { + * chdir('/tmp'); + * console.log(`New directory: ${cwd()}`); + * } catch (err) { + * console.error(`chdir: ${err}`); + * } + * ``` + * + * This feature is not available in `Worker` threads. + * @since v0.1.17 + */ + chdir(directory: string): void; + /** + * The `process.cwd()` method returns the current working directory of the Node.js + * process. + * + * ```js + * import { cwd } from 'node:process'; + * + * console.log(`Current directory: ${cwd()}`); + * ``` + * @since v0.1.8 + */ + cwd(): string; + /** + * The port used by the Node.js debugger when enabled. + * + * ```js + * import process from 'node:process'; + * + * process.debugPort = 5858; + * ``` + * @since v0.7.2 + */ + debugPort: number; + /** + * The `process.emitWarning()` method can be used to emit custom or application + * specific process warnings. These can be listened for by adding a handler to the `'warning'` event. + * + * ```js + * import { emitWarning } from 'node:process'; + * + * // Emit a warning with a code and additional detail. + * emitWarning('Something happened!', { + * code: 'MY_WARNING', + * detail: 'This is some additional information', + * }); + * // Emits: + * // (node:56338) [MY_WARNING] Warning: Something happened! + * // This is some additional information + * ``` + * + * In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler. + * + * ```js + * import process from 'node:process'; + * + * process.on('warning', (warning) => { + * console.warn(warning.name); // 'Warning' + * console.warn(warning.message); // 'Something happened!' + * console.warn(warning.code); // 'MY_WARNING' + * console.warn(warning.stack); // Stack trace + * console.warn(warning.detail); // 'This is some additional information' + * }); + * ``` + * + * If `warning` is passed as an `Error` object, the `options` argument is ignored. + * @since v8.0.0 + * @param warning The warning to emit. + */ + emitWarning(warning: string | Error, ctor?: Function): void; + emitWarning(warning: string | Error, type?: string, ctor?: Function): void; + emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void; + emitWarning(warning: string | Error, options?: EmitWarningOptions): void; + /** + * The `process.env` property returns an object containing the user environment. + * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html). + * + * An example of this object looks like: + * + * ```js + * { + * TERM: 'xterm-256color', + * SHELL: '/usr/local/bin/bash', + * USER: 'maciej', + * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', + * PWD: '/Users/maciej', + * EDITOR: 'vim', + * SHLVL: '1', + * HOME: '/Users/maciej', + * LOGNAME: 'maciej', + * _: '/usr/local/bin/node' + * } + * ``` + * + * It is possible to modify this object, but such modifications will not be + * reflected outside the Node.js process, or (unless explicitly requested) + * to other `Worker` threads. + * In other words, the following example would not work: + * + * ```bash + * node -e 'process.env.foo = "bar"' && echo $foo + * ``` + * + * While the following will: + * + * ```js + * import { env } from 'node:process'; + * + * env.foo = 'bar'; + * console.log(env.foo); + * ``` + * + * Assigning a property on `process.env` will implicitly convert the value + * to a string. **This behavior is deprecated.** Future versions of Node.js may + * throw an error when the value is not a string, number, or boolean. + * + * ```js + * import { env } from 'node:process'; + * + * env.test = null; + * console.log(env.test); + * // => 'null' + * env.test = undefined; + * console.log(env.test); + * // => 'undefined' + * ``` + * + * Use `delete` to delete a property from `process.env`. + * + * ```js + * import { env } from 'node:process'; + * + * env.TEST = 1; + * delete env.TEST; + * console.log(env.TEST); + * // => undefined + * ``` + * + * On Windows operating systems, environment variables are case-insensitive. + * + * ```js + * import { env } from 'node:process'; + * + * env.TEST = 1; + * console.log(env.test); + * // => 1 + * ``` + * + * Unless explicitly specified when creating a `Worker` instance, + * each `Worker` thread has its own copy of `process.env`, based on its + * parent thread's `process.env`, or whatever was specified as the `env` option + * to the `Worker` constructor. Changes to `process.env` will not be visible + * across `Worker` threads, and only the main thread can make changes that + * are visible to the operating system or to native add-ons. + * @since v0.1.27 + */ + env: ProcessEnv; + /** + * The `process.exit()` method instructs Node.js to terminate the process + * synchronously with an exit status of `code`. If `code` is omitted, exit uses + * either the 'success' code `0` or the value of `process.exitCode` if it has been + * set. Node.js will not terminate until all the `'exit'` event listeners are + * called. + * + * To exit with a 'failure' code: + * + * ```js + * import { exit } from 'node:process'; + * + * exit(1); + * ``` + * + * The shell that executed Node.js should see the exit code as `1`. + * + * Calling `process.exit()` will force the process to exit as quickly as possible + * even if there are still asynchronous operations pending that have not yet + * completed fully, including I/O operations to `process.stdout` and`process.stderr`. + * + * In most situations, it is not actually necessary to call `process.exit()`explicitly. The Node.js process will exit on its own _if there is no additional_ + * _work pending_ in the event loop. The `process.exitCode` property can be set to + * tell the process which exit code to use when the process exits gracefully. + * + * For instance, the following example illustrates a _misuse_ of the`process.exit()` method that could lead to data printed to stdout being + * truncated and lost: + * + * ```js + * import { exit } from 'node:process'; + * + * // This is an example of what *not* to do: + * if (someConditionNotMet()) { + * printUsageToStdout(); + * exit(1); + * } + * ``` + * + * The reason this is problematic is because writes to `process.stdout` in Node.js + * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js + * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed. + * + * Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding + * scheduling any additional work for the event loop: + * + * ```js + * import process from 'node:process'; + * + * // How to properly set the exit code while letting + * // the process exit gracefully. + * if (someConditionNotMet()) { + * printUsageToStdout(); + * process.exitCode = 1; + * } + * ``` + * + * If it is necessary to terminate the Node.js process due to an error condition, + * throwing an _uncaught_ error and allowing the process to terminate accordingly + * is safer than calling `process.exit()`. + * + * In `Worker` threads, this function stops the current thread rather + * than the current process. + * @since v0.1.13 + * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed. + */ + exit(code?: number): never; + /** + * A number which will be the process exit code, when the process either + * exits gracefully, or is exited via {@link exit} without specifying + * a code. + * + * Specifying a code to {@link exit} will override any + * previous setting of `process.exitCode`. + * @since v0.11.8 + */ + exitCode?: number | undefined; + /** + * The `process.getgid()` method returns the numerical group identity of the + * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).) + * + * ```js + * import process from 'process'; + * + * if (process.getgid) { + * console.log(`Current gid: ${process.getgid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.1.31 + */ + getgid?: () => number; + /** + * The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a + * numeric ID or a group name + * string. If a group name is specified, this method blocks while resolving the + * associated numeric ID. + * + * ```js + * import process from 'process'; + * + * if (process.getgid && process.setgid) { + * console.log(`Current gid: ${process.getgid()}`); + * try { + * process.setgid(501); + * console.log(`New gid: ${process.getgid()}`); + * } catch (err) { + * console.log(`Failed to set gid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.1.31 + * @param id The group name or ID + */ + setgid?: (id: number | string) => void; + /** + * The `process.getuid()` method returns the numeric user identity of the process. + * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).) + * + * ```js + * import process from 'process'; + * + * if (process.getuid) { + * console.log(`Current uid: ${process.getuid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.1.28 + */ + getuid?: () => number; + /** + * The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a + * numeric ID or a username string. + * If a username is specified, the method blocks while resolving the associated + * numeric ID. + * + * ```js + * import process from 'process'; + * + * if (process.getuid && process.setuid) { + * console.log(`Current uid: ${process.getuid()}`); + * try { + * process.setuid(501); + * console.log(`New uid: ${process.getuid()}`); + * } catch (err) { + * console.log(`Failed to set uid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.1.28 + */ + setuid?: (id: number | string) => void; + /** + * The `process.geteuid()` method returns the numerical effective user identity of + * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).) + * + * ```js + * import process from 'process'; + * + * if (process.geteuid) { + * console.log(`Current uid: ${process.geteuid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v2.0.0 + */ + geteuid?: () => number; + /** + * The `process.seteuid()` method sets the effective user identity of the process. + * (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username + * string. If a username is specified, the method blocks while resolving the + * associated numeric ID. + * + * ```js + * import process from 'process'; + * + * if (process.geteuid && process.seteuid) { + * console.log(`Current uid: ${process.geteuid()}`); + * try { + * process.seteuid(501); + * console.log(`New uid: ${process.geteuid()}`); + * } catch (err) { + * console.log(`Failed to set uid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v2.0.0 + * @param id A user name or ID + */ + seteuid?: (id: number | string) => void; + /** + * The `process.getegid()` method returns the numerical effective group identity + * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).) + * + * ```js + * import process from 'process'; + * + * if (process.getegid) { + * console.log(`Current gid: ${process.getegid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v2.0.0 + */ + getegid?: () => number; + /** + * The `process.setegid()` method sets the effective group identity of the process. + * (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group + * name string. If a group name is specified, this method blocks while resolving + * the associated a numeric ID. + * + * ```js + * import process from 'process'; + * + * if (process.getegid && process.setegid) { + * console.log(`Current gid: ${process.getegid()}`); + * try { + * process.setegid(501); + * console.log(`New gid: ${process.getegid()}`); + * } catch (err) { + * console.log(`Failed to set gid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v2.0.0 + * @param id A group name or ID + */ + setegid?: (id: number | string) => void; + /** + * The `process.getgroups()` method returns an array with the supplementary group + * IDs. POSIX leaves it unspecified if the effective group ID is included but + * Node.js ensures it always is. + * + * ```js + * import process from 'process'; + * + * if (process.getgroups) { + * console.log(process.getgroups()); // [ 16, 21, 297 ] + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.9.4 + */ + getgroups?: () => number[]; + /** + * The `process.setgroups()` method sets the supplementary group IDs for the + * Node.js process. This is a privileged operation that requires the Node.js + * process to have `root` or the `CAP_SETGID` capability. + * + * The `groups` array can contain numeric group IDs, group names, or both. + * + * ```js + * import process from 'process'; + * + * if (process.getgroups && process.setgroups) { + * try { + * process.setgroups([501]); + * console.log(process.getgroups()); // new groups + * } catch (err) { + * console.log(`Failed to set groups: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.9.4 + */ + setgroups?: (groups: ReadonlyArray) => void; + /** + * The `process.setUncaughtExceptionCaptureCallback()` function sets a function + * that will be invoked when an uncaught exception occurs, which will receive the + * exception value itself as its first argument. + * + * If such a function is set, the `'uncaughtException'` event will + * not be emitted. If `--abort-on-uncaught-exception` was passed from the + * command line or set through `v8.setFlagsFromString()`, the process will + * not abort. Actions configured to take place on exceptions such as report + * generations will be affected too + * + * To unset the capture function,`process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this + * method with a non-`null` argument while another capture function is set will + * throw an error. + * + * Using this function is mutually exclusive with using the deprecated `domain` built-in module. + * @since v9.3.0 + */ + setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; + /** + * Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}. + * @since v9.3.0 + */ + hasUncaughtExceptionCaptureCallback(): boolean; + /** + * The `process.version` property contains the Node.js version string. + * + * ```js + * import { version } from 'node:process'; + * + * console.log(`Version: ${version}`); + * // Version: v14.8.0 + * ``` + * + * To get the version string without the prepended _v_, use`process.versions.node`. + * @since v0.1.3 + */ + readonly version: string; + /** + * The `process.versions` property returns an object listing the version strings of + * Node.js and its dependencies. `process.versions.modules` indicates the current + * ABI version, which is increased whenever a C++ API changes. Node.js will refuse + * to load modules that were compiled against a different module ABI version. + * + * ```js + * import { versions } from 'node:process'; + * + * console.log(versions); + * ``` + * + * Will generate an object similar to: + * + * ```console + * { node: '20.2.0', + * acorn: '8.8.2', + * ada: '2.4.0', + * ares: '1.19.0', + * base64: '0.5.0', + * brotli: '1.0.9', + * cjs_module_lexer: '1.2.2', + * cldr: '43.0', + * icu: '73.1', + * llhttp: '8.1.0', + * modules: '115', + * napi: '8', + * nghttp2: '1.52.0', + * nghttp3: '0.7.0', + * ngtcp2: '0.8.1', + * openssl: '3.0.8+quic', + * simdutf: '3.2.9', + * tz: '2023c', + * undici: '5.22.0', + * unicode: '15.0', + * uv: '1.44.2', + * uvwasi: '0.0.16', + * v8: '11.3.244.8-node.9', + * zlib: '1.2.13' } + * ``` + * @since v0.2.0 + */ + readonly versions: ProcessVersions; + /** + * The `process.config` property returns a frozen `Object` containing the + * JavaScript representation of the configure options used to compile the current + * Node.js executable. This is the same as the `config.gypi` file that was produced + * when running the `./configure` script. + * + * An example of the possible output looks like: + * + * ```js + * { + * target_defaults: + * { cflags: [], + * default_configuration: 'Release', + * defines: [], + * include_dirs: [], + * libraries: [] }, + * variables: + * { + * host_arch: 'x64', + * napi_build_version: 5, + * node_install_npm: 'true', + * node_prefix: '', + * node_shared_cares: 'false', + * node_shared_http_parser: 'false', + * node_shared_libuv: 'false', + * node_shared_zlib: 'false', + * node_use_openssl: 'true', + * node_shared_openssl: 'false', + * strict_aliasing: 'true', + * target_arch: 'x64', + * v8_use_snapshot: 1 + * } + * } + * ``` + * @since v0.7.7 + */ + readonly config: ProcessConfig; + /** + * The `process.kill()` method sends the `signal` to the process identified by`pid`. + * + * Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information. + * + * This method will throw an error if the target `pid` does not exist. As a special + * case, a signal of `0` can be used to test for the existence of a process. + * Windows platforms will throw an error if the `pid` is used to kill a process + * group. + * + * Even though the name of this function is `process.kill()`, it is really just a + * signal sender, like the `kill` system call. The signal sent may do something + * other than kill the target process. + * + * ```js + * import process, { kill } from 'node:process'; + * + * process.on('SIGHUP', () => { + * console.log('Got SIGHUP signal.'); + * }); + * + * setTimeout(() => { + * console.log('Exiting.'); + * process.exit(0); + * }, 100); + * + * kill(process.pid, 'SIGHUP'); + * ``` + * + * When `SIGUSR1` is received by a Node.js process, Node.js will start the + * debugger. See `Signal Events`. + * @since v0.0.6 + * @param pid A process ID + * @param [signal='SIGTERM'] The signal to send, either as a string or number. + */ + kill(pid: number, signal?: string | number): true; + /** + * The `process.pid` property returns the PID of the process. + * + * ```js + * import { pid } from 'node:process'; + * + * console.log(`This process is pid ${pid}`); + * ``` + * @since v0.1.15 + */ + readonly pid: number; + /** + * The `process.ppid` property returns the PID of the parent of the + * current process. + * + * ```js + * import { ppid } from 'node:process'; + * + * console.log(`The parent process is pid ${ppid}`); + * ``` + * @since v9.2.0, v8.10.0, v6.13.0 + */ + readonly ppid: number; + /** + * The `process.title` property returns the current process title (i.e. returns + * the current value of `ps`). Assigning a new value to `process.title` modifies + * the current value of `ps`. + * + * When a new value is assigned, different platforms will impose different maximum + * length restrictions on the title. Usually such restrictions are quite limited. + * For instance, on Linux and macOS, `process.title` is limited to the size of the + * binary name plus the length of the command-line arguments because setting the`process.title` overwrites the `argv` memory of the process. Node.js v0.8 + * allowed for longer process title strings by also overwriting the `environ`memory but that was potentially insecure and confusing in some (rather obscure) + * cases. + * + * Assigning a value to `process.title` might not result in an accurate label + * within process manager applications such as macOS Activity Monitor or Windows + * Services Manager. + * @since v0.1.104 + */ + title: string; + /** + * The operating system CPU architecture for which the Node.js binary was compiled. + * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`. + * + * ```js + * import { arch } from 'node:process'; + * + * console.log(`This processor architecture is ${arch}`); + * ``` + * @since v0.5.0 + */ + readonly arch: Architecture; + /** + * The `process.platform` property returns a string identifying the operating + * system platform for which the Node.js binary was compiled. + * + * Currently possible values are: + * + * * `'aix'` + * * `'darwin'` + * * `'freebsd'` + * * `'linux'` + * * `'openbsd'` + * * `'sunos'` + * * `'win32'` + * + * ```js + * import { platform } from 'node:process'; + * + * console.log(`This platform is ${platform}`); + * ``` + * + * The value `'android'` may also be returned if the Node.js is built on the + * Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). + * @since v0.1.16 + */ + readonly platform: Platform; + /** + * The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at + * runtime, `require.main` may still refer to the original main module in + * modules that were required before the change occurred. Generally, it's + * safe to assume that the two refer to the same module. + * + * As with `require.main`, `process.mainModule` will be `undefined` if there + * is no entry script. + * @since v0.1.17 + * @deprecated Since v14.0.0 - Use `main` instead. + */ + mainModule?: Module | undefined; + memoryUsage: MemoryUsageFn; + /** + * Gets the amount of memory available to the process (in bytes) based on + * limits imposed by the OS. If there is no such constraint, or the constraint + * is unknown, `undefined` is returned. + * + * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more + * information. + * @since v19.6.0, v18.15.0 + * @experimental + */ + constrainedMemory(): number | undefined; + /** + * The `process.cpuUsage()` method returns the user and system CPU time usage of + * the current process, in an object with properties `user` and `system`, whose + * values are microsecond values (millionth of a second). These values measure time + * spent in user and system code respectively, and may end up being greater than + * actual elapsed time if multiple CPU cores are performing work for this process. + * + * The result of a previous call to `process.cpuUsage()` can be passed as the + * argument to the function, to get a diff reading. + * + * ```js + * import { cpuUsage } from 'node:process'; + * + * const startUsage = cpuUsage(); + * // { user: 38579, system: 6986 } + * + * // spin the CPU for 500 milliseconds + * const now = Date.now(); + * while (Date.now() - now < 500); + * + * console.log(cpuUsage(startUsage)); + * // { user: 514883, system: 11226 } + * ``` + * @since v6.1.0 + * @param previousValue A previous return value from calling `process.cpuUsage()` + */ + cpuUsage(previousValue?: CpuUsage): CpuUsage; + /** + * `process.nextTick()` adds `callback` to the "next tick queue". This queue is + * fully drained after the current operation on the JavaScript stack runs to + * completion and before the event loop is allowed to continue. It's possible to + * create an infinite loop if one were to recursively call `process.nextTick()`. + * See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background. + * + * ```js + * import { nextTick } from 'node:process'; + * + * console.log('start'); + * nextTick(() => { + * console.log('nextTick callback'); + * }); + * console.log('scheduled'); + * // Output: + * // start + * // scheduled + * // nextTick callback + * ``` + * + * This is important when developing APIs in order to give users the opportunity + * to assign event handlers _after_ an object has been constructed but before any + * I/O has occurred: + * + * ```js + * import { nextTick } from 'node:process'; + * + * function MyThing(options) { + * this.setupOptions(options); + * + * nextTick(() => { + * this.startDoingStuff(); + * }); + * } + * + * const thing = new MyThing(); + * thing.getReadyForStuff(); + * + * // thing.startDoingStuff() gets called now, not before. + * ``` + * + * It is very important for APIs to be either 100% synchronous or 100% + * asynchronous. Consider this example: + * + * ```js + * // WARNING! DO NOT USE! BAD UNSAFE HAZARD! + * function maybeSync(arg, cb) { + * if (arg) { + * cb(); + * return; + * } + * + * fs.stat('file', cb); + * } + * ``` + * + * This API is hazardous because in the following case: + * + * ```js + * const maybeTrue = Math.random() > 0.5; + * + * maybeSync(maybeTrue, () => { + * foo(); + * }); + * + * bar(); + * ``` + * + * It is not clear whether `foo()` or `bar()` will be called first. + * + * The following approach is much better: + * + * ```js + * import { nextTick } from 'node:process'; + * + * function definitelyAsync(arg, cb) { + * if (arg) { + * nextTick(cb); + * return; + * } + * + * fs.stat('file', cb); + * } + * ``` + * @since v0.1.26 + * @param args Additional arguments to pass when invoking the `callback` + */ + nextTick(callback: Function, ...args: any[]): void; + /** + * The `process.release` property returns an `Object` containing metadata related + * to the current release, including URLs for the source tarball and headers-only + * tarball. + * + * `process.release` contains the following properties: + * + * ```js + * { + * name: 'node', + * lts: 'Hydrogen', + * sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz', + * headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz', + * libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib' + * } + * ``` + * + * In custom builds from non-release versions of the source tree, only the`name` property may be present. The additional properties should not be + * relied upon to exist. + * @since v3.0.0 + */ + readonly release: ProcessRelease; + features: { + inspector: boolean; + debug: boolean; + uv: boolean; + ipv6: boolean; + tls_alpn: boolean; + tls_sni: boolean; + tls_ocsp: boolean; + tls: boolean; + }; + /** + * `process.umask()` returns the Node.js process's file mode creation mask. Child + * processes inherit the mask from the parent process. + * @since v0.1.19 + * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential * + * security vulnerability. There is no safe, cross-platform alternative API. + */ + umask(): number; + /** + * Can only be set if not in worker thread. + */ + umask(mask: string | number): number; + /** + * The `process.uptime()` method returns the number of seconds the current Node.js + * process has been running. + * + * The return value includes fractions of a second. Use `Math.floor()` to get whole + * seconds. + * @since v0.5.0 + */ + uptime(): number; + hrtime: HRTime; + /** + * If Node.js is spawned with an IPC channel, the `process.send()` method can be + * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object. + * + * If Node.js was not spawned with an IPC channel, `process.send` will be`undefined`. + * + * The message goes through serialization and parsing. The resulting message might + * not be the same as what is originally sent. + * @since v0.5.9 + * @param options used to parameterize the sending of certain types of handles.`options` supports the following properties: + */ + send?( + message: any, + sendHandle?: any, + options?: { + swallowErrors?: boolean | undefined; + }, + callback?: (error: Error | null) => void + ): boolean; + /** + * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the + * IPC channel to the parent process, allowing the child process to exit gracefully + * once there are no other connections keeping it alive. + * + * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process. + * + * If the Node.js process was not spawned with an IPC channel,`process.disconnect()` will be `undefined`. + * @since v0.7.2 + */ + disconnect(): void; + /** + * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return`true` so long as the IPC + * channel is connected and will return `false` after`process.disconnect()` is called. + * + * Once `process.connected` is `false`, it is no longer possible to send messages + * over the IPC channel using `process.send()`. + * @since v0.7.2 + */ + connected: boolean; + /** + * The `process.allowedNodeEnvironmentFlags` property is a special, + * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable. + * + * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides`Set.prototype.has` to recognize several different possible flag + * representations. `process.allowedNodeEnvironmentFlags.has()` will + * return `true` in the following cases: + * + * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g.,`inspect-brk` for `--inspect-brk`, or `r` for `-r`. + * * Flags passed through to V8 (as listed in `--v8-options`) may replace + * one or more _non-leading_ dashes for an underscore, or vice-versa; + * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`, + * etc. + * * Flags may contain one or more equals (`=`) characters; all + * characters after and including the first equals will be ignored; + * e.g., `--stack-trace-limit=100`. + * * Flags _must_ be allowable within `NODE_OPTIONS`. + * + * When iterating over `process.allowedNodeEnvironmentFlags`, flags will + * appear only _once_; each will begin with one or more dashes. Flags + * passed through to V8 will contain underscores instead of non-leading + * dashes: + * + * ```js + * import { allowedNodeEnvironmentFlags } from 'node:process'; + * + * allowedNodeEnvironmentFlags.forEach((flag) => { + * // -r + * // --inspect-brk + * // --abort_on_uncaught_exception + * // ... + * }); + * ``` + * + * The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail + * silently. + * + * If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will + * contain what _would have_ been allowable. + * @since v10.10.0 + */ + allowedNodeEnvironmentFlags: ReadonlySet; + /** + * `process.report` is an object whose methods are used to generate diagnostic + * reports for the current process. Additional documentation is available in the `report documentation`. + * @since v11.8.0 + */ + report?: ProcessReport | undefined; + /** + * ```js + * import { resourceUsage } from 'node:process'; + * + * console.log(resourceUsage()); + * /* + * Will output: + * { + * userCPUTime: 82872, + * systemCPUTime: 4143, + * maxRSS: 33164, + * sharedMemorySize: 0, + * unsharedDataSize: 0, + * unsharedStackSize: 0, + * minorPageFault: 2469, + * majorPageFault: 0, + * swappedOut: 0, + * fsRead: 0, + * fsWrite: 8, + * ipcSent: 0, + * ipcReceived: 0, + * signalsCount: 0, + * voluntaryContextSwitches: 79, + * involuntaryContextSwitches: 1 + * } + * + * ``` + * @since v12.6.0 + * @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t]. + */ + resourceUsage(): ResourceUsage; + /** + * The `process.traceDeprecation` property indicates whether the`--trace-deprecation` flag is set on the current Node.js process. See the + * documentation for the `'warning' event` and the `emitWarning() method` for more information about this + * flag's behavior. + * @since v0.8.0 + */ + traceDeprecation: boolean; + /* EventEmitter */ + addListener(event: 'beforeExit', listener: BeforeExitListener): this; + addListener(event: 'disconnect', listener: DisconnectListener): this; + addListener(event: 'exit', listener: ExitListener): this; + addListener(event: 'rejectionHandled', listener: RejectionHandledListener): this; + addListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + addListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + addListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + addListener(event: 'warning', listener: WarningListener): this; + addListener(event: 'message', listener: MessageListener): this; + addListener(event: Signals, listener: SignalsListener): this; + addListener(event: 'multipleResolves', listener: MultipleResolveListener): this; + addListener(event: 'worker', listener: WorkerListener): this; + emit(event: 'beforeExit', code: number): boolean; + emit(event: 'disconnect'): boolean; + emit(event: 'exit', code: number): boolean; + emit(event: 'rejectionHandled', promise: Promise): boolean; + emit(event: 'uncaughtException', error: Error): boolean; + emit(event: 'uncaughtExceptionMonitor', error: Error): boolean; + emit(event: 'unhandledRejection', reason: unknown, promise: Promise): boolean; + emit(event: 'warning', warning: Error): boolean; + emit(event: 'message', message: unknown, sendHandle: unknown): this; + emit(event: Signals, signal?: Signals): boolean; + emit(event: 'multipleResolves', type: MultipleResolveType, promise: Promise, value: unknown): this; + emit(event: 'worker', listener: WorkerListener): this; + on(event: 'beforeExit', listener: BeforeExitListener): this; + on(event: 'disconnect', listener: DisconnectListener): this; + on(event: 'exit', listener: ExitListener): this; + on(event: 'rejectionHandled', listener: RejectionHandledListener): this; + on(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + on(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + on(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + on(event: 'warning', listener: WarningListener): this; + on(event: 'message', listener: MessageListener): this; + on(event: Signals, listener: SignalsListener): this; + on(event: 'multipleResolves', listener: MultipleResolveListener): this; + on(event: 'worker', listener: WorkerListener): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'beforeExit', listener: BeforeExitListener): this; + once(event: 'disconnect', listener: DisconnectListener): this; + once(event: 'exit', listener: ExitListener): this; + once(event: 'rejectionHandled', listener: RejectionHandledListener): this; + once(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + once(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + once(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + once(event: 'warning', listener: WarningListener): this; + once(event: 'message', listener: MessageListener): this; + once(event: Signals, listener: SignalsListener): this; + once(event: 'multipleResolves', listener: MultipleResolveListener): this; + once(event: 'worker', listener: WorkerListener): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'beforeExit', listener: BeforeExitListener): this; + prependListener(event: 'disconnect', listener: DisconnectListener): this; + prependListener(event: 'exit', listener: ExitListener): this; + prependListener(event: 'rejectionHandled', listener: RejectionHandledListener): this; + prependListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + prependListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + prependListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + prependListener(event: 'warning', listener: WarningListener): this; + prependListener(event: 'message', listener: MessageListener): this; + prependListener(event: Signals, listener: SignalsListener): this; + prependListener(event: 'multipleResolves', listener: MultipleResolveListener): this; + prependListener(event: 'worker', listener: WorkerListener): this; + prependOnceListener(event: 'beforeExit', listener: BeforeExitListener): this; + prependOnceListener(event: 'disconnect', listener: DisconnectListener): this; + prependOnceListener(event: 'exit', listener: ExitListener): this; + prependOnceListener(event: 'rejectionHandled', listener: RejectionHandledListener): this; + prependOnceListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + prependOnceListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + prependOnceListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + prependOnceListener(event: 'warning', listener: WarningListener): this; + prependOnceListener(event: 'message', listener: MessageListener): this; + prependOnceListener(event: Signals, listener: SignalsListener): this; + prependOnceListener(event: 'multipleResolves', listener: MultipleResolveListener): this; + prependOnceListener(event: 'worker', listener: WorkerListener): this; + listeners(event: 'beforeExit'): BeforeExitListener[]; + listeners(event: 'disconnect'): DisconnectListener[]; + listeners(event: 'exit'): ExitListener[]; + listeners(event: 'rejectionHandled'): RejectionHandledListener[]; + listeners(event: 'uncaughtException'): UncaughtExceptionListener[]; + listeners(event: 'uncaughtExceptionMonitor'): UncaughtExceptionListener[]; + listeners(event: 'unhandledRejection'): UnhandledRejectionListener[]; + listeners(event: 'warning'): WarningListener[]; + listeners(event: 'message'): MessageListener[]; + listeners(event: Signals): SignalsListener[]; + listeners(event: 'multipleResolves'): MultipleResolveListener[]; + listeners(event: 'worker'): WorkerListener[]; + } + } + } + export = process; +} +declare module 'node:process' { + import process = require('process'); + export = process; +} diff --git a/node_modules/@types/node/punycode.d.ts b/node_modules/@types/node/punycode.d.ts new file mode 100755 index 0000000..8927207 --- /dev/null +++ b/node_modules/@types/node/punycode.d.ts @@ -0,0 +1,117 @@ +/** + * **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users + * currently depending on the `punycode` module should switch to using the + * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL + * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`. + * + * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It + * can be accessed using: + * + * ```js + * const punycode = require('punycode'); + * ``` + * + * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is + * primarily intended for use in Internationalized Domain Names. Because host + * names in URLs are limited to ASCII characters only, Domain Names that contain + * non-ASCII characters must be converted into ASCII using the Punycode scheme. + * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent + * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`. + * + * The `punycode` module provides a simple implementation of the Punycode standard. + * + * The `punycode` module is a third-party dependency used by Node.js and + * made available to developers as a convenience. Fixes or other modifications to + * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project. + * @deprecated Since v7.0.0 - Deprecated + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/punycode.js) + */ +declare module 'punycode' { + /** + * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only + * characters to the equivalent string of Unicode codepoints. + * + * ```js + * punycode.decode('maana-pta'); // 'mañana' + * punycode.decode('--dqo34k'); // '☃-⌘' + * ``` + * @since v0.5.1 + */ + function decode(string: string): string; + /** + * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters. + * + * ```js + * punycode.encode('mañana'); // 'maana-pta' + * punycode.encode('☃-⌘'); // '--dqo34k' + * ``` + * @since v0.5.1 + */ + function encode(string: string): string; + /** + * The `punycode.toUnicode()` method converts a string representing a domain name + * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be + * converted. + * + * ```js + * // decode domain names + * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com' + * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com' + * punycode.toUnicode('example.com'); // 'example.com' + * ``` + * @since v0.6.1 + */ + function toUnicode(domain: string): string; + /** + * The `punycode.toASCII()` method converts a Unicode string representing an + * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the + * domain name will be converted. Calling `punycode.toASCII()` on a string that + * already only contains ASCII characters will have no effect. + * + * ```js + * // encode domain names + * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com' + * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com' + * punycode.toASCII('example.com'); // 'example.com' + * ``` + * @since v0.6.1 + */ + function toASCII(domain: string): string; + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + const ucs2: ucs2; + interface ucs2 { + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + decode(string: string): number[]; + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + encode(codePoints: ReadonlyArray): string; + } + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + const version: string; +} +declare module 'node:punycode' { + export * from 'punycode'; +} diff --git a/node_modules/@types/node/querystring.d.ts b/node_modules/@types/node/querystring.d.ts new file mode 100755 index 0000000..e9d087c --- /dev/null +++ b/node_modules/@types/node/querystring.d.ts @@ -0,0 +1,131 @@ +/** + * The `node:querystring` module provides utilities for parsing and formatting URL + * query strings. It can be accessed using: + * + * ```js + * const querystring = require('node:querystring'); + * ``` + * + * `querystring` is more performant than `URLSearchParams` but is not a + * standardized API. Use `URLSearchParams` when performance is not critical or + * when compatibility with browser code is desirable. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/querystring.js) + */ +declare module 'querystring' { + interface StringifyOptions { + encodeURIComponent?: ((str: string) => string) | undefined; + } + interface ParseOptions { + maxKeys?: number | undefined; + decodeURIComponent?: ((str: string) => string) | undefined; + } + interface ParsedUrlQuery extends NodeJS.Dict {} + interface ParsedUrlQueryInput extends NodeJS.Dict | ReadonlyArray | ReadonlyArray | null> {} + /** + * The `querystring.stringify()` method produces a URL query string from a + * given `obj` by iterating through the object's "own properties". + * + * It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | + * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | + * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | + * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | + * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | + * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | + * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to + * empty strings. + * + * ```js + * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); + * // Returns 'foo=bar&baz=qux&baz=quux&corge=' + * + * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); + * // Returns 'foo:bar;baz:qux' + * ``` + * + * By default, characters requiring percent-encoding within the query string will + * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified: + * + * ```js + * // Assuming gbkEncodeURIComponent function already exists, + * + * querystring.stringify({ w: '中文', foo: 'bar' }, null, null, + * { encodeURIComponent: gbkEncodeURIComponent }); + * ``` + * @since v0.1.25 + * @param obj The object to serialize into a URL query string + * @param [sep='&'] The substring used to delimit key and value pairs in the query string. + * @param [eq='='] . The substring used to delimit keys and values in the query string. + */ + function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; + /** + * The `querystring.parse()` method parses a URL query string (`str`) into a + * collection of key and value pairs. + * + * For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into: + * + * ```js + * { + * foo: 'bar', + * abc: ['xyz', '123'] + * } + * ``` + * + * The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`, + * `obj.hasOwnProperty()`, and others + * are not defined and _will not work_. + * + * By default, percent-encoded characters within the query string will be assumed + * to use UTF-8 encoding. If an alternative character encoding is used, then an + * alternative `decodeURIComponent` option will need to be specified: + * + * ```js + * // Assuming gbkDecodeURIComponent function already exists... + * + * querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null, + * { decodeURIComponent: gbkDecodeURIComponent }); + * ``` + * @since v0.1.25 + * @param str The URL query string to parse + * @param [sep='&'] The substring used to delimit key and value pairs in the query string. + * @param [eq='='] . The substring used to delimit keys and values in the query string. + */ + function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; + /** + * The querystring.encode() function is an alias for querystring.stringify(). + */ + const encode: typeof stringify; + /** + * The querystring.decode() function is an alias for querystring.parse(). + */ + const decode: typeof parse; + /** + * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL + * query strings. + * + * The `querystring.escape()` method is used by `querystring.stringify()` and is + * generally not expected to be used directly. It is exported primarily to allow + * application code to provide a replacement percent-encoding implementation if + * necessary by assigning `querystring.escape` to an alternative function. + * @since v0.1.25 + */ + function escape(str: string): string; + /** + * The `querystring.unescape()` method performs decoding of URL percent-encoded + * characters on the given `str`. + * + * The `querystring.unescape()` method is used by `querystring.parse()` and is + * generally not expected to be used directly. It is exported primarily to allow + * application code to provide a replacement decoding implementation if + * necessary by assigning `querystring.unescape` to an alternative function. + * + * By default, the `querystring.unescape()` method will attempt to use the + * JavaScript built-in `decodeURIComponent()` method to decode. If that fails, + * a safer equivalent that does not throw on malformed URLs will be used. + * @since v0.1.25 + */ + function unescape(str: string): string; +} +declare module 'node:querystring' { + export * from 'querystring'; +} diff --git a/node_modules/@types/node/readline.d.ts b/node_modules/@types/node/readline.d.ts new file mode 100755 index 0000000..e6f7b0a --- /dev/null +++ b/node_modules/@types/node/readline.d.ts @@ -0,0 +1,526 @@ +/** + * The `node:readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time. + * + * To use the promise-based APIs: + * + * ```js + * import * as readline from 'node:readline/promises'; + * ``` + * + * To use the callback and sync APIs: + * + * ```js + * import * as readline from 'node:readline'; + * ``` + * + * The following simple example illustrates the basic use of the `node:readline`module. + * + * ```js + * import * as readline from 'node:readline/promises'; + * import { stdin as input, stdout as output } from 'node:process'; + * + * const rl = readline.createInterface({ input, output }); + * + * const answer = await rl.question('What do you think of Node.js? '); + * + * console.log(`Thank you for your valuable feedback: ${answer}`); + * + * rl.close(); + * ``` + * + * Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be + * received on the `input` stream. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js) + */ +declare module 'readline' { + import { Abortable, EventEmitter } from 'node:events'; + import * as promises from 'node:readline/promises'; + export { promises }; + export interface Key { + sequence?: string | undefined; + name?: string | undefined; + ctrl?: boolean | undefined; + meta?: boolean | undefined; + shift?: boolean | undefined; + } + /** + * Instances of the `readline.Interface` class are constructed using the`readline.createInterface()` method. Every instance is associated with a + * single `input` `Readable` stream and a single `output` `Writable` stream. + * The `output` stream is used to print prompts for user input that arrives on, + * and is read from, the `input` stream. + * @since v0.1.104 + */ + export class Interface extends EventEmitter { + readonly terminal: boolean; + /** + * The current input data being processed by node. + * + * This can be used when collecting input from a TTY stream to retrieve the + * current value that has been processed thus far, prior to the `line` event + * being emitted. Once the `line` event has been emitted, this property will + * be an empty string. + * + * Be aware that modifying the value during the instance runtime may have + * unintended consequences if `rl.cursor` is not also controlled. + * + * **If not using a TTY stream for input, use the `'line'` event.** + * + * One possible use case would be as follows: + * + * ```js + * const values = ['lorem ipsum', 'dolor sit amet']; + * const rl = readline.createInterface(process.stdin); + * const showResults = debounce(() => { + * console.log( + * '\n', + * values.filter((val) => val.startsWith(rl.line)).join(' '), + * ); + * }, 300); + * process.stdin.on('keypress', (c, k) => { + * showResults(); + * }); + * ``` + * @since v0.1.98 + */ + readonly line: string; + /** + * The cursor position relative to `rl.line`. + * + * This will track where the current cursor lands in the input string, when + * reading input from a TTY stream. The position of cursor determines the + * portion of the input string that will be modified as input is processed, + * as well as the column where the terminal caret will be rendered. + * @since v0.1.98 + */ + readonly cursor: number; + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor + */ + protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean); + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor + */ + protected constructor(options: ReadLineOptions); + /** + * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`. + * @since v15.3.0, v14.17.0 + * @return the current prompt string + */ + getPrompt(): string; + /** + * The `rl.setPrompt()` method sets the prompt that will be written to `output`whenever `rl.prompt()` is called. + * @since v0.1.98 + */ + setPrompt(prompt: string): void; + /** + * The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new + * location at which to provide input. + * + * When called, `rl.prompt()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written. + * @since v0.1.98 + * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`. + */ + prompt(preserveCursor?: boolean): void; + /** + * The `rl.question()` method displays the `query` by writing it to the `output`, + * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument. + * + * When called, `rl.question()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written. + * + * The `callback` function passed to `rl.question()` does not follow the typical + * pattern of accepting an `Error` object or `null` as the first argument. + * The `callback` is called with the provided answer as the only argument. + * + * An error will be thrown if calling `rl.question()` after `rl.close()`. + * + * Example usage: + * + * ```js + * rl.question('What is your favorite food? ', (answer) => { + * console.log(`Oh, so your favorite food is ${answer}`); + * }); + * ``` + * + * Using an `AbortController` to cancel a question. + * + * ```js + * const ac = new AbortController(); + * const signal = ac.signal; + * + * rl.question('What is your favorite food? ', { signal }, (answer) => { + * console.log(`Oh, so your favorite food is ${answer}`); + * }); + * + * signal.addEventListener('abort', () => { + * console.log('The food question timed out'); + * }, { once: true }); + * + * setTimeout(() => ac.abort(), 10000); + * ``` + * @since v0.3.3 + * @param query A statement or query to write to `output`, prepended to the prompt. + * @param callback A callback function that is invoked with the user's input in response to the `query`. + */ + question(query: string, callback: (answer: string) => void): void; + question(query: string, options: Abortable, callback: (answer: string) => void): void; + /** + * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed + * later if necessary. + * + * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance. + * @since v0.3.4 + */ + pause(): this; + /** + * The `rl.resume()` method resumes the `input` stream if it has been paused. + * @since v0.3.4 + */ + resume(): this; + /** + * The `rl.close()` method closes the `Interface` instance and + * relinquishes control over the `input` and `output` streams. When called, + * the `'close'` event will be emitted. + * + * Calling `rl.close()` does not immediately stop other events (including `'line'`) + * from being emitted by the `Interface` instance. + * @since v0.1.98 + */ + close(): void; + /** + * The `rl.write()` method will write either `data` or a key sequence identified + * by `key` to the `output`. The `key` argument is supported only if `output` is + * a `TTY` text terminal. See `TTY keybindings` for a list of key + * combinations. + * + * If `key` is specified, `data` is ignored. + * + * When called, `rl.write()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written. + * + * ```js + * rl.write('Delete this!'); + * // Simulate Ctrl+U to delete the line written previously + * rl.write(null, { ctrl: true, name: 'u' }); + * ``` + * + * The `rl.write()` method will write the data to the `readline` `Interface`'s`input`_as if it were provided by the user_. + * @since v0.1.98 + */ + write(data: string | Buffer, key?: Key): void; + write(data: undefined | null | string | Buffer, key: Key): void; + /** + * Returns the real position of the cursor in relation to the input + * prompt + string. Long input (wrapping) strings, as well as multiple + * line prompts are included in the calculations. + * @since v13.5.0, v12.16.0 + */ + getCursorPos(): CursorPos; + /** + * events.EventEmitter + * 1. close + * 2. line + * 3. pause + * 4. resume + * 5. SIGCONT + * 6. SIGINT + * 7. SIGTSTP + * 8. history + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'line', listener: (input: string) => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: 'SIGCONT', listener: () => void): this; + addListener(event: 'SIGINT', listener: () => void): this; + addListener(event: 'SIGTSTP', listener: () => void): this; + addListener(event: 'history', listener: (history: string[]) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'line', input: string): boolean; + emit(event: 'pause'): boolean; + emit(event: 'resume'): boolean; + emit(event: 'SIGCONT'): boolean; + emit(event: 'SIGINT'): boolean; + emit(event: 'SIGTSTP'): boolean; + emit(event: 'history', history: string[]): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'line', listener: (input: string) => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: 'SIGCONT', listener: () => void): this; + on(event: 'SIGINT', listener: () => void): this; + on(event: 'SIGTSTP', listener: () => void): this; + on(event: 'history', listener: (history: string[]) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'line', listener: (input: string) => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: 'SIGCONT', listener: () => void): this; + once(event: 'SIGINT', listener: () => void): this; + once(event: 'SIGTSTP', listener: () => void): this; + once(event: 'history', listener: (history: string[]) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'line', listener: (input: string) => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: 'SIGCONT', listener: () => void): this; + prependListener(event: 'SIGINT', listener: () => void): this; + prependListener(event: 'SIGTSTP', listener: () => void): this; + prependListener(event: 'history', listener: (history: string[]) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'line', listener: (input: string) => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: 'SIGCONT', listener: () => void): this; + prependOnceListener(event: 'SIGINT', listener: () => void): this; + prependOnceListener(event: 'SIGTSTP', listener: () => void): this; + prependOnceListener(event: 'history', listener: (history: string[]) => void): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + export type ReadLine = Interface; // type forwarded for backwards compatibility + export type Completer = (line: string) => CompleterResult; + export type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void; + export type CompleterResult = [string[], string]; + export interface ReadLineOptions { + input: NodeJS.ReadableStream; + output?: NodeJS.WritableStream | undefined; + completer?: Completer | AsyncCompleter | undefined; + terminal?: boolean | undefined; + /** + * Initial list of history lines. This option makes sense + * only if `terminal` is set to `true` by the user or by an internal `output` + * check, otherwise the history caching mechanism is not initialized at all. + * @default [] + */ + history?: string[] | undefined; + historySize?: number | undefined; + prompt?: string | undefined; + crlfDelay?: number | undefined; + /** + * If `true`, when a new input line added + * to the history list duplicates an older one, this removes the older line + * from the list. + * @default false + */ + removeHistoryDuplicates?: boolean | undefined; + escapeCodeTimeout?: number | undefined; + tabSize?: number | undefined; + } + /** + * The `readline.createInterface()` method creates a new `readline.Interface`instance. + * + * ```js + * const readline = require('node:readline'); + * const rl = readline.createInterface({ + * input: process.stdin, + * output: process.stdout, + * }); + * ``` + * + * Once the `readline.Interface` instance is created, the most common case is to + * listen for the `'line'` event: + * + * ```js + * rl.on('line', (line) => { + * console.log(`Received: ${line}`); + * }); + * ``` + * + * If `terminal` is `true` for this instance then the `output` stream will get + * the best compatibility if it defines an `output.columns` property and emits + * a `'resize'` event on the `output` if or when the columns ever change + * (`process.stdout` does this automatically when it is a TTY). + * + * When creating a `readline.Interface` using `stdin` as input, the program + * will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without + * waiting for user input, call `process.stdin.unref()`. + * @since v0.1.98 + */ + export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; + export function createInterface(options: ReadLineOptions): Interface; + /** + * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input. + * + * Optionally, `interface` specifies a `readline.Interface` instance for which + * autocompletion is disabled when copy-pasted input is detected. + * + * If the `stream` is a `TTY`, then it must be in raw mode. + * + * This is automatically called by any readline instance on its `input` if the`input` is a terminal. Closing the `readline` instance does not stop + * the `input` from emitting `'keypress'` events. + * + * ```js + * readline.emitKeypressEvents(process.stdin); + * if (process.stdin.isTTY) + * process.stdin.setRawMode(true); + * ``` + * + * ## Example: Tiny CLI + * + * The following example illustrates the use of `readline.Interface` class to + * implement a small command-line interface: + * + * ```js + * const readline = require('node:readline'); + * const rl = readline.createInterface({ + * input: process.stdin, + * output: process.stdout, + * prompt: 'OHAI> ', + * }); + * + * rl.prompt(); + * + * rl.on('line', (line) => { + * switch (line.trim()) { + * case 'hello': + * console.log('world!'); + * break; + * default: + * console.log(`Say what? I might have heard '${line.trim()}'`); + * break; + * } + * rl.prompt(); + * }).on('close', () => { + * console.log('Have a great day!'); + * process.exit(0); + * }); + * ``` + * + * ## Example: Read file stream line-by-Line + * + * A common use case for `readline` is to consume an input file one line at a + * time. The easiest way to do so is leveraging the `fs.ReadStream` API as + * well as a `for await...of` loop: + * + * ```js + * const fs = require('node:fs'); + * const readline = require('node:readline'); + * + * async function processLineByLine() { + * const fileStream = fs.createReadStream('input.txt'); + * + * const rl = readline.createInterface({ + * input: fileStream, + * crlfDelay: Infinity, + * }); + * // Note: we use the crlfDelay option to recognize all instances of CR LF + * // ('\r\n') in input.txt as a single line break. + * + * for await (const line of rl) { + * // Each line in input.txt will be successively available here as `line`. + * console.log(`Line from file: ${line}`); + * } + * } + * + * processLineByLine(); + * ``` + * + * Alternatively, one could use the `'line'` event: + * + * ```js + * const fs = require('node:fs'); + * const readline = require('node:readline'); + * + * const rl = readline.createInterface({ + * input: fs.createReadStream('sample.txt'), + * crlfDelay: Infinity, + * }); + * + * rl.on('line', (line) => { + * console.log(`Line from file: ${line}`); + * }); + * ``` + * + * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied: + * + * ```js + * const { once } = require('node:events'); + * const { createReadStream } = require('node:fs'); + * const { createInterface } = require('node:readline'); + * + * (async function processLineByLine() { + * try { + * const rl = createInterface({ + * input: createReadStream('big-file.txt'), + * crlfDelay: Infinity, + * }); + * + * rl.on('line', (line) => { + * // Process the line. + * }); + * + * await once(rl, 'close'); + * + * console.log('File processed.'); + * } catch (err) { + * console.error(err); + * } + * })(); + * ``` + * @since v0.7.7 + */ + export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; + export type Direction = -1 | 0 | 1; + export interface CursorPos { + rows: number; + cols: number; + } + /** + * The `readline.clearLine()` method clears current line of given `TTY` stream + * in a specified direction identified by `dir`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; + /** + * The `readline.clearScreenDown()` method clears the given `TTY` stream from + * the current position of the cursor down. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; + /** + * The `readline.cursorTo()` method moves cursor to the specified position in a + * given `TTY` `stream`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; + /** + * The `readline.moveCursor()` method moves the cursor _relative_ to its current + * position in a given `TTY` `stream`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; +} +declare module 'node:readline' { + export * from 'readline'; +} diff --git a/node_modules/@types/node/readline/promises.d.ts b/node_modules/@types/node/readline/promises.d.ts new file mode 100755 index 0000000..079fbdf --- /dev/null +++ b/node_modules/@types/node/readline/promises.d.ts @@ -0,0 +1,145 @@ +/** + * @since v17.0.0 + * @experimental + */ +declare module 'readline/promises' { + import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline'; + import { Abortable } from 'node:events'; + /** + * Instances of the `readlinePromises.Interface` class are constructed using the`readlinePromises.createInterface()` method. Every instance is associated with a + * single `input` `Readable` stream and a single `output` `Writable` stream. + * The `output` stream is used to print prompts for user input that arrives on, + * and is read from, the `input` stream. + * @since v17.0.0 + */ + class Interface extends _Interface { + /** + * The `rl.question()` method displays the `query` by writing it to the `output`, + * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument. + * + * When called, `rl.question()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written. + * + * If the question is called after `rl.close()`, it returns a rejected promise. + * + * Example usage: + * + * ```js + * const answer = await rl.question('What is your favorite food? '); + * console.log(`Oh, so your favorite food is ${answer}`); + * ``` + * + * Using an `AbortSignal` to cancel a question. + * + * ```js + * const signal = AbortSignal.timeout(10_000); + * + * signal.addEventListener('abort', () => { + * console.log('The food question timed out'); + * }, { once: true }); + * + * const answer = await rl.question('What is your favorite food? ', { signal }); + * console.log(`Oh, so your favorite food is ${answer}`); + * ``` + * @since v17.0.0 + * @param query A statement or query to write to `output`, prepended to the prompt. + * @return A promise that is fulfilled with the user's input in response to the `query`. + */ + question(query: string): Promise; + question(query: string, options: Abortable): Promise; + } + /** + * @since v17.0.0 + */ + class Readline { + /** + * @param stream A TTY stream. + */ + constructor( + stream: NodeJS.WritableStream, + options?: { + autoCommit?: boolean; + } + ); + /** + * The `rl.clearLine()` method adds to the internal list of pending action an + * action that clears current line of the associated `stream` in a specified + * direction identified by `dir`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. + * @since v17.0.0 + * @return this + */ + clearLine(dir: Direction): this; + /** + * The `rl.clearScreenDown()` method adds to the internal list of pending action an + * action that clears the associated stream from the current position of the + * cursor down. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. + * @since v17.0.0 + * @return this + */ + clearScreenDown(): this; + /** + * The `rl.commit()` method sends all the pending actions to the associated`stream` and clears the internal list of pending actions. + * @since v17.0.0 + */ + commit(): Promise; + /** + * The `rl.cursorTo()` method adds to the internal list of pending action an action + * that moves cursor to the specified position in the associated `stream`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. + * @since v17.0.0 + * @return this + */ + cursorTo(x: number, y?: number): this; + /** + * The `rl.moveCursor()` method adds to the internal list of pending action an + * action that moves the cursor _relative_ to its current position in the + * associated `stream`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. + * @since v17.0.0 + * @return this + */ + moveCursor(dx: number, dy: number): this; + /** + * The `rl.rollback` methods clears the internal list of pending actions without + * sending it to the associated `stream`. + * @since v17.0.0 + * @return this + */ + rollback(): this; + } + /** + * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface`instance. + * + * ```js + * const readlinePromises = require('node:readline/promises'); + * const rl = readlinePromises.createInterface({ + * input: process.stdin, + * output: process.stdout, + * }); + * ``` + * + * Once the `readlinePromises.Interface` instance is created, the most common case + * is to listen for the `'line'` event: + * + * ```js + * rl.on('line', (line) => { + * console.log(`Received: ${line}`); + * }); + * ``` + * + * If `terminal` is `true` for this instance then the `output` stream will get + * the best compatibility if it defines an `output.columns` property and emits + * a `'resize'` event on the `output` if or when the columns ever change + * (`process.stdout` does this automatically when it is a TTY). + * @since v17.0.0 + */ + function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; + function createInterface(options: ReadLineOptions): Interface; +} +declare module 'node:readline/promises' { + export * from 'readline/promises'; +} diff --git a/node_modules/@types/node/repl.d.ts b/node_modules/@types/node/repl.d.ts new file mode 100755 index 0000000..c8147ed --- /dev/null +++ b/node_modules/@types/node/repl.d.ts @@ -0,0 +1,424 @@ +/** + * The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation + * that is available both as a standalone program or includible in other + * applications. It can be accessed using: + * + * ```js + * const repl = require('node:repl'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/repl.js) + */ +declare module 'repl' { + import { Interface, Completer, AsyncCompleter } from 'node:readline'; + import { Context } from 'node:vm'; + import { InspectOptions } from 'node:util'; + interface ReplOptions { + /** + * The input prompt to display. + * @default "> " + */ + prompt?: string | undefined; + /** + * The `Readable` stream from which REPL input will be read. + * @default process.stdin + */ + input?: NodeJS.ReadableStream | undefined; + /** + * The `Writable` stream to which REPL output will be written. + * @default process.stdout + */ + output?: NodeJS.WritableStream | undefined; + /** + * If `true`, specifies that the output should be treated as a TTY terminal, and have + * ANSI/VT100 escape codes written to it. + * Default: checking the value of the `isTTY` property on the output stream upon + * instantiation. + */ + terminal?: boolean | undefined; + /** + * The function to be used when evaluating each given line of input. + * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can + * error with `repl.Recoverable` to indicate the input was incomplete and prompt for + * additional lines. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_default_evaluation + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_custom_evaluation_functions + */ + eval?: REPLEval | undefined; + /** + * Defines if the repl prints output previews or not. + * @default `true` Always `false` in case `terminal` is falsy. + */ + preview?: boolean | undefined; + /** + * If `true`, specifies that the default `writer` function should include ANSI color + * styling to REPL output. If a custom `writer` function is provided then this has no + * effect. + * Default: the REPL instance's `terminal` value. + */ + useColors?: boolean | undefined; + /** + * If `true`, specifies that the default evaluation function will use the JavaScript + * `global` as the context as opposed to creating a new separate context for the REPL + * instance. The node CLI REPL sets this value to `true`. + * Default: `false`. + */ + useGlobal?: boolean | undefined; + /** + * If `true`, specifies that the default writer will not output the return value of a + * command if it evaluates to `undefined`. + * Default: `false`. + */ + ignoreUndefined?: boolean | undefined; + /** + * The function to invoke to format the output of each command before writing to `output`. + * Default: a wrapper for `util.inspect`. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output + */ + writer?: REPLWriter | undefined; + /** + * An optional function used for custom Tab auto completion. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function + */ + completer?: Completer | AsyncCompleter | undefined; + /** + * A flag that specifies whether the default evaluator executes all JavaScript commands in + * strict mode or default (sloppy) mode. + * Accepted values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined; + /** + * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is + * pressed. This cannot be used together with a custom `eval` function. + * Default: `false`. + */ + breakEvalOnSigint?: boolean | undefined; + } + type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void; + type REPLWriter = (this: REPLServer, obj: any) => string; + /** + * This is the default "writer" value, if none is passed in the REPL options, + * and it can be overridden by custom print functions. + */ + const writer: REPLWriter & { + options: InspectOptions; + }; + type REPLCommandAction = (this: REPLServer, text: string) => void; + interface REPLCommand { + /** + * Help text to be displayed when `.help` is entered. + */ + help?: string | undefined; + /** + * The function to execute, optionally accepting a single string argument. + */ + action: REPLCommandAction; + } + /** + * Instances of `repl.REPLServer` are created using the {@link start} method + * or directly using the JavaScript `new` keyword. + * + * ```js + * const repl = require('node:repl'); + * + * const options = { useColors: true }; + * + * const firstInstance = repl.start(options); + * const secondInstance = new repl.REPLServer(options); + * ``` + * @since v0.1.91 + */ + class REPLServer extends Interface { + /** + * The `vm.Context` provided to the `eval` function to be used for JavaScript + * evaluation. + */ + readonly context: Context; + /** + * @deprecated since v14.3.0 - Use `input` instead. + */ + readonly inputStream: NodeJS.ReadableStream; + /** + * @deprecated since v14.3.0 - Use `output` instead. + */ + readonly outputStream: NodeJS.WritableStream; + /** + * The `Readable` stream from which REPL input will be read. + */ + readonly input: NodeJS.ReadableStream; + /** + * The `Writable` stream to which REPL output will be written. + */ + readonly output: NodeJS.WritableStream; + /** + * The commands registered via `replServer.defineCommand()`. + */ + readonly commands: NodeJS.ReadOnlyDict; + /** + * A value indicating whether the REPL is currently in "editor mode". + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys + */ + readonly editorMode: boolean; + /** + * A value indicating whether the `_` variable has been assigned. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreAssigned: boolean; + /** + * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly last: any; + /** + * A value indicating whether the `_error` variable has been assigned. + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreErrAssigned: boolean; + /** + * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly lastError: any; + /** + * Specified in the REPL options, this is the function to be used when evaluating each + * given line of input. If not specified in the REPL options, this is an async wrapper + * for the JavaScript `eval()` function. + */ + readonly eval: REPLEval; + /** + * Specified in the REPL options, this is a value indicating whether the default + * `writer` function should include ANSI color styling to REPL output. + */ + readonly useColors: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `eval` + * function will use the JavaScript `global` as the context as opposed to creating a new + * separate context for the REPL instance. + */ + readonly useGlobal: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `writer` + * function should output the result of a command if it evaluates to `undefined`. + */ + readonly ignoreUndefined: boolean; + /** + * Specified in the REPL options, this is the function to invoke to format the output of + * each command before writing to `outputStream`. If not specified in the REPL options, + * this will be a wrapper for `util.inspect`. + */ + readonly writer: REPLWriter; + /** + * Specified in the REPL options, this is the function to use for custom Tab auto-completion. + */ + readonly completer: Completer | AsyncCompleter; + /** + * Specified in the REPL options, this is a flag that specifies whether the default `eval` + * function should execute all JavaScript commands in strict mode or default (sloppy) mode. + * Possible values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; + /** + * NOTE: According to the documentation: + * + * > Instances of `repl.REPLServer` are created using the `repl.start()` method and + * > _should not_ be created directly using the JavaScript `new` keyword. + * + * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver + */ + private constructor(); + /** + * The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands + * to the REPL instance. Such commands are invoked by typing a `.` followed by the`keyword`. The `cmd` is either a `Function` or an `Object` with the following + * properties: + * + * The following example shows two new commands added to the REPL instance: + * + * ```js + * const repl = require('node:repl'); + * + * const replServer = repl.start({ prompt: '> ' }); + * replServer.defineCommand('sayhello', { + * help: 'Say hello', + * action(name) { + * this.clearBufferedCommand(); + * console.log(`Hello, ${name}!`); + * this.displayPrompt(); + * }, + * }); + * replServer.defineCommand('saybye', function saybye() { + * console.log('Goodbye!'); + * this.close(); + * }); + * ``` + * + * The new commands can then be used from within the REPL instance: + * + * ```console + * > .sayhello Node.js User + * Hello, Node.js User! + * > .saybye + * Goodbye! + * ``` + * @since v0.3.0 + * @param keyword The command keyword (_without_ a leading `.` character). + * @param cmd The function to invoke when the command is processed. + */ + defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; + /** + * The `replServer.displayPrompt()` method readies the REPL instance for input + * from the user, printing the configured `prompt` to a new line in the `output`and resuming the `input` to accept new input. + * + * When multi-line input is being entered, an ellipsis is printed rather than the + * 'prompt'. + * + * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`. + * + * The `replServer.displayPrompt` method is primarily intended to be called from + * within the action function for commands registered using the`replServer.defineCommand()` method. + * @since v0.1.91 + */ + displayPrompt(preserveCursor?: boolean): void; + /** + * The `replServer.clearBufferedCommand()` method clears any command that has been + * buffered but not yet executed. This method is primarily intended to be + * called from within the action function for commands registered using the`replServer.defineCommand()` method. + * @since v9.0.0 + */ + clearBufferedCommand(): void; + /** + * Initializes a history log file for the REPL instance. When executing the + * Node.js binary and using the command-line REPL, a history file is initialized + * by default. However, this is not the case when creating a REPL + * programmatically. Use this method to initialize a history log file when working + * with REPL instances programmatically. + * @since v11.10.0 + * @param historyPath the path to the history file + * @param callback called when history writes are ready or upon error + */ + setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void; + /** + * events.EventEmitter + * 1. close - inherited from `readline.Interface` + * 2. line - inherited from `readline.Interface` + * 3. pause - inherited from `readline.Interface` + * 4. resume - inherited from `readline.Interface` + * 5. SIGCONT - inherited from `readline.Interface` + * 6. SIGINT - inherited from `readline.Interface` + * 7. SIGTSTP - inherited from `readline.Interface` + * 8. exit + * 9. reset + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'line', listener: (input: string) => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: 'SIGCONT', listener: () => void): this; + addListener(event: 'SIGINT', listener: () => void): this; + addListener(event: 'SIGTSTP', listener: () => void): this; + addListener(event: 'exit', listener: () => void): this; + addListener(event: 'reset', listener: (context: Context) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'line', input: string): boolean; + emit(event: 'pause'): boolean; + emit(event: 'resume'): boolean; + emit(event: 'SIGCONT'): boolean; + emit(event: 'SIGINT'): boolean; + emit(event: 'SIGTSTP'): boolean; + emit(event: 'exit'): boolean; + emit(event: 'reset', context: Context): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'line', listener: (input: string) => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: 'SIGCONT', listener: () => void): this; + on(event: 'SIGINT', listener: () => void): this; + on(event: 'SIGTSTP', listener: () => void): this; + on(event: 'exit', listener: () => void): this; + on(event: 'reset', listener: (context: Context) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'line', listener: (input: string) => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: 'SIGCONT', listener: () => void): this; + once(event: 'SIGINT', listener: () => void): this; + once(event: 'SIGTSTP', listener: () => void): this; + once(event: 'exit', listener: () => void): this; + once(event: 'reset', listener: (context: Context) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'line', listener: (input: string) => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: 'SIGCONT', listener: () => void): this; + prependListener(event: 'SIGINT', listener: () => void): this; + prependListener(event: 'SIGTSTP', listener: () => void): this; + prependListener(event: 'exit', listener: () => void): this; + prependListener(event: 'reset', listener: (context: Context) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'line', listener: (input: string) => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: 'SIGCONT', listener: () => void): this; + prependOnceListener(event: 'SIGINT', listener: () => void): this; + prependOnceListener(event: 'SIGTSTP', listener: () => void): this; + prependOnceListener(event: 'exit', listener: () => void): this; + prependOnceListener(event: 'reset', listener: (context: Context) => void): this; + } + /** + * A flag passed in the REPL options. Evaluates expressions in sloppy mode. + */ + const REPL_MODE_SLOPPY: unique symbol; + /** + * A flag passed in the REPL options. Evaluates expressions in strict mode. + * This is equivalent to prefacing every repl statement with `'use strict'`. + */ + const REPL_MODE_STRICT: unique symbol; + /** + * The `repl.start()` method creates and starts a {@link REPLServer} instance. + * + * If `options` is a string, then it specifies the input prompt: + * + * ```js + * const repl = require('node:repl'); + * + * // a Unix style prompt + * repl.start('$ '); + * ``` + * @since v0.1.91 + */ + function start(options?: string | ReplOptions): REPLServer; + /** + * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors + */ + class Recoverable extends SyntaxError { + err: Error; + constructor(err: Error); + } +} +declare module 'node:repl' { + export * from 'repl'; +} diff --git a/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts new file mode 100755 index 0000000..7577c98 --- /dev/null +++ b/node_modules/@types/node/stream.d.ts @@ -0,0 +1,1568 @@ +/** + * A stream is an abstract interface for working with streaming data in Node.js. + * The `node:stream` module provides an API for implementing the stream interface. + * + * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances. + * + * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`. + * + * To access the `node:stream` module: + * + * ```js + * const stream = require('node:stream'); + * ``` + * + * The `node:stream` module is useful for creating new types of stream instances. + * It is usually not necessary to use the `node:stream` module to consume streams. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/stream.js) + */ +declare module 'stream' { + import { EventEmitter, Abortable } from 'node:events'; + import { Blob as NodeBlob } from 'node:buffer'; + import * as streamPromises from 'node:stream/promises'; + import * as streamConsumers from 'node:stream/consumers'; + import * as streamWeb from 'node:stream/web'; + + type ComposeFnParam = (source: any) => void; + + class internal extends EventEmitter { + pipe( + destination: T, + options?: { + end?: boolean | undefined; + } + ): T; + compose(stream: T | ComposeFnParam | Iterable | AsyncIterable, options?: { signal: AbortSignal }): T; + } + import Stream = internal.Stream; + import Readable = internal.Readable; + import ReadableOptions = internal.ReadableOptions; + interface ArrayOptions { + /** the maximum concurrent invocations of `fn` to call on the stream at once. **Default: 1**. */ + concurrency?: number; + /** allows destroying the stream if the signal is aborted. */ + signal?: AbortSignal; + } + class ReadableBase extends Stream implements NodeJS.ReadableStream { + /** + * A utility method for creating Readable Streams out of iterators. + */ + static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; + /** + * Returns whether the stream has been read from or cancelled. + * @since v16.8.0 + */ + static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean; + /** + * Returns whether the stream was destroyed or errored before emitting `'end'`. + * @since v16.8.0 + * @experimental + */ + readonly readableAborted: boolean; + /** + * Is `true` if it is safe to call `readable.read()`, which means + * the stream has not been destroyed or emitted `'error'` or `'end'`. + * @since v11.4.0 + */ + readable: boolean; + /** + * Returns whether `'data'` has been emitted. + * @since v16.7.0, v14.18.0 + * @experimental + */ + readonly readableDidRead: boolean; + /** + * Getter for the property `encoding` of a given `Readable` stream. The `encoding`property can be set using the `readable.setEncoding()` method. + * @since v12.7.0 + */ + readonly readableEncoding: BufferEncoding | null; + /** + * Becomes `true` when `'end'` event is emitted. + * @since v12.9.0 + */ + readonly readableEnded: boolean; + /** + * This property reflects the current state of a `Readable` stream as described + * in the `Three states` section. + * @since v9.4.0 + */ + readonly readableFlowing: boolean | null; + /** + * Returns the value of `highWaterMark` passed when creating this `Readable`. + * @since v9.3.0 + */ + readonly readableHighWaterMark: number; + /** + * This property contains the number of bytes (or objects) in the queue + * ready to be read. The value provides introspection data regarding + * the status of the `highWaterMark`. + * @since v9.4.0 + */ + readonly readableLength: number; + /** + * Getter for the property `objectMode` of a given `Readable` stream. + * @since v12.3.0 + */ + readonly readableObjectMode: boolean; + /** + * Is `true` after `readable.destroy()` has been called. + * @since v8.0.0 + */ + destroyed: boolean; + /** + * Is `true` after `'close'` has been emitted. + * @since v18.0.0 + */ + readonly closed: boolean; + /** + * Returns error if the stream has been destroyed with an error. + * @since v18.0.0 + */ + readonly errored: Error | null; + constructor(opts?: ReadableOptions); + _construct?(callback: (error?: Error | null) => void): void; + _read(size: number): void; + /** + * The `readable.read()` method reads data out of the internal buffer and + * returns it. If no data is available to be read, `null` is returned. By default, + * the data is returned as a `Buffer` object unless an encoding has been + * specified using the `readable.setEncoding()` method or the stream is operating + * in object mode. + * + * The optional `size` argument specifies a specific number of bytes to read. If`size` bytes are not available to be read, `null` will be returned _unless_the stream has ended, in which + * case all of the data remaining in the internal + * buffer will be returned. + * + * If the `size` argument is not specified, all of the data contained in the + * internal buffer will be returned. + * + * The `size` argument must be less than or equal to 1 GiB. + * + * The `readable.read()` method should only be called on `Readable` streams + * operating in paused mode. In flowing mode, `readable.read()` is called + * automatically until the internal buffer is fully drained. + * + * ```js + * const readable = getReadableStreamSomehow(); + * + * // 'readable' may be triggered multiple times as data is buffered in + * readable.on('readable', () => { + * let chunk; + * console.log('Stream is readable (new data received in buffer)'); + * // Use a loop to make sure we read all currently available data + * while (null !== (chunk = readable.read())) { + * console.log(`Read ${chunk.length} bytes of data...`); + * } + * }); + * + * // 'end' will be triggered once when there is no more data available + * readable.on('end', () => { + * console.log('Reached end of stream.'); + * }); + * ``` + * + * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks + * are not concatenated. A `while` loop is necessary to consume all data + * currently in the buffer. When reading a large file `.read()` may return `null`, + * having consumed all buffered content so far, but there is still more data to + * come not yet buffered. In this case a new `'readable'` event will be emitted + * when there is more data in the buffer. Finally the `'end'` event will be + * emitted when there is no more data to come. + * + * Therefore to read a file's whole contents from a `readable`, it is necessary + * to collect chunks across multiple `'readable'` events: + * + * ```js + * const chunks = []; + * + * readable.on('readable', () => { + * let chunk; + * while (null !== (chunk = readable.read())) { + * chunks.push(chunk); + * } + * }); + * + * readable.on('end', () => { + * const content = chunks.join(''); + * }); + * ``` + * + * A `Readable` stream in object mode will always return a single item from + * a call to `readable.read(size)`, regardless of the value of the`size` argument. + * + * If the `readable.read()` method returns a chunk of data, a `'data'` event will + * also be emitted. + * + * Calling {@link read} after the `'end'` event has + * been emitted will return `null`. No runtime error will be raised. + * @since v0.9.4 + * @param size Optional argument to specify how much data to read. + */ + read(size?: number): any; + /** + * The `readable.setEncoding()` method sets the character encoding for + * data read from the `Readable` stream. + * + * By default, no encoding is assigned and stream data will be returned as`Buffer` objects. Setting an encoding causes the stream data + * to be returned as strings of the specified encoding rather than as `Buffer`objects. For instance, calling `readable.setEncoding('utf8')` will cause the + * output data to be interpreted as UTF-8 data, and passed as strings. Calling`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal + * string format. + * + * The `Readable` stream will properly handle multi-byte characters delivered + * through the stream that would otherwise become improperly decoded if simply + * pulled from the stream as `Buffer` objects. + * + * ```js + * const readable = getReadableStreamSomehow(); + * readable.setEncoding('utf8'); + * readable.on('data', (chunk) => { + * assert.equal(typeof chunk, 'string'); + * console.log('Got %d characters of string data:', chunk.length); + * }); + * ``` + * @since v0.9.4 + * @param encoding The encoding to use. + */ + setEncoding(encoding: BufferEncoding): this; + /** + * The `readable.pause()` method will cause a stream in flowing mode to stop + * emitting `'data'` events, switching out of flowing mode. Any data that + * becomes available will remain in the internal buffer. + * + * ```js + * const readable = getReadableStreamSomehow(); + * readable.on('data', (chunk) => { + * console.log(`Received ${chunk.length} bytes of data.`); + * readable.pause(); + * console.log('There will be no additional data for 1 second.'); + * setTimeout(() => { + * console.log('Now data will start flowing again.'); + * readable.resume(); + * }, 1000); + * }); + * ``` + * + * The `readable.pause()` method has no effect if there is a `'readable'`event listener. + * @since v0.9.4 + */ + pause(): this; + /** + * The `readable.resume()` method causes an explicitly paused `Readable` stream to + * resume emitting `'data'` events, switching the stream into flowing mode. + * + * The `readable.resume()` method can be used to fully consume the data from a + * stream without actually processing any of that data: + * + * ```js + * getReadableStreamSomehow() + * .resume() + * .on('end', () => { + * console.log('Reached the end, but did not read anything.'); + * }); + * ``` + * + * The `readable.resume()` method has no effect if there is a `'readable'`event listener. + * @since v0.9.4 + */ + resume(): this; + /** + * The `readable.isPaused()` method returns the current operating state of the`Readable`. This is used primarily by the mechanism that underlies the`readable.pipe()` method. In most + * typical cases, there will be no reason to + * use this method directly. + * + * ```js + * const readable = new stream.Readable(); + * + * readable.isPaused(); // === false + * readable.pause(); + * readable.isPaused(); // === true + * readable.resume(); + * readable.isPaused(); // === false + * ``` + * @since v0.11.14 + */ + isPaused(): boolean; + /** + * The `readable.unpipe()` method detaches a `Writable` stream previously attached + * using the {@link pipe} method. + * + * If the `destination` is not specified, then _all_ pipes are detached. + * + * If the `destination` is specified, but no pipe is set up for it, then + * the method does nothing. + * + * ```js + * const fs = require('node:fs'); + * const readable = getReadableStreamSomehow(); + * const writable = fs.createWriteStream('file.txt'); + * // All the data from readable goes into 'file.txt', + * // but only for the first second. + * readable.pipe(writable); + * setTimeout(() => { + * console.log('Stop writing to file.txt.'); + * readable.unpipe(writable); + * console.log('Manually close the file stream.'); + * writable.end(); + * }, 1000); + * ``` + * @since v0.9.4 + * @param destination Optional specific stream to unpipe + */ + unpipe(destination?: NodeJS.WritableStream): this; + /** + * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the + * same as `readable.push(null)`, after which no more data can be written. The EOF + * signal is put at the end of the buffer and any buffered data will still be + * flushed. + * + * The `readable.unshift()` method pushes a chunk of data back into the internal + * buffer. This is useful in certain situations where a stream is being consumed by + * code that needs to "un-consume" some amount of data that it has optimistically + * pulled out of the source, so that the data can be passed on to some other party. + * + * The `stream.unshift(chunk)` method cannot be called after the `'end'` event + * has been emitted or a runtime error will be thrown. + * + * Developers using `stream.unshift()` often should consider switching to + * use of a `Transform` stream instead. See the `API for stream implementers` section for more information. + * + * ```js + * // Pull off a header delimited by \n\n. + * // Use unshift() if we get too much. + * // Call the callback with (error, header, stream). + * const { StringDecoder } = require('node:string_decoder'); + * function parseHeader(stream, callback) { + * stream.on('error', callback); + * stream.on('readable', onReadable); + * const decoder = new StringDecoder('utf8'); + * let header = ''; + * function onReadable() { + * let chunk; + * while (null !== (chunk = stream.read())) { + * const str = decoder.write(chunk); + * if (str.includes('\n\n')) { + * // Found the header boundary. + * const split = str.split(/\n\n/); + * header += split.shift(); + * const remaining = split.join('\n\n'); + * const buf = Buffer.from(remaining, 'utf8'); + * stream.removeListener('error', callback); + * // Remove the 'readable' listener before unshifting. + * stream.removeListener('readable', onReadable); + * if (buf.length) + * stream.unshift(buf); + * // Now the body of the message can be read from the stream. + * callback(null, header, stream); + * return; + * } + * // Still reading the header. + * header += str; + * } + * } + * } + * ``` + * + * Unlike {@link push}, `stream.unshift(chunk)` will not + * end the reading process by resetting the internal reading state of the stream. + * This can cause unexpected results if `readable.unshift()` is called during a + * read (i.e. from within a {@link _read} implementation on a + * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately, + * however it is best to simply avoid calling `readable.unshift()` while in the + * process of performing a read. + * @since v0.9.11 + * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must be a string, `Buffer`, `Uint8Array`, or `null`. For object mode + * streams, `chunk` may be any JavaScript value. + * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. + */ + unshift(chunk: any, encoding?: BufferEncoding): void; + /** + * Prior to Node.js 0.10, streams did not implement the entire `node:stream`module API as it is currently defined. (See `Compatibility` for more + * information.) + * + * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the`readable.wrap()` method can be used to create a `Readable` + * stream that uses + * the old stream as its data source. + * + * It will rarely be necessary to use `readable.wrap()` but the method has been + * provided as a convenience for interacting with older Node.js applications and + * libraries. + * + * ```js + * const { OldReader } = require('./old-api-module.js'); + * const { Readable } = require('node:stream'); + * const oreader = new OldReader(); + * const myReader = new Readable().wrap(oreader); + * + * myReader.on('readable', () => { + * myReader.read(); // etc. + * }); + * ``` + * @since v0.9.4 + * @param stream An "old style" readable stream + */ + wrap(stream: NodeJS.ReadableStream): this; + push(chunk: any, encoding?: BufferEncoding): boolean; + /** + * The iterator created by this method gives users the option to cancel the destruction + * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`, + * or if the iterator should destroy the stream if the stream emitted an error during iteration. + * @since v16.3.0 + * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator, + * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream. + * **Default: `true`**. + */ + iterator(options?: {destroyOnReturn?: boolean}): AsyncIterableIterator; + /** + * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream. + * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream. + * @since v17.4.0, v16.14.0 + * @param fn a function to map over every chunk in the stream. Async or not. + * @returns a stream mapped with the function *fn*. + */ + map(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; + /** + * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called + * and if it returns a truthy value, the chunk will be passed to the result stream. + * If the *fn* function returns a promise - that promise will be `await`ed. + * @since v17.4.0, v16.14.0 + * @param fn a function to filter chunks from the stream. Async or not. + * @returns a stream filtered with the predicate *fn*. + */ + filter(fn: (data: any, options?: Pick) => boolean | Promise, options?: ArrayOptions): Readable; + /** + * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called. + * If the *fn* function returns a promise - that promise will be `await`ed. + * + * This method is different from `for await...of` loops in that it can optionally process chunks concurrently. + * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option + * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`. + * In either case the stream will be destroyed. + * + * This method is different from listening to the `'data'` event in that it uses the `readable` event + * in the underlying machinary and can limit the number of concurrent *fn* calls. + * @since v17.5.0 + * @param fn a function to call on each chunk of the stream. Async or not. + * @returns a promise for when the stream has finished. + */ + forEach(fn: (data: any, options?: Pick) => void | Promise, options?: ArrayOptions): Promise; + /** + * This method allows easily obtaining the contents of a stream. + * + * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended + * for interoperability and convenience, not as the primary way to consume streams. + * @since v17.5.0 + * @returns a promise containing an array with the contents of the stream. + */ + toArray(options?: Pick): Promise; + /** + * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream + * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk + * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`. + * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`. + * @since v17.5.0 + * @param fn a function to call on each chunk of the stream. Async or not. + * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks. + */ + some(fn: (data: any, options?: Pick) => boolean | Promise, options?: ArrayOptions): Promise; + /** + * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream + * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy, + * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value. + * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`. + * @since v17.5.0 + * @param fn a function to call on each chunk of the stream. Async or not. + * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value, + * or `undefined` if no element was found. + */ + find(fn: (data: any, options?: Pick) => data is T, options?: ArrayOptions): Promise; + find(fn: (data: any, options?: Pick) => boolean | Promise, options?: ArrayOptions): Promise; + /** + * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream + * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk + * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`. + * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`. + * @since v17.5.0 + * @param fn a function to call on each chunk of the stream. Async or not. + * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks. + */ + every(fn: (data: any, options?: Pick) => boolean | Promise, options?: ArrayOptions): Promise; + /** + * This method returns a new stream by applying the given callback to each chunk of the stream + * and then flattening the result. + * + * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams + * will be merged (flattened) into the returned stream. + * @since v17.5.0 + * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator. + * @returns a stream flat-mapped with the function *fn*. + */ + flatMap(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; + /** + * This method returns a new stream with the first *limit* chunks dropped from the start. + * @since v17.5.0 + * @param limit the number of chunks to drop from the readable. + * @returns a stream with *limit* chunks dropped from the start. + */ + drop(limit: number, options?: Pick): Readable; + /** + * This method returns a new stream with the first *limit* chunks. + * @since v17.5.0 + * @param limit the number of chunks to take from the readable. + * @returns a stream with *limit* chunks taken. + */ + take(limit: number, options?: Pick): Readable; + /** + * This method returns a new stream with chunks of the underlying stream paired with a counter + * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced. + * @since v17.5.0 + * @returns a stream of indexed pairs. + */ + asIndexedPairs(options?: Pick): Readable; + /** + * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation + * on the previous element. It returns a promise for the final value of the reduction. + * + * If no *initial* value is supplied the first chunk of the stream is used as the initial value. + * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property. + * + * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter + * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method. + * @since v17.5.0 + * @param fn a reducer function to call over every chunk in the stream. Async or not. + * @param initial the initial value to use in the reduction. + * @returns a promise for the final value of the reduction. + */ + reduce(fn: (previous: any, data: any, options?: Pick) => T, initial?: undefined, options?: Pick): Promise; + reduce(fn: (previous: T, data: any, options?: Pick) => T, initial: T, options?: Pick): Promise; + _destroy(error: Error | null, callback: (error?: Error | null) => void): void; + /** + * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable + * stream will release any internal resources and subsequent calls to `push()`will be ignored. + * + * Once `destroy()` has been called any further calls will be a no-op and no + * further errors except from `_destroy()` may be emitted as `'error'`. + * + * Implementors should not override this method, but instead implement `readable._destroy()`. + * @since v8.0.0 + * @param error Error which will be passed as payload in `'error'` event + */ + destroy(error?: Error): this; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. data + * 3. end + * 4. error + * 5. pause + * 6. readable + * 7. resume + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: any) => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'readable', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'data', chunk: any): boolean; + emit(event: 'end'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'pause'): boolean; + emit(event: 'readable'): boolean; + emit(event: 'resume'): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: any) => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'readable', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: any) => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'readable', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: any) => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'readable', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: any) => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'readable', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: 'close', listener: () => void): this; + removeListener(event: 'data', listener: (chunk: any) => void): this; + removeListener(event: 'end', listener: () => void): this; + removeListener(event: 'error', listener: (err: Error) => void): this; + removeListener(event: 'pause', listener: () => void): this; + removeListener(event: 'readable', listener: () => void): this; + removeListener(event: 'resume', listener: () => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + /** + * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished. + * @since v20.4.0 + */ + [Symbol.asyncDispose](): Promise; + } + import WritableOptions = internal.WritableOptions; + class WritableBase extends Stream implements NodeJS.WritableStream { + /** + * Is `true` if it is safe to call `writable.write()`, which means + * the stream has not been destroyed, errored, or ended. + * @since v11.4.0 + */ + readonly writable: boolean; + /** + * Is `true` after `writable.end()` has been called. This property + * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead. + * @since v12.9.0 + */ + readonly writableEnded: boolean; + /** + * Is set to `true` immediately before the `'finish'` event is emitted. + * @since v12.6.0 + */ + readonly writableFinished: boolean; + /** + * Return the value of `highWaterMark` passed when creating this `Writable`. + * @since v9.3.0 + */ + readonly writableHighWaterMark: number; + /** + * This property contains the number of bytes (or objects) in the queue + * ready to be written. The value provides introspection data regarding + * the status of the `highWaterMark`. + * @since v9.4.0 + */ + readonly writableLength: number; + /** + * Getter for the property `objectMode` of a given `Writable` stream. + * @since v12.3.0 + */ + readonly writableObjectMode: boolean; + /** + * Number of times `writable.uncork()` needs to be + * called in order to fully uncork the stream. + * @since v13.2.0, v12.16.0 + */ + readonly writableCorked: number; + /** + * Is `true` after `writable.destroy()` has been called. + * @since v8.0.0 + */ + destroyed: boolean; + /** + * Is `true` after `'close'` has been emitted. + * @since v18.0.0 + */ + readonly closed: boolean; + /** + * Returns error if the stream has been destroyed with an error. + * @since v18.0.0 + */ + readonly errored: Error | null; + /** + * Is `true` if the stream's buffer has been full and stream will emit `'drain'`. + * @since v15.2.0, v14.17.0 + */ + readonly writableNeedDrain: boolean; + constructor(opts?: WritableOptions); + _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + _writev?( + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + _construct?(callback: (error?: Error | null) => void): void; + _destroy(error: Error | null, callback: (error?: Error | null) => void): void; + _final(callback: (error?: Error | null) => void): void; + /** + * The `writable.write()` method writes some data to the stream, and calls the + * supplied `callback` once the data has been fully handled. If an error + * occurs, the `callback` will be called with the error as its + * first argument. The `callback` is called asynchronously and before `'error'` is + * emitted. + * + * The return value is `true` if the internal buffer is less than the`highWaterMark` configured when the stream was created after admitting `chunk`. + * If `false` is returned, further attempts to write data to the stream should + * stop until the `'drain'` event is emitted. + * + * While a stream is not draining, calls to `write()` will buffer `chunk`, and + * return false. Once all currently buffered chunks are drained (accepted for + * delivery by the operating system), the `'drain'` event will be emitted. + * Once `write()` returns false, do not write more chunks + * until the `'drain'` event is emitted. While calling `write()` on a stream that + * is not draining is allowed, Node.js will buffer all written chunks until + * maximum memory usage occurs, at which point it will abort unconditionally. + * Even before it aborts, high memory usage will cause poor garbage collector + * performance and high RSS (which is not typically released back to the system, + * even after the memory is no longer required). Since TCP sockets may never + * drain if the remote peer does not read the data, writing a socket that is + * not draining may lead to a remotely exploitable vulnerability. + * + * Writing data while the stream is not draining is particularly + * problematic for a `Transform`, because the `Transform` streams are paused + * by default until they are piped or a `'data'` or `'readable'` event handler + * is added. + * + * If the data to be written can be generated or fetched on demand, it is + * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is + * possible to respect backpressure and avoid memory issues using the `'drain'` event: + * + * ```js + * function write(data, cb) { + * if (!stream.write(data)) { + * stream.once('drain', cb); + * } else { + * process.nextTick(cb); + * } + * } + * + * // Wait for cb to be called before doing any other write. + * write('hello', () => { + * console.log('Write completed, do more writes now.'); + * }); + * ``` + * + * A `Writable` stream in object mode will always ignore the `encoding` argument. + * @since v0.9.4 + * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any + * JavaScript value other than `null`. + * @param [encoding='utf8'] The encoding, if `chunk` is a string. + * @param callback Callback for when this chunk of data is flushed. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean; + write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean; + /** + * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream. + * @since v0.11.15 + * @param encoding The new default encoding + */ + setDefaultEncoding(encoding: BufferEncoding): this; + /** + * Calling the `writable.end()` method signals that no more data will be written + * to the `Writable`. The optional `chunk` and `encoding` arguments allow one + * final additional chunk of data to be written immediately before closing the + * stream. + * + * Calling the {@link write} method after calling {@link end} will raise an error. + * + * ```js + * // Write 'hello, ' and then end with 'world!'. + * const fs = require('node:fs'); + * const file = fs.createWriteStream('example.txt'); + * file.write('hello, '); + * file.end('world!'); + * // Writing more now is not allowed! + * ``` + * @since v0.9.4 + * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any + * JavaScript value other than `null`. + * @param encoding The encoding if `chunk` is a string + * @param callback Callback for when the stream is finished. + */ + end(cb?: () => void): this; + end(chunk: any, cb?: () => void): this; + end(chunk: any, encoding: BufferEncoding, cb?: () => void): this; + /** + * The `writable.cork()` method forces all written data to be buffered in memory. + * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called. + * + * The primary intent of `writable.cork()` is to accommodate a situation in which + * several small chunks are written to the stream in rapid succession. Instead of + * immediately forwarding them to the underlying destination, `writable.cork()`buffers all the chunks until `writable.uncork()` is called, which will pass them + * all to `writable._writev()`, if present. This prevents a head-of-line blocking + * situation where data is being buffered while waiting for the first small chunk + * to be processed. However, use of `writable.cork()` without implementing`writable._writev()` may have an adverse effect on throughput. + * + * See also: `writable.uncork()`, `writable._writev()`. + * @since v0.11.2 + */ + cork(): void; + /** + * The `writable.uncork()` method flushes all data buffered since {@link cork} was called. + * + * When using `writable.cork()` and `writable.uncork()` to manage the buffering + * of writes to a stream, defer calls to `writable.uncork()` using`process.nextTick()`. Doing so allows batching of all`writable.write()` calls that occur within a given Node.js event + * loop phase. + * + * ```js + * stream.cork(); + * stream.write('some '); + * stream.write('data '); + * process.nextTick(() => stream.uncork()); + * ``` + * + * If the `writable.cork()` method is called multiple times on a stream, the + * same number of calls to `writable.uncork()` must be called to flush the buffered + * data. + * + * ```js + * stream.cork(); + * stream.write('some '); + * stream.cork(); + * stream.write('data '); + * process.nextTick(() => { + * stream.uncork(); + * // The data will not be flushed until uncork() is called a second time. + * stream.uncork(); + * }); + * ``` + * + * See also: `writable.cork()`. + * @since v0.11.2 + */ + uncork(): void; + /** + * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the writable + * stream has ended and subsequent calls to `write()` or `end()` will result in + * an `ERR_STREAM_DESTROYED` error. + * This is a destructive and immediate way to destroy a stream. Previous calls to`write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error. + * Use `end()` instead of destroy if data should flush before close, or wait for + * the `'drain'` event before destroying the stream. + * + * Once `destroy()` has been called any further calls will be a no-op and no + * further errors except from `_destroy()` may be emitted as `'error'`. + * + * Implementors should not override this method, + * but instead implement `writable._destroy()`. + * @since v8.0.0 + * @param error Optional, an error to emit with `'error'` event. + */ + destroy(error?: Error): this; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. drain + * 3. error + * 4. finish + * 5. pipe + * 6. unpipe + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'pipe', listener: (src: Readable) => void): this; + addListener(event: 'unpipe', listener: (src: Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'drain'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'finish'): boolean; + emit(event: 'pipe', src: Readable): boolean; + emit(event: 'unpipe', src: Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'pipe', listener: (src: Readable) => void): this; + on(event: 'unpipe', listener: (src: Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'pipe', listener: (src: Readable) => void): this; + once(event: 'unpipe', listener: (src: Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'pipe', listener: (src: Readable) => void): this; + prependListener(event: 'unpipe', listener: (src: Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'pipe', listener: (src: Readable) => void): this; + prependOnceListener(event: 'unpipe', listener: (src: Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: 'close', listener: () => void): this; + removeListener(event: 'drain', listener: () => void): this; + removeListener(event: 'error', listener: (err: Error) => void): this; + removeListener(event: 'finish', listener: () => void): this; + removeListener(event: 'pipe', listener: (src: Readable) => void): this; + removeListener(event: 'unpipe', listener: (src: Readable) => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + namespace internal { + class Stream extends internal { + constructor(opts?: ReadableOptions); + } + interface StreamOptions extends Abortable { + emitClose?: boolean | undefined; + highWaterMark?: number | undefined; + objectMode?: boolean | undefined; + construct?(this: T, callback: (error?: Error | null) => void): void; + destroy?(this: T, error: Error | null, callback: (error: Error | null) => void): void; + autoDestroy?: boolean | undefined; + } + interface ReadableOptions extends StreamOptions { + encoding?: BufferEncoding | undefined; + read?(this: Readable, size: number): void; + } + /** + * @since v0.9.4 + */ + class Readable extends ReadableBase { + /** + * A utility method for creating a `Readable` from a web `ReadableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb(readableStream: streamWeb.ReadableStream, options?: Pick): Readable; + /** + * A utility method for creating a web `ReadableStream` from a `Readable`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamReadable: Readable): streamWeb.ReadableStream; + } + interface WritableOptions extends StreamOptions { + decodeStrings?: boolean | undefined; + defaultEncoding?: BufferEncoding | undefined; + write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + writev?( + this: Writable, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + final?(this: Writable, callback: (error?: Error | null) => void): void; + } + /** + * @since v0.9.4 + */ + class Writable extends WritableBase { + /** + * A utility method for creating a `Writable` from a web `WritableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb(writableStream: streamWeb.WritableStream, options?: Pick): Writable; + /** + * A utility method for creating a web `WritableStream` from a `Writable`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamWritable: Writable): streamWeb.WritableStream; + } + interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean | undefined; + readableObjectMode?: boolean | undefined; + writableObjectMode?: boolean | undefined; + readableHighWaterMark?: number | undefined; + writableHighWaterMark?: number | undefined; + writableCorked?: number | undefined; + construct?(this: Duplex, callback: (error?: Error | null) => void): void; + read?(this: Duplex, size: number): void; + write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + writev?( + this: Duplex, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + final?(this: Duplex, callback: (error?: Error | null) => void): void; + destroy?(this: Duplex, error: Error | null, callback: (error: Error | null) => void): void; + } + /** + * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces. + * + * Examples of `Duplex` streams include: + * + * * `TCP sockets` + * * `zlib streams` + * * `crypto streams` + * @since v0.9.4 + */ + class Duplex extends ReadableBase implements WritableBase { + readonly writable: boolean; + readonly writableEnded: boolean; + readonly writableFinished: boolean; + readonly writableHighWaterMark: number; + readonly writableLength: number; + readonly writableObjectMode: boolean; + readonly writableCorked: number; + readonly writableNeedDrain: boolean; + readonly closed: boolean; + readonly errored: Error | null; + /** + * If `false` then the stream will automatically end the writable side when the + * readable side ends. Set initially by the `allowHalfOpen` constructor option, + * which defaults to `true`. + * + * This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is + * emitted. + * @since v0.9.4 + */ + allowHalfOpen: boolean; + constructor(opts?: DuplexOptions); + /** + * A utility method for creating duplex streams. + * + * - `Stream` converts writable stream into writable `Duplex` and readable stream + * to `Duplex`. + * - `Blob` converts into readable `Duplex`. + * - `string` converts into readable `Duplex`. + * - `ArrayBuffer` converts into readable `Duplex`. + * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`. + * - `AsyncGeneratorFunction` converts into a readable/writable transform + * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield + * `null`. + * - `AsyncFunction` converts into a writable `Duplex`. Must return + * either `null` or `undefined` + * - `Object ({ writable, readable })` converts `readable` and + * `writable` into `Stream` and then combines them into `Duplex` where the + * `Duplex` will write to the `writable` and read from the `readable`. + * - `Promise` converts into readable `Duplex`. Value `null` is ignored. + * + * @since v16.8.0 + */ + static from(src: Stream | NodeBlob | ArrayBuffer | string | Iterable | AsyncIterable | AsyncGeneratorFunction | Promise | Object): Duplex; + _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + _writev?( + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + _destroy(error: Error | null, callback: (error: Error | null) => void): void; + _final(callback: (error?: Error | null) => void): void; + write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean; + write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; + setDefaultEncoding(encoding: BufferEncoding): this; + end(cb?: () => void): this; + end(chunk: any, cb?: () => void): this; + end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this; + cork(): void; + uncork(): void; + /** + * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamDuplex: Duplex): { + readable: streamWeb.ReadableStream; + writable: streamWeb.WritableStream; + }; + /** + * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb( + duplexStream: { + readable: streamWeb.ReadableStream; + writable: streamWeb.WritableStream; + }, + options?: Pick + ): Duplex; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. data + * 3. drain + * 4. end + * 5. error + * 6. finish + * 7. pause + * 8. pipe + * 9. readable + * 10. resume + * 11. unpipe + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: any) => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'pipe', listener: (src: Readable) => void): this; + addListener(event: 'readable', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: 'unpipe', listener: (src: Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'data', chunk: any): boolean; + emit(event: 'drain'): boolean; + emit(event: 'end'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'finish'): boolean; + emit(event: 'pause'): boolean; + emit(event: 'pipe', src: Readable): boolean; + emit(event: 'readable'): boolean; + emit(event: 'resume'): boolean; + emit(event: 'unpipe', src: Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: any) => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'pipe', listener: (src: Readable) => void): this; + on(event: 'readable', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: 'unpipe', listener: (src: Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: any) => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'pipe', listener: (src: Readable) => void): this; + once(event: 'readable', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: 'unpipe', listener: (src: Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: any) => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'pipe', listener: (src: Readable) => void): this; + prependListener(event: 'readable', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: 'unpipe', listener: (src: Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: any) => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'pipe', listener: (src: Readable) => void): this; + prependOnceListener(event: 'readable', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: 'unpipe', listener: (src: Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: 'close', listener: () => void): this; + removeListener(event: 'data', listener: (chunk: any) => void): this; + removeListener(event: 'drain', listener: () => void): this; + removeListener(event: 'end', listener: () => void): this; + removeListener(event: 'error', listener: (err: Error) => void): this; + removeListener(event: 'finish', listener: () => void): this; + removeListener(event: 'pause', listener: () => void): this; + removeListener(event: 'pipe', listener: (src: Readable) => void): this; + removeListener(event: 'readable', listener: () => void): this; + removeListener(event: 'resume', listener: () => void): this; + removeListener(event: 'unpipe', listener: (src: Readable) => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + type TransformCallback = (error?: Error | null, data?: any) => void; + interface TransformOptions extends DuplexOptions { + construct?(this: Transform, callback: (error?: Error | null) => void): void; + read?(this: Transform, size: number): void; + write?(this: Transform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + writev?( + this: Transform, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + final?(this: Transform, callback: (error?: Error | null) => void): void; + destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void; + transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; + flush?(this: Transform, callback: TransformCallback): void; + } + /** + * Transform streams are `Duplex` streams where the output is in some way + * related to the input. Like all `Duplex` streams, `Transform` streams + * implement both the `Readable` and `Writable` interfaces. + * + * Examples of `Transform` streams include: + * + * * `zlib streams` + * * `crypto streams` + * @since v0.9.4 + */ + class Transform extends Duplex { + constructor(opts?: TransformOptions); + _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; + _flush(callback: TransformCallback): void; + } + /** + * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is + * primarily for examples and testing, but there are some use cases where`stream.PassThrough` is useful as a building block for novel sorts of streams. + */ + class PassThrough extends Transform {} + /** + * A stream to attach a signal to. + * + * Attaches an AbortSignal to a readable or writeable stream. This lets code + * control stream destruction using an `AbortController`. + * + * Calling `abort` on the `AbortController` corresponding to the passed`AbortSignal` will behave the same way as calling `.destroy(new AbortError())`on the stream, and `controller.error(new + * AbortError())` for webstreams. + * + * ```js + * const fs = require('node:fs'); + * + * const controller = new AbortController(); + * const read = addAbortSignal( + * controller.signal, + * fs.createReadStream(('object.json')), + * ); + * // Later, abort the operation closing the stream + * controller.abort(); + * ``` + * + * Or using an `AbortSignal` with a readable stream as an async iterable: + * + * ```js + * const controller = new AbortController(); + * setTimeout(() => controller.abort(), 10_000); // set a timeout + * const stream = addAbortSignal( + * controller.signal, + * fs.createReadStream(('object.json')), + * ); + * (async () => { + * try { + * for await (const chunk of stream) { + * await process(chunk); + * } + * } catch (e) { + * if (e.name === 'AbortError') { + * // The operation was cancelled + * } else { + * throw e; + * } + * } + * })(); + * ``` + * + * Or using an `AbortSignal` with a ReadableStream: + * + * ```js + * const controller = new AbortController(); + * const rs = new ReadableStream({ + * start(controller) { + * controller.enqueue('hello'); + * controller.enqueue('world'); + * controller.close(); + * }, + * }); + * + * addAbortSignal(controller.signal, rs); + * + * finished(rs, (err) => { + * if (err) { + * if (err.name === 'AbortError') { + * // The operation was cancelled + * } + * } + * }); + * + * const reader = rs.getReader(); + * + * reader.read().then(({ value, done }) => { + * console.log(value); // hello + * console.log(done); // false + * controller.abort(); + * }); + * ``` + * @since v15.4.0 + * @param signal A signal representing possible cancellation + * @param stream a stream to attach a signal to + */ + function addAbortSignal(signal: AbortSignal, stream: T): T; + /** + * Returns the default highWaterMark used by streams. + * Defaults to `16384` (16 KiB), or `16` for `objectMode`. + * @since v19.9.0 + * @param objectMode + */ + function getDefaultHighWaterMark(objectMode: boolean): number; + /** + * Sets the default highWaterMark used by streams. + * @since v19.9.0 + * @param objectMode + * @param value highWaterMark value + */ + function setDefaultHighWaterMark(objectMode: boolean, value: number): void; + interface FinishedOptions extends Abortable { + error?: boolean | undefined; + readable?: boolean | undefined; + writable?: boolean | undefined; + } + /** + * A readable and/or writable stream/webstream. + * + * A function to get notified when a stream is no longer readable, writable + * or has experienced an error or a premature close event. + * + * ```js + * const { finished } = require('node:stream'); + * const fs = require('node:fs'); + * + * const rs = fs.createReadStream('archive.tar'); + * + * finished(rs, (err) => { + * if (err) { + * console.error('Stream failed.', err); + * } else { + * console.log('Stream is done reading.'); + * } + * }); + * + * rs.resume(); // Drain the stream. + * ``` + * + * Especially useful in error handling scenarios where a stream is destroyed + * prematurely (like an aborted HTTP request), and will not emit `'end'`or `'finish'`. + * + * The `finished` API provides `promise version`. + * + * `stream.finished()` leaves dangling event listeners (in particular`'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been + * invoked. The reason for this is so that unexpected `'error'` events (due to + * incorrect stream implementations) do not cause unexpected crashes. + * If this is unwanted behavior then the returned cleanup function needs to be + * invoked in the callback: + * + * ```js + * const cleanup = finished(rs, (err) => { + * cleanup(); + * // ... + * }); + * ``` + * @since v10.0.0 + * @param stream A readable and/or writable stream. + * @param callback A callback function that takes an optional error argument. + * @return A cleanup function which removes all registered listeners. + */ + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; + namespace finished { + function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise; + } + type PipelineSourceFunction = () => Iterable | AsyncIterable; + type PipelineSource = Iterable | AsyncIterable | NodeJS.ReadableStream | PipelineSourceFunction; + type PipelineTransform, U> = + | NodeJS.ReadWriteStream + | ((source: S extends (...args: any[]) => Iterable | AsyncIterable ? AsyncIterable : S) => AsyncIterable); + type PipelineTransformSource = PipelineSource | PipelineTransform; + type PipelineDestinationIterableFunction = (source: AsyncIterable) => AsyncIterable; + type PipelineDestinationPromiseFunction = (source: AsyncIterable) => Promise

; + type PipelineDestination, P> = S extends PipelineTransformSource + ? NodeJS.WritableStream | PipelineDestinationIterableFunction | PipelineDestinationPromiseFunction + : never; + type PipelineCallback> = S extends PipelineDestinationPromiseFunction + ? (err: NodeJS.ErrnoException | null, value: P) => void + : (err: NodeJS.ErrnoException | null) => void; + type PipelinePromise> = S extends PipelineDestinationPromiseFunction ? Promise

: Promise; + interface PipelineOptions { + signal?: AbortSignal | undefined; + end?: boolean | undefined; + } + /** + * A module method to pipe between streams and generators forwarding errors and + * properly cleaning up and provide a callback when the pipeline is complete. + * + * ```js + * const { pipeline } = require('node:stream'); + * const fs = require('node:fs'); + * const zlib = require('node:zlib'); + * + * // Use the pipeline API to easily pipe a series of streams + * // together and get notified when the pipeline is fully done. + * + * // A pipeline to gzip a potentially huge tar file efficiently: + * + * pipeline( + * fs.createReadStream('archive.tar'), + * zlib.createGzip(), + * fs.createWriteStream('archive.tar.gz'), + * (err) => { + * if (err) { + * console.error('Pipeline failed.', err); + * } else { + * console.log('Pipeline succeeded.'); + * } + * }, + * ); + * ``` + * + * The `pipeline` API provides a `promise version`. + * + * `stream.pipeline()` will call `stream.destroy(err)` on all streams except: + * + * * `Readable` streams which have emitted `'end'` or `'close'`. + * * `Writable` streams which have emitted `'finish'` or `'close'`. + * + * `stream.pipeline()` leaves dangling event listeners on the streams + * after the `callback` has been invoked. In the case of reuse of streams after + * failure, this can cause event listener leaks and swallowed errors. If the last + * stream is readable, dangling event listeners will be removed so that the last + * stream can be consumed later. + * + * `stream.pipeline()` closes all the streams when an error is raised. + * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior + * once it would destroy the socket without sending the expected response. + * See the example below: + * + * ```js + * const fs = require('node:fs'); + * const http = require('node:http'); + * const { pipeline } = require('node:stream'); + * + * const server = http.createServer((req, res) => { + * const fileStream = fs.createReadStream('./fileNotExist.txt'); + * pipeline(fileStream, res, (err) => { + * if (err) { + * console.log(err); // No such file + * // this message can't be sent once `pipeline` already destroyed the socket + * return res.end('error!!!'); + * } + * }); + * }); + * ``` + * @since v10.0.0 + * @param callback Called when the pipeline is fully done. + */ + function pipeline, B extends PipelineDestination>( + source: A, + destination: B, + callback?: PipelineCallback + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline, T1 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + destination: B, + callback?: PipelineCallback + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline, T1 extends PipelineTransform, T2 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + transform2: T2, + destination: B, + callback?: PipelineCallback + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, callback?: PipelineCallback): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, callback?: PipelineCallback): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline( + streams: ReadonlyArray, + callback?: (err: NodeJS.ErrnoException | null) => void + ): NodeJS.WritableStream; + function pipeline( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array void)> + ): NodeJS.WritableStream; + namespace pipeline { + function __promisify__, B extends PipelineDestination>(source: A, destination: B, options?: PipelineOptions): PipelinePromise; + function __promisify__, T1 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + destination: B, + options?: PipelineOptions + ): PipelinePromise; + function __promisify__, T1 extends PipelineTransform, T2 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + transform2: T2, + destination: B, + options?: PipelineOptions + ): PipelinePromise; + function __promisify__< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise; + function __promisify__< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise; + function __promisify__(streams: ReadonlyArray, options?: PipelineOptions): Promise; + function __promisify__( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array + ): Promise; + } + interface Pipe { + close(): void; + hasRef(): boolean; + ref(): void; + unref(): void; + } + /** + * Returns whether the stream has encountered an error. + * @since v17.3.0, v16.14.0 + * @experimental + */ + function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean; + /** + * Returns whether the stream is readable. + * @since v17.4.0, v16.14.0 + * @experimental + */ + function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; + const promises: typeof streamPromises; + const consumers: typeof streamConsumers; + } + export = internal; +} +declare module 'node:stream' { + import stream = require('stream'); + export = stream; +} diff --git a/node_modules/@types/node/stream/consumers.d.ts b/node_modules/@types/node/stream/consumers.d.ts new file mode 100755 index 0000000..2fd9424 --- /dev/null +++ b/node_modules/@types/node/stream/consumers.d.ts @@ -0,0 +1,12 @@ +declare module 'stream/consumers' { + import { Blob as NodeBlob } from 'node:buffer'; + import { Readable } from 'node:stream'; + function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; + function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; + function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; + function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; + function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; +} +declare module 'node:stream/consumers' { + export * from 'stream/consumers'; +} diff --git a/node_modules/@types/node/stream/promises.d.ts b/node_modules/@types/node/stream/promises.d.ts new file mode 100755 index 0000000..b427073 --- /dev/null +++ b/node_modules/@types/node/stream/promises.d.ts @@ -0,0 +1,42 @@ +declare module 'stream/promises' { + import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream'; + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise; + function pipeline, B extends PipelineDestination>(source: A, destination: B, options?: PipelineOptions): PipelinePromise; + function pipeline, T1 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + destination: B, + options?: PipelineOptions + ): PipelinePromise; + function pipeline, T1 extends PipelineTransform, T2 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + transform2: T2, + destination: B, + options?: PipelineOptions + ): PipelinePromise; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise; + function pipeline(streams: ReadonlyArray, options?: PipelineOptions): Promise; + function pipeline( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array + ): Promise; +} +declare module 'node:stream/promises' { + export * from 'stream/promises'; +} diff --git a/node_modules/@types/node/stream/web.d.ts b/node_modules/@types/node/stream/web.d.ts new file mode 100755 index 0000000..f9ef057 --- /dev/null +++ b/node_modules/@types/node/stream/web.d.ts @@ -0,0 +1,330 @@ +declare module 'stream/web' { + // stub module, pending copy&paste from .d.ts or manual impl + // copy from lib.dom.d.ts + interface ReadableWritablePair { + readable: ReadableStream; + /** + * Provides a convenient, chainable way of piping this readable stream + * through a transform stream (or any other { writable, readable } + * pair). It simply pipes the stream into the writable side of the + * supplied pair, and returns the readable side for further use. + * + * Piping a stream will lock it for the duration of the pipe, preventing + * any other consumer from acquiring a reader. + */ + writable: WritableStream; + } + interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + /** + * Pipes this readable stream to a given writable stream destination. + * The way in which the piping process behaves under various error + * conditions can be customized with a number of passed options. It + * returns a promise that fulfills when the piping process completes + * successfully, or rejects if any errors were encountered. + * + * Piping a stream will lock it for the duration of the pipe, preventing + * any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate + * as follows: + * + * An error in this source readable stream will abort destination, + * unless preventAbort is truthy. The returned promise will be rejected + * with the source's error, or with any error that occurs during + * aborting the destination. + * + * An error in destination will cancel this source readable stream, + * unless preventCancel is truthy. The returned promise will be rejected + * with the destination's error, or with any error that occurs during + * canceling the source. + * + * When this source readable stream closes, destination will be closed, + * unless preventClose is truthy. The returned promise will be fulfilled + * once this process completes, unless an error is encountered while + * closing the destination, in which case it will be rejected with that + * error. + * + * If destination starts out closed or closing, this source readable + * stream will be canceled, unless preventCancel is true. The returned + * promise will be rejected with an error indicating piping to a closed + * stream failed, or with any error that occurs during canceling the + * source. + * + * The signal option can be set to an AbortSignal to allow aborting an + * ongoing pipe operation via the corresponding AbortController. In this + * case, this source readable stream will be canceled, and destination + * aborted, unless the respective options preventCancel or preventAbort + * are set. + */ + preventClose?: boolean; + signal?: AbortSignal; + } + interface ReadableStreamGenericReader { + readonly closed: Promise; + cancel(reason?: any): Promise; + } + interface ReadableStreamDefaultReadValueResult { + done: false; + value: T; + } + interface ReadableStreamDefaultReadDoneResult { + done: true; + value?: undefined; + } + type ReadableStreamController = ReadableStreamDefaultController; + type ReadableStreamDefaultReadResult = ReadableStreamDefaultReadValueResult | ReadableStreamDefaultReadDoneResult; + interface ReadableByteStreamControllerCallback { + (controller: ReadableByteStreamController): void | PromiseLike; + } + interface UnderlyingSinkAbortCallback { + (reason?: any): void | PromiseLike; + } + interface UnderlyingSinkCloseCallback { + (): void | PromiseLike; + } + interface UnderlyingSinkStartCallback { + (controller: WritableStreamDefaultController): any; + } + interface UnderlyingSinkWriteCallback { + (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike; + } + interface UnderlyingSourceCancelCallback { + (reason?: any): void | PromiseLike; + } + interface UnderlyingSourcePullCallback { + (controller: ReadableStreamController): void | PromiseLike; + } + interface UnderlyingSourceStartCallback { + (controller: ReadableStreamController): any; + } + interface TransformerFlushCallback { + (controller: TransformStreamDefaultController): void | PromiseLike; + } + interface TransformerStartCallback { + (controller: TransformStreamDefaultController): any; + } + interface TransformerTransformCallback { + (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; + } + interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: ReadableStreamErrorCallback; + pull?: ReadableByteStreamControllerCallback; + start?: ReadableByteStreamControllerCallback; + type: 'bytes'; + } + interface UnderlyingSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback; + start?: UnderlyingSourceStartCallback; + type?: undefined; + } + interface UnderlyingSink { + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; + type?: undefined; + write?: UnderlyingSinkWriteCallback; + } + interface ReadableStreamErrorCallback { + (reason: any): void | PromiseLike; + } + /** This Streams API interface represents a readable stream of byte data. */ + interface ReadableStream { + readonly locked: boolean; + cancel(reason?: any): Promise; + getReader(): ReadableStreamDefaultReader; + pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; + pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; + tee(): [ReadableStream, ReadableStream]; + values(options?: { preventCancel?: boolean }): AsyncIterableIterator; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + const ReadableStream: { + prototype: ReadableStream; + new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy): ReadableStream; + new (underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; + }; + interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { + read(): Promise>; + releaseLock(): void; + } + const ReadableStreamDefaultReader: { + prototype: ReadableStreamDefaultReader; + new (stream: ReadableStream): ReadableStreamDefaultReader; + }; + const ReadableStreamBYOBReader: any; + const ReadableStreamBYOBRequest: any; + interface ReadableByteStreamController { + readonly byobRequest: undefined; + readonly desiredSize: number | null; + close(): void; + enqueue(chunk: ArrayBufferView): void; + error(error?: any): void; + } + const ReadableByteStreamController: { + prototype: ReadableByteStreamController; + new (): ReadableByteStreamController; + }; + interface ReadableStreamDefaultController { + readonly desiredSize: number | null; + close(): void; + enqueue(chunk?: R): void; + error(e?: any): void; + } + const ReadableStreamDefaultController: { + prototype: ReadableStreamDefaultController; + new (): ReadableStreamDefaultController; + }; + interface Transformer { + flush?: TransformerFlushCallback; + readableType?: undefined; + start?: TransformerStartCallback; + transform?: TransformerTransformCallback; + writableType?: undefined; + } + interface TransformStream { + readonly readable: ReadableStream; + readonly writable: WritableStream; + } + const TransformStream: { + prototype: TransformStream; + new (transformer?: Transformer, writableStrategy?: QueuingStrategy, readableStrategy?: QueuingStrategy): TransformStream; + }; + interface TransformStreamDefaultController { + readonly desiredSize: number | null; + enqueue(chunk?: O): void; + error(reason?: any): void; + terminate(): void; + } + const TransformStreamDefaultController: { + prototype: TransformStreamDefaultController; + new (): TransformStreamDefaultController; + }; + /** + * This Streams API interface provides a standard abstraction for writing + * streaming data to a destination, known as a sink. This object comes with + * built-in back pressure and queuing. + */ + interface WritableStream { + readonly locked: boolean; + abort(reason?: any): Promise; + close(): Promise; + getWriter(): WritableStreamDefaultWriter; + } + const WritableStream: { + prototype: WritableStream; + new (underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy): WritableStream; + }; + /** + * This Streams API interface is the object returned by + * WritableStream.getWriter() and once created locks the < writer to the + * WritableStream ensuring that no other streams can write to the underlying + * sink. + */ + interface WritableStreamDefaultWriter { + readonly closed: Promise; + readonly desiredSize: number | null; + readonly ready: Promise; + abort(reason?: any): Promise; + close(): Promise; + releaseLock(): void; + write(chunk?: W): Promise; + } + const WritableStreamDefaultWriter: { + prototype: WritableStreamDefaultWriter; + new (stream: WritableStream): WritableStreamDefaultWriter; + }; + /** + * This Streams API interface represents a controller allowing control of a + * WritableStream's state. When constructing a WritableStream, the + * underlying sink is given a corresponding WritableStreamDefaultController + * instance to manipulate. + */ + interface WritableStreamDefaultController { + error(e?: any): void; + } + const WritableStreamDefaultController: { + prototype: WritableStreamDefaultController; + new (): WritableStreamDefaultController; + }; + interface QueuingStrategy { + highWaterMark?: number; + size?: QueuingStrategySize; + } + interface QueuingStrategySize { + (chunk?: T): number; + } + interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water + * mark. + * + * Note that the provided high water mark will not be validated ahead of + * time. Instead, if it is negative, NaN, or not a number, the resulting + * ByteLengthQueuingStrategy will cause the corresponding stream + * constructor to throw. + */ + highWaterMark: number; + } + /** + * This Streams API interface provides a built-in byte length queuing + * strategy that can be used when constructing streams. + */ + interface ByteLengthQueuingStrategy extends QueuingStrategy { + readonly highWaterMark: number; + readonly size: QueuingStrategySize; + } + const ByteLengthQueuingStrategy: { + prototype: ByteLengthQueuingStrategy; + new (init: QueuingStrategyInit): ByteLengthQueuingStrategy; + }; + /** + * This Streams API interface provides a built-in byte length queuing + * strategy that can be used when constructing streams. + */ + interface CountQueuingStrategy extends QueuingStrategy { + readonly highWaterMark: number; + readonly size: QueuingStrategySize; + } + const CountQueuingStrategy: { + prototype: CountQueuingStrategy; + new (init: QueuingStrategyInit): CountQueuingStrategy; + }; + interface TextEncoderStream { + /** Returns "utf-8". */ + readonly encoding: 'utf-8'; + readonly readable: ReadableStream; + readonly writable: WritableStream; + readonly [Symbol.toStringTag]: string; + } + const TextEncoderStream: { + prototype: TextEncoderStream; + new (): TextEncoderStream; + }; + interface TextDecoderOptions { + fatal?: boolean; + ignoreBOM?: boolean; + } + type BufferSource = ArrayBufferView | ArrayBuffer; + interface TextDecoderStream { + /** Returns encoding's name, lower cased. */ + readonly encoding: string; + /** Returns `true` if error mode is "fatal", and `false` otherwise. */ + readonly fatal: boolean; + /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ + readonly ignoreBOM: boolean; + readonly readable: ReadableStream; + readonly writable: WritableStream; + readonly [Symbol.toStringTag]: string; + } + const TextDecoderStream: { + prototype: TextDecoderStream; + new (label?: string, options?: TextDecoderOptions): TextDecoderStream; + }; +} +declare module 'node:stream/web' { + export * from 'stream/web'; +} diff --git a/node_modules/@types/node/string_decoder.d.ts b/node_modules/@types/node/string_decoder.d.ts new file mode 100755 index 0000000..a069bb8 --- /dev/null +++ b/node_modules/@types/node/string_decoder.d.ts @@ -0,0 +1,67 @@ +/** + * The `node:string_decoder` module provides an API for decoding `Buffer` objects + * into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 + * characters. It can be accessed using: + * + * ```js + * const { StringDecoder } = require('node:string_decoder'); + * ``` + * + * The following example shows the basic use of the `StringDecoder` class. + * + * ```js + * const { StringDecoder } = require('node:string_decoder'); + * const decoder = new StringDecoder('utf8'); + * + * const cent = Buffer.from([0xC2, 0xA2]); + * console.log(decoder.write(cent)); + * + * const euro = Buffer.from([0xE2, 0x82, 0xAC]); + * console.log(decoder.write(euro)); + * ``` + * + * When a `Buffer` instance is written to the `StringDecoder` instance, an + * internal buffer is used to ensure that the decoded string does not contain + * any incomplete multibyte characters. These are held in the buffer until the + * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called. + * + * In the following example, the three UTF-8 encoded bytes of the European Euro + * symbol (`€`) are written over three separate operations: + * + * ```js + * const { StringDecoder } = require('node:string_decoder'); + * const decoder = new StringDecoder('utf8'); + * + * decoder.write(Buffer.from([0xE2])); + * decoder.write(Buffer.from([0x82])); + * console.log(decoder.end(Buffer.from([0xAC]))); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/string_decoder.js) + */ +declare module 'string_decoder' { + class StringDecoder { + constructor(encoding?: BufferEncoding); + /** + * Returns a decoded string, ensuring that any incomplete multibyte characters at + * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the + * returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`. + * @since v0.1.99 + * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode. + */ + write(buffer: Buffer): string; + /** + * Returns any remaining input stored in the internal buffer as a string. Bytes + * representing incomplete UTF-8 and UTF-16 characters will be replaced with + * substitution characters appropriate for the character encoding. + * + * If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input. + * After `end()` is called, the `stringDecoder` object can be reused for new input. + * @since v0.9.3 + * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode. + */ + end(buffer?: Buffer): string; + } +} +declare module 'node:string_decoder' { + export * from 'string_decoder'; +} diff --git a/node_modules/@types/node/test.d.ts b/node_modules/@types/node/test.d.ts new file mode 100755 index 0000000..81c73a8 --- /dev/null +++ b/node_modules/@types/node/test.d.ts @@ -0,0 +1,1461 @@ +/** + * The `node:test` module facilitates the creation of JavaScript tests. + * To access it: + * + * ```js + * import test from 'node:test'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import test from 'test'; + * ``` + * + * Tests created via the `test` module consist of a single function that is + * processed in one of three ways: + * + * 1. A synchronous function that is considered failing if it throws an exception, + * and is considered passing otherwise. + * 2. A function that returns a `Promise` that is considered failing if the`Promise` rejects, and is considered passing if the `Promise` resolves. + * 3. A function that receives a callback function. If the callback receives any + * truthy value as its first argument, the test is considered failing. If a + * falsy value is passed as the first argument to the callback, the test is + * considered passing. If the test function receives a callback function and + * also returns a `Promise`, the test will fail. + * + * The following example illustrates how tests are written using the`test` module. + * + * ```js + * test('synchronous passing test', (t) => { + * // This test passes because it does not throw an exception. + * assert.strictEqual(1, 1); + * }); + * + * test('synchronous failing test', (t) => { + * // This test fails because it throws an exception. + * assert.strictEqual(1, 2); + * }); + * + * test('asynchronous passing test', async (t) => { + * // This test passes because the Promise returned by the async + * // function is not rejected. + * assert.strictEqual(1, 1); + * }); + * + * test('asynchronous failing test', async (t) => { + * // This test fails because the Promise returned by the async + * // function is rejected. + * assert.strictEqual(1, 2); + * }); + * + * test('failing test using Promises', (t) => { + * // Promises can be used directly as well. + * return new Promise((resolve, reject) => { + * setImmediate(() => { + * reject(new Error('this will cause the test to fail')); + * }); + * }); + * }); + * + * test('callback passing test', (t, done) => { + * // done() is the callback function. When the setImmediate() runs, it invokes + * // done() with no arguments. + * setImmediate(done); + * }); + * + * test('callback failing test', (t, done) => { + * // When the setImmediate() runs, done() is invoked with an Error object and + * // the test fails. + * setImmediate(() => { + * done(new Error('callback failure')); + * }); + * }); + * ``` + * + * If any tests fail, the process exit code is set to `1`. + * @since v18.0.0, v16.17.0 + * @see [source](https://github.com/nodejs/node/blob/v20.4.0/lib/test.js) + */ +declare module 'node:test' { + import { Readable } from 'node:stream'; + import { AsyncResource } from 'node:async_hooks'; + /** + * ```js + * import { tap } from 'node:test/reporters'; + * import process from 'node:process'; + * + * run({ files: [path.resolve('./tests/test.js')] }) + * .compose(tap) + * .pipe(process.stdout); + * ``` + * @since v18.9.0, v16.19.0 + * @param options Configuration options for running tests. The following properties are supported: + */ + function run(options?: RunOptions): TestsStream; + /** + * The `test()` function is the value imported from the `test` module. Each + * invocation of this function results in reporting the test to the `TestsStream`. + * + * The `TestContext` object passed to the `fn` argument can be used to perform + * actions related to the current test. Examples include skipping the test, adding + * additional diagnostic information, or creating subtests. + * + * `test()` returns a `Promise` that resolves once the test completes. + * if `test()` is called within a `describe()` block, it resolve immediately. + * The return value can usually be discarded for top level tests. + * However, the return value from subtests should be used to prevent the parent + * test from finishing first and cancelling the subtest + * as shown in the following example. + * + * ```js + * test('top level test', async (t) => { + * // The setTimeout() in the following subtest would cause it to outlive its + * // parent test if 'await' is removed on the next line. Once the parent test + * // completes, it will cancel any outstanding subtests. + * await t.test('longer running subtest', async (t) => { + * return new Promise((resolve, reject) => { + * setTimeout(resolve, 1000); + * }); + * }); + * }); + * ``` + * + * The `timeout` option can be used to fail the test if it takes longer than`timeout` milliseconds to complete. However, it is not a reliable mechanism for + * canceling tests because a running test might block the application thread and + * thus prevent the scheduled cancellation. + * @since v18.0.0, v16.17.0 + * @param [name='The name'] The name of the test, which is displayed when reporting test results. + * @param options Configuration options for the test. The following properties are supported: + * @param [fn='A no-op function'] The function under test. The first argument to this function is a {@link TestContext} object. If the test uses callbacks, the callback function is passed as the + * second argument. + * @return Resolved with `undefined` once the test completes, or immediately if the test runs within {@link describe}. + */ + function test(name?: string, fn?: TestFn): Promise; + function test(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function test(options?: TestOptions, fn?: TestFn): Promise; + function test(fn?: TestFn): Promise; + namespace test { + export { + after, + afterEach, + before, + beforeEach, + describe, + it, + run, + mock, + test, + skip, + todo, + only + }; + } + /** + * The `describe()` function imported from the `node:test` module. Each + * invocation of this function results in the creation of a Subtest. + * After invocation of top level `describe` functions, + * all top level tests and suites will execute. + * @param [name='The name'] The name of the suite, which is displayed when reporting test results. + * @param options Configuration options for the suite. supports the same options as `test([name][, options][, fn])`. + * @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object. + * @return Immediately fulfilled with `undefined`. + */ + function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function describe(name?: string, fn?: SuiteFn): Promise; + function describe(options?: TestOptions, fn?: SuiteFn): Promise; + function describe(fn?: SuiteFn): Promise; + namespace describe { + /** + * Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`. + */ + function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function skip(name?: string, fn?: SuiteFn): Promise; + function skip(options?: TestOptions, fn?: SuiteFn): Promise; + function skip(fn?: SuiteFn): Promise; + /** + * Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`. + */ + function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function todo(name?: string, fn?: SuiteFn): Promise; + function todo(options?: TestOptions, fn?: SuiteFn): Promise; + function todo(fn?: SuiteFn): Promise; + /** + * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`. + * @since v18.15.0 + */ + function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function only(name?: string, fn?: SuiteFn): Promise; + function only(options?: TestOptions, fn?: SuiteFn): Promise; + function only(fn?: SuiteFn): Promise; + } + /** + * Shorthand for `test()`. + * + * The `it()` function is imported from the `node:test` module. + * @since v18.6.0, v16.17.0 + */ + function it(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function it(name?: string, fn?: TestFn): Promise; + function it(options?: TestOptions, fn?: TestFn): Promise; + function it(fn?: TestFn): Promise; + namespace it { + /** + * Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`. + */ + function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function skip(name?: string, fn?: TestFn): Promise; + function skip(options?: TestOptions, fn?: TestFn): Promise; + function skip(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`. + */ + function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function todo(name?: string, fn?: TestFn): Promise; + function todo(options?: TestOptions, fn?: TestFn): Promise; + function todo(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`. + * @since v18.15.0 + */ + function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function only(name?: string, fn?: TestFn): Promise; + function only(options?: TestOptions, fn?: TestFn): Promise; + function only(fn?: TestFn): Promise; + } + /** + * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`. + * @since v20.2.0 + */ + function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function skip(name?: string, fn?: TestFn): Promise; + function skip(options?: TestOptions, fn?: TestFn): Promise; + function skip(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`. + * @since v20.2.0 + */ + function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function todo(name?: string, fn?: TestFn): Promise; + function todo(options?: TestOptions, fn?: TestFn): Promise; + function todo(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`. + * @since v20.2.0 + */ + function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function only(name?: string, fn?: TestFn): Promise; + function only(options?: TestOptions, fn?: TestFn): Promise; + function only(fn?: TestFn): Promise; + /** + * The type of a function under test. The first argument to this function is a + * {@link TestContext} object. If the test uses callbacks, the callback function is passed as + * the second argument. + */ + type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise; + /** + * The type of a function under Suite. + */ + type SuiteFn = (s: SuiteContext) => void | Promise; + interface TestShard { + /** + * A positive integer between 1 and `` that specifies the index of the shard to run. + */ + index: number; + /** + * A positive integer that specifies the total number of shards to split the test files to. + */ + total: number; + } + interface RunOptions { + /** + * If a number is provided, then that many files would run in parallel. + * If truthy, it would run (number of cpu cores - 1) files in parallel. + * If falsy, it would only run one file at a time. + * If unspecified, subtests inherit this value from their parent. + * @default true + */ + concurrency?: number | boolean | undefined; + /** + * An array containing the list of files to run. + * If unspecified, the test runner execution model will be used. + */ + files?: readonly string[] | undefined; + /** + * Allows aborting an in-progress test execution. + * @default undefined + */ + signal?: AbortSignal | undefined; + /** + * A number of milliseconds the test will fail after. + * If unspecified, subtests inherit this value from their parent. + * @default Infinity + */ + timeout?: number | undefined; + /** + * Sets inspector port of test child process. + * If a nullish value is provided, each process gets its own port, + * incremented from the primary's `process.debugPort`. + */ + inspectPort?: number | (() => number) | undefined; + /** + * That can be used to only run tests whose name matches the provided pattern. + * Test name patterns are interpreted as JavaScript regular expressions. + * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run. + */ + testNamePatterns?: string | RegExp | string[] | RegExp[]; + /** + * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run. + */ + setup?: (root: Test) => void | Promise; + /** + * Whether to run in watch mode or not. + * @default false + */ + watch?: boolean | undefined; + /** + * Running tests in a specific shard. + * @default undefined + */ + shard?: TestShard | undefined; + } + class Test extends AsyncResource { + concurrency: number; + nesting: number; + only: boolean; + reporter: TestsStream; + runOnlySubtests: boolean; + testNumber: number; + timeout: number | null; + } + /** + * A successful call to `run()` method will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.`TestsStream` will emit events, in the + * order of the tests definition + * @since v18.9.0, v16.19.0 + */ + class TestsStream extends Readable implements NodeJS.ReadableStream { + addListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + addListener(event: 'test:fail', listener: (data: TestFail) => void): this; + addListener(event: 'test:pass', listener: (data: TestPass) => void): this; + addListener(event: 'test:plan', listener: (data: TestPlan) => void): this; + addListener(event: 'test:start', listener: (data: TestStart) => void): this; + addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; + addListener(event: string, listener: (...args: any[]) => void): this; + emit(event: 'test:diagnostic', data: DiagnosticData): boolean; + emit(event: 'test:fail', data: TestFail): boolean; + emit(event: 'test:pass', data: TestPass): boolean; + emit(event: 'test:plan', data: TestPlan): boolean; + emit(event: 'test:start', data: TestStart): boolean; + emit(event: 'test:stderr', data: TestStderr): boolean; + emit(event: 'test:stdout', data: TestStdout): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + on(event: 'test:fail', listener: (data: TestFail) => void): this; + on(event: 'test:pass', listener: (data: TestPass) => void): this; + on(event: 'test:plan', listener: (data: TestPlan) => void): this; + on(event: 'test:start', listener: (data: TestStart) => void): this; + on(event: 'test:stderr', listener: (data: TestStderr) => void): this; + on(event: 'test:stdout', listener: (data: TestStdout) => void): this; + on(event: string, listener: (...args: any[]) => void): this; + once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + once(event: 'test:fail', listener: (data: TestFail) => void): this; + once(event: 'test:pass', listener: (data: TestPass) => void): this; + once(event: 'test:plan', listener: (data: TestPlan) => void): this; + once(event: 'test:start', listener: (data: TestStart) => void): this; + once(event: 'test:stderr', listener: (data: TestStderr) => void): this; + once(event: 'test:stdout', listener: (data: TestStdout) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + prependListener(event: 'test:fail', listener: (data: TestFail) => void): this; + prependListener(event: 'test:pass', listener: (data: TestPass) => void): this; + prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this; + prependListener(event: 'test:start', listener: (data: TestStart) => void): this; + prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this; + prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this; + prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this; + prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this; + prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + } + /** + * An instance of `TestContext` is passed to each test function in order to + * interact with the test runner. However, the `TestContext` constructor is not + * exposed as part of the API. + * @since v18.0.0, v16.17.0 + */ + class TestContext { + /** + * This function is used to create a hook running before subtest of the current test. + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as + * the second argument. Default: A no-op function. + * @param options Configuration options for the hook. + * @since v20.1.0 + */ + before: typeof before; + /** + * This function is used to create a hook running before each subtest of the current test. + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as + * the second argument. Default: A no-op function. + * @param options Configuration options for the hook. + * @since v18.8.0 + */ + beforeEach: typeof beforeEach; + /** + * This function is used to create a hook that runs after the current test finishes. + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as + * the second argument. Default: A no-op function. + * @param options Configuration options for the hook. + * @since v18.13.0 + */ + after: typeof after; + /** + * This function is used to create a hook running after each subtest of the current test. + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as + * the second argument. Default: A no-op function. + * @param options Configuration options for the hook. + * @since v18.8.0 + */ + afterEach: typeof afterEach; + /** + * This function is used to write diagnostics to the output. Any diagnostic + * information is included at the end of the test's results. This function does + * not return a value. + * + * ```js + * test('top level test', (t) => { + * t.diagnostic('A diagnostic message'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Message to be reported. + */ + diagnostic(message: string): void; + /** + * The name of the test. + * @since v18.8.0, v16.18.0 + */ + readonly name: string; + /** + * If `shouldRunOnlyTests` is truthy, the test context will only run tests that + * have the `only` option set. Otherwise, all tests are run. If Node.js was not + * started with the `--test-only` command-line option, this function is a + * no-op. + * + * ```js + * test('top level test', (t) => { + * // The test context can be set to run subtests with the 'only' option. + * t.runOnly(true); + * return Promise.all([ + * t.test('this subtest is now skipped'), + * t.test('this subtest is run', { only: true }), + * ]); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param shouldRunOnlyTests Whether or not to run `only` tests. + */ + runOnly(shouldRunOnlyTests: boolean): void; + /** + * ```js + * test('top level test', async (t) => { + * await fetch('some/uri', { signal: t.signal }); + * }); + * ``` + * @since v18.7.0, v16.17.0 + */ + readonly signal: AbortSignal; + /** + * This function causes the test's output to indicate the test as skipped. If`message` is provided, it is included in the output. Calling `skip()` does + * not terminate execution of the test function. This function does not return a + * value. + * + * ```js + * test('top level test', (t) => { + * // Make sure to return here as well if the test contains additional logic. + * t.skip('this is skipped'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Optional skip message. + */ + skip(message?: string): void; + /** + * This function adds a `TODO` directive to the test's output. If `message` is + * provided, it is included in the output. Calling `todo()` does not terminate + * execution of the test function. This function does not return a value. + * + * ```js + * test('top level test', (t) => { + * // This test is marked as `TODO` + * t.todo('this is a todo'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Optional `TODO` message. + */ + todo(message?: string): void; + /** + * This function is used to create subtests under the current test. This function behaves in + * the same fashion as the top level {@link test} function. + * @since v18.0.0 + * @param name The name of the test, which is displayed when reporting test results. + * Default: The `name` property of fn, or `''` if `fn` does not have a name. + * @param options Configuration options for the test + * @param fn The function under test. This first argument to this function is a + * {@link TestContext} object. If the test uses callbacks, the callback function is + * passed as the second argument. Default: A no-op function. + * @returns A {@link Promise} resolved with `undefined` once the test completes. + */ + test: typeof test; + /** + * Each test provides its own MockTracker instance. + */ + readonly mock: MockTracker; + } + /** + * An instance of `SuiteContext` is passed to each suite function in order to + * interact with the test runner. However, the `SuiteContext` constructor is not + * exposed as part of the API. + * @since v18.7.0, v16.17.0 + */ + class SuiteContext { + /** + * The name of the suite. + * @since v18.8.0, v16.18.0 + */ + readonly name: string; + /** + * Can be used to abort test subtasks when the test has been aborted. + * @since v18.7.0, v16.17.0 + */ + readonly signal: AbortSignal; + } + interface TestOptions { + /** + * If a number is provided, then that many tests would run in parallel. + * If truthy, it would run (number of cpu cores - 1) tests in parallel. + * For subtests, it will be `Infinity` tests in parallel. + * If falsy, it would only run one test at a time. + * If unspecified, subtests inherit this value from their parent. + * @default false + */ + concurrency?: number | boolean | undefined; + /** + * If truthy, and the test context is configured to run `only` tests, then this test will be + * run. Otherwise, the test is skipped. + * @default false + */ + only?: boolean | undefined; + /** + * Allows aborting an in-progress test. + * @since v18.8.0 + */ + signal?: AbortSignal | undefined; + /** + * If truthy, the test is skipped. If a string is provided, that string is displayed in the + * test results as the reason for skipping the test. + * @default false + */ + skip?: boolean | string | undefined; + /** + * A number of milliseconds the test will fail after. If unspecified, subtests inherit this + * value from their parent. + * @default Infinity + * @since v18.7.0 + */ + timeout?: number | undefined; + /** + * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in + * the test results as the reason why the test is `TODO`. + * @default false + */ + todo?: boolean | string | undefined; + } + /** + * This function is used to create a hook running before running a suite. + * + * ```js + * describe('tests', async () => { + * before(() => console.log('about to run some test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. The following properties are supported: + */ + function before(fn?: HookFn, options?: HookOptions): void; + /** + * This function is used to create a hook running after running a suite. + * + * ```js + * describe('tests', async () => { + * after(() => console.log('finished running tests')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. The following properties are supported: + */ + function after(fn?: HookFn, options?: HookOptions): void; + /** + * This function is used to create a hook running + * before each subtest of the current suite. + * + * ```js + * describe('tests', async () => { + * beforeEach(() => console.log('about to run a test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. The following properties are supported: + */ + function beforeEach(fn?: HookFn, options?: HookOptions): void; + /** + * This function is used to create a hook running + * after each subtest of the current test. + * + * ```js + * describe('tests', async () => { + * afterEach(() => console.log('finished running a test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. The following properties are supported: + */ + function afterEach(fn?: HookFn, options?: HookOptions): void; + /** + * The hook function. If the hook uses callbacks, the callback function is passed as the + * second argument. + */ + type HookFn = (s: SuiteContext, done: (result?: any) => void) => any; + /** + * Configuration options for hooks. + * @since v18.8.0 + */ + interface HookOptions { + /** + * Allows aborting an in-progress hook. + */ + signal?: AbortSignal | undefined; + /** + * A number of milliseconds the hook will fail after. If unspecified, subtests inherit this + * value from their parent. + * @default Infinity + */ + timeout?: number | undefined; + } + interface MockFunctionOptions { + /** + * The number of times that the mock will use the behavior of `implementation`. + * Once the mock function has been called `times` times, + * it will automatically restore the behavior of `original`. + * This value must be an integer greater than zero. + * @default Infinity + */ + times?: number | undefined; + } + interface MockMethodOptions extends MockFunctionOptions { + /** + * If `true`, `object[methodName]` is treated as a getter. + * This option cannot be used with the `setter` option. + */ + getter?: boolean | undefined; + /** + * If `true`, `object[methodName]` is treated as a setter. + * This option cannot be used with the `getter` option. + */ + setter?: boolean | undefined; + } + type Mock = F & { + mock: MockFunctionContext; + }; + type NoOpFunction = (...args: any[]) => undefined; + type FunctionPropertyNames = { + [K in keyof T]: T[K] extends Function ? K : never; + }[keyof T]; + /** + * The `MockTracker` class is used to manage mocking functionality. The test runner + * module provides a top level `mock` export which is a `MockTracker` instance. + * Each test also provides its own `MockTracker` instance via the test context's`mock` property. + * @since v19.1.0, v18.13.0 + */ + class MockTracker { + /** + * This function is used to create a mock function. + * + * The following example creates a mock function that increments a counter by one + * on each invocation. The `times` option is used to modify the mock behavior such + * that the first two invocations add two to the counter instead of one. + * + * ```js + * test('mocks a counting function', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne, addTwo, { times: 2 }); + * + * assert.strictEqual(fn(), 2); + * assert.strictEqual(fn(), 4); + * assert.strictEqual(fn(), 5); + * assert.strictEqual(fn(), 6); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param [original='A no-op function'] An optional function to create a mock on. + * @param implementation An optional function used as the mock implementation for `original`. This is useful for creating mocks that exhibit one behavior for a specified number of calls and + * then restore the behavior of `original`. + * @param options Optional configuration options for the mock function. The following properties are supported: + * @return The mocked function. The mocked function contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the + * behavior of the mocked function. + */ + fn(original?: F, options?: MockFunctionOptions): Mock; + fn(original?: F, implementation?: Implementation, options?: MockFunctionOptions): Mock; + /** + * This function is used to create a mock on an existing object method. The + * following example demonstrates how a mock is created on an existing object + * method. + * + * ```js + * test('spies on an object method', (t) => { + * const number = { + * value: 5, + * subtract(a) { + * return this.value - a; + * }, + * }; + * + * t.mock.method(number, 'subtract'); + * assert.strictEqual(number.subtract.mock.calls.length, 0); + * assert.strictEqual(number.subtract(3), 2); + * assert.strictEqual(number.subtract.mock.calls.length, 1); + * + * const call = number.subtract.mock.calls[0]; + * + * assert.deepStrictEqual(call.arguments, [3]); + * assert.strictEqual(call.result, 2); + * assert.strictEqual(call.error, undefined); + * assert.strictEqual(call.target, undefined); + * assert.strictEqual(call.this, number); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param object The object whose method is being mocked. + * @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown. + * @param implementation An optional function used as the mock implementation for `object[methodName]`. + * @param options Optional configuration options for the mock method. The following properties are supported: + * @return The mocked method. The mocked method contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the + * behavior of the mocked method. + */ + method< + MockedObject extends object, + MethodName extends FunctionPropertyNames, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function + ? Mock + : never; + method< + MockedObject extends object, + MethodName extends FunctionPropertyNames, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation: Implementation, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function + ? Mock + : never; + method( + object: MockedObject, + methodName: keyof MockedObject, + options: MockMethodOptions, + ): Mock; + method( + object: MockedObject, + methodName: keyof MockedObject, + implementation: Function, + options: MockMethodOptions, + ): Mock; + + /** + * This function is syntax sugar for `MockTracker.method` with `options.getter`set to `true`. + * @since v19.3.0, v18.13.0 + */ + getter< + MockedObject extends object, + MethodName extends keyof MockedObject, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): Mock<() => MockedObject[MethodName]>; + getter< + MockedObject extends object, + MethodName extends keyof MockedObject, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation?: Implementation, + options?: MockFunctionOptions, + ): Mock<(() => MockedObject[MethodName]) | Implementation>; + /** + * This function is syntax sugar for `MockTracker.method` with `options.setter`set to `true`. + * @since v19.3.0, v18.13.0 + */ + setter< + MockedObject extends object, + MethodName extends keyof MockedObject, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): Mock<(value: MockedObject[MethodName]) => void>; + setter< + MockedObject extends object, + MethodName extends keyof MockedObject, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation?: Implementation, + options?: MockFunctionOptions, + ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTracker` and disassociates the mocks from the`MockTracker` instance. Once disassociated, the mocks can still be used, but the`MockTracker` instance can no longer be + * used to reset their behavior or + * otherwise interact with them. + * + * After each test completes, this function is called on the test context's`MockTracker`. If the global `MockTracker` is used extensively, calling this + * function manually is recommended. + * @since v19.1.0, v18.13.0 + */ + reset(): void; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTracker`. Unlike `mock.reset()`, `mock.restoreAll()` does + * not disassociate the mocks from the `MockTracker` instance. + * @since v19.1.0, v18.13.0 + */ + restoreAll(): void; + timers: MockTimers; + } + const mock: MockTracker; + interface MockFunctionCall< + F extends Function, + ReturnType = F extends (...args: any) => infer T + ? T + : F extends abstract new (...args: any) => infer T + ? T + : unknown, + Args = F extends (...args: infer Y) => any + ? Y + : F extends abstract new (...args: infer Y) => any + ? Y + : unknown[], + > { + /** + * An array of the arguments passed to the mock function. + */ + arguments: Args; + /** + * If the mocked function threw then this property contains the thrown value. + */ + error: unknown | undefined; + /** + * The value returned by the mocked function. + * + * If the mocked function threw, it will be `undefined`. + */ + result: ReturnType | undefined; + /** + * An `Error` object whose stack can be used to determine the callsite of the mocked function invocation. + */ + stack: Error; + /** + * If the mocked function is a constructor, this field contains the class being constructed. + * Otherwise this will be `undefined`. + */ + target: F extends abstract new (...args: any) => any ? F : undefined; + /** + * The mocked function's `this` value. + */ + this: unknown; + } + /** + * The `MockFunctionContext` class is used to inspect or manipulate the behavior of + * mocks created via the `MockTracker` APIs. + * @since v19.1.0, v18.13.0 + */ + class MockFunctionContext { + /** + * A getter that returns a copy of the internal array used to track calls to the + * mock. Each entry in the array is an object with the following properties. + * @since v19.1.0, v18.13.0 + */ + readonly calls: Array>; + /** + * This function returns the number of times that this mock has been invoked. This + * function is more efficient than checking `ctx.calls.length` because `ctx.calls`is a getter that creates a copy of the internal call tracking array. + * @since v19.1.0, v18.13.0 + * @return The number of times that this mock has been invoked. + */ + callCount(): number; + /** + * This function is used to change the behavior of an existing mock. + * + * The following example creates a mock function using `t.mock.fn()`, calls the + * mock function, and then changes the mock implementation to a different function. + * + * ```js + * test('changes a mock behavior', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne); + * + * assert.strictEqual(fn(), 1); + * fn.mock.mockImplementation(addTwo); + * assert.strictEqual(fn(), 3); + * assert.strictEqual(fn(), 5); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param implementation The function to be used as the mock's new implementation. + */ + mockImplementation(implementation: Function): void; + /** + * This function is used to change the behavior of an existing mock for a single + * invocation. Once invocation `onCall` has occurred, the mock will revert to + * whatever behavior it would have used had `mockImplementationOnce()` not been + * called. + * + * The following example creates a mock function using `t.mock.fn()`, calls the + * mock function, changes the mock implementation to a different function for the + * next invocation, and then resumes its previous behavior. + * + * ```js + * test('changes a mock behavior once', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne); + * + * assert.strictEqual(fn(), 1); + * fn.mock.mockImplementationOnce(addTwo); + * assert.strictEqual(fn(), 3); + * assert.strictEqual(fn(), 4); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`. + * @param onCall The invocation number that will use `implementation`. If the specified invocation has already occurred then an exception is thrown. + */ + mockImplementationOnce(implementation: Function, onCall?: number): void; + /** + * Resets the call history of the mock function. + * @since v19.3.0, v18.13.0 + */ + resetCalls(): void; + /** + * Resets the implementation of the mock function to its original behavior. The + * mock can still be used after calling this function. + * @since v19.1.0, v18.13.0 + */ + restore(): void; + } + type Timer = 'setInterval' | 'clearInterval' | 'setTimeout' | 'clearTimeout'; + /** + * Mocking timers is a technique commonly used in software testing to simulate and + * control the behavior of timers, such as `setInterval` and `setTimeout`, + * without actually waiting for the specified time intervals. + * + * The `MockTracker` provides a top-level `timers` export + * which is a `MockTimers` instance. + * @since v20.4.0 + * @experimental + */ + class MockTimers { + /** + * Enables timer mocking for the specified timers. + * + * **Note:** When you enable mocking for a specific timer, its associated + * clear function will also be implicitly mocked. + * + * Example usage: + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.enable(['setInterval']); + * ``` + * + * ```js + * const { mock } = require('node:test'); + * mock.timers.enable(['setInterval']); + * ``` + * + * The above example enables mocking for the `setInterval` timer and + * implicitly mocks the `clearInterval` function. Only the `setInterval`and `clearInterval` functions from `node:timers`,`node:timers/promises`, and`globalThis` will be mocked. + * + * Alternatively, if you call `mock.timers.enable()` without any parameters: + * + * All timers (`'setInterval'`, `'clearInterval'`, `'setTimeout'`, and `'clearTimeout'`) + * will be mocked. The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout`functions from `node:timers`, `node:timers/promises`, + * and `globalThis` will be mocked. + * @since v20.4.0 + */ + enable(timers?: Timer[]): void; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTimers` instance and disassociates the mocks + * from the `MockTracker` instance. + * + * **Note:** After each test completes, this function is called on + * the test context's `MockTracker`. + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.reset(); + * ``` + * + * ```js + * const { mock } = require('node:test'); + * mock.timers.reset(); + * ``` + * @since v20.4.0 + */ + reset(): void; + /** + * Advances time for all mocked timers. + * + * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts + * only positive numbers. In Node.js, `setTimeout` with negative numbers is + * only supported for web compatibility reasons. + * + * The following example mocks a `setTimeout` function and + * by using `.tick` advances in + * time triggering all pending timers. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * + * context.mock.timers.enable(['setTimeout']); + * + * setTimeout(fn, 9999); + * + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * + * setTimeout(fn, 9999); + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * Alternativelly, the `.tick` function can be called many times + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * @since v20.4.0 + */ + tick(milliseconds: number): void; + /** + * Triggers all pending mocked timers immediately. + * + * The example below triggers all pending timers immediately, + * causing them to execute without any delay. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable(['setTimeout']); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * + * assert.deepStrictEqual(results, [3, 2, 1]); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable(['setTimeout']); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * + * assert.deepStrictEqual(results, [3, 2, 1]); + * }); + * ``` + * + * **Note:** The `runAll()` function is specifically designed for + * triggering timers in the context of timer mocking. + * It does not have any effect on real-time system + * clocks or actual timers outside of the mocking environment. + * @since v20.4.0 + */ + runAll(): void; + /** + * Calls {@link MockTimers.reset()}. + */ + [Symbol.dispose](): void; + } + export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo }; +} + +interface DiagnosticData { + /** + * The diagnostic message. + */ + message: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestFail { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration_ms: number; + /** + * The error thrown by the test. + */ + error: Error; + /** + * The type of the test, used to denote whether this is a suite. + * @since 20.0.0, 19.9.0, 18.17.0 + */ + type?: 'suite'; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestPass { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration_ms: number; + /** + * The type of the test, used to denote whether this is a suite. + * @since 20.0.0, 19.9.0, 18.17.0 + */ + type?: 'suite'; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestPlan { + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The number of subtests that have ran. + */ + count: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestStart { + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestStderr { + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The message written to `stderr` + */ + message: string; +} +interface TestStdout { + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The message written to `stdout` + */ + message: string; +} +interface TestEnqueue { + /** + * The test name + */ + name: string; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The nesting level of the test. + */ + nesting: number; +} +interface TestDequeue { + /** + * The test name + */ + name: string; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The nesting level of the test. + */ + nesting: number; +} + +/** + * The `node:test/reporters` module exposes the builtin-reporters for `node:test`. + * To access it: + * + * ```js + * import test from 'node:test/reporters'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import test from 'test/reporters'; + * ``` + * @since v19.9.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js) + */ +declare module 'node:test/reporters' { + import { Transform } from 'node:stream'; + + type TestEvent = + | { type: 'test:diagnostic', data: DiagnosticData } + | { type: 'test:fail', data: TestFail } + | { type: 'test:pass', data: TestPass } + | { type: 'test:plan', data: TestPlan } + | { type: 'test:start', data: TestStart } + | { type: 'test:stderr', data: TestStderr } + | { type: 'test:stdout', data: TestStdout } + | { type: 'test:enqueue', data: TestEnqueue } + | { type: 'test:dequeue', data: TestDequeue } + | { type: 'test:watch:drained' }; + type TestEventGenerator = AsyncGenerator; + + /** + * The `dot` reporter outputs the test results in a compact format, + * where each passing test is represented by a `.`, + * and each failing test is represented by a `X`. + */ + function dot(source: TestEventGenerator): AsyncGenerator<'\n' | '.' | 'X', void>; + /** + * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. + */ + function tap(source: TestEventGenerator): AsyncGenerator; + /** + * The `spec` reporter outputs the test results in a human-readable format. + */ + class Spec extends Transform { + constructor(); + } + export { dot, tap, Spec as spec, TestEvent }; +} diff --git a/node_modules/@types/node/timers.d.ts b/node_modules/@types/node/timers.d.ts new file mode 100755 index 0000000..51acc4e --- /dev/null +++ b/node_modules/@types/node/timers.d.ts @@ -0,0 +1,225 @@ +/** + * The `timer` module exposes a global API for scheduling functions to + * be called at some future period of time. Because the timer functions are + * globals, there is no need to call `require('node:timers')` to use the API. + * + * The timer functions within Node.js implement a similar API as the timers API + * provided by Web Browsers but use a different internal implementation that is + * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout). + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/timers.js) + */ +declare module 'timers' { + import { Abortable } from 'node:events'; + import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises'; + interface TimerOptions extends Abortable { + /** + * Set to `false` to indicate that the scheduled `Timeout` + * should not require the Node.js event loop to remain active. + * @default true + */ + ref?: boolean | undefined; + } + let setTimeout: typeof global.setTimeout; + let clearTimeout: typeof global.clearTimeout; + let setInterval: typeof global.setInterval; + let clearInterval: typeof global.clearInterval; + let setImmediate: typeof global.setImmediate; + let clearImmediate: typeof global.clearImmediate; + global { + namespace NodeJS { + // compatibility with older typings + interface Timer extends RefCounted { + hasRef(): boolean; + refresh(): this; + [Symbol.toPrimitive](): number; + } + /** + * This object is created internally and is returned from `setImmediate()`. It + * can be passed to `clearImmediate()` in order to cancel the scheduled + * actions. + * + * By default, when an immediate is scheduled, the Node.js event loop will continue + * running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`functions that can be used to + * control this default behavior. + */ + class Immediate implements RefCounted { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the`Immediate` is active. Calling `immediate.ref()` multiple times will have no + * effect. + * + * By default, all `Immediate` objects are "ref'ed", making it normally unnecessary + * to call `immediate.ref()` unless `immediate.unref()` had been called previously. + * @since v9.7.0 + * @return a reference to `immediate` + */ + ref(): this; + /** + * When called, the active `Immediate` object will not require the Node.js event + * loop to remain active. If there is no other activity keeping the event loop + * running, the process may exit before the `Immediate` object's callback is + * invoked. Calling `immediate.unref()` multiple times will have no effect. + * @since v9.7.0 + * @return a reference to `immediate` + */ + unref(): this; + /** + * If true, the `Immediate` object will keep the Node.js event loop active. + * @since v11.0.0 + */ + hasRef(): boolean; + _onImmediate: Function; // to distinguish it from the Timeout class + /** + * Cancels the immediate. This is similar to calling `clearImmediate()`. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + } + /** + * This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the + * scheduled actions. + * + * By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the + * timer is active. Each of the `Timeout` objects returned by these functions + * export both `timeout.ref()` and `timeout.unref()` functions that can be used to + * control this default behavior. + */ + class Timeout implements Timer { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect. + * + * By default, all `Timeout` objects are "ref'ed", making it normally unnecessary + * to call `timeout.ref()` unless `timeout.unref()` had been called previously. + * @since v0.9.1 + * @return a reference to `timeout` + */ + ref(): this; + /** + * When called, the active `Timeout` object will not require the Node.js event loop + * to remain active. If there is no other activity keeping the event loop running, + * the process may exit before the `Timeout` object's callback is invoked. Calling`timeout.unref()` multiple times will have no effect. + * @since v0.9.1 + * @return a reference to `timeout` + */ + unref(): this; + /** + * If true, the `Timeout` object will keep the Node.js event loop active. + * @since v11.0.0 + */ + hasRef(): boolean; + /** + * Sets the timer's start time to the current time, and reschedules the timer to + * call its callback at the previously specified duration adjusted to the current + * time. This is useful for refreshing a timer without allocating a new + * JavaScript object. + * + * Using this on a timer that has already called its callback will reactivate the + * timer. + * @since v10.2.0 + * @return a reference to `timeout` + */ + refresh(): this; + [Symbol.toPrimitive](): number; + /** + * Cancels the timeout. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + } + } + /** + * Schedules execution of a one-time `callback` after `delay` milliseconds. + * + * The `callback` will likely not be invoked in precisely `delay` milliseconds. + * Node.js makes no guarantees about the exact timing of when callbacks will fire, + * nor of their ordering. The callback will be called as close as possible to the + * time specified. + * + * When `delay` is larger than `2147483647` or less than `1`, the `delay`will be set to `1`. Non-integer delays are truncated to an integer. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setTimeout()`. + * @since v0.0.1 + * @param callback The function to call when the timer elapses. + * @param [delay=1] The number of milliseconds to wait before calling the `callback`. + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearTimeout} + */ + function setTimeout(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout; + // util.promisify no rest args compability + // tslint:disable-next-line void-return + function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout; + namespace setTimeout { + const __promisify__: typeof setTimeoutPromise; + } + /** + * Cancels a `Timeout` object created by `setTimeout()`. + * @since v0.0.1 + * @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number. + */ + function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void; + /** + * Schedules repeated execution of `callback` every `delay` milliseconds. + * + * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be + * set to `1`. Non-integer delays are truncated to an integer. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setInterval()`. + * @since v0.0.1 + * @param callback The function to call when the timer elapses. + * @param [delay=1] The number of milliseconds to wait before calling the `callback`. + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearInterval} + */ + function setInterval(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout; + // util.promisify no rest args compability + // tslint:disable-next-line void-return + function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout; + namespace setInterval { + const __promisify__: typeof setIntervalPromise; + } + /** + * Cancels a `Timeout` object created by `setInterval()`. + * @since v0.0.1 + * @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number. + */ + function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void; + /** + * Schedules the "immediate" execution of the `callback` after I/O events' + * callbacks. + * + * When multiple calls to `setImmediate()` are made, the `callback` functions are + * queued for execution in the order in which they are created. The entire callback + * queue is processed every event loop iteration. If an immediate timer is queued + * from inside an executing callback, that timer will not be triggered until the + * next event loop iteration. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setImmediate()`. + * @since v0.9.1 + * @param callback The function to call at the end of this turn of the Node.js `Event Loop` + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearImmediate} + */ + function setImmediate(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate; + // util.promisify no rest args compability + // tslint:disable-next-line void-return + function setImmediate(callback: (args: void) => void): NodeJS.Immediate; + namespace setImmediate { + const __promisify__: typeof setImmediatePromise; + } + /** + * Cancels an `Immediate` object created by `setImmediate()`. + * @since v0.9.1 + * @param immediate An `Immediate` object as returned by {@link setImmediate}. + */ + function clearImmediate(immediateId: NodeJS.Immediate | undefined): void; + function queueMicrotask(callback: () => void): void; + } +} +declare module 'node:timers' { + export * from 'timers'; +} diff --git a/node_modules/@types/node/timers/promises.d.ts b/node_modules/@types/node/timers/promises.d.ts new file mode 100755 index 0000000..299a355 --- /dev/null +++ b/node_modules/@types/node/timers/promises.d.ts @@ -0,0 +1,93 @@ +/** + * The `timers/promises` API provides an alternative set of timer functions + * that return `Promise` objects. The API is accessible via`require('node:timers/promises')`. + * + * ```js + * import { + * setTimeout, + * setImmediate, + * setInterval, + * } from 'timers/promises'; + * ``` + * @since v15.0.0 + */ +declare module 'timers/promises' { + import { TimerOptions } from 'node:timers'; + /** + * ```js + * import { + * setTimeout, + * } from 'timers/promises'; + * + * const res = await setTimeout(100, 'result'); + * + * console.log(res); // Prints 'result' + * ``` + * @since v15.0.0 + * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. + * @param value A value with which the promise is fulfilled. + */ + function setTimeout(delay?: number, value?: T, options?: TimerOptions): Promise; + /** + * ```js + * import { + * setImmediate, + * } from 'timers/promises'; + * + * const res = await setImmediate('result'); + * + * console.log(res); // Prints 'result' + * ``` + * @since v15.0.0 + * @param value A value with which the promise is fulfilled. + */ + function setImmediate(value?: T, options?: TimerOptions): Promise; + /** + * Returns an async iterator that generates values in an interval of `delay` ms. + * If `ref` is `true`, you need to call `next()` of async iterator explicitly + * or implicitly to keep the event loop alive. + * + * ```js + * import { + * setInterval, + * } from 'timers/promises'; + * + * const interval = 100; + * for await (const startTime of setInterval(interval, Date.now())) { + * const now = Date.now(); + * console.log(now); + * if ((now - startTime) > 1000) + * break; + * } + * console.log(Date.now()); + * ``` + * @since v15.9.0 + */ + function setInterval(delay?: number, value?: T, options?: TimerOptions): AsyncIterable; + interface Scheduler { + /** + * ```js + * import { scheduler } from 'node:timers/promises'; + * + * await scheduler.wait(1000); // Wait one second before continuing + * ``` + * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API. + * Calling timersPromises.scheduler.wait(delay, options) is roughly equivalent to calling timersPromises.setTimeout(delay, undefined, options) except that the ref option is not supported. + * @since v16.14.0 + * @experimental + * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. + */ + wait: (delay?: number, options?: TimerOptions) => Promise; + /** + * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API. + * Calling timersPromises.scheduler.yield() is equivalent to calling timersPromises.setImmediate() with no arguments. + * @since v16.14.0 + * @experimental + */ + yield: () => Promise; + } + const scheduler: Scheduler; +} +declare module 'node:timers/promises' { + export * from 'timers/promises'; +} diff --git a/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts new file mode 100755 index 0000000..4992b24 --- /dev/null +++ b/node_modules/@types/node/tls.d.ts @@ -0,0 +1,1130 @@ +/** + * The `node:tls` module provides an implementation of the Transport Layer Security + * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. + * The module can be accessed using: + * + * ```js + * const tls = require('node:tls'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js) + */ +declare module 'tls' { + import { X509Certificate } from 'node:crypto'; + import * as net from 'node:net'; + import * as stream from 'stream'; + const CLIENT_RENEG_LIMIT: number; + const CLIENT_RENEG_WINDOW: number; + interface Certificate { + /** + * Country code. + */ + C: string; + /** + * Street. + */ + ST: string; + /** + * Locality. + */ + L: string; + /** + * Organization. + */ + O: string; + /** + * Organizational unit. + */ + OU: string; + /** + * Common name. + */ + CN: string; + } + interface PeerCertificate { + /** + * `true` if a Certificate Authority (CA), `false` otherwise. + * @since v18.13.0 + */ + ca: boolean; + /** + * The DER encoded X.509 certificate data. + */ + raw: Buffer; + /** + * The certificate subject. + */ + subject: Certificate; + /** + * The certificate issuer, described in the same terms as the `subject`. + */ + issuer: Certificate; + /** + * The date-time the certificate is valid from. + */ + valid_from: string; + /** + * The date-time the certificate is valid to. + */ + valid_to: string; + /** + * The certificate serial number, as a hex string. + */ + serialNumber: string; + /** + * The SHA-1 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint: string; + /** + * The SHA-256 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint256: string; + /** + * The SHA-512 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint512: string; + /** + * The extended key usage, a set of OIDs. + */ + ext_key_usage?: string[]; + /** + * A string containing concatenated names for the subject, + * an alternative to the `subject` names. + */ + subjectaltname?: string; + /** + * An array describing the AuthorityInfoAccess, used with OCSP. + */ + infoAccess?: NodeJS.Dict; + /** + * For RSA keys: The RSA bit size. + * + * For EC keys: The key size in bits. + */ + bits?: number; + /** + * The RSA exponent, as a string in hexadecimal number notation. + */ + exponent?: string; + /** + * The RSA modulus, as a hexadecimal string. + */ + modulus?: string; + /** + * The public key. + */ + pubkey?: Buffer; + /** + * The ASN.1 name of the OID of the elliptic curve. + * Well-known curves are identified by an OID. + * While it is unusual, it is possible that the curve + * is identified by its mathematical properties, + * in which case it will not have an OID. + */ + asn1Curve?: string; + /** + * The NIST name for the elliptic curve,if it has one + * (not all well-known curves have been assigned names by NIST). + */ + nistCurve?: string; + } + interface DetailedPeerCertificate extends PeerCertificate { + /** + * The issuer certificate object. + * For self-signed certificates, this may be a circular reference. + */ + issuerCertificate: DetailedPeerCertificate; + } + interface CipherNameAndProtocol { + /** + * The cipher name. + */ + name: string; + /** + * SSL/TLS protocol version. + */ + version: string; + /** + * IETF name for the cipher suite. + */ + standardName: string; + } + interface EphemeralKeyInfo { + /** + * The supported types are 'DH' and 'ECDH'. + */ + type: string; + /** + * The name property is available only when type is 'ECDH'. + */ + name?: string | undefined; + /** + * The size of parameter of an ephemeral key exchange. + */ + size: number; + } + interface KeyObject { + /** + * Private keys in PEM format. + */ + pem: string | Buffer; + /** + * Optional passphrase. + */ + passphrase?: string | undefined; + } + interface PxfObject { + /** + * PFX or PKCS12 encoded private key and certificate chain. + */ + buf: string | Buffer; + /** + * Optional passphrase. + */ + passphrase?: string | undefined; + } + interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { + /** + * If true the TLS socket will be instantiated in server-mode. + * Defaults to false. + */ + isServer?: boolean | undefined; + /** + * An optional net.Server instance. + */ + server?: net.Server | undefined; + /** + * An optional Buffer instance containing a TLS session. + */ + session?: Buffer | undefined; + /** + * If true, specifies that the OCSP status request extension will be + * added to the client hello and an 'OCSPResponse' event will be + * emitted on the socket before establishing a secure communication + */ + requestOCSP?: boolean | undefined; + } + /** + * Performs transparent encryption of written data and all required TLS + * negotiation. + * + * Instances of `tls.TLSSocket` implement the duplex `Stream` interface. + * + * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the + * connection is open. + * @since v0.11.4 + */ + class TLSSocket extends net.Socket { + /** + * Construct a new tls.TLSSocket object from an existing TCP socket. + */ + constructor(socket: net.Socket, options?: TLSSocketOptions); + /** + * This property is `true` if the peer certificate was signed by one of the CAs + * specified when creating the `tls.TLSSocket` instance, otherwise `false`. + * @since v0.11.4 + */ + authorized: boolean; + /** + * Returns the reason why the peer's certificate was not been verified. This + * property is set only when `tlsSocket.authorized === false`. + * @since v0.11.4 + */ + authorizationError: Error; + /** + * Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances. + * @since v0.11.4 + */ + encrypted: true; + /** + * String containing the selected ALPN protocol. + * Before a handshake has completed, this value is always null. + * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false. + */ + alpnProtocol: string | false | null; + /** + * Returns an object representing the local certificate. The returned object has + * some properties corresponding to the fields of the certificate. + * + * See {@link TLSSocket.getPeerCertificate} for an example of the certificate + * structure. + * + * If there is no local certificate, an empty object will be returned. If the + * socket has been destroyed, `null` will be returned. + * @since v11.2.0 + */ + getCertificate(): PeerCertificate | object | null; + /** + * Returns an object containing information on the negotiated cipher suite. + * + * For example, a TLSv1.2 protocol with AES256-SHA cipher: + * + * ```json + * { + * "name": "AES256-SHA", + * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA", + * "version": "SSLv3" + * } + * ``` + * + * See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information. + * @since v0.11.4 + */ + getCipher(): CipherNameAndProtocol; + /** + * Returns an object representing the type, name, and size of parameter of + * an ephemeral key exchange in `perfect forward secrecy` on a client + * connection. It returns an empty object when the key exchange is not + * ephemeral. As this is only supported on a client socket; `null` is returned + * if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The`name` property is available only when type is `'ECDH'`. + * + * For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`. + * @since v5.0.0 + */ + getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; + /** + * As the `Finished` messages are message digests of the complete handshake + * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can + * be used for external authentication procedures when the authentication + * provided by SSL/TLS is not desired or is not enough. + * + * Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used + * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + * @since v9.9.0 + * @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet. + */ + getFinished(): Buffer | undefined; + /** + * Returns an object representing the peer's certificate. If the peer does not + * provide a certificate, an empty object will be returned. If the socket has been + * destroyed, `null` will be returned. + * + * If the full certificate chain was requested, each certificate will include an`issuerCertificate` property containing an object representing its issuer's + * certificate. + * @since v0.11.4 + * @param detailed Include the full certificate chain if `true`, otherwise include just the peer's certificate. + * @return A certificate object. + */ + getPeerCertificate(detailed: true): DetailedPeerCertificate; + getPeerCertificate(detailed?: false): PeerCertificate; + getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; + /** + * As the `Finished` messages are message digests of the complete handshake + * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can + * be used for external authentication procedures when the authentication + * provided by SSL/TLS is not desired or is not enough. + * + * Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used + * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + * @since v9.9.0 + * @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so + * far. + */ + getPeerFinished(): Buffer | undefined; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the + * current connection. The value `'unknown'` will be returned for connected + * sockets that have not completed the handshaking process. The value `null` will + * be returned for server sockets or disconnected client sockets. + * + * Protocol versions are: + * + * * `'SSLv3'` + * * `'TLSv1'` + * * `'TLSv1.1'` + * * `'TLSv1.2'` + * * `'TLSv1.3'` + * + * See the OpenSSL [`SSL_get_version`](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html) documentation for more information. + * @since v5.7.0 + */ + getProtocol(): string | null; + /** + * Returns the TLS session data or `undefined` if no session was + * negotiated. On the client, the data can be provided to the `session` option of {@link connect} to resume the connection. On the server, it may be useful + * for debugging. + * + * See `Session Resumption` for more information. + * + * Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications + * must use the `'session'` event (it also works for TLSv1.2 and below). + * @since v0.11.4 + */ + getSession(): Buffer | undefined; + /** + * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information. + * @since v12.11.0 + * @return List of signature algorithms shared between the server and the client in the order of decreasing preference. + */ + getSharedSigalgs(): string[]; + /** + * For a client, returns the TLS session ticket if one is available, or`undefined`. For a server, always returns `undefined`. + * + * It may be useful for debugging. + * + * See `Session Resumption` for more information. + * @since v0.11.4 + */ + getTLSTicket(): Buffer | undefined; + /** + * See `Session Resumption` for more information. + * @since v0.5.6 + * @return `true` if the session was reused, `false` otherwise. + */ + isSessionReused(): boolean; + /** + * The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. + * Upon completion, the `callback` function will be passed a single argument + * that is either an `Error` (if the request failed) or `null`. + * + * This method can be used to request a peer's certificate after the secure + * connection has been established. + * + * When running as the server, the socket will be destroyed with an error after`handshakeTimeout` timeout. + * + * For TLSv1.3, renegotiation cannot be initiated, it is not supported by the + * protocol. + * @since v0.11.8 + * @param callback If `renegotiate()` returned `true`, callback is attached once to the `'secure'` event. If `renegotiate()` returned `false`, `callback` will be called in the next tick with + * an error, unless the `tlsSocket` has been destroyed, in which case `callback` will not be called at all. + * @return `true` if renegotiation was initiated, `false` otherwise. + */ + renegotiate( + options: { + rejectUnauthorized?: boolean | undefined; + requestCert?: boolean | undefined; + }, + callback: (err: Error | null) => void + ): undefined | boolean; + /** + * The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. + * Returns `true` if setting the limit succeeded; `false` otherwise. + * + * Smaller fragment sizes decrease the buffering latency on the client: larger + * fragments are buffered by the TLS layer until the entire fragment is received + * and its integrity is verified; large fragments can span multiple roundtrips + * and their processing can be delayed due to packet loss or reordering. However, + * smaller fragments add extra TLS framing bytes and CPU overhead, which may + * decrease overall server throughput. + * @since v0.11.11 + * @param [size=16384] The maximum TLS fragment size. The maximum value is `16384`. + */ + setMaxSendFragment(size: number): boolean; + /** + * Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts + * to renegotiate will trigger an `'error'` event on the `TLSSocket`. + * @since v8.4.0 + */ + disableRenegotiation(): void; + /** + * When enabled, TLS packet trace information is written to `stderr`. This can be + * used to debug TLS connection problems. + * + * The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by + * OpenSSL's `SSL_trace()` function, the format is undocumented, can change + * without notice, and should not be relied on. + * @since v12.2.0 + */ + enableTrace(): void; + /** + * Returns the peer certificate as an `X509Certificate` object. + * + * If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned. + * @since v15.9.0 + */ + getPeerX509Certificate(): X509Certificate | undefined; + /** + * Returns the local certificate as an `X509Certificate` object. + * + * If there is no local certificate, or the socket has been destroyed,`undefined` will be returned. + * @since v15.9.0 + */ + getX509Certificate(): X509Certificate | undefined; + /** + * Keying material is used for validations to prevent different kind of attacks in + * network protocols, for example in the specifications of IEEE 802.1X. + * + * Example + * + * ```js + * const keyingMaterial = tlsSocket.exportKeyingMaterial( + * 128, + * 'client finished'); + * + * /* + * Example return value of keyingMaterial: + * + * + * ``` + * + * See the OpenSSL [`SSL_export_keying_material`](https://www.openssl.org/docs/man1.1.1/man3/SSL_export_keying_material.html) documentation for more + * information. + * @since v13.10.0, v12.17.0 + * @param length number of bytes to retrieve from keying material + * @param label an application specific label, typically this will be a value from the [IANA Exporter Label + * Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). + * @param context Optionally provide a context. + * @return requested bytes of the keying material + */ + exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + addListener(event: 'secureConnect', listener: () => void): this; + addListener(event: 'session', listener: (session: Buffer) => void): this; + addListener(event: 'keylog', listener: (line: Buffer) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'OCSPResponse', response: Buffer): boolean; + emit(event: 'secureConnect'): boolean; + emit(event: 'session', session: Buffer): boolean; + emit(event: 'keylog', line: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + on(event: 'secureConnect', listener: () => void): this; + on(event: 'session', listener: (session: Buffer) => void): this; + on(event: 'keylog', listener: (line: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + once(event: 'secureConnect', listener: () => void): this; + once(event: 'session', listener: (session: Buffer) => void): this; + once(event: 'keylog', listener: (line: Buffer) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + prependListener(event: 'secureConnect', listener: () => void): this; + prependListener(event: 'session', listener: (session: Buffer) => void): this; + prependListener(event: 'keylog', listener: (line: Buffer) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + prependOnceListener(event: 'secureConnect', listener: () => void): this; + prependOnceListener(event: 'session', listener: (session: Buffer) => void): this; + prependOnceListener(event: 'keylog', listener: (line: Buffer) => void): this; + } + interface CommonConnectionOptions { + /** + * An optional TLS context object from tls.createSecureContext() + */ + secureContext?: SecureContext | undefined; + /** + * When enabled, TLS packet trace information is written to `stderr`. This can be + * used to debug TLS connection problems. + * @default false + */ + enableTrace?: boolean | undefined; + /** + * If true the server will request a certificate from clients that + * connect and attempt to verify that certificate. Defaults to + * false. + */ + requestCert?: boolean | undefined; + /** + * An array of strings or a Buffer naming possible ALPN protocols. + * (Protocols should be ordered by their priority.) + */ + ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined; + /** + * SNICallback(servername, cb) A function that will be + * called if the client supports SNI TLS extension. Two arguments + * will be passed when called: servername and cb. SNICallback should + * invoke cb(null, ctx), where ctx is a SecureContext instance. + * (tls.createSecureContext(...) can be used to get a proper + * SecureContext.) If SNICallback wasn't provided the default callback + * with high-level API will be used (see below). + */ + SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined; + /** + * If true the server will reject any connection which is not + * authorized with the list of supplied CAs. This option only has an + * effect if requestCert is true. + * @default true + */ + rejectUnauthorized?: boolean | undefined; + } + interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { + /** + * Abort the connection if the SSL/TLS handshake does not finish in the + * specified number of milliseconds. A 'tlsClientError' is emitted on + * the tls.Server object whenever a handshake times out. Default: + * 120000 (120 seconds). + */ + handshakeTimeout?: number | undefined; + /** + * The number of seconds after which a TLS session created by the + * server will no longer be resumable. See Session Resumption for more + * information. Default: 300. + */ + sessionTimeout?: number | undefined; + /** + * 48-bytes of cryptographically strong pseudo-random data. + */ + ticketKeys?: Buffer | undefined; + /** + * + * @param socket + * @param identity identity parameter sent from the client. + * @return pre-shared key that must either be + * a buffer or `null` to stop the negotiation process. Returned PSK must be + * compatible with the selected cipher's digest. + * + * When negotiating TLS-PSK (pre-shared keys), this function is called + * with the identity provided by the client. + * If the return value is `null` the negotiation process will stop and an + * "unknown_psk_identity" alert message will be sent to the other party. + * If the server wishes to hide the fact that the PSK identity was not known, + * the callback must provide some random data as `psk` to make the connection + * fail with "decrypt_error" before negotiation is finished. + * PSK ciphers are disabled by default, and using TLS-PSK thus + * requires explicitly specifying a cipher suite with the `ciphers` option. + * More information can be found in the RFC 4279. + */ + pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null; + /** + * hint to send to a client to help + * with selecting the identity during TLS-PSK negotiation. Will be ignored + * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be + * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. + */ + pskIdentityHint?: string | undefined; + } + interface PSKCallbackNegotation { + psk: DataView | NodeJS.TypedArray; + identity: string; + } + interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { + host?: string | undefined; + port?: number | undefined; + path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. + socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket + checkServerIdentity?: typeof checkServerIdentity | undefined; + servername?: string | undefined; // SNI TLS Extension + session?: Buffer | undefined; + minDHSize?: number | undefined; + lookup?: net.LookupFunction | undefined; + timeout?: number | undefined; + /** + * When negotiating TLS-PSK (pre-shared keys), this function is called + * with optional identity `hint` provided by the server or `null` + * in case of TLS 1.3 where `hint` was removed. + * It will be necessary to provide a custom `tls.checkServerIdentity()` + * for the connection as the default one will try to check hostname/IP + * of the server against the certificate but that's not applicable for PSK + * because there won't be a certificate present. + * More information can be found in the RFC 4279. + * + * @param hint message sent from the server to help client + * decide which identity to use during negotiation. + * Always `null` if TLS 1.3 is used. + * @returns Return `null` to stop the negotiation process. `psk` must be + * compatible with the selected cipher's digest. + * `identity` must use UTF-8 encoding. + */ + pskCallback?(hint: string | null): PSKCallbackNegotation | null; + } + /** + * Accepts encrypted connections using TLS or SSL. + * @since v0.3.2 + */ + class Server extends net.Server { + constructor(secureConnectionListener?: (socket: TLSSocket) => void); + constructor(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void); + /** + * The `server.addContext()` method adds a secure context that will be used if + * the client request's SNI name matches the supplied `hostname` (or wildcard). + * + * When there are multiple matching contexts, the most recently added one is + * used. + * @since v0.5.3 + * @param hostname A SNI host name or wildcard (e.g. `'*'`) + * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created + * with {@link createSecureContext} itself. + */ + addContext(hostname: string, context: SecureContextOptions): void; + /** + * Returns the session ticket keys. + * + * See `Session Resumption` for more information. + * @since v3.0.0 + * @return A 48-byte buffer containing the session ticket keys. + */ + getTicketKeys(): Buffer; + /** + * The `server.setSecureContext()` method replaces the secure context of an + * existing server. Existing connections to the server are not interrupted. + * @since v11.0.0 + * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). + */ + setSecureContext(options: SecureContextOptions): void; + /** + * Sets the session ticket keys. + * + * Changes to the ticket keys are effective only for future server connections. + * Existing or currently pending server connections will use the previous keys. + * + * See `Session Resumption` for more information. + * @since v3.0.0 + * @param keys A 48-byte buffer containing the session ticket keys. + */ + setTicketKeys(keys: Buffer): void; + /** + * events.EventEmitter + * 1. tlsClientError + * 2. newSession + * 3. OCSPRequest + * 4. resumeSession + * 5. secureConnection + * 6. keylog + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + addListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + addListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'tlsClientError', err: Error, tlsSocket: TLSSocket): boolean; + emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean; + emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; + emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void): boolean; + emit(event: 'secureConnection', tlsSocket: TLSSocket): boolean; + emit(event: 'keylog', line: Buffer, tlsSocket: TLSSocket): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + on(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + on(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + once(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + once(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + prependListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + prependOnceListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + prependOnceListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + prependOnceListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + } + /** + * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. + */ + interface SecurePair { + encrypted: TLSSocket; + cleartext: TLSSocket; + } + type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; + interface SecureContextOptions { + /** + * If set, this will be called when a client opens a connection using the ALPN extension. + * One argument will be passed to the callback: an object containing `servername` and `protocols` fields, + * respectively containing the server name from the SNI extension (if any) and an array of + * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, + * which will be returned to the client as the selected ALPN protocol, or `undefined`, + * to reject the connection with a fatal alert. If a string is returned that does not match one of + * the client's ALPN protocols, an error will be thrown. + * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error. + */ + ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined; + /** + * Optionally override the trusted CA certificates. Default is to trust + * the well-known CAs curated by Mozilla. Mozilla's CAs are completely + * replaced when CAs are explicitly specified using this option. + */ + ca?: string | Buffer | Array | undefined; + /** + * Cert chains in PEM format. One cert chain should be provided per + * private key. Each cert chain should consist of the PEM formatted + * certificate for a provided private key, followed by the PEM + * formatted intermediate certificates (if any), in order, and not + * including the root CA (the root CA must be pre-known to the peer, + * see ca). When providing multiple cert chains, they do not have to + * be in the same order as their private keys in key. If the + * intermediate certificates are not provided, the peer will not be + * able to validate the certificate, and the handshake will fail. + */ + cert?: string | Buffer | Array | undefined; + /** + * Colon-separated list of supported signature algorithms. The list + * can contain digest algorithms (SHA256, MD5 etc.), public key + * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g + * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). + */ + sigalgs?: string | undefined; + /** + * Cipher suite specification, replacing the default. For more + * information, see modifying the default cipher suite. Permitted + * ciphers can be obtained via tls.getCiphers(). Cipher names must be + * uppercased in order for OpenSSL to accept them. + */ + ciphers?: string | undefined; + /** + * Name of an OpenSSL engine which can provide the client certificate. + */ + clientCertEngine?: string | undefined; + /** + * PEM formatted CRLs (Certificate Revocation Lists). + */ + crl?: string | Buffer | Array | undefined; + /** + * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy. + * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available. + * ECDHE-based perfect forward secrecy will still be available. + */ + dhparam?: string | Buffer | undefined; + /** + * A string describing a named curve or a colon separated list of curve + * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key + * agreement. Set to auto to select the curve automatically. Use + * crypto.getCurves() to obtain a list of available curve names. On + * recent releases, openssl ecparam -list_curves will also display the + * name and description of each available elliptic curve. Default: + * tls.DEFAULT_ECDH_CURVE. + */ + ecdhCurve?: string | undefined; + /** + * Attempt to use the server's cipher suite preferences instead of the + * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be + * set in secureOptions + */ + honorCipherOrder?: boolean | undefined; + /** + * Private keys in PEM format. PEM allows the option of private keys + * being encrypted. Encrypted keys will be decrypted with + * options.passphrase. Multiple keys using different algorithms can be + * provided either as an array of unencrypted key strings or buffers, + * or an array of objects in the form {pem: [, + * passphrase: ]}. The object form can only occur in an array. + * object.passphrase is optional. Encrypted keys will be decrypted with + * object.passphrase if provided, or options.passphrase if it is not. + */ + key?: string | Buffer | Array | undefined; + /** + * Name of an OpenSSL engine to get private key from. Should be used + * together with privateKeyIdentifier. + */ + privateKeyEngine?: string | undefined; + /** + * Identifier of a private key managed by an OpenSSL engine. Should be + * used together with privateKeyEngine. Should not be set together with + * key, because both options define a private key in different ways. + */ + privateKeyIdentifier?: string | undefined; + /** + * Optionally set the maximum TLS version to allow. One + * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the + * `secureProtocol` option, use one or the other. + * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using + * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to + * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. + */ + maxVersion?: SecureVersion | undefined; + /** + * Optionally set the minimum TLS version to allow. One + * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the + * `secureProtocol` option, use one or the other. It is not recommended to use + * less than TLSv1.2, but it may be required for interoperability. + * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using + * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to + * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to + * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. + */ + minVersion?: SecureVersion | undefined; + /** + * Shared passphrase used for a single private key and/or a PFX. + */ + passphrase?: string | undefined; + /** + * PFX or PKCS12 encoded private key and certificate chain. pfx is an + * alternative to providing key and cert individually. PFX is usually + * encrypted, if it is, passphrase will be used to decrypt it. Multiple + * PFX can be provided either as an array of unencrypted PFX buffers, + * or an array of objects in the form {buf: [, + * passphrase: ]}. The object form can only occur in an array. + * object.passphrase is optional. Encrypted PFX will be decrypted with + * object.passphrase if provided, or options.passphrase if it is not. + */ + pfx?: string | Buffer | Array | undefined; + /** + * Optionally affect the OpenSSL protocol behavior, which is not + * usually necessary. This should be used carefully if at all! Value is + * a numeric bitmask of the SSL_OP_* options from OpenSSL Options + */ + secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options + /** + * Legacy mechanism to select the TLS protocol version to use, it does + * not support independent control of the minimum and maximum version, + * and does not support limiting the protocol to TLSv1.3. Use + * minVersion and maxVersion instead. The possible values are listed as + * SSL_METHODS, use the function names as strings. For example, use + * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow + * any TLS protocol version up to TLSv1.3. It is not recommended to use + * TLS versions less than 1.2, but it may be required for + * interoperability. Default: none, see minVersion. + */ + secureProtocol?: string | undefined; + /** + * Opaque identifier used by servers to ensure session state is not + * shared between applications. Unused by clients. + */ + sessionIdContext?: string | undefined; + /** + * 48-bytes of cryptographically strong pseudo-random data. + * See Session Resumption for more information. + */ + ticketKeys?: Buffer | undefined; + /** + * The number of seconds after which a TLS session created by the + * server will no longer be resumable. See Session Resumption for more + * information. Default: 300. + */ + sessionTimeout?: number | undefined; + } + interface SecureContext { + context: any; + } + /** + * Verifies the certificate `cert` is issued to `hostname`. + * + * Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on + * failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). + * + * This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as + * such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead. + * + * This function can be overwritten by providing an alternative function as the`options.checkServerIdentity` option that is passed to `tls.connect()`. The + * overwriting function can call `tls.checkServerIdentity()` of course, to augment + * the checks done with additional verification. + * + * This function is only called if the certificate passed all other checks, such as + * being issued by trusted CA (`options.ca`). + * + * Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name + * was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use + * a custom`options.checkServerIdentity` function that implements the desired behavior. + * @since v0.8.4 + * @param hostname The host name or IP address to verify the certificate against. + * @param cert A `certificate object` representing the peer's certificate. + */ + function checkServerIdentity(hostname: string, cert: PeerCertificate): Error | undefined; + /** + * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is + * automatically set as a listener for the `'secureConnection'` event. + * + * The `ticketKeys` options is automatically shared between `node:cluster` module + * workers. + * + * The following illustrates a simple echo server: + * + * ```js + * const tls = require('node:tls'); + * const fs = require('node:fs'); + * + * const options = { + * key: fs.readFileSync('server-key.pem'), + * cert: fs.readFileSync('server-cert.pem'), + * + * // This is necessary only if using client certificate authentication. + * requestCert: true, + * + * // This is necessary only if the client uses a self-signed certificate. + * ca: [ fs.readFileSync('client-cert.pem') ], + * }; + * + * const server = tls.createServer(options, (socket) => { + * console.log('server connected', + * socket.authorized ? 'authorized' : 'unauthorized'); + * socket.write('welcome!\n'); + * socket.setEncoding('utf8'); + * socket.pipe(socket); + * }); + * server.listen(8000, () => { + * console.log('server bound'); + * }); + * ``` + * + * The server can be tested by connecting to it using the example client from {@link connect}. + * @since v0.3.2 + */ + function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; + function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; + /** + * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event. + * + * `tls.connect()` returns a {@link TLSSocket} object. + * + * Unlike the `https` API, `tls.connect()` does not enable the + * SNI (Server Name Indication) extension by default, which may cause some + * servers to return an incorrect certificate or reject the connection + * altogether. To enable SNI, set the `servername` option in addition + * to `host`. + * + * The following illustrates a client for the echo server example from {@link createServer}: + * + * ```js + * // Assumes an echo server that is listening on port 8000. + * const tls = require('node:tls'); + * const fs = require('node:fs'); + * + * const options = { + * // Necessary only if the server requires client certificate authentication. + * key: fs.readFileSync('client-key.pem'), + * cert: fs.readFileSync('client-cert.pem'), + * + * // Necessary only if the server uses a self-signed certificate. + * ca: [ fs.readFileSync('server-cert.pem') ], + * + * // Necessary only if the server's cert isn't for "localhost". + * checkServerIdentity: () => { return null; }, + * }; + * + * const socket = tls.connect(8000, options, () => { + * console.log('client connected', + * socket.authorized ? 'authorized' : 'unauthorized'); + * process.stdin.pipe(socket); + * process.stdin.resume(); + * }); + * socket.setEncoding('utf8'); + * socket.on('data', (data) => { + * console.log(data); + * }); + * socket.on('end', () => { + * console.log('server ends connection'); + * }); + * ``` + * @since v0.11.3 + */ + function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + /** + * Creates a new secure pair object with two streams, one of which reads and writes + * the encrypted data and the other of which reads and writes the cleartext data. + * Generally, the encrypted stream is piped to/from an incoming encrypted data + * stream and the cleartext one is used as a replacement for the initial encrypted + * stream. + * + * `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and`encrypted` stream properties. + * + * Using `cleartext` has the same API as {@link TLSSocket}. + * + * The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code: + * + * ```js + * pair = tls.createSecurePair(// ... ); + * pair.encrypted.pipe(socket); + * socket.pipe(pair.encrypted); + * ``` + * + * can be replaced by: + * + * ```js + * secureSocket = tls.TLSSocket(socket, options); + * ``` + * + * where `secureSocket` has the same API as `pair.cleartext`. + * @since v0.3.2 + * @deprecated Since v0.11.3 - Use {@link TLSSocket} instead. + * @param context A secure context object as returned by `tls.createSecureContext()` + * @param isServer `true` to specify that this TLS connection should be opened as a server. + * @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`. + * @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`. + */ + function createSecurePair(context?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; + /** + * {@link createServer} sets the default value of the `honorCipherOrder` option + * to `true`, other APIs that create secure contexts leave it unset. + * + * {@link createServer} uses a 128 bit truncated SHA1 hash value generated + * from `process.argv` as the default value of the `sessionIdContext` option, other + * APIs that create secure contexts have no default value. + * + * The `tls.createSecureContext()` method creates a `SecureContext` object. It is + * usable as an argument to several `tls` APIs, such as `server.addContext()`, + * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option. + * + * A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it. + * + * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of + * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt). + * + * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength + * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can + * be used to create custom parameters. The key length must be greater than or + * equal to 1024 bits or else an error will be thrown. Although 1024 bits is + * permissible, use 2048 bits or larger for stronger security. + * @since v0.11.13 + */ + function createSecureContext(options?: SecureContextOptions): SecureContext; + /** + * Returns an array with the names of the supported TLS ciphers. The names are + * lower-case for historical reasons, but must be uppercased to be used in + * the `ciphers` option of {@link createSecureContext}. + * + * Not all supported ciphers are enabled by default. See `Modifying the default TLS cipher suite`. + * + * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for + * TLSv1.2 and below. + * + * ```js + * console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...] + * ``` + * @since v0.10.2 + */ + function getCiphers(): string[]; + /** + * The default curve name to use for ECDH key agreement in a tls server. + * The default value is 'auto'. See tls.createSecureContext() for further + * information. + */ + let DEFAULT_ECDH_CURVE: string; + /** + * The default value of the maxVersion option of + * tls.createSecureContext(). It can be assigned any of the supported TLS + * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: + * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets + * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to + * 'TLSv1.3'. If multiple of the options are provided, the highest maximum + * is used. + */ + let DEFAULT_MAX_VERSION: SecureVersion; + /** + * The default value of the minVersion option of tls.createSecureContext(). + * It can be assigned any of the supported TLS protocol versions, + * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless + * changed using CLI options. Using --tls-min-v1.0 sets the default to + * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using + * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options + * are provided, the lowest minimum is used. + */ + let DEFAULT_MIN_VERSION: SecureVersion; + /** + * The default value of the ciphers option of tls.createSecureContext(). + * It can be assigned any of the supported OpenSSL ciphers. + * Defaults to the content of crypto.constants.defaultCoreCipherList, unless + * changed using CLI options using --tls-default-ciphers. + */ + let DEFAULT_CIPHERS: string; + /** + * An immutable array of strings representing the root certificates (in PEM + * format) used for verifying peer certificates. This is the default value + * of the ca option to tls.createSecureContext(). + */ + const rootCertificates: ReadonlyArray; +} +declare module 'node:tls' { + export * from 'tls'; +} diff --git a/node_modules/@types/node/trace_events.d.ts b/node_modules/@types/node/trace_events.d.ts new file mode 100755 index 0000000..ca8baed --- /dev/null +++ b/node_modules/@types/node/trace_events.d.ts @@ -0,0 +1,182 @@ +/** + * The `node:trace_events` module provides a mechanism to centralize tracing + * information generated by V8, Node.js core, and userspace code. + * + * Tracing can be enabled with the `--trace-event-categories` command-line flag + * or by using the `node:trace_events` module. The `--trace-event-categories` flag + * accepts a list of comma-separated category names. + * + * The available categories are: + * + * * `node`: An empty placeholder. + * * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data. + * The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. + * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones. + * * `node.console`: Enables capture of `console.time()` and `console.count()`output. + * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool + * synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. + * * `node.threadpoolwork.async`: Enables capture of trace data for threadpool + * asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. + * * `node.dns.native`: Enables capture of trace data for DNS queries. + * * `node.net.native`: Enables capture of trace data for network. + * * `node.environment`: Enables capture of Node.js Environment milestones. + * * `node.fs.sync`: Enables capture of trace data for file system sync methods. + * * `node.fs_dir.sync`: Enables capture of trace data for file system sync + * directory methods. + * * `node.fs.async`: Enables capture of trace data for file system async methods. + * * `node.fs_dir.async`: Enables capture of trace data for file system async + * directory methods. + * * `node.perf`: Enables capture of `Performance API` measurements. + * * `node.perf.usertiming`: Enables capture of only Performance API User Timing + * measures and marks. + * * `node.perf.timerify`: Enables capture of only Performance API timerify + * measurements. + * * `node.promises.rejections`: Enables capture of trace data tracking the number + * of unhandled Promise rejections and handled-after-rejections. + * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. + * * `v8`: The `V8` events are GC, compiling, and execution related. + * * `node.http`: Enables capture of trace data for http request / response. + * + * By default the `node`, `node.async_hooks`, and `v8` categories are enabled. + * + * ```bash + * node --trace-event-categories v8,node,node.async_hooks server.js + * ``` + * + * Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be + * used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default. + * + * ```bash + * node --trace-events-enabled + * + * # is equivalent to + * + * node --trace-event-categories v8,node,node.async_hooks + * ``` + * + * Alternatively, trace events may be enabled using the `node:trace_events` module: + * + * ```js + * const trace_events = require('node:trace_events'); + * const tracing = trace_events.createTracing({ categories: ['node.perf'] }); + * tracing.enable(); // Enable trace event capture for the 'node.perf' category + * + * // do work + * + * tracing.disable(); // Disable trace event capture for the 'node.perf' category + * ``` + * + * Running Node.js with tracing enabled will produce log files that can be opened + * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome. + * + * The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can + * be specified with `--trace-event-file-pattern` that accepts a template + * string that supports `${rotation}` and `${pid}`: + * + * ```bash + * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js + * ``` + * + * To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers + * in your code, such as: + * + * ```js + * process.on('SIGINT', function onSigint() { + * console.info('Received SIGINT.'); + * process.exit(130); // Or applicable exit code depending on OS and signal + * }); + * ``` + * + * The tracing system uses the same time source + * as the one used by `process.hrtime()`. + * However the trace-event timestamps are expressed in microseconds, + * unlike `process.hrtime()` which returns nanoseconds. + * + * The features from this module are not available in `Worker` threads. + * @experimental + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/trace_events.js) + */ +declare module 'trace_events' { + /** + * The `Tracing` object is used to enable or disable tracing for sets of + * categories. Instances are created using the + * `trace_events.createTracing()` method. + * + * When created, the `Tracing` object is disabled. Calling the + * `tracing.enable()` method adds the categories to the set of enabled trace + * event categories. Calling `tracing.disable()` will remove the categories + * from the set of enabled trace event categories. + */ + interface Tracing { + /** + * A comma-separated list of the trace event categories covered by this + * `Tracing` object. + */ + readonly categories: string; + /** + * Disables this `Tracing` object. + * + * Only trace event categories _not_ covered by other enabled `Tracing` + * objects and _not_ specified by the `--trace-event-categories` flag + * will be disabled. + */ + disable(): void; + /** + * Enables this `Tracing` object for the set of categories covered by + * the `Tracing` object. + */ + enable(): void; + /** + * `true` only if the `Tracing` object has been enabled. + */ + readonly enabled: boolean; + } + interface CreateTracingOptions { + /** + * An array of trace category names. Values included in the array are + * coerced to a string when possible. An error will be thrown if the + * value cannot be coerced. + */ + categories: string[]; + } + /** + * Creates and returns a `Tracing` object for the given set of `categories`. + * + * ```js + * const trace_events = require('node:trace_events'); + * const categories = ['node.perf', 'node.async_hooks']; + * const tracing = trace_events.createTracing({ categories }); + * tracing.enable(); + * // do stuff + * tracing.disable(); + * ``` + * @since v10.0.0 + * @return . + */ + function createTracing(options: CreateTracingOptions): Tracing; + /** + * Returns a comma-separated list of all currently-enabled trace event + * categories. The current set of enabled trace event categories is determined + * by the _union_ of all currently-enabled `Tracing` objects and any categories + * enabled using the `--trace-event-categories` flag. + * + * Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console. + * + * ```js + * const trace_events = require('node:trace_events'); + * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] }); + * const t2 = trace_events.createTracing({ categories: ['node.perf'] }); + * const t3 = trace_events.createTracing({ categories: ['v8'] }); + * + * t1.enable(); + * t2.enable(); + * + * console.log(trace_events.getEnabledCategories()); + * ``` + * @since v10.0.0 + */ + function getEnabledCategories(): string | undefined; +} +declare module 'node:trace_events' { + export * from 'trace_events'; +} diff --git a/node_modules/@types/node/ts4.8/assert.d.ts b/node_modules/@types/node/ts4.8/assert.d.ts new file mode 100755 index 0000000..e309252 --- /dev/null +++ b/node_modules/@types/node/ts4.8/assert.d.ts @@ -0,0 +1,972 @@ +/** + * The `node:assert` module provides a set of assertion functions for verifying + * invariants. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js) + */ +declare module 'assert' { + /** + * An alias of {@link ok}. + * @since v0.5.9 + * @param value The input that is checked for being truthy. + */ + function assert(value: unknown, message?: string | Error): asserts value; + namespace assert { + /** + * Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class. + */ + class AssertionError extends Error { + /** + * Set to the `actual` argument for methods such as {@link assert.strictEqual()}. + */ + actual: unknown; + /** + * Set to the `expected` argument for methods such as {@link assert.strictEqual()}. + */ + expected: unknown; + /** + * Set to the passed in operator value. + */ + operator: string; + /** + * Indicates if the message was auto-generated (`true`) or not. + */ + generatedMessage: boolean; + /** + * Value is always `ERR_ASSERTION` to show that the error is an assertion error. + */ + code: 'ERR_ASSERTION'; + constructor(options?: { + /** If provided, the error message is set to this value. */ + message?: string | undefined; + /** The `actual` property on the error instance. */ + actual?: unknown | undefined; + /** The `expected` property on the error instance. */ + expected?: unknown | undefined; + /** The `operator` property on the error instance. */ + operator?: string | undefined; + /** If provided, the generated stack trace omits frames before this function. */ + // tslint:disable-next-line:ban-types + stackStartFn?: Function | undefined; + }); + } + /** + * This feature is deprecated and will be removed in a future version. + * Please consider using alternatives such as the `mock` helper function. + * @since v14.2.0, v12.19.0 + * @deprecated Deprecated + */ + class CallTracker { + /** + * The wrapper function is expected to be called exactly `exact` times. If the + * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an + * error. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func); + * ``` + * @since v14.2.0, v12.19.0 + * @param [fn='A no-op function'] + * @param [exact=1] + * @return that wraps `fn`. + */ + calls(exact?: number): () => void; + calls any>(fn?: Func, exact?: number): Func; + /** + * Example: + * + * ```js + * import assert from 'node:assert'; + * + * const tracker = new assert.CallTracker(); + * + * function func() {} + * const callsfunc = tracker.calls(func); + * callsfunc(1, 2, 3); + * + * assert.deepStrictEqual(tracker.getCalls(callsfunc), + * [{ thisArg: undefined, arguments: [1, 2, 3] }]); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn + * @return An Array with all the calls to a tracked function. + */ + getCalls(fn: Function): CallTrackerCall[]; + /** + * The arrays contains information about the expected and actual number of calls of + * the functions that have not been called the expected number of times. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func, 2); + * + * // Returns an array containing information on callsfunc() + * console.log(tracker.report()); + * // [ + * // { + * // message: 'Expected the func function to be executed 2 time(s) but was + * // executed 0 time(s).', + * // actual: 0, + * // expected: 2, + * // operator: 'func', + * // stack: stack trace + * // } + * // ] + * ``` + * @since v14.2.0, v12.19.0 + * @return An Array of objects containing information about the wrapper functions returned by `calls`. + */ + report(): CallTrackerReportInformation[]; + /** + * Reset calls of the call tracker. + * If a tracked function is passed as an argument, the calls will be reset for it. + * If no arguments are passed, all tracked functions will be reset. + * + * ```js + * import assert from 'node:assert'; + * + * const tracker = new assert.CallTracker(); + * + * function func() {} + * const callsfunc = tracker.calls(func); + * + * callsfunc(); + * // Tracker was called once + * assert.strictEqual(tracker.getCalls(callsfunc).length, 1); + * + * tracker.reset(callsfunc); + * assert.strictEqual(tracker.getCalls(callsfunc).length, 0); + * ``` + * @since v18.8.0, v16.18.0 + * @param fn a tracked function to reset. + */ + reset(fn?: Function): void; + /** + * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that + * have not been called the expected number of times. + * + * ```js + * import assert from 'node:assert'; + * + * // Creates call tracker. + * const tracker = new assert.CallTracker(); + * + * function func() {} + * + * // Returns a function that wraps func() that must be called exact times + * // before tracker.verify(). + * const callsfunc = tracker.calls(func, 2); + * + * callsfunc(); + * + * // Will throw an error since callsfunc() was only called once. + * tracker.verify(); + * ``` + * @since v14.2.0, v12.19.0 + */ + verify(): void; + } + interface CallTrackerCall { + thisArg: object; + arguments: unknown[]; + } + interface CallTrackerReportInformation { + message: string; + /** The actual number of times the function was called. */ + actual: number; + /** The number of times the function was expected to be called. */ + expected: number; + /** The name of the function that is wrapped. */ + operator: string; + /** A stack trace of the function. */ + stack: object; + } + type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error; + /** + * Throws an `AssertionError` with the provided error message or a default + * error message. If the `message` parameter is an instance of an `Error` then + * it will be thrown instead of the `AssertionError`. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.fail(); + * // AssertionError [ERR_ASSERTION]: Failed + * + * assert.fail('boom'); + * // AssertionError [ERR_ASSERTION]: boom + * + * assert.fail(new TypeError('need array')); + * // TypeError: need array + * ``` + * + * Using `assert.fail()` with more than two arguments is possible but deprecated. + * See below for further details. + * @since v0.1.21 + * @param [message='Failed'] + */ + function fail(message?: string | Error): never; + /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ + function fail( + actual: unknown, + expected: unknown, + message?: string | Error, + operator?: string, + // tslint:disable-next-line:ban-types + stackStartFn?: Function + ): never; + /** + * Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`. + * + * If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default + * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. + * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``. + * + * Be aware that in the `repl` the error message will be different to the one + * thrown in a file! See below for further details. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.ok(true); + * // OK + * assert.ok(1); + * // OK + * + * assert.ok(); + * // AssertionError: No value argument passed to `assert.ok()` + * + * assert.ok(false, 'it\'s false'); + * // AssertionError: it's false + * + * // In the repl: + * assert.ok(typeof 123 === 'string'); + * // AssertionError: false == true + * + * // In a file (e.g. test.js): + * assert.ok(typeof 123 === 'string'); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(typeof 123 === 'string') + * + * assert.ok(false); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(false) + * + * assert.ok(0); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert.ok(0) + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * // Using `assert()` works the same: + * assert(0); + * // AssertionError: The expression evaluated to a falsy value: + * // + * // assert(0) + * ``` + * @since v0.1.21 + */ + function ok(value: unknown, message?: string | Error): asserts value; + /** + * **Strict assertion mode** + * + * An alias of {@link strictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link strictEqual} instead. + * + * Tests shallow, coercive equality between the `actual` and `expected` parameters + * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled + * and treated as being identical if both sides are `NaN`. + * + * ```js + * import assert from 'node:assert'; + * + * assert.equal(1, 1); + * // OK, 1 == 1 + * assert.equal(1, '1'); + * // OK, 1 == '1' + * assert.equal(NaN, NaN); + * // OK + * + * assert.equal(1, 2); + * // AssertionError: 1 == 2 + * assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); + * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } } + * ``` + * + * If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default + * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. + * @since v0.1.21 + */ + function equal(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link notStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead. + * + * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is + * specially handled and treated as being identical if both sides are `NaN`. + * + * ```js + * import assert from 'node:assert'; + * + * assert.notEqual(1, 2); + * // OK + * + * assert.notEqual(1, 1); + * // AssertionError: 1 != 1 + * + * assert.notEqual(1, '1'); + * // AssertionError: 1 != '1' + * ``` + * + * If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error + * message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. + * @since v0.1.21 + */ + function notEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link deepStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead. + * + * Tests for deep equality between the `actual` and `expected` parameters. Consider + * using {@link deepStrictEqual} instead. {@link deepEqual} can have + * surprising results. + * + * _Deep equality_ means that the enumerable "own" properties of child objects + * are also recursively evaluated by the following rules. + * @since v0.1.21 + */ + function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * **Strict assertion mode** + * + * An alias of {@link notDeepStrictEqual}. + * + * **Legacy assertion mode** + * + * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead. + * + * Tests for any deep inequality. Opposite of {@link deepEqual}. + * + * ```js + * import assert from 'node:assert'; + * + * const obj1 = { + * a: { + * b: 1, + * }, + * }; + * const obj2 = { + * a: { + * b: 2, + * }, + * }; + * const obj3 = { + * a: { + * b: 1, + * }, + * }; + * const obj4 = { __proto__: obj1 }; + * + * assert.notDeepEqual(obj1, obj1); + * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } + * + * assert.notDeepEqual(obj1, obj2); + * // OK + * + * assert.notDeepEqual(obj1, obj3); + * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } + * + * assert.notDeepEqual(obj1, obj4); + * // OK + * ``` + * + * If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default + * error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Tests strict equality between the `actual` and `expected` parameters as + * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.strictEqual(1, 2); + * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: + * // + * // 1 !== 2 + * + * assert.strictEqual(1, 1); + * // OK + * + * assert.strictEqual('Hello foobar', 'Hello World!'); + * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: + * // + actual - expected + * // + * // + 'Hello foobar' + * // - 'Hello World!' + * // ^ + * + * const apples = 1; + * const oranges = 2; + * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`); + * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2 + * + * assert.strictEqual(1, '1', new TypeError('Inputs are not identical')); + * // TypeError: Inputs are not identical + * ``` + * + * If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a + * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function strictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; + /** + * Tests strict inequality between the `actual` and `expected` parameters as + * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.notStrictEqual(1, 2); + * // OK + * + * assert.notStrictEqual(1, 1); + * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to: + * // + * // 1 + * + * assert.notStrictEqual(1, '1'); + * // OK + * ``` + * + * If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a + * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v0.1.21 + */ + function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Tests for deep equality between the `actual` and `expected` parameters. + * "Deep" equality means that the enumerable "own" properties of child objects + * are recursively evaluated also by the following rules. + * @since v1.2.0 + */ + function deepStrictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; + /** + * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); + * // OK + * ``` + * + * If the values are deeply and strictly equal, an `AssertionError` is thrown + * with a `message` property set equal to the value of the `message` parameter. If + * the `message` parameter is undefined, a default error message is assigned. If + * the `message` parameter is an instance of an `Error` then it will be thrown + * instead of the `AssertionError`. + * @since v1.2.0 + */ + function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; + /** + * Expects the function `fn` to throw an error. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, + * a validation object where each property will be tested for strict deep equality, + * or an instance of error where each property will be tested for strict deep + * equality including the non-enumerable `message` and `name` properties. When + * using an object, it is also possible to use a regular expression, when + * validating against a string property. See below for examples. + * + * If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation + * fails. + * + * Custom validation object/error instance: + * + * ```js + * import assert from 'node:assert/strict'; + * + * const err = new TypeError('Wrong value'); + * err.code = 404; + * err.foo = 'bar'; + * err.info = { + * nested: true, + * baz: 'text', + * }; + * err.reg = /abc/i; + * + * assert.throws( + * () => { + * throw err; + * }, + * { + * name: 'TypeError', + * message: 'Wrong value', + * info: { + * nested: true, + * baz: 'text', + * }, + * // Only properties on the validation object will be tested for. + * // Using nested objects requires all properties to be present. Otherwise + * // the validation is going to fail. + * }, + * ); + * + * // Using regular expressions to validate error properties: + * assert.throws( + * () => { + * throw err; + * }, + * { + * // The `name` and `message` properties are strings and using regular + * // expressions on those will match against the string. If they fail, an + * // error is thrown. + * name: /^TypeError$/, + * message: /Wrong/, + * foo: 'bar', + * info: { + * nested: true, + * // It is not possible to use regular expressions for nested properties! + * baz: 'text', + * }, + * // The `reg` property contains a regular expression and only if the + * // validation object contains an identical regular expression, it is going + * // to pass. + * reg: /abc/i, + * }, + * ); + * + * // Fails due to the different `message` and `name` properties: + * assert.throws( + * () => { + * const otherErr = new Error('Not found'); + * // Copy all enumerable properties from `err` to `otherErr`. + * for (const [key, value] of Object.entries(err)) { + * otherErr[key] = value; + * } + * throw otherErr; + * }, + * // The error's `message` and `name` properties will also be checked when using + * // an error as validation object. + * err, + * ); + * ``` + * + * Validate instanceof using constructor: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * Error, + * ); + * ``` + * + * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions): + * + * Using a regular expression runs `.toString` on the error object, and will + * therefore also include the error name. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * /^Error: Wrong value$/, + * ); + * ``` + * + * Custom error validation: + * + * The function must return `true` to indicate all internal validations passed. + * It will otherwise fail with an `AssertionError`. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.throws( + * () => { + * throw new Error('Wrong value'); + * }, + * (err) => { + * assert(err instanceof Error); + * assert(/value/.test(err)); + * // Avoid returning anything from validation functions besides `true`. + * // Otherwise, it's not clear what part of the validation failed. Instead, + * // throw an error about the specific validation that failed (as done in this + * // example) and add as much helpful debugging information to that error as + * // possible. + * return true; + * }, + * 'unexpected error', + * ); + * ``` + * + * `error` cannot be a string. If a string is provided as the second + * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same + * message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using + * a string as the second argument gets considered: + * + * ```js + * import assert from 'node:assert/strict'; + * + * function throwingFirst() { + * throw new Error('First'); + * } + * + * function throwingSecond() { + * throw new Error('Second'); + * } + * + * function notThrowing() {} + * + * // The second argument is a string and the input function threw an Error. + * // The first case will not throw as it does not match for the error message + * // thrown by the input function! + * assert.throws(throwingFirst, 'Second'); + * // In the next example the message has no benefit over the message from the + * // error and since it is not clear if the user intended to actually match + * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error. + * assert.throws(throwingSecond, 'Second'); + * // TypeError [ERR_AMBIGUOUS_ARGUMENT] + * + * // The string is only used (as message) in case the function does not throw: + * assert.throws(notThrowing, 'Second'); + * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second + * + * // If it was intended to match for the error message do this instead: + * // It does not throw because the error messages match. + * assert.throws(throwingSecond, /Second$/); + * + * // If the error message does not match, an AssertionError is thrown. + * assert.throws(throwingFirst, /Second$/); + * // AssertionError [ERR_ASSERTION] + * ``` + * + * Due to the confusing error-prone notation, avoid a string as the second + * argument. + * @since v0.1.21 + */ + function throws(block: () => unknown, message?: string | Error): void; + function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void; + /** + * Asserts that the function `fn` does not throw an error. + * + * Using `assert.doesNotThrow()` is actually not useful because there + * is no benefit in catching an error and then rethrowing it. Instead, consider + * adding a comment next to the specific code path that should not throw and keep + * error messages as expressive as possible. + * + * When `assert.doesNotThrow()` is called, it will immediately call the `fn`function. + * + * If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a + * different type, or if the `error` parameter is undefined, the error is + * propagated back to the caller. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation + * function. See {@link throws} for more details. + * + * The following, for instance, will throw the `TypeError` because there is no + * matching error type in the assertion: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * SyntaxError, + * ); + * ``` + * + * However, the following will result in an `AssertionError` with the message + * 'Got unwanted exception...': + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * TypeError, + * ); + * ``` + * + * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message: + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * /Wrong value/, + * 'Whoops', + * ); + * // Throws: AssertionError: Got unwanted exception: Whoops + * ``` + * @since v0.1.21 + */ + function doesNotThrow(block: () => unknown, message?: string | Error): void; + function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void; + /** + * Throws `value` if `value` is not `undefined` or `null`. This is useful when + * testing the `error` argument in callbacks. The stack trace contains all frames + * from the error passed to `ifError()` including the potential new frames for`ifError()` itself. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.ifError(null); + * // OK + * assert.ifError(0); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0 + * assert.ifError('error'); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error' + * assert.ifError(new Error()); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error + * + * // Create some random error frames. + * let err; + * (function errorFrame() { + * err = new Error('test error'); + * })(); + * + * (function ifErrorFrame() { + * assert.ifError(err); + * })(); + * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error + * // at ifErrorFrame + * // at errorFrame + * ``` + * @since v0.1.97 + */ + function ifError(value: unknown): asserts value is null | undefined; + /** + * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately + * calls the function and awaits the returned promise to complete. It will then + * check that the promise is rejected. + * + * If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the + * function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error + * handler is skipped. + * + * Besides the async nature to await the completion behaves identically to {@link throws}. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, + * an object where each property will be tested for, or an instance of error where + * each property will be tested for including the non-enumerable `message` and`name` properties. + * + * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject. + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.rejects( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * { + * name: 'TypeError', + * message: 'Wrong value', + * }, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.rejects( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * (err) => { + * assert.strictEqual(err.name, 'TypeError'); + * assert.strictEqual(err.message, 'Wrong value'); + * return true; + * }, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.rejects( + * Promise.reject(new Error('Wrong value')), + * Error, + * ).then(() => { + * // ... + * }); + * ``` + * + * `error` cannot be a string. If a string is provided as the second + * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the + * example in {@link throws} carefully if using a string as the second + * argument gets considered. + * @since v10.0.0 + */ + function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; + function rejects(block: (() => Promise) | Promise, error: AssertPredicate, message?: string | Error): Promise; + /** + * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately + * calls the function and awaits the returned promise to complete. It will then + * check that the promise is not rejected. + * + * If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If + * the function does not return a promise, `assert.doesNotReject()` will return a + * rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases + * the error handler is skipped. + * + * Using `assert.doesNotReject()` is actually not useful because there is little + * benefit in catching a rejection and then rejecting it again. Instead, consider + * adding a comment next to the specific code path that should not reject and keep + * error messages as expressive as possible. + * + * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), + * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation + * function. See {@link throws} for more details. + * + * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}. + * + * ```js + * import assert from 'node:assert/strict'; + * + * await assert.doesNotReject( + * async () => { + * throw new TypeError('Wrong value'); + * }, + * SyntaxError, + * ); + * ``` + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotReject(Promise.reject(new TypeError('Wrong value'))) + * .then(() => { + * // ... + * }); + * ``` + * @since v10.0.0 + */ + function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise; + function doesNotReject(block: (() => Promise) | Promise, error: AssertPredicate, message?: string | Error): Promise; + /** + * Expects the `string` input to match the regular expression. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.match('I will fail', /pass/); + * // AssertionError [ERR_ASSERTION]: The input did not match the regular ... + * + * assert.match(123, /pass/); + * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. + * + * assert.match('I will pass', /pass/); + * // OK + * ``` + * + * If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal + * to the value of the `message` parameter. If the `message` parameter is + * undefined, a default error message is assigned. If the `message` parameter is an + * instance of an `Error` then it will be thrown instead of the `AssertionError`. + * @since v13.6.0, v12.16.0 + */ + function match(value: string, regExp: RegExp, message?: string | Error): void; + /** + * Expects the `string` input not to match the regular expression. + * + * ```js + * import assert from 'node:assert/strict'; + * + * assert.doesNotMatch('I will fail', /fail/); + * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ... + * + * assert.doesNotMatch(123, /pass/); + * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. + * + * assert.doesNotMatch('I will pass', /different/); + * // OK + * ``` + * + * If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal + * to the value of the `message` parameter. If the `message` parameter is + * undefined, a default error message is assigned. If the `message` parameter is an + * instance of an `Error` then it will be thrown instead of the `AssertionError`. + * @since v13.6.0, v12.16.0 + */ + function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; + const strict: Omit & { + (value: unknown, message?: string | Error): asserts value; + equal: typeof strictEqual; + notEqual: typeof notStrictEqual; + deepEqual: typeof deepStrictEqual; + notDeepEqual: typeof notDeepStrictEqual; + // Mapped types and assertion functions are incompatible? + // TS2775: Assertions require every name in the call target + // to be declared with an explicit type annotation. + ok: typeof ok; + strictEqual: typeof strictEqual; + deepStrictEqual: typeof deepStrictEqual; + ifError: typeof ifError; + strict: typeof strict; + }; + } + export = assert; +} +declare module 'node:assert' { + import assert = require('assert'); + export = assert; +} diff --git a/node_modules/@types/node/ts4.8/assert/strict.d.ts b/node_modules/@types/node/ts4.8/assert/strict.d.ts new file mode 100755 index 0000000..b4319b9 --- /dev/null +++ b/node_modules/@types/node/ts4.8/assert/strict.d.ts @@ -0,0 +1,8 @@ +declare module 'assert/strict' { + import { strict } from 'node:assert'; + export = strict; +} +declare module 'node:assert/strict' { + import { strict } from 'node:assert'; + export = strict; +} diff --git a/node_modules/@types/node/ts4.8/async_hooks.d.ts b/node_modules/@types/node/ts4.8/async_hooks.d.ts new file mode 100755 index 0000000..d0b2ebf --- /dev/null +++ b/node_modules/@types/node/ts4.8/async_hooks.d.ts @@ -0,0 +1,531 @@ +/** + * We strongly discourage the use of the `async_hooks` API. + * Other APIs that can cover most of its use cases include: + * + * * `AsyncLocalStorage` tracks async context + * * `process.getActiveResourcesInfo()` tracks active resources + * + * The `node:async_hooks` module provides an API to track asynchronous resources. + * It can be accessed using: + * + * ```js + * import async_hooks from 'node:async_hooks'; + * ``` + * @experimental + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js) + */ +declare module 'async_hooks' { + /** + * ```js + * import { executionAsyncId } from 'node:async_hooks'; + * import fs from 'node:fs'; + * + * console.log(executionAsyncId()); // 1 - bootstrap + * fs.open(path, 'r', (err, fd) => { + * console.log(executionAsyncId()); // 6 - open() + * }); + * ``` + * + * The ID returned from `executionAsyncId()` is related to execution timing, not + * causality (which is covered by `triggerAsyncId()`): + * + * ```js + * const server = net.createServer((conn) => { + * // Returns the ID of the server, not of the new connection, because the + * // callback runs in the execution scope of the server's MakeCallback(). + * async_hooks.executionAsyncId(); + * + * }).listen(port, () => { + * // Returns the ID of a TickObject (process.nextTick()) because all + * // callbacks passed to .listen() are wrapped in a nextTick(). + * async_hooks.executionAsyncId(); + * }); + * ``` + * + * Promise contexts may not get precise `executionAsyncIds` by default. + * See the section on `promise execution tracking`. + * @since v8.1.0 + * @return The `asyncId` of the current execution context. Useful to track when something calls. + */ + function executionAsyncId(): number; + /** + * Resource objects returned by `executionAsyncResource()` are most often internal + * Node.js handle objects with undocumented APIs. Using any functions or properties + * on the object is likely to crash your application and should be avoided. + * + * Using `executionAsyncResource()` in the top-level execution context will + * return an empty object as there is no handle or request object to use, + * but having an object representing the top-level can be helpful. + * + * ```js + * import { open } from 'node:fs'; + * import { executionAsyncId, executionAsyncResource } from 'node:async_hooks'; + * + * console.log(executionAsyncId(), executionAsyncResource()); // 1 {} + * open(new URL(import.meta.url), 'r', (err, fd) => { + * console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap + * }); + * ``` + * + * This can be used to implement continuation local storage without the + * use of a tracking `Map` to store the metadata: + * + * ```js + * import { createServer } from 'node:http'; + * import { + * executionAsyncId, + * executionAsyncResource, + * createHook, + * } from 'async_hooks'; + * const sym = Symbol('state'); // Private symbol to avoid pollution + * + * createHook({ + * init(asyncId, type, triggerAsyncId, resource) { + * const cr = executionAsyncResource(); + * if (cr) { + * resource[sym] = cr[sym]; + * } + * }, + * }).enable(); + * + * const server = createServer((req, res) => { + * executionAsyncResource()[sym] = { state: req.url }; + * setTimeout(function() { + * res.end(JSON.stringify(executionAsyncResource()[sym])); + * }, 100); + * }).listen(3000); + * ``` + * @since v13.9.0, v12.17.0 + * @return The resource representing the current execution. Useful to store data within the resource. + */ + function executionAsyncResource(): object; + /** + * ```js + * const server = net.createServer((conn) => { + * // The resource that caused (or triggered) this callback to be called + * // was that of the new connection. Thus the return value of triggerAsyncId() + * // is the asyncId of "conn". + * async_hooks.triggerAsyncId(); + * + * }).listen(port, () => { + * // Even though all callbacks passed to .listen() are wrapped in a nextTick() + * // the callback itself exists because the call to the server's .listen() + * // was made. So the return value would be the ID of the server. + * async_hooks.triggerAsyncId(); + * }); + * ``` + * + * Promise contexts may not get valid `triggerAsyncId`s by default. See + * the section on `promise execution tracking`. + * @return The ID of the resource responsible for calling the callback that is currently being executed. + */ + function triggerAsyncId(): number; + interface HookCallbacks { + /** + * Called when a class is constructed that has the possibility to emit an asynchronous event. + * @param asyncId a unique ID for the async resource + * @param type the type of the async resource + * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created + * @param resource reference to the resource representing the async operation, needs to be released during destroy + */ + init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; + /** + * When an asynchronous operation is initiated or completes a callback is called to notify the user. + * The before callback is called just before said callback is executed. + * @param asyncId the unique identifier assigned to the resource about to execute the callback. + */ + before?(asyncId: number): void; + /** + * Called immediately after the callback specified in before is completed. + * @param asyncId the unique identifier assigned to the resource which has executed the callback. + */ + after?(asyncId: number): void; + /** + * Called when a promise has resolve() called. This may not be in the same execution id + * as the promise itself. + * @param asyncId the unique id for the promise that was resolve()d. + */ + promiseResolve?(asyncId: number): void; + /** + * Called after the resource corresponding to asyncId is destroyed + * @param asyncId a unique ID for the async resource + */ + destroy?(asyncId: number): void; + } + interface AsyncHook { + /** + * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. + */ + enable(): this; + /** + * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. + */ + disable(): this; + } + /** + * Registers functions to be called for different lifetime events of each async + * operation. + * + * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the + * respective asynchronous event during a resource's lifetime. + * + * All callbacks are optional. For example, if only resource cleanup needs to + * be tracked, then only the `destroy` callback needs to be passed. The + * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section. + * + * ```js + * import { createHook } from 'node:async_hooks'; + * + * const asyncHook = createHook({ + * init(asyncId, type, triggerAsyncId, resource) { }, + * destroy(asyncId) { }, + * }); + * ``` + * + * The callbacks will be inherited via the prototype chain: + * + * ```js + * class MyAsyncCallbacks { + * init(asyncId, type, triggerAsyncId, resource) { } + * destroy(asyncId) {} + * } + * + * class MyAddedCallbacks extends MyAsyncCallbacks { + * before(asyncId) { } + * after(asyncId) { } + * } + * + * const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); + * ``` + * + * Because promises are asynchronous resources whose lifecycle is tracked + * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises. + * @since v8.1.0 + * @param callbacks The `Hook Callbacks` to register + * @return Instance used for disabling and enabling hooks + */ + function createHook(callbacks: HookCallbacks): AsyncHook; + interface AsyncResourceOptions { + /** + * The ID of the execution context that created this async event. + * @default executionAsyncId() + */ + triggerAsyncId?: number | undefined; + /** + * Disables automatic `emitDestroy` when the object is garbage collected. + * This usually does not need to be set (even if `emitDestroy` is called + * manually), unless the resource's `asyncId` is retrieved and the + * sensitive API's `emitDestroy` is called with it. + * @default false + */ + requireManualDestroy?: boolean | undefined; + } + /** + * The class `AsyncResource` is designed to be extended by the embedder's async + * resources. Using this, users can easily trigger the lifetime events of their + * own resources. + * + * The `init` hook will trigger when an `AsyncResource` is instantiated. + * + * The following is an overview of the `AsyncResource` API. + * + * ```js + * import { AsyncResource, executionAsyncId } from 'node:async_hooks'; + * + * // AsyncResource() is meant to be extended. Instantiating a + * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then + * // async_hook.executionAsyncId() is used. + * const asyncResource = new AsyncResource( + * type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }, + * ); + * + * // Run a function in the execution context of the resource. This will + * // * establish the context of the resource + * // * trigger the AsyncHooks before callbacks + * // * call the provided function `fn` with the supplied arguments + * // * trigger the AsyncHooks after callbacks + * // * restore the original execution context + * asyncResource.runInAsyncScope(fn, thisArg, ...args); + * + * // Call AsyncHooks destroy callbacks. + * asyncResource.emitDestroy(); + * + * // Return the unique ID assigned to the AsyncResource instance. + * asyncResource.asyncId(); + * + * // Return the trigger ID for the AsyncResource instance. + * asyncResource.triggerAsyncId(); + * ``` + */ + class AsyncResource { + /** + * AsyncResource() is meant to be extended. Instantiating a + * new AsyncResource() also triggers init. If triggerAsyncId is omitted then + * async_hook.executionAsyncId() is used. + * @param type The type of async event. + * @param triggerAsyncId The ID of the execution context that created + * this async event (default: `executionAsyncId()`), or an + * AsyncResourceOptions object (since v9.3.0) + */ + constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions); + /** + * Binds the given function to the current execution context. + * @since v14.8.0, v12.19.0 + * @param fn The function to bind to the current execution context. + * @param type An optional name to associate with the underlying `AsyncResource`. + */ + static bind any, ThisArg>(fn: Func, type?: string, thisArg?: ThisArg): Func; + /** + * Binds the given function to execute to this `AsyncResource`'s scope. + * @since v14.8.0, v12.19.0 + * @param fn The function to bind to the current `AsyncResource`. + */ + bind any>(fn: Func): Func; + /** + * Call the provided function with the provided arguments in the execution context + * of the async resource. This will establish the context, trigger the AsyncHooks + * before callbacks, call the function, trigger the AsyncHooks after callbacks, and + * then restore the original execution context. + * @since v9.6.0 + * @param fn The function to call in the execution context of this async resource. + * @param thisArg The receiver to be used for the function call. + * @param args Optional arguments to pass to the function. + */ + runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result; + /** + * Call all `destroy` hooks. This should only ever be called once. An error will + * be thrown if it is called more than once. This **must** be manually called. If + * the resource is left to be collected by the GC then the `destroy` hooks will + * never be called. + * @return A reference to `asyncResource`. + */ + emitDestroy(): this; + /** + * @return The unique `asyncId` assigned to the resource. + */ + asyncId(): number; + /** + * + * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. + */ + triggerAsyncId(): number; + } + /** + * This class creates stores that stay coherent through asynchronous operations. + * + * While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory + * safe implementation that involves significant optimizations that are non-obvious + * to implement. + * + * The following example uses `AsyncLocalStorage` to build a simple logger + * that assigns IDs to incoming HTTP requests and includes them in messages + * logged within each request. + * + * ```js + * import http from 'node:http'; + * import { AsyncLocalStorage } from 'node:async_hooks'; + * + * const asyncLocalStorage = new AsyncLocalStorage(); + * + * function logWithId(msg) { + * const id = asyncLocalStorage.getStore(); + * console.log(`${id !== undefined ? id : '-'}:`, msg); + * } + * + * let idSeq = 0; + * http.createServer((req, res) => { + * asyncLocalStorage.run(idSeq++, () => { + * logWithId('start'); + * // Imagine any chain of async operations here + * setImmediate(() => { + * logWithId('finish'); + * res.end(); + * }); + * }); + * }).listen(8080); + * + * http.get('http://localhost:8080'); + * http.get('http://localhost:8080'); + * // Prints: + * // 0: start + * // 1: start + * // 0: finish + * // 1: finish + * ``` + * + * Each instance of `AsyncLocalStorage` maintains an independent storage context. + * Multiple instances can safely exist simultaneously without risk of interfering + * with each other's data. + * @since v13.10.0, v12.17.0 + */ + class AsyncLocalStorage { + /** + * Binds the given function to the current execution context. + * @since v19.8.0 + * @experimental + * @param fn The function to bind to the current execution context. + * @return A new function that calls `fn` within the captured execution context. + */ + static bind any>(fn: Func): Func; + /** + * Captures the current execution context and returns a function that accepts a + * function as an argument. Whenever the returned function is called, it + * calls the function passed to it within the captured context. + * + * ```js + * const asyncLocalStorage = new AsyncLocalStorage(); + * const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot()); + * const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore())); + * console.log(result); // returns 123 + * ``` + * + * AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple + * async context tracking purposes, for example: + * + * ```js + * class Foo { + * #runInAsyncScope = AsyncLocalStorage.snapshot(); + * + * get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); } + * } + * + * const foo = asyncLocalStorage.run(123, () => new Foo()); + * console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123 + * ``` + * @since v19.8.0 + * @experimental + * @return A new function with the signature `(fn: (...args) : R, ...args) : R`. + */ + static snapshot(): (fn: (...args: TArgs) => R, ...args: TArgs) => R; + /** + * Disables the instance of `AsyncLocalStorage`. All subsequent calls + * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. + * + * When calling `asyncLocalStorage.disable()`, all current contexts linked to the + * instance will be exited. + * + * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores + * provided by the `asyncLocalStorage`, as those objects are garbage collected + * along with the corresponding async resources. + * + * Use this method when the `asyncLocalStorage` is not in use anymore + * in the current process. + * @since v13.10.0, v12.17.0 + * @experimental + */ + disable(): void; + /** + * Returns the current store. + * If called outside of an asynchronous context initialized by + * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it + * returns `undefined`. + * @since v13.10.0, v12.17.0 + */ + getStore(): T | undefined; + /** + * Runs a function synchronously within a context and returns its + * return value. The store is not accessible outside of the callback function. + * The store is accessible to any asynchronous operations created within the + * callback. + * + * The optional `args` are passed to the callback function. + * + * If the callback function throws an error, the error is thrown by `run()` too. + * The stacktrace is not impacted by this call and the context is exited. + * + * Example: + * + * ```js + * const store = { id: 2 }; + * try { + * asyncLocalStorage.run(store, () => { + * asyncLocalStorage.getStore(); // Returns the store object + * setTimeout(() => { + * asyncLocalStorage.getStore(); // Returns the store object + * }, 200); + * throw new Error(); + * }); + * } catch (e) { + * asyncLocalStorage.getStore(); // Returns undefined + * // The error will be caught here + * } + * ``` + * @since v13.10.0, v12.17.0 + */ + run(store: T, callback: () => R): R; + run(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R; + /** + * Runs a function synchronously outside of a context and returns its + * return value. The store is not accessible within the callback function or + * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`. + * + * The optional `args` are passed to the callback function. + * + * If the callback function throws an error, the error is thrown by `exit()` too. + * The stacktrace is not impacted by this call and the context is re-entered. + * + * Example: + * + * ```js + * // Within a call to run + * try { + * asyncLocalStorage.getStore(); // Returns the store object or value + * asyncLocalStorage.exit(() => { + * asyncLocalStorage.getStore(); // Returns undefined + * throw new Error(); + * }); + * } catch (e) { + * asyncLocalStorage.getStore(); // Returns the same object or value + * // The error will be caught here + * } + * ``` + * @since v13.10.0, v12.17.0 + * @experimental + */ + exit(callback: (...args: TArgs) => R, ...args: TArgs): R; + /** + * Transitions into the context for the remainder of the current + * synchronous execution and then persists the store through any following + * asynchronous calls. + * + * Example: + * + * ```js + * const store = { id: 1 }; + * // Replaces previous store with the given store object + * asyncLocalStorage.enterWith(store); + * asyncLocalStorage.getStore(); // Returns the store object + * someAsyncOperation(() => { + * asyncLocalStorage.getStore(); // Returns the same object + * }); + * ``` + * + * This transition will continue for the _entire_ synchronous execution. + * This means that if, for example, the context is entered within an event + * handler subsequent event handlers will also run within that context unless + * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons + * to use the latter method. + * + * ```js + * const store = { id: 1 }; + * + * emitter.on('my-event', () => { + * asyncLocalStorage.enterWith(store); + * }); + * emitter.on('my-event', () => { + * asyncLocalStorage.getStore(); // Returns the same object + * }); + * + * asyncLocalStorage.getStore(); // Returns undefined + * emitter.emit('my-event'); + * asyncLocalStorage.getStore(); // Returns the same object + * ``` + * @since v13.11.0, v12.17.0 + * @experimental + */ + enterWith(store: T): void; + } +} +declare module 'node:async_hooks' { + export * from 'async_hooks'; +} diff --git a/node_modules/@types/node/ts4.8/buffer.d.ts b/node_modules/@types/node/ts4.8/buffer.d.ts new file mode 100755 index 0000000..86694b0 --- /dev/null +++ b/node_modules/@types/node/ts4.8/buffer.d.ts @@ -0,0 +1,2354 @@ +/** + * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many + * Node.js APIs support `Buffer`s. + * + * The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and + * extends it with methods that cover additional use cases. Node.js APIs accept + * plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well. + * + * While the `Buffer` class is available within the global scope, it is still + * recommended to explicitly reference it via an import or require statement. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Creates a zero-filled Buffer of length 10. + * const buf1 = Buffer.alloc(10); + * + * // Creates a Buffer of length 10, + * // filled with bytes which all have the value `1`. + * const buf2 = Buffer.alloc(10, 1); + * + * // Creates an uninitialized buffer of length 10. + * // This is faster than calling Buffer.alloc() but the returned + * // Buffer instance might contain old data that needs to be + * // overwritten using fill(), write(), or other functions that fill the Buffer's + * // contents. + * const buf3 = Buffer.allocUnsafe(10); + * + * // Creates a Buffer containing the bytes [1, 2, 3]. + * const buf4 = Buffer.from([1, 2, 3]); + * + * // Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries + * // are all truncated using `(value & 255)` to fit into the range 0–255. + * const buf5 = Buffer.from([257, 257.5, -255, '1']); + * + * // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést': + * // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation) + * // [116, 195, 169, 115, 116] (in decimal notation) + * const buf6 = Buffer.from('tést'); + * + * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74]. + * const buf7 = Buffer.from('tést', 'latin1'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/buffer.js) + */ +declare module 'buffer' { + import { BinaryLike } from 'node:crypto'; + import { ReadableStream as WebReadableStream } from 'node:stream/web'; + /** + * This function returns `true` if `input` contains only valid UTF-8-encoded data, + * including the case in which `input` is empty. + * + * Throws if the `input` is a detached array buffer. + * @since v19.4.0, v18.14.0 + * @param input The input to validate. + */ + export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; + /** + * This function returns `true` if `input` contains only valid ASCII-encoded data, + * including the case in which `input` is empty. + * + * Throws if the `input` is a detached array buffer. + * @since v19.6.0, v18.15.0 + * @param input The input to validate. + */ + export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; + export const INSPECT_MAX_BYTES: number; + export const kMaxLength: number; + export const kStringMaxLength: number; + export const constants: { + MAX_LENGTH: number; + MAX_STRING_LENGTH: number; + }; + export type TranscodeEncoding = 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'latin1' | 'binary'; + /** + * Re-encodes the given `Buffer` or `Uint8Array` instance from one character + * encoding to another. Returns a new `Buffer` instance. + * + * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if + * conversion from `fromEnc` to `toEnc` is not permitted. + * + * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`,`'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`. + * + * The transcoding process will use substitution characters if a given byte + * sequence cannot be adequately represented in the target encoding. For instance: + * + * ```js + * import { Buffer, transcode } from 'node:buffer'; + * + * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii'); + * console.log(newBuf.toString('ascii')); + * // Prints: '?' + * ``` + * + * Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced + * with `?` in the transcoded `Buffer`. + * @since v7.1.0 + * @param source A `Buffer` or `Uint8Array` instance. + * @param fromEnc The current encoding. + * @param toEnc To target encoding. + */ + export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; + export const SlowBuffer: { + /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */ + new (size: number): Buffer; + prototype: Buffer; + }; + /** + * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using + * a prior call to `URL.createObjectURL()`. + * @since v16.7.0 + * @experimental + * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. + */ + export function resolveObjectURL(id: string): Blob | undefined; + export { Buffer }; + /** + * @experimental + */ + export interface BlobOptions { + /** + * @default 'utf8' + */ + encoding?: BufferEncoding | undefined; + /** + * The Blob content-type. The intent is for `type` to convey + * the MIME media type of the data, however no validation of the type format + * is performed. + */ + type?: string | undefined; + } + /** + * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across + * multiple worker threads. + * @since v15.7.0, v14.18.0 + */ + export class Blob { + /** + * The total size of the `Blob` in bytes. + * @since v15.7.0, v14.18.0 + */ + readonly size: number; + /** + * The content-type of the `Blob`. + * @since v15.7.0, v14.18.0 + */ + readonly type: string; + /** + * Creates a new `Blob` object containing a concatenation of the given sources. + * + * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into + * the 'Blob' and can therefore be safely modified after the 'Blob' is created. + * + * String sources are also copied into the `Blob`. + */ + constructor(sources: Array, options?: BlobOptions); + /** + * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of + * the `Blob` data. + * @since v15.7.0, v14.18.0 + */ + arrayBuffer(): Promise; + /** + * Creates and returns a new `Blob` containing a subset of this `Blob` objects + * data. The original `Blob` is not altered. + * @since v15.7.0, v14.18.0 + * @param start The starting index. + * @param end The ending index. + * @param type The content-type for the new `Blob` + */ + slice(start?: number, end?: number, type?: string): Blob; + /** + * Returns a promise that fulfills with the contents of the `Blob` decoded as a + * UTF-8 string. + * @since v15.7.0, v14.18.0 + */ + text(): Promise; + /** + * Returns a new `ReadableStream` that allows the content of the `Blob` to be read. + * @since v16.7.0 + */ + stream(): WebReadableStream; + } + export interface FileOptions { + /** + * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be + * converted to the platform native line-ending as specified by `require('node:os').EOL`. + */ + endings?: 'native' | 'transparent'; + /** The File content-type. */ + type?: string; + /** The last modified date of the file. `Default`: Date.now(). */ + lastModified?: number; + } + /** + * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. + * @since v19.2.0, v18.13.0 + */ + export class File extends Blob { + constructor(sources: Array, fileName: string, options?: FileOptions); + /** + * The name of the `File`. + * @since v19.2.0, v18.13.0 + */ + readonly name: string; + /** + * The last modified date of the `File`. + * @since v19.2.0, v18.13.0 + */ + readonly lastModified: number; + } + export import atob = globalThis.atob; + export import btoa = globalThis.btoa; + import { Blob as NodeBlob } from 'buffer'; + // This conditional type will be the existing global Blob in a browser, or + // the copy below in a Node environment. + type __Blob = typeof globalThis extends { onmessage: any; Blob: infer T } ? T : NodeBlob; + global { + namespace NodeJS { + export { BufferEncoding }; + } + // Buffer class + type BufferEncoding = + | 'ascii' + | 'utf8' + | 'utf-8' + | 'utf16le' + | 'ucs2' + | 'ucs-2' + | 'base64' + | 'base64url' + | 'latin1' + | 'binary' + | 'hex'; + type WithImplicitCoercion = + | T + | { + valueOf(): T; + }; + /** + * Raw data is stored in instances of the Buffer class. + * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. + * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex' + */ + interface BufferConstructor { + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. + */ + new (str: string, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). + */ + new (size: number): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. + */ + new (array: Uint8Array): Buffer; + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}/{SharedArrayBuffer}. + * + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. + */ + new (arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. + */ + new (array: ReadonlyArray): Buffer; + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. + */ + new (buffer: Buffer): Buffer; + /** + * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. + * Array entries outside that range will be truncated to fit into it. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'. + * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); + * ``` + * + * If `array` is an `Array`\-like object (that is, one with a `length` property of + * type `number`), it is treated as if it is an array, unless it is a `Buffer` or + * a `Uint8Array`. This means all other `TypedArray` variants get treated as an`Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`. + * + * A `TypeError` will be thrown if `array` is not an `Array` or another type + * appropriate for `Buffer.from()` variants. + * + * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does. + * @since v5.10.0 + */ + from( + arrayBuffer: WithImplicitCoercion, + byteOffset?: number, + length?: number, + ): Buffer; + /** + * Creates a new Buffer using the passed {data} + * @param data data to create a new Buffer + */ + from(data: Uint8Array | ReadonlyArray): Buffer; + from(data: WithImplicitCoercion | string>): Buffer; + /** + * Creates a new Buffer containing the given JavaScript string {str}. + * If provided, the {encoding} parameter identifies the character encoding. + * If not provided, {encoding} defaults to 'utf8'. + */ + from( + str: + | WithImplicitCoercion + | { + [Symbol.toPrimitive](hint: 'string'): string; + }, + encoding?: BufferEncoding, + ): Buffer; + /** + * Creates a new Buffer using the passed {data} + * @param values to create a new Buffer + */ + of(...items: number[]): Buffer; + /** + * Returns `true` if `obj` is a `Buffer`, `false` otherwise. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * Buffer.isBuffer(Buffer.alloc(10)); // true + * Buffer.isBuffer(Buffer.from('foo')); // true + * Buffer.isBuffer('a string'); // false + * Buffer.isBuffer([]); // false + * Buffer.isBuffer(new Uint8Array(1024)); // false + * ``` + * @since v0.1.101 + */ + isBuffer(obj: any): obj is Buffer; + /** + * Returns `true` if `encoding` is the name of a supported character encoding, + * or `false` otherwise. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * console.log(Buffer.isEncoding('utf8')); + * // Prints: true + * + * console.log(Buffer.isEncoding('hex')); + * // Prints: true + * + * console.log(Buffer.isEncoding('utf/8')); + * // Prints: false + * + * console.log(Buffer.isEncoding('')); + * // Prints: false + * ``` + * @since v0.9.1 + * @param encoding A character encoding name to check. + */ + isEncoding(encoding: string): encoding is BufferEncoding; + /** + * Returns the byte length of a string when encoded using `encoding`. + * This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account + * for the encoding that is used to convert the string into bytes. + * + * For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input. + * For strings that contain non-base64/hex-encoded data (e.g. whitespace), the + * return value might be greater than the length of a `Buffer` created from the + * string. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const str = '\u00bd + \u00bc = \u00be'; + * + * console.log(`${str}: ${str.length} characters, ` + + * `${Buffer.byteLength(str, 'utf8')} bytes`); + * // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes + * ``` + * + * When `string` is a + * `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/- + * Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop- + * er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned. + * @since v0.1.90 + * @param string A value to calculate the length of. + * @param [encoding='utf8'] If `string` is a string, this is its encoding. + * @return The number of bytes contained within `string`. + */ + byteLength( + string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, + encoding?: BufferEncoding, + ): number; + /** + * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. + * + * If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned. + * + * If `totalLength` is not provided, it is calculated from the `Buffer` instances + * in `list` by adding their lengths. + * + * If `totalLength` is provided, it is coerced to an unsigned integer. If the + * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is + * truncated to `totalLength`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a single `Buffer` from a list of three `Buffer` instances. + * + * const buf1 = Buffer.alloc(10); + * const buf2 = Buffer.alloc(14); + * const buf3 = Buffer.alloc(18); + * const totalLength = buf1.length + buf2.length + buf3.length; + * + * console.log(totalLength); + * // Prints: 42 + * + * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); + * + * console.log(bufA); + * // Prints: + * console.log(bufA.length); + * // Prints: 42 + * ``` + * + * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. + * @since v0.7.11 + * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate. + * @param totalLength Total length of the `Buffer` instances in `list` when concatenated. + */ + concat(list: ReadonlyArray, totalLength?: number): Buffer; + /** + * Copies the underlying memory of `view` into a new `Buffer`. + * + * ```js + * const u16 = new Uint16Array([0, 0xffff]); + * const buf = Buffer.copyBytesFrom(u16, 1, 1); + * u16[1] = 0; + * console.log(buf.length); // 2 + * console.log(buf[0]); // 255 + * console.log(buf[1]); // 255 + * ``` + * @since v19.8.0 + * @param view The {TypedArray} to copy. + * @param [offset=': 0'] The starting offset within `view`. + * @param [length=view.length - offset] The number of elements from `view` to copy. + */ + copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer; + /** + * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('1234'); + * const buf2 = Buffer.from('0123'); + * const arr = [buf1, buf2]; + * + * console.log(arr.sort(Buffer.compare)); + * // Prints: [ , ] + * // (This result is equal to: [buf2, buf1].) + * ``` + * @since v0.11.13 + * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details. + */ + compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1; + /** + * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(5); + * + * console.log(buf); + * // Prints: + * ``` + * + * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. + * + * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(5, 'a'); + * + * console.log(buf); + * // Prints: + * ``` + * + * If both `fill` and `encoding` are specified, the allocated `Buffer` will be + * initialized by calling `buf.fill(fill, encoding)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); + * + * console.log(buf); + * // Prints: + * ``` + * + * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance + * contents will never contain sensitive data from previous allocations, including + * data that might not have been allocated for `Buffer`s. + * + * A `TypeError` will be thrown if `size` is not a number. + * @since v5.10.0 + * @param size The desired length of the new `Buffer`. + * @param [fill=0] A value to pre-fill the new `Buffer` with. + * @param [encoding='utf8'] If `fill` is a string, this is its encoding. + */ + alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. + * + * The underlying memory for `Buffer` instances created in this way is _not_ + * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(10); + * + * console.log(buf); + * // Prints (contents may vary): + * + * buf.fill(0); + * + * console.log(buf); + * // Prints: + * ``` + * + * A `TypeError` will be thrown if `size` is not a number. + * + * The `Buffer` module pre-allocates an internal `Buffer` instance of + * size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, + * and `Buffer.concat()` only when `size` is less than or equal to`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). + * + * Use of this pre-allocated internal memory pool is a key difference between + * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. + * Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less + * than or equal to half `Buffer.poolSize`. The + * difference is subtle but can be important when an application requires the + * additional performance that `Buffer.allocUnsafe()` provides. + * @since v5.10.0 + * @param size The desired length of the new `Buffer`. + */ + allocUnsafe(size: number): Buffer; + /** + * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if + * `size` is 0. + * + * The underlying memory for `Buffer` instances created in this way is _not_ + * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize + * such `Buffer` instances with zeroes. + * + * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, + * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This + * allows applications to avoid the garbage collection overhead of creating many + * individually allocated `Buffer` instances. This approach improves both + * performance and memory usage by eliminating the need to track and clean up as + * many individual `ArrayBuffer` objects. + * + * However, in the case where a developer may need to retain a small chunk of + * memory from a pool for an indeterminate amount of time, it may be appropriate + * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and + * then copying out the relevant bits. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Need to keep around a few small chunks of memory. + * const store = []; + * + * socket.on('readable', () => { + * let data; + * while (null !== (data = readable.read())) { + * // Allocate for retained data. + * const sb = Buffer.allocUnsafeSlow(10); + * + * // Copy the data into the new allocation. + * data.copy(sb, 0, 0, 10); + * + * store.push(sb); + * } + * }); + * ``` + * + * A `TypeError` will be thrown if `size` is not a number. + * @since v5.12.0 + * @param size The desired length of the new `Buffer`. + */ + allocUnsafeSlow(size: number): Buffer; + /** + * This is the size (in bytes) of pre-allocated internal `Buffer` instances used + * for pooling. This value may be modified. + * @since v0.11.3 + */ + poolSize: number; + } + interface Buffer extends Uint8Array { + /** + * Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did + * not contain enough space to fit the entire string, only part of `string` will be + * written. However, partially encoded characters will not be written. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.alloc(256); + * + * const len = buf.write('\u00bd + \u00bc = \u00be', 0); + * + * console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); + * // Prints: 12 bytes: ½ + ¼ = ¾ + * + * const buffer = Buffer.alloc(10); + * + * const length = buffer.write('abcd', 8); + * + * console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`); + * // Prints: 2 bytes : ab + * ``` + * @since v0.1.90 + * @param string String to write to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write `string`. + * @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`). + * @param [encoding='utf8'] The character encoding of `string`. + * @return Number of bytes written. + */ + write(string: string, encoding?: BufferEncoding): number; + write(string: string, offset: number, encoding?: BufferEncoding): number; + write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; + /** + * Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`. + * + * If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8, + * then each invalid byte is replaced with the replacement character `U+FFFD`. + * + * The maximum length of a string instance (in UTF-16 code units) is available + * as {@link constants.MAX_STRING_LENGTH}. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * console.log(buf1.toString('utf8')); + * // Prints: abcdefghijklmnopqrstuvwxyz + * console.log(buf1.toString('utf8', 0, 5)); + * // Prints: abcde + * + * const buf2 = Buffer.from('tést'); + * + * console.log(buf2.toString('hex')); + * // Prints: 74c3a97374 + * console.log(buf2.toString('utf8', 0, 3)); + * // Prints: té + * console.log(buf2.toString(undefined, 0, 3)); + * // Prints: té + * ``` + * @since v0.1.90 + * @param [encoding='utf8'] The character encoding to use. + * @param [start=0] The byte offset to start decoding at. + * @param [end=buf.length] The byte offset to stop decoding at (not inclusive). + */ + toString(encoding?: BufferEncoding, start?: number, end?: number): string; + /** + * Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls + * this function when stringifying a `Buffer` instance. + * + * `Buffer.from()` accepts objects in the format returned from this method. + * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); + * const json = JSON.stringify(buf); + * + * console.log(json); + * // Prints: {"type":"Buffer","data":[1,2,3,4,5]} + * + * const copy = JSON.parse(json, (key, value) => { + * return value && value.type === 'Buffer' ? + * Buffer.from(value) : + * value; + * }); + * + * console.log(copy); + * // Prints: + * ``` + * @since v0.9.2 + */ + toJSON(): { + type: 'Buffer'; + data: number[]; + }; + /** + * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('ABC'); + * const buf2 = Buffer.from('414243', 'hex'); + * const buf3 = Buffer.from('ABCD'); + * + * console.log(buf1.equals(buf2)); + * // Prints: true + * console.log(buf1.equals(buf3)); + * // Prints: false + * ``` + * @since v0.11.13 + * @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`. + */ + equals(otherBuffer: Uint8Array): boolean; + /** + * Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order. + * Comparison is based on the actual sequence of bytes in each `Buffer`. + * + * * `0` is returned if `target` is the same as `buf` + * * `1` is returned if `target` should come _before_`buf` when sorted. + * * `-1` is returned if `target` should come _after_`buf` when sorted. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('ABC'); + * const buf2 = Buffer.from('BCD'); + * const buf3 = Buffer.from('ABCD'); + * + * console.log(buf1.compare(buf1)); + * // Prints: 0 + * console.log(buf1.compare(buf2)); + * // Prints: -1 + * console.log(buf1.compare(buf3)); + * // Prints: -1 + * console.log(buf2.compare(buf1)); + * // Prints: 1 + * console.log(buf2.compare(buf3)); + * // Prints: 1 + * console.log([buf1, buf2, buf3].sort(Buffer.compare)); + * // Prints: [ , , ] + * // (This result is equal to: [buf1, buf3, buf2].) + * ``` + * + * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]); + * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]); + * + * console.log(buf1.compare(buf2, 5, 9, 0, 4)); + * // Prints: 0 + * console.log(buf1.compare(buf2, 0, 6, 4)); + * // Prints: -1 + * console.log(buf1.compare(buf2, 5, 6, 5)); + * // Prints: 1 + * ``` + * + * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`,`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`. + * @since v0.11.13 + * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`. + * @param [targetStart=0] The offset within `target` at which to begin comparison. + * @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive). + * @param [sourceStart=0] The offset within `buf` at which to begin comparison. + * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive). + */ + compare( + target: Uint8Array, + targetStart?: number, + targetEnd?: number, + sourceStart?: number, + sourceEnd?: number, + ): -1 | 0 | 1; + /** + * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`. + * + * [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available + * for all TypedArrays, including Node.js `Buffer`s, although it takes + * different function arguments. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create two `Buffer` instances. + * const buf1 = Buffer.allocUnsafe(26); + * const buf2 = Buffer.allocUnsafe(26).fill('!'); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`. + * buf1.copy(buf2, 8, 16, 20); + * // This is equivalent to: + * // buf2.set(buf1.subarray(16, 20), 8); + * + * console.log(buf2.toString('ascii', 0, 25)); + * // Prints: !!!!!!!!qrst!!!!!!!!!!!!! + * ``` + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a `Buffer` and copy data from one region to an overlapping region + * // within the same `Buffer`. + * + * const buf = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf[i] = i + 97; + * } + * + * buf.copy(buf, 0, 4, 10); + * + * console.log(buf.toString()); + * // Prints: efghijghijklmnopqrstuvwxyz + * ``` + * @since v0.1.90 + * @param target A `Buffer` or {@link Uint8Array} to copy into. + * @param [targetStart=0] The offset within `target` at which to begin writing. + * @param [sourceStart=0] The offset within `buf` from which to begin copying. + * @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive). + * @return The number of bytes copied. + */ + copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + /** + * Returns a new `Buffer` that references the same memory as the original, but + * offset and cropped by the `start` and `end` indices. + * + * This method is not compatible with the `Uint8Array.prototype.slice()`, + * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * const copiedBuf = Uint8Array.prototype.slice.call(buf); + * copiedBuf[0]++; + * console.log(copiedBuf.toString()); + * // Prints: cuffer + * + * console.log(buf.toString()); + * // Prints: buffer + * + * // With buf.slice(), the original buffer is modified. + * const notReallyCopiedBuf = buf.slice(); + * notReallyCopiedBuf[0]++; + * console.log(notReallyCopiedBuf.toString()); + * // Prints: cuffer + * console.log(buf.toString()); + * // Also prints: cuffer (!) + * ``` + * @since v0.3.0 + * @deprecated Use `subarray` instead. + * @param [start=0] Where the new `Buffer` will start. + * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). + */ + slice(start?: number, end?: number): Buffer; + /** + * Returns a new `Buffer` that references the same memory as the original, but + * offset and cropped by the `start` and `end` indices. + * + * Specifying `end` greater than `buf.length` will return the same result as + * that of `end` equal to `buf.length`. + * + * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). + * + * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte + * // from the original `Buffer`. + * + * const buf1 = Buffer.allocUnsafe(26); + * + * for (let i = 0; i < 26; i++) { + * // 97 is the decimal ASCII value for 'a'. + * buf1[i] = i + 97; + * } + * + * const buf2 = buf1.subarray(0, 3); + * + * console.log(buf2.toString('ascii', 0, buf2.length)); + * // Prints: abc + * + * buf1[0] = 33; + * + * console.log(buf2.toString('ascii', 0, buf2.length)); + * // Prints: !bc + * ``` + * + * Specifying negative indexes causes the slice to be generated relative to the + * end of `buf` rather than the beginning. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * console.log(buf.subarray(-6, -1).toString()); + * // Prints: buffe + * // (Equivalent to buf.subarray(0, 5).) + * + * console.log(buf.subarray(-6, -2).toString()); + * // Prints: buff + * // (Equivalent to buf.subarray(0, 4).) + * + * console.log(buf.subarray(-5, -2).toString()); + * // Prints: uff + * // (Equivalent to buf.subarray(1, 4).) + * ``` + * @since v3.0.0 + * @param [start=0] Where the new `Buffer` will start. + * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). + */ + subarray(start?: number, end?: number): Buffer; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigInt64BE(0x0102030405060708n, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigInt64BE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigInt64LE(0x0102030405060708n, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigInt64LE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. + * + * This function is also available under the `writeBigUint64BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigUInt64BE(0xdecafafecacefaden, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigUInt64BE(value: bigint, offset?: number): number; + /** + * @alias Buffer.writeBigUInt64BE + * @since v14.10.0, v12.19.0 + */ + writeBigUint64BE(value: bigint, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeBigUInt64LE(0xdecafafecacefaden, 0); + * + * console.log(buf); + * // Prints: + * ``` + * + * This function is also available under the `writeBigUint64LE` alias. + * @since v12.0.0, v10.20.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeBigUInt64LE(value: bigint, offset?: number): number; + /** + * @alias Buffer.writeBigUInt64LE + * @since v14.10.0, v12.19.0 + */ + writeBigUint64LE(value: bigint, offset?: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than an unsigned integer. + * + * This function is also available under the `writeUintLE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeUIntLE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeUIntLE(value: number, offset: number, byteLength: number): number; + /** + * @alias Buffer.writeUIntLE + * @since v14.9.0, v12.19.0 + */ + writeUintLE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than an unsigned integer. + * + * This function is also available under the `writeUintBE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeUIntBE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeUIntBE(value: number, offset: number, byteLength: number): number; + /** + * @alias Buffer.writeUIntBE + * @since v14.9.0, v12.19.0 + */ + writeUintBE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined + * when `value` is anything other than a signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeIntLE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeIntLE(value: number, offset: number, byteLength: number): number; + /** + * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a + * signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(6); + * + * buf.writeIntBE(0x1234567890ab, 0, 6); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. + * @return `offset` plus the number of bytes written. + */ + writeIntBE(value: number, offset: number, byteLength: number): number; + /** + * Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readBigUint64BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); + * + * console.log(buf.readBigUInt64BE(0)); + * // Prints: 4294967295n + * ``` + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigUInt64BE(offset?: number): bigint; + /** + * @alias Buffer.readBigUInt64BE + * @since v14.10.0, v12.19.0 + */ + readBigUint64BE(offset?: number): bigint; + /** + * Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readBigUint64LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); + * + * console.log(buf.readBigUInt64LE(0)); + * // Prints: 18446744069414584320n + * ``` + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigUInt64LE(offset?: number): bigint; + /** + * @alias Buffer.readBigUInt64LE + * @since v14.10.0, v12.19.0 + */ + readBigUint64LE(offset?: number): bigint; + /** + * Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed + * values. + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigInt64BE(offset?: number): bigint; + /** + * Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed + * values. + * @since v12.0.0, v10.20.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. + */ + readBigInt64LE(offset?: number): bigint; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting + * up to 48 bits of accuracy. + * + * This function is also available under the `readUintLE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readUIntLE(0, 6).toString(16)); + * // Prints: ab9078563412 + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readUIntLE(offset: number, byteLength: number): number; + /** + * @alias Buffer.readUIntLE + * @since v14.9.0, v12.19.0 + */ + readUintLE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting + * up to 48 bits of accuracy. + * + * This function is also available under the `readUintBE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readUIntBE(0, 6).toString(16)); + * // Prints: 1234567890ab + * console.log(buf.readUIntBE(1, 6).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readUIntBE(offset: number, byteLength: number): number; + /** + * @alias Buffer.readUIntBE + * @since v14.9.0, v12.19.0 + */ + readUintBE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value + * supporting up to 48 bits of accuracy. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readIntLE(0, 6).toString(16)); + * // Prints: -546f87a9cbee + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readIntLE(offset: number, byteLength: number): number; + /** + * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value + * supporting up to 48 bits of accuracy. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); + * + * console.log(buf.readIntBE(0, 6).toString(16)); + * // Prints: 1234567890ab + * console.log(buf.readIntBE(1, 6).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * console.log(buf.readIntBE(1, 0).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. + * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. + */ + readIntBE(offset: number, byteLength: number): number; + /** + * Reads an unsigned 8-bit integer from `buf` at the specified `offset`. + * + * This function is also available under the `readUint8` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, -2]); + * + * console.log(buf.readUInt8(0)); + * // Prints: 1 + * console.log(buf.readUInt8(1)); + * // Prints: 254 + * console.log(buf.readUInt8(2)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. + */ + readUInt8(offset?: number): number; + /** + * @alias Buffer.readUInt8 + * @since v14.9.0, v12.19.0 + */ + readUint8(offset?: number): number; + /** + * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint16LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56]); + * + * console.log(buf.readUInt16LE(0).toString(16)); + * // Prints: 3412 + * console.log(buf.readUInt16LE(1).toString(16)); + * // Prints: 5634 + * console.log(buf.readUInt16LE(2).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readUInt16LE(offset?: number): number; + /** + * @alias Buffer.readUInt16LE + * @since v14.9.0, v12.19.0 + */ + readUint16LE(offset?: number): number; + /** + * Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint16BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56]); + * + * console.log(buf.readUInt16BE(0).toString(16)); + * // Prints: 1234 + * console.log(buf.readUInt16BE(1).toString(16)); + * // Prints: 3456 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readUInt16BE(offset?: number): number; + /** + * @alias Buffer.readUInt16BE + * @since v14.9.0, v12.19.0 + */ + readUint16BE(offset?: number): number; + /** + * Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint32LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); + * + * console.log(buf.readUInt32LE(0).toString(16)); + * // Prints: 78563412 + * console.log(buf.readUInt32LE(1).toString(16)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readUInt32LE(offset?: number): number; + /** + * @alias Buffer.readUInt32LE + * @since v14.9.0, v12.19.0 + */ + readUint32LE(offset?: number): number; + /** + * Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`. + * + * This function is also available under the `readUint32BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); + * + * console.log(buf.readUInt32BE(0).toString(16)); + * // Prints: 12345678 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readUInt32BE(offset?: number): number; + /** + * @alias Buffer.readUInt32BE + * @since v14.9.0, v12.19.0 + */ + readUint32BE(offset?: number): number; + /** + * Reads a signed 8-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([-1, 5]); + * + * console.log(buf.readInt8(0)); + * // Prints: -1 + * console.log(buf.readInt8(1)); + * // Prints: 5 + * console.log(buf.readInt8(2)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.0 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. + */ + readInt8(offset?: number): number; + /** + * Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 5]); + * + * console.log(buf.readInt16LE(0)); + * // Prints: 1280 + * console.log(buf.readInt16LE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readInt16LE(offset?: number): number; + /** + * Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 5]); + * + * console.log(buf.readInt16BE(0)); + * // Prints: 5 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. + */ + readInt16BE(offset?: number): number; + /** + * Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 0, 0, 5]); + * + * console.log(buf.readInt32LE(0)); + * // Prints: 83886080 + * console.log(buf.readInt32LE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readInt32LE(offset?: number): number; + /** + * Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`. + * + * Integers read from a `Buffer` are interpreted as two's complement signed values. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([0, 0, 0, 5]); + * + * console.log(buf.readInt32BE(0)); + * // Prints: 5 + * ``` + * @since v0.5.5 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readInt32BE(offset?: number): number; + /** + * Reads a 32-bit, little-endian float from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4]); + * + * console.log(buf.readFloatLE(0)); + * // Prints: 1.539989614439558e-36 + * console.log(buf.readFloatLE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readFloatLE(offset?: number): number; + /** + * Reads a 32-bit, big-endian float from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4]); + * + * console.log(buf.readFloatBE(0)); + * // Prints: 2.387939260590663e-38 + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. + */ + readFloatBE(offset?: number): number; + /** + * Reads a 64-bit, little-endian double from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + * + * console.log(buf.readDoubleLE(0)); + * // Prints: 5.447603722011605e-270 + * console.log(buf.readDoubleLE(1)); + * // Throws ERR_OUT_OF_RANGE. + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. + */ + readDoubleLE(offset?: number): number; + /** + * Reads a 64-bit, big-endian double from `buf` at the specified `offset`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + * + * console.log(buf.readDoubleBE(0)); + * // Prints: 8.20788039913184e-304 + * ``` + * @since v0.11.15 + * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. + */ + readDoubleBE(offset?: number): number; + reverse(): this; + /** + * Interprets `buf` as an array of unsigned 16-bit integers and swaps the + * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap16(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap16(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * + * One convenient use of `buf.swap16()` is to perform a fast in-place conversion + * between UTF-16 little-endian and UTF-16 big-endian: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le'); + * buf.swap16(); // Convert to big-endian UTF-16 text. + * ``` + * @since v5.10.0 + * @return A reference to `buf`. + */ + swap16(): Buffer; + /** + * Interprets `buf` as an array of unsigned 32-bit integers and swaps the + * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap32(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap32(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * @since v5.10.0 + * @return A reference to `buf`. + */ + swap32(): Buffer; + /** + * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_. + * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); + * + * console.log(buf1); + * // Prints: + * + * buf1.swap64(); + * + * console.log(buf1); + * // Prints: + * + * const buf2 = Buffer.from([0x1, 0x2, 0x3]); + * + * buf2.swap64(); + * // Throws ERR_INVALID_BUFFER_SIZE. + * ``` + * @since v6.3.0 + * @return A reference to `buf`. + */ + swap64(): Buffer; + /** + * Writes `value` to `buf` at the specified `offset`. `value` must be a + * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything + * other than an unsigned 8-bit integer. + * + * This function is also available under the `writeUint8` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt8(0x3, 0); + * buf.writeUInt8(0x4, 1); + * buf.writeUInt8(0x23, 2); + * buf.writeUInt8(0x42, 3); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. + * @return `offset` plus the number of bytes written. + */ + writeUInt8(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt8 + * @since v14.9.0, v12.19.0 + */ + writeUint8(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is + * anything other than an unsigned 16-bit integer. + * + * This function is also available under the `writeUint16LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt16LE(0xdead, 0); + * buf.writeUInt16LE(0xbeef, 2); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeUInt16LE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt16LE + * @since v14.9.0, v12.19.0 + */ + writeUint16LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an + * unsigned 16-bit integer. + * + * This function is also available under the `writeUint16BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt16BE(0xdead, 0); + * buf.writeUInt16BE(0xbeef, 2); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeUInt16BE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt16BE + * @since v14.9.0, v12.19.0 + */ + writeUint16BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is + * anything other than an unsigned 32-bit integer. + * + * This function is also available under the `writeUint32LE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt32LE(0xfeedface, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeUInt32LE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt32LE + * @since v14.9.0, v12.19.0 + */ + writeUint32LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an + * unsigned 32-bit integer. + * + * This function is also available under the `writeUint32BE` alias. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeUInt32BE(0xfeedface, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeUInt32BE(value: number, offset?: number): number; + /** + * @alias Buffer.writeUInt32BE + * @since v14.9.0, v12.19.0 + */ + writeUint32BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset`. `value` must be a valid + * signed 8-bit integer. Behavior is undefined when `value` is anything other than + * a signed 8-bit integer. + * + * `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt8(2, 0); + * buf.writeInt8(-2, 1); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.0 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. + * @return `offset` plus the number of bytes written. + */ + writeInt8(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is + * anything other than a signed 16-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt16LE(0x0304, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeInt16LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is + * anything other than a signed 16-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(2); + * + * buf.writeInt16BE(0x0102, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. + * @return `offset` plus the number of bytes written. + */ + writeInt16BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is + * anything other than a signed 32-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeInt32LE(0x05060708, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeInt32LE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is + * anything other than a signed 32-bit integer. + * + * The `value` is interpreted and written as a two's complement signed integer. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeInt32BE(0x01020304, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.5.5 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeInt32BE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is + * undefined when `value` is anything other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeFloatLE(0xcafebabe, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeFloatLE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is + * undefined when `value` is anything other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(4); + * + * buf.writeFloatBE(0xcafebabe, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. + * @return `offset` plus the number of bytes written. + */ + writeFloatBE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything + * other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeDoubleLE(123.456, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeDoubleLE(value: number, offset?: number): number; + /** + * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything + * other than a JavaScript number. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(8); + * + * buf.writeDoubleBE(123.456, 0); + * + * console.log(buf); + * // Prints: + * ``` + * @since v0.11.15 + * @param value Number to be written to `buf`. + * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. + * @return `offset` plus the number of bytes written. + */ + writeDoubleBE(value: number, offset?: number): number; + /** + * Fills `buf` with the specified `value`. If the `offset` and `end` are not given, + * the entire `buf` will be filled: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Fill a `Buffer` with the ASCII character 'h'. + * + * const b = Buffer.allocUnsafe(50).fill('h'); + * + * console.log(b.toString()); + * // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh + * + * // Fill a buffer with empty string + * const c = Buffer.allocUnsafe(5).fill(''); + * + * console.log(c.fill('')); + * // Prints: + * ``` + * + * `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or + * integer. If the resulting integer is greater than `255` (decimal), `buf` will be + * filled with `value & 255`. + * + * If the final write of a `fill()` operation falls on a multi-byte character, + * then only the bytes of that character that fit into `buf` are written: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Fill a `Buffer` with character that takes up two bytes in UTF-8. + * + * console.log(Buffer.allocUnsafe(5).fill('\u0222')); + * // Prints: + * ``` + * + * If `value` contains invalid characters, it is truncated; if no valid + * fill data remains, an exception is thrown: + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.allocUnsafe(5); + * + * console.log(buf.fill('a')); + * // Prints: + * console.log(buf.fill('aazz', 'hex')); + * // Prints: + * console.log(buf.fill('zz', 'hex')); + * // Throws an exception. + * ``` + * @since v0.5.0 + * @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`. + * @param [offset=0] Number of bytes to skip before starting to fill `buf`. + * @param [end=buf.length] Where to stop filling `buf` (not inclusive). + * @param [encoding='utf8'] The encoding for `value` if `value` is a string. + * @return A reference to `buf`. + */ + fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; + /** + * If `value` is: + * + * * a string, `value` is interpreted according to the character encoding in`encoding`. + * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety. + * To compare a partial `Buffer`, use `buf.subarray`. + * * a number, `value` will be interpreted as an unsigned 8-bit integer + * value between `0` and `255`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this is a buffer'); + * + * console.log(buf.indexOf('this')); + * // Prints: 0 + * console.log(buf.indexOf('is')); + * // Prints: 2 + * console.log(buf.indexOf(Buffer.from('a buffer'))); + * // Prints: 8 + * console.log(buf.indexOf(97)); + * // Prints: 8 (97 is the decimal ASCII value for 'a') + * console.log(buf.indexOf(Buffer.from('a buffer example'))); + * // Prints: -1 + * console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8))); + * // Prints: 8 + * + * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); + * + * console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le')); + * // Prints: 4 + * console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le')); + * // Prints: 6 + * ``` + * + * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value, + * an integer between 0 and 255. + * + * If `byteOffset` is not a number, it will be coerced to a number. If the result + * of coercion is `NaN` or `0`, then the entire buffer will be searched. This + * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf). + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const b = Buffer.from('abcdef'); + * + * // Passing a value that's a number, but not a valid byte. + * // Prints: 2, equivalent to searching for 99 or 'c'. + * console.log(b.indexOf(99.9)); + * console.log(b.indexOf(256 + 99)); + * + * // Passing a byteOffset that coerces to NaN or 0. + * // Prints: 1, searching the whole buffer. + * console.log(b.indexOf('b', undefined)); + * console.log(b.indexOf('b', {})); + * console.log(b.indexOf('b', null)); + * console.log(b.indexOf('b', [])); + * ``` + * + * If `value` is an empty string or empty `Buffer` and `byteOffset` is less + * than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned. + * @since v1.5.0 + * @param value What to search for. + * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. + * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. + */ + indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + /** + * Identical to `buf.indexOf()`, except the last occurrence of `value` is found + * rather than the first occurrence. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this buffer is a buffer'); + * + * console.log(buf.lastIndexOf('this')); + * // Prints: 0 + * console.log(buf.lastIndexOf('buffer')); + * // Prints: 17 + * console.log(buf.lastIndexOf(Buffer.from('buffer'))); + * // Prints: 17 + * console.log(buf.lastIndexOf(97)); + * // Prints: 15 (97 is the decimal ASCII value for 'a') + * console.log(buf.lastIndexOf(Buffer.from('yolo'))); + * // Prints: -1 + * console.log(buf.lastIndexOf('buffer', 5)); + * // Prints: 5 + * console.log(buf.lastIndexOf('buffer', 4)); + * // Prints: -1 + * + * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); + * + * console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le')); + * // Prints: 6 + * console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le')); + * // Prints: 4 + * ``` + * + * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value, + * an integer between 0 and 255. + * + * If `byteOffset` is not a number, it will be coerced to a number. Any arguments + * that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer. + * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf). + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const b = Buffer.from('abcdef'); + * + * // Passing a value that's a number, but not a valid byte. + * // Prints: 2, equivalent to searching for 99 or 'c'. + * console.log(b.lastIndexOf(99.9)); + * console.log(b.lastIndexOf(256 + 99)); + * + * // Passing a byteOffset that coerces to NaN. + * // Prints: 1, searching the whole buffer. + * console.log(b.lastIndexOf('b', undefined)); + * console.log(b.lastIndexOf('b', {})); + * + * // Passing a byteOffset that coerces to 0. + * // Prints: -1, equivalent to passing 0. + * console.log(b.lastIndexOf('b', null)); + * console.log(b.lastIndexOf('b', [])); + * ``` + * + * If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned. + * @since v6.0.0 + * @param value What to search for. + * @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. + * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. + */ + lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + /** + * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `[index, byte]` pairs from the contents + * of `buf`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * // Log the entire contents of a `Buffer`. + * + * const buf = Buffer.from('buffer'); + * + * for (const pair of buf.entries()) { + * console.log(pair); + * } + * // Prints: + * // [0, 98] + * // [1, 117] + * // [2, 102] + * // [3, 102] + * // [4, 101] + * // [5, 114] + * ``` + * @since v1.1.0 + */ + entries(): IterableIterator<[number, number]>; + /** + * Equivalent to `buf.indexOf() !== -1`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('this is a buffer'); + * + * console.log(buf.includes('this')); + * // Prints: true + * console.log(buf.includes('is')); + * // Prints: true + * console.log(buf.includes(Buffer.from('a buffer'))); + * // Prints: true + * console.log(buf.includes(97)); + * // Prints: true (97 is the decimal ASCII value for 'a') + * console.log(buf.includes(Buffer.from('a buffer example'))); + * // Prints: false + * console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8))); + * // Prints: true + * console.log(buf.includes('this', 4)); + * // Prints: false + * ``` + * @since v5.3.0 + * @param value What to search for. + * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. + * @param [encoding='utf8'] If `value` is a string, this is its encoding. + * @return `true` if `value` was found in `buf`, `false` otherwise. + */ + includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; + /** + * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices). + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * for (const key of buf.keys()) { + * console.log(key); + * } + * // Prints: + * // 0 + * // 1 + * // 2 + * // 3 + * // 4 + * // 5 + * ``` + * @since v1.1.0 + */ + keys(): IterableIterator; + /** + * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) for `buf` values (bytes). This function is + * called automatically when a `Buffer` is used in a `for..of` statement. + * + * ```js + * import { Buffer } from 'node:buffer'; + * + * const buf = Buffer.from('buffer'); + * + * for (const value of buf.values()) { + * console.log(value); + * } + * // Prints: + * // 98 + * // 117 + * // 102 + * // 102 + * // 101 + * // 114 + * + * for (const value of buf) { + * console.log(value); + * } + * // Prints: + * // 98 + * // 117 + * // 102 + * // 102 + * // 101 + * // 114 + * ``` + * @since v1.1.0 + */ + values(): IterableIterator; + } + var Buffer: BufferConstructor; + /** + * Decodes a string of Base64-encoded data into bytes, and encodes those bytes + * into a string using Latin-1 (ISO-8859-1). + * + * The `data` may be any JavaScript-value that can be coerced into a string. + * + * **This function is only provided for compatibility with legacy web platform APIs** + * **and should never be used in new code, because they use strings to represent** + * **binary data and predate the introduction of typed arrays in JavaScript.** + * **For code running using Node.js APIs, converting between base64-encoded strings** + * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.** + * @since v15.13.0, v14.17.0 + * @legacy Use `Buffer.from(data, 'base64')` instead. + * @param data The Base64-encoded input string. + */ + function atob(data: string): string; + /** + * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes + * into a string using Base64. + * + * The `data` may be any JavaScript-value that can be coerced into a string. + * + * **This function is only provided for compatibility with legacy web platform APIs** + * **and should never be used in new code, because they use strings to represent** + * **binary data and predate the introduction of typed arrays in JavaScript.** + * **For code running using Node.js APIs, converting between base64-encoded strings** + * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.** + * @since v15.13.0, v14.17.0 + * @legacy Use `buf.toString('base64')` instead. + * @param data An ASCII (Latin1) string. + */ + function btoa(data: string): string; + interface Blob extends __Blob {} + /** + * `Blob` class is a global reference for `require('node:buffer').Blob` + * https://nodejs.org/api/buffer.html#class-blob + * @since v18.0.0 + */ + var Blob: typeof globalThis extends { + onmessage: any; + Blob: infer T; + } + ? T + : typeof NodeBlob; + } +} +declare module 'node:buffer' { + export * from 'buffer'; +} diff --git a/node_modules/@types/node/ts4.8/child_process.d.ts b/node_modules/@types/node/ts4.8/child_process.d.ts new file mode 100755 index 0000000..b255795 --- /dev/null +++ b/node_modules/@types/node/ts4.8/child_process.d.ts @@ -0,0 +1,1400 @@ +/** + * The `node:child_process` module provides the ability to spawn subprocesses in + * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability + * is primarily provided by the {@link spawn} function: + * + * ```js + * const { spawn } = require('node:child_process'); + * const ls = spawn('ls', ['-lh', '/usr']); + * + * ls.stdout.on('data', (data) => { + * console.log(`stdout: ${data}`); + * }); + * + * ls.stderr.on('data', (data) => { + * console.error(`stderr: ${data}`); + * }); + * + * ls.on('close', (code) => { + * console.log(`child process exited with code ${code}`); + * }); + * ``` + * + * By default, pipes for `stdin`, `stdout`, and `stderr` are established between + * the parent Node.js process and the spawned subprocess. These pipes have + * limited (and platform-specific) capacity. If the subprocess writes to + * stdout in excess of that limit without the output being captured, the + * subprocess blocks waiting for the pipe buffer to accept more data. This is + * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed. + * + * The command lookup is performed using the `options.env.PATH` environment + * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is + * used. If `options.env` is set without `PATH`, lookup on Unix is performed + * on a default search path search of `/usr/bin:/bin` (see your operating system's + * manual for execvpe/execvp), on Windows the current processes environment + * variable `PATH` is used. + * + * On Windows, environment variables are case-insensitive. Node.js + * lexicographically sorts the `env` keys and uses the first one that + * case-insensitively matches. Only first (in lexicographic order) entry will be + * passed to the subprocess. This might lead to issues on Windows when passing + * objects to the `env` option that have multiple variants of the same key, such as`PATH` and `Path`. + * + * The {@link spawn} method spawns the child process asynchronously, + * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks + * the event loop until the spawned process either exits or is terminated. + * + * For convenience, the `node:child_process` module provides a handful of + * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on + * top of {@link spawn} or {@link spawnSync}. + * + * * {@link exec}: spawns a shell and runs a command within that + * shell, passing the `stdout` and `stderr` to a callback function when + * complete. + * * {@link execFile}: similar to {@link exec} except + * that it spawns the command directly without first spawning a shell by + * default. + * * {@link fork}: spawns a new Node.js process and invokes a + * specified module with an IPC communication channel established that allows + * sending messages between parent and child. + * * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop. + * * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop. + * + * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however, + * the synchronous methods can have significant impact on performance due to + * stalling the event loop while spawned processes complete. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/child_process.js) + */ +declare module 'child_process' { + import { ObjectEncodingOptions } from 'node:fs'; + import { EventEmitter, Abortable } from 'node:events'; + import * as net from 'node:net'; + import { Writable, Readable, Stream, Pipe } from 'node:stream'; + import { URL } from 'node:url'; + type Serializable = string | object | number | boolean | bigint; + type SendHandle = net.Socket | net.Server; + /** + * Instances of the `ChildProcess` represent spawned child processes. + * + * Instances of `ChildProcess` are not intended to be created directly. Rather, + * use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create + * instances of `ChildProcess`. + * @since v2.2.0 + */ + class ChildProcess extends EventEmitter { + /** + * A `Writable Stream` that represents the child process's `stdin`. + * + * If a child process waits to read all of its input, the child will not continue + * until this stream has been closed via `end()`. + * + * If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will + * refer to the same value. + * + * The `subprocess.stdin` property can be `null` or `undefined`if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stdin: Writable | null; + /** + * A `Readable Stream` that represents the child process's `stdout`. + * + * If the child was spawned with `stdio[1]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will + * refer to the same value. + * + * ```js + * const { spawn } = require('node:child_process'); + * + * const subprocess = spawn('ls'); + * + * subprocess.stdout.on('data', (data) => { + * console.log(`Received chunk ${data}`); + * }); + * ``` + * + * The `subprocess.stdout` property can be `null` or `undefined`if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stdout: Readable | null; + /** + * A `Readable Stream` that represents the child process's `stderr`. + * + * If the child was spawned with `stdio[2]` set to anything other than `'pipe'`, + * then this will be `null`. + * + * `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will + * refer to the same value. + * + * The `subprocess.stderr` property can be `null` or `undefined`if the child process could not be successfully spawned. + * @since v0.1.90 + */ + stderr: Readable | null; + /** + * The `subprocess.channel` property is a reference to the child's IPC channel. If + * no IPC channel exists, this property is `undefined`. + * @since v7.1.0 + */ + readonly channel?: Pipe | null | undefined; + /** + * A sparse array of pipes to the child process, corresponding with positions in + * the `stdio` option passed to {@link spawn} that have been set + * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and`subprocess.stdio[2]` are also available as `subprocess.stdin`,`subprocess.stdout`, and `subprocess.stderr`, + * respectively. + * + * In the following example, only the child's fd `1` (stdout) is configured as a + * pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values + * in the array are `null`. + * + * ```js + * const assert = require('node:assert'); + * const fs = require('node:fs'); + * const child_process = require('node:child_process'); + * + * const subprocess = child_process.spawn('ls', { + * stdio: [ + * 0, // Use parent's stdin for child. + * 'pipe', // Pipe child's stdout to parent. + * fs.openSync('err.out', 'w'), // Direct child's stderr to a file. + * ], + * }); + * + * assert.strictEqual(subprocess.stdio[0], null); + * assert.strictEqual(subprocess.stdio[0], subprocess.stdin); + * + * assert(subprocess.stdout); + * assert.strictEqual(subprocess.stdio[1], subprocess.stdout); + * + * assert.strictEqual(subprocess.stdio[2], null); + * assert.strictEqual(subprocess.stdio[2], subprocess.stderr); + * ``` + * + * The `subprocess.stdio` property can be `undefined` if the child process could + * not be successfully spawned. + * @since v0.7.10 + */ + readonly stdio: [ + Writable | null, + // stdin + Readable | null, + // stdout + Readable | null, + // stderr + Readable | Writable | null | undefined, + // extra + Readable | Writable | null | undefined // extra + ]; + /** + * The `subprocess.killed` property indicates whether the child process + * successfully received a signal from `subprocess.kill()`. The `killed` property + * does not indicate that the child process has been terminated. + * @since v0.5.10 + */ + readonly killed: boolean; + /** + * Returns the process identifier (PID) of the child process. If the child process + * fails to spawn due to errors, then the value is `undefined` and `error` is + * emitted. + * + * ```js + * const { spawn } = require('node:child_process'); + * const grep = spawn('grep', ['ssh']); + * + * console.log(`Spawned child pid: ${grep.pid}`); + * grep.stdin.end(); + * ``` + * @since v0.1.90 + */ + readonly pid?: number | undefined; + /** + * The `subprocess.connected` property indicates whether it is still possible to + * send and receive messages from a child process. When `subprocess.connected` is`false`, it is no longer possible to send or receive messages. + * @since v0.7.2 + */ + readonly connected: boolean; + /** + * The `subprocess.exitCode` property indicates the exit code of the child process. + * If the child process is still running, the field will be `null`. + */ + readonly exitCode: number | null; + /** + * The `subprocess.signalCode` property indicates the signal received by + * the child process if any, else `null`. + */ + readonly signalCode: NodeJS.Signals | null; + /** + * The `subprocess.spawnargs` property represents the full list of command-line + * arguments the child process was launched with. + */ + readonly spawnargs: string[]; + /** + * The `subprocess.spawnfile` property indicates the executable file name of + * the child process that is launched. + * + * For {@link fork}, its value will be equal to `process.execPath`. + * For {@link spawn}, its value will be the name of + * the executable file. + * For {@link exec}, its value will be the name of the shell + * in which the child process is launched. + */ + readonly spawnfile: string; + /** + * The `subprocess.kill()` method sends a signal to the child process. If no + * argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function + * returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise. + * + * ```js + * const { spawn } = require('node:child_process'); + * const grep = spawn('grep', ['ssh']); + * + * grep.on('close', (code, signal) => { + * console.log( + * `child process terminated due to receipt of signal ${signal}`); + * }); + * + * // Send SIGHUP to process. + * grep.kill('SIGHUP'); + * ``` + * + * The `ChildProcess` object may emit an `'error'` event if the signal + * cannot be delivered. Sending a signal to a child process that has already exited + * is not an error but may have unforeseen consequences. Specifically, if the + * process identifier (PID) has been reassigned to another process, the signal will + * be delivered to that process instead which can have unexpected results. + * + * While the function is called `kill`, the signal delivered to the child process + * may not actually terminate the process. + * + * See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference. + * + * On Windows, where POSIX signals do not exist, the `signal` argument will be + * ignored, and the process will be killed forcefully and abruptly (similar to`'SIGKILL'`). + * See `Signal Events` for more details. + * + * On Linux, child processes of child processes will not be terminated + * when attempting to kill their parent. This is likely to happen when running a + * new process in a shell or with the use of the `shell` option of `ChildProcess`: + * + * ```js + * 'use strict'; + * const { spawn } = require('node:child_process'); + * + * const subprocess = spawn( + * 'sh', + * [ + * '-c', + * `node -e "setInterval(() => { + * console.log(process.pid, 'is alive') + * }, 500);"`, + * ], { + * stdio: ['inherit', 'inherit', 'inherit'], + * }, + * ); + * + * setTimeout(() => { + * subprocess.kill(); // Does not terminate the Node.js process in the shell. + * }, 2000); + * ``` + * @since v0.1.90 + */ + kill(signal?: NodeJS.Signals | number): boolean; + /** + * Calls {@link ChildProcess.kill} with `'SIGTERM'`. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + /** + * When an IPC channel has been established between the parent and child ( + * i.e. when using {@link fork}), the `subprocess.send()` method can + * be used to send messages to the child process. When the child process is a + * Node.js instance, these messages can be received via the `'message'` event. + * + * The message goes through serialization and parsing. The resulting + * message might not be the same as what is originally sent. + * + * For example, in the parent script: + * + * ```js + * const cp = require('node:child_process'); + * const n = cp.fork(`${__dirname}/sub.js`); + * + * n.on('message', (m) => { + * console.log('PARENT got message:', m); + * }); + * + * // Causes the child to print: CHILD got message: { hello: 'world' } + * n.send({ hello: 'world' }); + * ``` + * + * And then the child script, `'sub.js'` might look like this: + * + * ```js + * process.on('message', (m) => { + * console.log('CHILD got message:', m); + * }); + * + * // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null } + * process.send({ foo: 'bar', baz: NaN }); + * ``` + * + * Child Node.js processes will have a `process.send()` method of their own + * that allows the child to send messages back to the parent. + * + * There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages + * containing a `NODE_` prefix in the `cmd` property are reserved for use within + * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the`'internalMessage'` event and are consumed internally by Node.js. + * Applications should avoid using such messages or listening for`'internalMessage'` events as it is subject to change without notice. + * + * The optional `sendHandle` argument that may be passed to `subprocess.send()` is + * for passing a TCP server or socket object to the child process. The child will + * receive the object as the second argument passed to the callback function + * registered on the `'message'` event. Any data that is received + * and buffered in the socket will not be sent to the child. + * + * The optional `callback` is a function that is invoked after the message is + * sent but before the child may have received it. The function is called with a + * single argument: `null` on success, or an `Error` object on failure. + * + * If no `callback` function is provided and the message cannot be sent, an`'error'` event will be emitted by the `ChildProcess` object. This can + * happen, for instance, when the child process has already exited. + * + * `subprocess.send()` will return `false` if the channel has closed or when the + * backlog of unsent messages exceeds a threshold that makes it unwise to send + * more. Otherwise, the method returns `true`. The `callback` function can be + * used to implement flow control. + * + * #### Example: sending a server object + * + * The `sendHandle` argument can be used, for instance, to pass the handle of + * a TCP server object to the child process as illustrated in the example below: + * + * ```js + * const subprocess = require('node:child_process').fork('subprocess.js'); + * + * // Open up the server object and send the handle. + * const server = require('node:net').createServer(); + * server.on('connection', (socket) => { + * socket.end('handled by parent'); + * }); + * server.listen(1337, () => { + * subprocess.send('server', server); + * }); + * ``` + * + * The child would then receive the server object as: + * + * ```js + * process.on('message', (m, server) => { + * if (m === 'server') { + * server.on('connection', (socket) => { + * socket.end('handled by child'); + * }); + * } + * }); + * ``` + * + * Once the server is now shared between the parent and child, some connections + * can be handled by the parent and some by the child. + * + * While the example above uses a server created using the `node:net` module,`node:dgram` module servers use exactly the same workflow with the exceptions of + * listening on a `'message'` event instead of `'connection'` and using`server.bind()` instead of `server.listen()`. This is, however, only + * supported on Unix platforms. + * + * #### Example: sending a socket object + * + * Similarly, the `sendHandler` argument can be used to pass the handle of a + * socket to the child process. The example below spawns two children that each + * handle connections with "normal" or "special" priority: + * + * ```js + * const { fork } = require('node:child_process'); + * const normal = fork('subprocess.js', ['normal']); + * const special = fork('subprocess.js', ['special']); + * + * // Open up the server and send sockets to child. Use pauseOnConnect to prevent + * // the sockets from being read before they are sent to the child process. + * const server = require('node:net').createServer({ pauseOnConnect: true }); + * server.on('connection', (socket) => { + * + * // If this is special priority... + * if (socket.remoteAddress === '74.125.127.100') { + * special.send('socket', socket); + * return; + * } + * // This is normal priority. + * normal.send('socket', socket); + * }); + * server.listen(1337); + * ``` + * + * The `subprocess.js` would receive the socket handle as the second argument + * passed to the event callback function: + * + * ```js + * process.on('message', (m, socket) => { + * if (m === 'socket') { + * if (socket) { + * // Check that the client socket exists. + * // It is possible for the socket to be closed between the time it is + * // sent and the time it is received in the child process. + * socket.end(`Request handled with ${process.argv[2]} priority`); + * } + * } + * }); + * ``` + * + * Do not use `.maxConnections` on a socket that has been passed to a subprocess. + * The parent cannot track when the socket is destroyed. + * + * Any `'message'` handlers in the subprocess should verify that `socket` exists, + * as the connection may have been closed during the time it takes to send the + * connection to the child. + * @since v0.5.9 + * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: + */ + send(message: Serializable, callback?: (error: Error | null) => void): boolean; + send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; + send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean; + /** + * Closes the IPC channel between parent and child, allowing the child to exit + * gracefully once there are no other connections keeping it alive. After calling + * this method the `subprocess.connected` and `process.connected` properties in + * both the parent and child (respectively) will be set to `false`, and it will be + * no longer possible to pass messages between the processes. + * + * The `'disconnect'` event will be emitted when there are no messages in the + * process of being received. This will most often be triggered immediately after + * calling `subprocess.disconnect()`. + * + * When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked + * within the child process to close the IPC channel as well. + * @since v0.7.2 + */ + disconnect(): void; + /** + * By default, the parent will wait for the detached child to exit. To prevent the + * parent from waiting for a given `subprocess` to exit, use the`subprocess.unref()` method. Doing so will cause the parent's event loop to not + * include the child in its reference count, allowing the parent to exit + * independently of the child, unless there is an established IPC channel between + * the child and the parent. + * + * ```js + * const { spawn } = require('node:child_process'); + * + * const subprocess = spawn(process.argv[0], ['child_program.js'], { + * detached: true, + * stdio: 'ignore', + * }); + * + * subprocess.unref(); + * ``` + * @since v0.7.10 + */ + unref(): void; + /** + * Calling `subprocess.ref()` after making a call to `subprocess.unref()` will + * restore the removed reference count for the child process, forcing the parent + * to wait for the child to exit before exiting itself. + * + * ```js + * const { spawn } = require('node:child_process'); + * + * const subprocess = spawn(process.argv[0], ['child_program.js'], { + * detached: true, + * stdio: 'ignore', + * }); + * + * subprocess.unref(); + * subprocess.ref(); + * ``` + * @since v0.7.10 + */ + ref(): void; + /** + * events.EventEmitter + * 1. close + * 2. disconnect + * 3. error + * 4. exit + * 5. message + * 6. spawn + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + addListener(event: 'disconnect', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + addListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + addListener(event: 'spawn', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close', code: number | null, signal: NodeJS.Signals | null): boolean; + emit(event: 'disconnect'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'exit', code: number | null, signal: NodeJS.Signals | null): boolean; + emit(event: 'message', message: Serializable, sendHandle: SendHandle): boolean; + emit(event: 'spawn', listener: () => void): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + on(event: 'disconnect', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + on(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + on(event: 'spawn', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + once(event: 'disconnect', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + once(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + once(event: 'spawn', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependListener(event: 'disconnect', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + prependListener(event: 'spawn', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependOnceListener(event: 'disconnect', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; + prependOnceListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this; + prependOnceListener(event: 'spawn', listener: () => void): this; + } + // return this object when stdio option is undefined or not specified + interface ChildProcessWithoutNullStreams extends ChildProcess { + stdin: Writable; + stdout: Readable; + stderr: Readable; + readonly stdio: [ + Writable, + Readable, + Readable, + // stderr + Readable | Writable | null | undefined, + // extra, no modification + Readable | Writable | null | undefined // extra, no modification + ]; + } + // return this object when stdio option is a tuple of 3 + interface ChildProcessByStdio extends ChildProcess { + stdin: I; + stdout: O; + stderr: E; + readonly stdio: [ + I, + O, + E, + Readable | Writable | null | undefined, + // extra, no modification + Readable | Writable | null | undefined // extra, no modification + ]; + } + interface MessageOptions { + keepOpen?: boolean | undefined; + } + type IOType = 'overlapped' | 'pipe' | 'ignore' | 'inherit'; + type StdioOptions = IOType | Array; + type SerializationType = 'json' | 'advanced'; + interface MessagingOptions extends Abortable { + /** + * Specify the kind of serialization used for sending messages between processes. + * @default 'json' + */ + serialization?: SerializationType | undefined; + /** + * The signal value to be used when the spawned process will be killed by the abort signal. + * @default 'SIGTERM' + */ + killSignal?: NodeJS.Signals | number | undefined; + /** + * In milliseconds the maximum amount of time the process is allowed to run. + */ + timeout?: number | undefined; + } + interface ProcessEnvOptions { + uid?: number | undefined; + gid?: number | undefined; + cwd?: string | URL | undefined; + env?: NodeJS.ProcessEnv | undefined; + } + interface CommonOptions extends ProcessEnvOptions { + /** + * @default false + */ + windowsHide?: boolean | undefined; + /** + * @default 0 + */ + timeout?: number | undefined; + } + interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable { + argv0?: string | undefined; + /** + * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + shell?: boolean | string | undefined; + windowsVerbatimArguments?: boolean | undefined; + } + interface SpawnOptions extends CommonSpawnOptions { + detached?: boolean | undefined; + } + interface SpawnOptionsWithoutStdio extends SpawnOptions { + stdio?: StdioPipeNamed | StdioPipe[] | undefined; + } + type StdioNull = 'inherit' | 'ignore' | Stream; + type StdioPipeNamed = 'pipe' | 'overlapped'; + type StdioPipe = undefined | null | StdioPipeNamed; + interface SpawnOptionsWithStdioTuple extends SpawnOptions { + stdio: [Stdin, Stdout, Stderr]; + } + /** + * The `child_process.spawn()` method spawns a new process using the given`command`, with command-line arguments in `args`. If omitted, `args` defaults + * to an empty array. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * + * A third argument may be used to specify additional options, with these defaults: + * + * ```js + * const defaults = { + * cwd: undefined, + * env: process.env, + * }; + * ``` + * + * Use `cwd` to specify the working directory from which the process is spawned. + * If not given, the default is to inherit the current working directory. If given, + * but the path does not exist, the child process emits an `ENOENT` error + * and exits immediately. `ENOENT` is also emitted when the command + * does not exist. + * + * Use `env` to specify environment variables that will be visible to the new + * process, the default is `process.env`. + * + * `undefined` values in `env` will be ignored. + * + * Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the + * exit code: + * + * ```js + * const { spawn } = require('node:child_process'); + * const ls = spawn('ls', ['-lh', '/usr']); + * + * ls.stdout.on('data', (data) => { + * console.log(`stdout: ${data}`); + * }); + * + * ls.stderr.on('data', (data) => { + * console.error(`stderr: ${data}`); + * }); + * + * ls.on('close', (code) => { + * console.log(`child process exited with code ${code}`); + * }); + * ``` + * + * Example: A very elaborate way to run `ps ax | grep ssh` + * + * ```js + * const { spawn } = require('node:child_process'); + * const ps = spawn('ps', ['ax']); + * const grep = spawn('grep', ['ssh']); + * + * ps.stdout.on('data', (data) => { + * grep.stdin.write(data); + * }); + * + * ps.stderr.on('data', (data) => { + * console.error(`ps stderr: ${data}`); + * }); + * + * ps.on('close', (code) => { + * if (code !== 0) { + * console.log(`ps process exited with code ${code}`); + * } + * grep.stdin.end(); + * }); + * + * grep.stdout.on('data', (data) => { + * console.log(data.toString()); + * }); + * + * grep.stderr.on('data', (data) => { + * console.error(`grep stderr: ${data}`); + * }); + * + * grep.on('close', (code) => { + * if (code !== 0) { + * console.log(`grep process exited with code ${code}`); + * } + * }); + * ``` + * + * Example of checking for failed `spawn`: + * + * ```js + * const { spawn } = require('node:child_process'); + * const subprocess = spawn('bad_command'); + * + * subprocess.on('error', (err) => { + * console.error('Failed to start subprocess.'); + * }); + * ``` + * + * Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process + * title while others (Windows, SunOS) will use `command`. + * + * Node.js overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent. Retrieve + * it with the`process.argv0` property instead. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * const { spawn } = require('node:child_process'); + * const controller = new AbortController(); + * const { signal } = controller; + * const grep = spawn('grep', ['ssh'], { signal }); + * grep.on('error', (err) => { + * // This will be called with err being an AbortError if the controller aborts + * }); + * controller.abort(); // Stops the child process + * ``` + * @since v0.1.90 + * @param command The command to run. + * @param args List of string arguments. + */ + function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, options: SpawnOptions): ChildProcess; + // overloads of spawn with 'args' + function spawn(command: string, args?: ReadonlyArray, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio; + function spawn(command: string, args: ReadonlyArray, options: SpawnOptions): ChildProcess; + interface ExecOptions extends CommonOptions { + shell?: string | undefined; + signal?: AbortSignal | undefined; + maxBuffer?: number | undefined; + killSignal?: NodeJS.Signals | number | undefined; + } + interface ExecOptionsWithStringEncoding extends ExecOptions { + encoding: BufferEncoding; + } + interface ExecOptionsWithBufferEncoding extends ExecOptions { + encoding: BufferEncoding | null; // specify `null`. + } + interface ExecException extends Error { + cmd?: string | undefined; + killed?: boolean | undefined; + code?: number | undefined; + signal?: NodeJS.Signals | undefined; + } + /** + * Spawns a shell then executes the `command` within that shell, buffering any + * generated output. The `command` string passed to the exec function is processed + * directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters)) + * need to be dealt with accordingly: + * + * ```js + * const { exec } = require('node:child_process'); + * + * exec('"/path/to/test file/test.sh" arg1 arg2'); + * // Double quotes are used so that the space in the path is not interpreted as + * // a delimiter of multiple arguments. + * + * exec('echo "The \\$HOME variable is $HOME"'); + * // The $HOME variable is escaped in the first instance, but not in the second. + * ``` + * + * **Never pass unsanitized user input to this function. Any input containing shell** + * **metacharacters may be used to trigger arbitrary command execution.** + * + * If a `callback` function is provided, it is called with the arguments`(error, stdout, stderr)`. On success, `error` will be `null`. On error,`error` will be an instance of `Error`. The + * `error.code` property will be + * the exit code of the process. By convention, any exit code other than `0`indicates an error. `error.signal` will be the signal that terminated the + * process. + * + * The `stdout` and `stderr` arguments passed to the callback will contain the + * stdout and stderr output of the child process. By default, Node.js will decode + * the output as UTF-8 and pass strings to the callback. The `encoding` option + * can be used to specify the character encoding used to decode the stdout and + * stderr output. If `encoding` is `'buffer'`, or an unrecognized character + * encoding, `Buffer` objects will be passed to the callback instead. + * + * ```js + * const { exec } = require('node:child_process'); + * exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => { + * if (error) { + * console.error(`exec error: ${error}`); + * return; + * } + * console.log(`stdout: ${stdout}`); + * console.error(`stderr: ${stderr}`); + * }); + * ``` + * + * If `timeout` is greater than `0`, the parent will send the signal + * identified by the `killSignal` property (the default is `'SIGTERM'`) if the + * child runs longer than `timeout` milliseconds. + * + * Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace + * the existing process and uses a shell to execute the command. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In + * case of an error (including any error resulting in an exit code other than 0), a + * rejected promise is returned, with the same `error` object given in the + * callback, but with two additional properties `stdout` and `stderr`. + * + * ```js + * const util = require('node:util'); + * const exec = util.promisify(require('node:child_process').exec); + * + * async function lsExample() { + * const { stdout, stderr } = await exec('ls'); + * console.log('stdout:', stdout); + * console.error('stderr:', stderr); + * } + * lsExample(); + * ``` + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * const { exec } = require('node:child_process'); + * const controller = new AbortController(); + * const { signal } = controller; + * const child = exec('grep ssh', { signal }, (error) => { + * console.error(error); // an AbortError + * }); + * controller.abort(); + * ``` + * @since v0.1.90 + * @param command The command to run, with space-separated arguments. + * @param callback called with the output when process terminates. + */ + function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; + // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. + function exec( + command: string, + options: { + encoding: 'buffer' | null; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void + ): ChildProcess; + // `options` with well known `encoding` means stdout/stderr are definitely `string`. + function exec( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: string, stderr: string) => void + ): ChildProcess; + // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. + // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. + function exec( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions, + callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void + ): ChildProcess; + // `options` without an `encoding` means stdout/stderr are definitely `string`. + function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess; + // fallback if nothing else matches. Worst case is always `string | Buffer`. + function exec( + command: string, + options: (ObjectEncodingOptions & ExecOptions) | undefined | null, + callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void + ): ChildProcess; + interface PromiseWithChild extends Promise { + child: ChildProcess; + } + namespace exec { + function __promisify__(command: string): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options: { + encoding: 'buffer' | null; + } & ExecOptions + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + command: string, + options: { + encoding: BufferEncoding; + } & ExecOptions + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options: ExecOptions + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + command: string, + options?: (ObjectEncodingOptions & ExecOptions) | null + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + } + interface ExecFileOptions extends CommonOptions, Abortable { + maxBuffer?: number | undefined; + killSignal?: NodeJS.Signals | number | undefined; + windowsVerbatimArguments?: boolean | undefined; + shell?: boolean | string | undefined; + signal?: AbortSignal | undefined; + } + interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { + encoding: BufferEncoding; + } + interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { + encoding: 'buffer' | null; + } + interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { + encoding: BufferEncoding; + } + type ExecFileException = + & Omit + & Omit + & { code?: string | number | undefined | null }; + /** + * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified + * executable `file` is spawned directly as a new process making it slightly more + * efficient than {@link exec}. + * + * The same options as {@link exec} are supported. Since a shell is + * not spawned, behaviors such as I/O redirection and file globbing are not + * supported. + * + * ```js + * const { execFile } = require('node:child_process'); + * const child = execFile('node', ['--version'], (error, stdout, stderr) => { + * if (error) { + * throw error; + * } + * console.log(stdout); + * }); + * ``` + * + * The `stdout` and `stderr` arguments passed to the callback will contain the + * stdout and stderr output of the child process. By default, Node.js will decode + * the output as UTF-8 and pass strings to the callback. The `encoding` option + * can be used to specify the character encoding used to decode the stdout and + * stderr output. If `encoding` is `'buffer'`, or an unrecognized character + * encoding, `Buffer` objects will be passed to the callback instead. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In + * case of an error (including any error resulting in an exit code other than 0), a + * rejected promise is returned, with the same `error` object given in the + * callback, but with two additional properties `stdout` and `stderr`. + * + * ```js + * const util = require('node:util'); + * const execFile = util.promisify(require('node:child_process').execFile); + * async function getVersion() { + * const { stdout } = await execFile('node', ['--version']); + * console.log(stdout); + * } + * getVersion(); + * ``` + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * const { execFile } = require('node:child_process'); + * const controller = new AbortController(); + * const { signal } = controller; + * const child = execFile('node', ['--version'], { signal }, (error) => { + * console.error(error); // an AbortError + * }); + * controller.abort(); + * ``` + * @since v0.1.91 + * @param file The name or path of the executable file to run. + * @param args List of string arguments. + * @param callback Called with the output when process terminates. + */ + function execFile(file: string): ChildProcess; + function execFile(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess; + function execFile(file: string, args?: ReadonlyArray | null): ChildProcess; + function execFile(file: string, args: ReadonlyArray | undefined | null, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess; + // no `options` definitely means stdout/stderr are `string`. + function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; + function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; + // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. + function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithBufferEncoding, + callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void + ): ChildProcess; + // `options` with well known `encoding` means stdout/stderr are definitely `string`. + function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithStringEncoding, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void + ): ChildProcess; + // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. + // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. + function execFile(file: string, options: ExecFileOptionsWithOtherEncoding, callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithOtherEncoding, + callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void + ): ChildProcess; + // `options` without an `encoding` means stdout/stderr are definitely `string`. + function execFile(file: string, options: ExecFileOptions, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptions, + callback: (error: ExecFileException | null, stdout: string, stderr: string) => void + ): ChildProcess; + // fallback if nothing else matches. Worst case is always `string | Buffer`. + function execFile( + file: string, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null + ): ChildProcess; + function execFile( + file: string, + args: ReadonlyArray | undefined | null, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, + callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null + ): ChildProcess; + namespace execFile { + function __promisify__(file: string): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithBufferEncoding + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithBufferEncoding + ): PromiseWithChild<{ + stdout: Buffer; + stderr: Buffer; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithStringEncoding + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithStringEncoding + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: ExecFileOptionsWithOtherEncoding + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptionsWithOtherEncoding + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + options: ExecFileOptions + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: ExecFileOptions + ): PromiseWithChild<{ + stdout: string; + stderr: string; + }>; + function __promisify__( + file: string, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + function __promisify__( + file: string, + args: ReadonlyArray | undefined | null, + options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null + ): PromiseWithChild<{ + stdout: string | Buffer; + stderr: string | Buffer; + }>; + } + interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable { + execPath?: string | undefined; + execArgv?: string[] | undefined; + silent?: boolean | undefined; + /** + * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + detached?: boolean | undefined; + windowsVerbatimArguments?: boolean | undefined; + } + /** + * The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes. + * Like {@link spawn}, a `ChildProcess` object is returned. The + * returned `ChildProcess` will have an additional communication channel + * built-in that allows messages to be passed back and forth between the parent and + * child. See `subprocess.send()` for details. + * + * Keep in mind that spawned Node.js child processes are + * independent of the parent with exception of the IPC communication channel + * that is established between the two. Each process has its own memory, with + * their own V8 instances. Because of the additional resource allocations + * required, spawning a large number of child Node.js processes is not + * recommended. + * + * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the`options` object allows for an alternative + * execution path to be used. + * + * Node.js processes launched with a custom `execPath` will communicate with the + * parent process using the file descriptor (fd) identified using the + * environment variable `NODE_CHANNEL_FD` on the child process. + * + * Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the + * current process. + * + * The `shell` option available in {@link spawn} is not supported by`child_process.fork()` and will be ignored if set. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except + * the error passed to the callback will be an `AbortError`: + * + * ```js + * if (process.argv[2] === 'child') { + * setTimeout(() => { + * console.log(`Hello from ${process.argv[2]}!`); + * }, 1_000); + * } else { + * const { fork } = require('node:child_process'); + * const controller = new AbortController(); + * const { signal } = controller; + * const child = fork(__filename, ['child'], { signal }); + * child.on('error', (err) => { + * // This will be called with err being an AbortError if the controller aborts + * }); + * controller.abort(); // Stops the child process + * } + * ``` + * @since v0.5.0 + * @param modulePath The module to run in the child. + * @param args List of string arguments. + */ + function fork(modulePath: string, options?: ForkOptions): ChildProcess; + function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess; + interface SpawnSyncOptions extends CommonSpawnOptions { + input?: string | NodeJS.ArrayBufferView | undefined; + maxBuffer?: number | undefined; + encoding?: BufferEncoding | 'buffer' | null | undefined; + } + interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { + encoding: BufferEncoding; + } + interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { + encoding?: 'buffer' | null | undefined; + } + interface SpawnSyncReturns { + pid: number; + output: Array; + stdout: T; + stderr: T; + status: number | null; + signal: NodeJS.Signals | null; + error?: Error | undefined; + } + /** + * The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return + * until the child process has fully closed. When a timeout has been encountered + * and `killSignal` is sent, the method won't return until the process has + * completely exited. If the process intercepts and handles the `SIGTERM` signal + * and doesn't exit, the parent process will wait until the child process has + * exited. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * @since v0.11.12 + * @param command The command to run. + * @param args List of string arguments. + */ + function spawnSync(command: string): SpawnSyncReturns; + function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; + function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; + function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; + function spawnSync(command: string, args: ReadonlyArray): SpawnSyncReturns; + function spawnSync(command: string, args: ReadonlyArray, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; + function spawnSync(command: string, args: ReadonlyArray, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; + function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns; + interface CommonExecOptions extends CommonOptions { + input?: string | NodeJS.ArrayBufferView | undefined; + /** + * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings. + * If passed as an array, the first element is used for `stdin`, the second for + * `stdout`, and the third for `stderr`. A fourth element can be used to + * specify the `stdio` behavior beyond the standard streams. See + * {@link ChildProcess.stdio} for more information. + * + * @default 'pipe' + */ + stdio?: StdioOptions | undefined; + killSignal?: NodeJS.Signals | number | undefined; + maxBuffer?: number | undefined; + encoding?: BufferEncoding | 'buffer' | null | undefined; + } + interface ExecSyncOptions extends CommonExecOptions { + shell?: string | undefined; + } + interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { + encoding: BufferEncoding; + } + interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { + encoding?: 'buffer' | null | undefined; + } + /** + * The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return + * until the child process has fully closed. When a timeout has been encountered + * and `killSignal` is sent, the method won't return until the process has + * completely exited. If the child process intercepts and handles the `SIGTERM`signal and doesn't exit, the parent process will wait until the child process + * has exited. + * + * If the process times out or has a non-zero exit code, this method will throw. + * The `Error` object will contain the entire result from {@link spawnSync}. + * + * **Never pass unsanitized user input to this function. Any input containing shell** + * **metacharacters may be used to trigger arbitrary command execution.** + * @since v0.11.12 + * @param command The command to run. + * @return The stdout from the command. + */ + function execSync(command: string): Buffer; + function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string; + function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer; + function execSync(command: string, options?: ExecSyncOptions): string | Buffer; + interface ExecFileSyncOptions extends CommonExecOptions { + shell?: boolean | string | undefined; + } + interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { + encoding: BufferEncoding; + } + interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { + encoding?: 'buffer' | null; // specify `null`. + } + /** + * The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not + * return until the child process has fully closed. When a timeout has been + * encountered and `killSignal` is sent, the method won't return until the process + * has completely exited. + * + * If the child process intercepts and handles the `SIGTERM` signal and + * does not exit, the parent process will still wait until the child process has + * exited. + * + * If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}. + * + * **If the `shell` option is enabled, do not pass unsanitized user input to this** + * **function. Any input containing shell metacharacters may be used to trigger** + * **arbitrary command execution.** + * @since v0.11.12 + * @param file The name or path of the executable file to run. + * @param args List of string arguments. + * @return The stdout from the command. + */ + function execFileSync(file: string): Buffer; + function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string; + function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; + function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer; + function execFileSync(file: string, args: ReadonlyArray): Buffer; + function execFileSync(file: string, args: ReadonlyArray, options: ExecFileSyncOptionsWithStringEncoding): string; + function execFileSync(file: string, args: ReadonlyArray, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; + function execFileSync(file: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): string | Buffer; +} +declare module 'node:child_process' { + export * from 'child_process'; +} diff --git a/node_modules/@types/node/ts4.8/cluster.d.ts b/node_modules/@types/node/ts4.8/cluster.d.ts new file mode 100755 index 0000000..4fa9aef --- /dev/null +++ b/node_modules/@types/node/ts4.8/cluster.d.ts @@ -0,0 +1,414 @@ +/** + * Clusters of Node.js processes can be used to run multiple instances of Node.js + * that can distribute workloads among their application threads. When process + * isolation is not needed, use the `worker_threads` module instead, which + * allows running multiple application threads within a single Node.js instance. + * + * The cluster module allows easy creation of child processes that all share + * server ports. + * + * ```js + * import cluster from 'node:cluster'; + * import http from 'node:http'; + * import { availableParallelism } from 'node:os'; + * import process from 'node:process'; + * + * const numCPUs = availableParallelism(); + * + * if (cluster.isPrimary) { + * console.log(`Primary ${process.pid} is running`); + * + * // Fork workers. + * for (let i = 0; i < numCPUs; i++) { + * cluster.fork(); + * } + * + * cluster.on('exit', (worker, code, signal) => { + * console.log(`worker ${worker.process.pid} died`); + * }); + * } else { + * // Workers can share any TCP connection + * // In this case it is an HTTP server + * http.createServer((req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * + * console.log(`Worker ${process.pid} started`); + * } + * ``` + * + * Running Node.js will now share port 8000 between the workers: + * + * ```console + * $ node server.js + * Primary 3596 is running + * Worker 4324 started + * Worker 4520 started + * Worker 6056 started + * Worker 5644 started + * ``` + * + * On Windows, it is not yet possible to set up a named pipe server in a worker. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/cluster.js) + */ +declare module 'cluster' { + import * as child from 'node:child_process'; + import EventEmitter = require('node:events'); + import * as net from 'node:net'; + type SerializationType = 'json' | 'advanced'; + export interface ClusterSettings { + execArgv?: string[] | undefined; // default: process.execArgv + exec?: string | undefined; + args?: string[] | undefined; + silent?: boolean | undefined; + stdio?: any[] | undefined; + uid?: number | undefined; + gid?: number | undefined; + inspectPort?: number | (() => number) | undefined; + serialization?: SerializationType | undefined; + cwd?: string | undefined; + windowsHide?: boolean | undefined; + } + export interface Address { + address: string; + port: number; + addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6" + } + /** + * A `Worker` object contains all public information and method about a worker. + * In the primary it can be obtained using `cluster.workers`. In a worker + * it can be obtained using `cluster.worker`. + * @since v0.7.0 + */ + export class Worker extends EventEmitter { + /** + * Each new worker is given its own unique id, this id is stored in the`id`. + * + * While a worker is alive, this is the key that indexes it in`cluster.workers`. + * @since v0.8.0 + */ + id: number; + /** + * All workers are created using `child_process.fork()`, the returned object + * from this function is stored as `.process`. In a worker, the global `process`is stored. + * + * See: `Child Process module`. + * + * Workers will call `process.exit(0)` if the `'disconnect'` event occurs + * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against + * accidental disconnection. + * @since v0.7.0 + */ + process: child.ChildProcess; + /** + * Send a message to a worker or primary, optionally with a handle. + * + * In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`. + * + * In a worker, this sends a message to the primary. It is identical to`process.send()`. + * + * This example will echo back all messages from the primary: + * + * ```js + * if (cluster.isPrimary) { + * const worker = cluster.fork(); + * worker.send('hi there'); + * + * } else if (cluster.isWorker) { + * process.on('message', (msg) => { + * process.send(msg); + * }); + * } + * ``` + * @since v0.7.0 + * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: + */ + send(message: child.Serializable, callback?: (error: Error | null) => void): boolean; + send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean; + send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean; + /** + * This function will kill the worker. In the primary worker, it does this by + * disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`. + * + * The `kill()` function kills the worker process without waiting for a graceful + * disconnect, it has the same behavior as `worker.process.kill()`. + * + * This method is aliased as `worker.destroy()` for backwards compatibility. + * + * In a worker, `process.kill()` exists, but it is not this function; + * it is `kill()`. + * @since v0.9.12 + * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process. + */ + kill(signal?: string): void; + destroy(signal?: string): void; + /** + * In a worker, this function will close all servers, wait for the `'close'` event + * on those servers, and then disconnect the IPC channel. + * + * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself. + * + * Causes `.exitedAfterDisconnect` to be set. + * + * After a server is closed, it will no longer accept new connections, + * but connections may be accepted by any other listening worker. Existing + * connections will be allowed to close as usual. When no more connections exist, + * see `server.close()`, the IPC channel to the worker will close allowing it + * to die gracefully. + * + * The above applies _only_ to server connections, client connections are not + * automatically closed by workers, and disconnect does not wait for them to close + * before exiting. + * + * In a worker, `process.disconnect` exists, but it is not this function; + * it is `disconnect()`. + * + * Because long living server connections may block workers from disconnecting, it + * may be useful to send a message, so application specific actions may be taken to + * close them. It also may be useful to implement a timeout, killing a worker if + * the `'disconnect'` event has not been emitted after some time. + * + * ```js + * if (cluster.isPrimary) { + * const worker = cluster.fork(); + * let timeout; + * + * worker.on('listening', (address) => { + * worker.send('shutdown'); + * worker.disconnect(); + * timeout = setTimeout(() => { + * worker.kill(); + * }, 2000); + * }); + * + * worker.on('disconnect', () => { + * clearTimeout(timeout); + * }); + * + * } else if (cluster.isWorker) { + * const net = require('node:net'); + * const server = net.createServer((socket) => { + * // Connections never end + * }); + * + * server.listen(8000); + * + * process.on('message', (msg) => { + * if (msg === 'shutdown') { + * // Initiate graceful close of any connections to server + * } + * }); + * } + * ``` + * @since v0.7.7 + * @return A reference to `worker`. + */ + disconnect(): void; + /** + * This function returns `true` if the worker is connected to its primary via its + * IPC channel, `false` otherwise. A worker is connected to its primary after it + * has been created. It is disconnected after the `'disconnect'` event is emitted. + * @since v0.11.14 + */ + isConnected(): boolean; + /** + * This function returns `true` if the worker's process has terminated (either + * because of exiting or being signaled). Otherwise, it returns `false`. + * + * ```js + * import cluster from 'node:cluster'; + * import http from 'node:http'; + * import { availableParallelism } from 'node:os'; + * import process from 'node:process'; + * + * const numCPUs = availableParallelism(); + * + * if (cluster.isPrimary) { + * console.log(`Primary ${process.pid} is running`); + * + * // Fork workers. + * for (let i = 0; i < numCPUs; i++) { + * cluster.fork(); + * } + * + * cluster.on('fork', (worker) => { + * console.log('worker is dead:', worker.isDead()); + * }); + * + * cluster.on('exit', (worker, code, signal) => { + * console.log('worker is dead:', worker.isDead()); + * }); + * } else { + * // Workers can share any TCP connection. In this case, it is an HTTP server. + * http.createServer((req, res) => { + * res.writeHead(200); + * res.end(`Current process\n ${process.pid}`); + * process.kill(process.pid); + * }).listen(8000); + * } + * ``` + * @since v0.11.14 + */ + isDead(): boolean; + /** + * This property is `true` if the worker exited due to `.disconnect()`. + * If the worker exited any other way, it is `false`. If the + * worker has not exited, it is `undefined`. + * + * The boolean `worker.exitedAfterDisconnect` allows distinguishing between + * voluntary and accidental exit, the primary may choose not to respawn a worker + * based on this value. + * + * ```js + * cluster.on('exit', (worker, code, signal) => { + * if (worker.exitedAfterDisconnect === true) { + * console.log('Oh, it was just voluntary – no need to worry'); + * } + * }); + * + * // kill worker + * worker.kill(); + * ``` + * @since v6.0.0 + */ + exitedAfterDisconnect: boolean; + /** + * events.EventEmitter + * 1. disconnect + * 2. error + * 3. exit + * 4. listening + * 5. message + * 6. online + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'disconnect', listener: () => void): this; + addListener(event: 'error', listener: (error: Error) => void): this; + addListener(event: 'exit', listener: (code: number, signal: string) => void): this; + addListener(event: 'listening', listener: (address: Address) => void): this; + addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + addListener(event: 'online', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'disconnect'): boolean; + emit(event: 'error', error: Error): boolean; + emit(event: 'exit', code: number, signal: string): boolean; + emit(event: 'listening', address: Address): boolean; + emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean; + emit(event: 'online'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'disconnect', listener: () => void): this; + on(event: 'error', listener: (error: Error) => void): this; + on(event: 'exit', listener: (code: number, signal: string) => void): this; + on(event: 'listening', listener: (address: Address) => void): this; + on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + on(event: 'online', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'disconnect', listener: () => void): this; + once(event: 'error', listener: (error: Error) => void): this; + once(event: 'exit', listener: (code: number, signal: string) => void): this; + once(event: 'listening', listener: (address: Address) => void): this; + once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + once(event: 'online', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'disconnect', listener: () => void): this; + prependListener(event: 'error', listener: (error: Error) => void): this; + prependListener(event: 'exit', listener: (code: number, signal: string) => void): this; + prependListener(event: 'listening', listener: (address: Address) => void): this; + prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + prependListener(event: 'online', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'disconnect', listener: () => void): this; + prependOnceListener(event: 'error', listener: (error: Error) => void): this; + prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this; + prependOnceListener(event: 'listening', listener: (address: Address) => void): this; + prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + prependOnceListener(event: 'online', listener: () => void): this; + } + export interface Cluster extends EventEmitter { + disconnect(callback?: () => void): void; + fork(env?: any): Worker; + /** @deprecated since v16.0.0 - use isPrimary. */ + readonly isMaster: boolean; + readonly isPrimary: boolean; + readonly isWorker: boolean; + schedulingPolicy: number; + readonly settings: ClusterSettings; + /** @deprecated since v16.0.0 - use setupPrimary. */ + setupMaster(settings?: ClusterSettings): void; + /** + * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings. + */ + setupPrimary(settings?: ClusterSettings): void; + readonly worker?: Worker | undefined; + readonly workers?: NodeJS.Dict | undefined; + readonly SCHED_NONE: number; + readonly SCHED_RR: number; + /** + * events.EventEmitter + * 1. disconnect + * 2. exit + * 3. fork + * 4. listening + * 5. message + * 6. online + * 7. setup + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'disconnect', listener: (worker: Worker) => void): this; + addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + addListener(event: 'fork', listener: (worker: Worker) => void): this; + addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + addListener(event: 'online', listener: (worker: Worker) => void): this; + addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'disconnect', worker: Worker): boolean; + emit(event: 'exit', worker: Worker, code: number, signal: string): boolean; + emit(event: 'fork', worker: Worker): boolean; + emit(event: 'listening', worker: Worker, address: Address): boolean; + emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean; + emit(event: 'online', worker: Worker): boolean; + emit(event: 'setup', settings: ClusterSettings): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'disconnect', listener: (worker: Worker) => void): this; + on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + on(event: 'fork', listener: (worker: Worker) => void): this; + on(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + on(event: 'online', listener: (worker: Worker) => void): this; + on(event: 'setup', listener: (settings: ClusterSettings) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'disconnect', listener: (worker: Worker) => void): this; + once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + once(event: 'fork', listener: (worker: Worker) => void): this; + once(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. + once(event: 'online', listener: (worker: Worker) => void): this; + once(event: 'setup', listener: (settings: ClusterSettings) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'disconnect', listener: (worker: Worker) => void): this; + prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + prependListener(event: 'fork', listener: (worker: Worker) => void): this; + prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + // the handle is a net.Socket or net.Server object, or undefined. + prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this; + prependListener(event: 'online', listener: (worker: Worker) => void): this; + prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this; + prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this; + prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this; + prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this; + // the handle is a net.Socket or net.Server object, or undefined. + prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; + prependOnceListener(event: 'online', listener: (worker: Worker) => void): this; + prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this; + } + const cluster: Cluster; + export default cluster; +} +declare module 'node:cluster' { + export * from 'cluster'; + export { default as default } from 'cluster'; +} diff --git a/node_modules/@types/node/ts4.8/console.d.ts b/node_modules/@types/node/ts4.8/console.d.ts new file mode 100755 index 0000000..7e35638 --- /dev/null +++ b/node_modules/@types/node/ts4.8/console.d.ts @@ -0,0 +1,412 @@ +/** + * The `node:console` module provides a simple debugging console that is similar to + * the JavaScript console mechanism provided by web browsers. + * + * The module exports two specific components: + * + * * A `Console` class with methods such as `console.log()`, `console.error()`, and`console.warn()` that can be used to write to any Node.js stream. + * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('node:console')`. + * + * _**Warning**_: The global console object's methods are neither consistently + * synchronous like the browser APIs they resemble, nor are they consistently + * asynchronous like all other Node.js streams. See the `note on process I/O` for + * more information. + * + * Example using the global `console`: + * + * ```js + * console.log('hello world'); + * // Prints: hello world, to stdout + * console.log('hello %s', 'world'); + * // Prints: hello world, to stdout + * console.error(new Error('Whoops, something bad happened')); + * // Prints error message and stack trace to stderr: + * // Error: Whoops, something bad happened + * // at [eval]:5:15 + * // at Script.runInThisContext (node:vm:132:18) + * // at Object.runInThisContext (node:vm:309:38) + * // at node:internal/process/execution:77:19 + * // at [eval]-wrapper:6:22 + * // at evalScript (node:internal/process/execution:76:60) + * // at node:internal/main/eval_string:23:3 + * + * const name = 'Will Robinson'; + * console.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to stderr + * ``` + * + * Example using the `Console` class: + * + * ```js + * const out = getStreamSomehow(); + * const err = getStreamSomehow(); + * const myConsole = new console.Console(out, err); + * + * myConsole.log('hello world'); + * // Prints: hello world, to out + * myConsole.log('hello %s', 'world'); + * // Prints: hello world, to out + * myConsole.error(new Error('Whoops, something bad happened')); + * // Prints: [Error: Whoops, something bad happened], to err + * + * const name = 'Will Robinson'; + * myConsole.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to err + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/console.js) + */ +declare module 'console' { + import console = require('node:console'); + export = console; +} +declare module 'node:console' { + import { InspectOptions } from 'node:util'; + global { + // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build + interface Console { + Console: console.ConsoleConstructor; + /** + * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only + * writes a message and does not otherwise affect execution. The output always + * starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`. + * + * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens. + * + * ```js + * console.assert(true, 'does nothing'); + * + * console.assert(false, 'Whoops %s work', 'didn\'t'); + * // Assertion failed: Whoops didn't work + * + * console.assert(); + * // Assertion failed + * ``` + * @since v0.1.101 + * @param value The value tested for being truthy. + * @param message All arguments besides `value` are used as error message. + */ + assert(value: any, message?: string, ...optionalParams: any[]): void; + /** + * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the + * TTY. When `stdout` is not a TTY, this method does nothing. + * + * The specific operation of `console.clear()` can vary across operating systems + * and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the + * current terminal viewport for the Node.js + * binary. + * @since v8.3.0 + */ + clear(): void; + /** + * Maintains an internal counter specific to `label` and outputs to `stdout` the + * number of times `console.count()` has been called with the given `label`. + * + * ```js + * > console.count() + * default: 1 + * undefined + * > console.count('default') + * default: 2 + * undefined + * > console.count('abc') + * abc: 1 + * undefined + * > console.count('xyz') + * xyz: 1 + * undefined + * > console.count('abc') + * abc: 2 + * undefined + * > console.count() + * default: 3 + * undefined + * > + * ``` + * @since v8.3.0 + * @param label The display label for the counter. + */ + count(label?: string): void; + /** + * Resets the internal counter specific to `label`. + * + * ```js + * > console.count('abc'); + * abc: 1 + * undefined + * > console.countReset('abc'); + * undefined + * > console.count('abc'); + * abc: 1 + * undefined + * > + * ``` + * @since v8.3.0 + * @param label The display label for the counter. + */ + countReset(label?: string): void; + /** + * The `console.debug()` function is an alias for {@link log}. + * @since v8.0.0 + */ + debug(message?: any, ...optionalParams: any[]): void; + /** + * Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`. + * This function bypasses any custom `inspect()` function defined on `obj`. + * @since v0.1.101 + */ + dir(obj: any, options?: InspectOptions): void; + /** + * This method calls `console.log()` passing it the arguments received. + * This method does not produce any XML formatting. + * @since v8.0.0 + */ + dirxml(...data: any[]): void; + /** + * Prints to `stderr` with newline. Multiple arguments can be passed, with the + * first used as the primary message and all additional used as substitution + * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`). + * + * ```js + * const code = 5; + * console.error('error #%d', code); + * // Prints: error #5, to stderr + * console.error('error', code); + * // Prints: error 5, to stderr + * ``` + * + * If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string + * values are concatenated. See `util.format()` for more information. + * @since v0.1.100 + */ + error(message?: any, ...optionalParams: any[]): void; + /** + * Increases indentation of subsequent lines by spaces for `groupIndentation`length. + * + * If one or more `label`s are provided, those are printed first without the + * additional indentation. + * @since v8.5.0 + */ + group(...label: any[]): void; + /** + * An alias for {@link group}. + * @since v8.5.0 + */ + groupCollapsed(...label: any[]): void; + /** + * Decreases indentation of subsequent lines by spaces for `groupIndentation`length. + * @since v8.5.0 + */ + groupEnd(): void; + /** + * The `console.info()` function is an alias for {@link log}. + * @since v0.1.100 + */ + info(message?: any, ...optionalParams: any[]): void; + /** + * Prints to `stdout` with newline. Multiple arguments can be passed, with the + * first used as the primary message and all additional used as substitution + * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`). + * + * ```js + * const count = 5; + * console.log('count: %d', count); + * // Prints: count: 5, to stdout + * console.log('count:', count); + * // Prints: count: 5, to stdout + * ``` + * + * See `util.format()` for more information. + * @since v0.1.100 + */ + log(message?: any, ...optionalParams: any[]): void; + /** + * Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just + * logging the argument if it can’t be parsed as tabular. + * + * ```js + * // These can't be parsed as tabular data + * console.table(Symbol()); + * // Symbol() + * + * console.table(undefined); + * // undefined + * + * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]); + * // ┌─────────┬─────┬─────┐ + * // │ (index) │ a │ b │ + * // ├─────────┼─────┼─────┤ + * // │ 0 │ 1 │ 'Y' │ + * // │ 1 │ 'Z' │ 2 │ + * // └─────────┴─────┴─────┘ + * + * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); + * // ┌─────────┬─────┐ + * // │ (index) │ a │ + * // ├─────────┼─────┤ + * // │ 0 │ 1 │ + * // │ 1 │ 'Z' │ + * // └─────────┴─────┘ + * ``` + * @since v10.0.0 + * @param properties Alternate properties for constructing the table. + */ + table(tabularData: any, properties?: ReadonlyArray): void; + /** + * Starts a timer that can be used to compute the duration of an operation. Timers + * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in + * suitable time units to `stdout`. For example, if the elapsed + * time is 3869ms, `console.timeEnd()` displays "3.869s". + * @since v0.1.104 + */ + time(label?: string): void; + /** + * Stops a timer that was previously started by calling {@link time} and + * prints the result to `stdout`: + * + * ```js + * console.time('100-elements'); + * for (let i = 0; i < 100; i++) {} + * console.timeEnd('100-elements'); + * // prints 100-elements: 225.438ms + * ``` + * @since v0.1.104 + */ + timeEnd(label?: string): void; + /** + * For a timer that was previously started by calling {@link time}, prints + * the elapsed time and other `data` arguments to `stdout`: + * + * ```js + * console.time('process'); + * const value = expensiveProcess1(); // Returns 42 + * console.timeLog('process', value); + * // Prints "process: 365.227ms 42". + * doExpensiveProcess2(value); + * console.timeEnd('process'); + * ``` + * @since v10.7.0 + */ + timeLog(label?: string, ...data: any[]): void; + /** + * Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code. + * + * ```js + * console.trace('Show me'); + * // Prints: (stack trace will vary based on where trace is called) + * // Trace: Show me + * // at repl:2:9 + * // at REPLServer.defaultEval (repl.js:248:27) + * // at bound (domain.js:287:14) + * // at REPLServer.runBound [as eval] (domain.js:300:12) + * // at REPLServer. (repl.js:412:12) + * // at emitOne (events.js:82:20) + * // at REPLServer.emit (events.js:169:7) + * // at REPLServer.Interface._onLine (readline.js:210:10) + * // at REPLServer.Interface._line (readline.js:549:8) + * // at REPLServer.Interface._ttyWrite (readline.js:826:14) + * ``` + * @since v0.1.104 + */ + trace(message?: any, ...optionalParams: any[]): void; + /** + * The `console.warn()` function is an alias for {@link error}. + * @since v0.1.100 + */ + warn(message?: any, ...optionalParams: any[]): void; + // --- Inspector mode only --- + /** + * This method does not display anything unless used in the inspector. + * Starts a JavaScript CPU profile with an optional label. + */ + profile(label?: string): void; + /** + * This method does not display anything unless used in the inspector. + * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. + */ + profileEnd(label?: string): void; + /** + * This method does not display anything unless used in the inspector. + * Adds an event with the label `label` to the Timeline panel of the inspector. + */ + timeStamp(label?: string): void; + } + /** + * The `console` module provides a simple debugging console that is similar to the + * JavaScript console mechanism provided by web browsers. + * + * The module exports two specific components: + * + * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream. + * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`. + * + * _**Warning**_: The global console object's methods are neither consistently + * synchronous like the browser APIs they resemble, nor are they consistently + * asynchronous like all other Node.js streams. See the `note on process I/O` for + * more information. + * + * Example using the global `console`: + * + * ```js + * console.log('hello world'); + * // Prints: hello world, to stdout + * console.log('hello %s', 'world'); + * // Prints: hello world, to stdout + * console.error(new Error('Whoops, something bad happened')); + * // Prints error message and stack trace to stderr: + * // Error: Whoops, something bad happened + * // at [eval]:5:15 + * // at Script.runInThisContext (node:vm:132:18) + * // at Object.runInThisContext (node:vm:309:38) + * // at node:internal/process/execution:77:19 + * // at [eval]-wrapper:6:22 + * // at evalScript (node:internal/process/execution:76:60) + * // at node:internal/main/eval_string:23:3 + * + * const name = 'Will Robinson'; + * console.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to stderr + * ``` + * + * Example using the `Console` class: + * + * ```js + * const out = getStreamSomehow(); + * const err = getStreamSomehow(); + * const myConsole = new console.Console(out, err); + * + * myConsole.log('hello world'); + * // Prints: hello world, to out + * myConsole.log('hello %s', 'world'); + * // Prints: hello world, to out + * myConsole.error(new Error('Whoops, something bad happened')); + * // Prints: [Error: Whoops, something bad happened], to err + * + * const name = 'Will Robinson'; + * myConsole.warn(`Danger ${name}! Danger!`); + * // Prints: Danger Will Robinson! Danger!, to err + * ``` + * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js) + */ + namespace console { + interface ConsoleConstructorOptions { + stdout: NodeJS.WritableStream; + stderr?: NodeJS.WritableStream | undefined; + ignoreErrors?: boolean | undefined; + colorMode?: boolean | 'auto' | undefined; + inspectOptions?: InspectOptions | undefined; + /** + * Set group indentation + * @default 2 + */ + groupIndentation?: number | undefined; + } + interface ConsoleConstructor { + prototype: Console; + new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console; + new (options: ConsoleConstructorOptions): Console; + } + } + var console: Console; + } + export = globalThis.console; +} diff --git a/node_modules/@types/node/ts4.8/constants.d.ts b/node_modules/@types/node/ts4.8/constants.d.ts new file mode 100755 index 0000000..208020d --- /dev/null +++ b/node_modules/@types/node/ts4.8/constants.d.ts @@ -0,0 +1,18 @@ +/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ +declare module 'constants' { + import { constants as osConstants, SignalConstants } from 'node:os'; + import { constants as cryptoConstants } from 'node:crypto'; + import { constants as fsConstants } from 'node:fs'; + + const exp: typeof osConstants.errno & + typeof osConstants.priority & + SignalConstants & + typeof cryptoConstants & + typeof fsConstants; + export = exp; +} + +declare module 'node:constants' { + import constants = require('constants'); + export = constants; +} diff --git a/node_modules/@types/node/ts4.8/crypto.d.ts b/node_modules/@types/node/ts4.8/crypto.d.ts new file mode 100755 index 0000000..5b51217 --- /dev/null +++ b/node_modules/@types/node/ts4.8/crypto.d.ts @@ -0,0 +1,3977 @@ +/** + * The `node:crypto` module provides cryptographic functionality that includes a + * set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify + * functions. + * + * ```js + * const { createHmac } = await import('node:crypto'); + * + * const secret = 'abcdefg'; + * const hash = createHmac('sha256', secret) + * .update('I love cupcakes') + * .digest('hex'); + * console.log(hash); + * // Prints: + * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js) + */ +declare module 'crypto' { + import * as stream from 'node:stream'; + import { PeerCertificate } from 'node:tls'; + /** + * SPKAC is a Certificate Signing Request mechanism originally implemented by + * Netscape and was specified formally as part of HTML5's `keygen` element. + * + * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects + * should not use this element anymore. + * + * The `node:crypto` module provides the `Certificate` class for working with SPKAC + * data. The most common usage is handling output generated by the HTML5`` element. Node.js uses [OpenSSL's SPKAC + * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally. + * @since v0.11.8 + */ + class Certificate { + /** + * ```js + * const { Certificate } = await import('node:crypto'); + * const spkac = getSpkacSomehow(); + * const challenge = Certificate.exportChallenge(spkac); + * console.log(challenge.toString('utf8')); + * // Prints: the challenge as a UTF8 string + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge. + */ + static exportChallenge(spkac: BinaryLike): Buffer; + /** + * ```js + * const { Certificate } = await import('node:crypto'); + * const spkac = getSpkacSomehow(); + * const publicKey = Certificate.exportPublicKey(spkac); + * console.log(publicKey); + * // Prints: the public key as + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return The public key component of the `spkac` data structure, which includes a public key and a challenge. + */ + static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; + /** + * ```js + * import { Buffer } from 'node:buffer'; + * const { Certificate } = await import('node:crypto'); + * + * const spkac = getSpkacSomehow(); + * console.log(Certificate.verifySpkac(Buffer.from(spkac))); + * // Prints: true or false + * ``` + * @since v9.0.0 + * @param encoding The `encoding` of the `spkac` string. + * @return `true` if the given `spkac` data structure is valid, `false` otherwise. + */ + static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; + /** + * @deprecated + * @param spkac + * @returns The challenge component of the `spkac` data structure, + * which includes a public key and a challenge. + */ + exportChallenge(spkac: BinaryLike): Buffer; + /** + * @deprecated + * @param spkac + * @param encoding The encoding of the spkac string. + * @returns The public key component of the `spkac` data structure, + * which includes a public key and a challenge. + */ + exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; + /** + * @deprecated + * @param spkac + * @returns `true` if the given `spkac` data structure is valid, + * `false` otherwise. + */ + verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; + } + namespace constants { + // https://nodejs.org/dist/latest-v20.x/docs/api/crypto.html#crypto-constants + const OPENSSL_VERSION_NUMBER: number; + /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ + const SSL_OP_ALL: number; + /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ + const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; + /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ + const SSL_OP_CIPHER_SERVER_PREFERENCE: number; + /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */ + const SSL_OP_CISCO_ANYCONNECT: number; + /** Instructs OpenSSL to turn on cookie exchange. */ + const SSL_OP_COOKIE_EXCHANGE: number; + /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ + const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; + /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ + const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; + /** Allows initial connection to servers that do not support RI. */ + const SSL_OP_LEGACY_SERVER_CONNECT: number; + /** Instructs OpenSSL to disable support for SSL/TLS compression. */ + const SSL_OP_NO_COMPRESSION: number; + const SSL_OP_NO_QUERY_MTU: number; + /** Instructs OpenSSL to always start a new session when performing renegotiation. */ + const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; + const SSL_OP_NO_SSLv2: number; + const SSL_OP_NO_SSLv3: number; + const SSL_OP_NO_TICKET: number; + const SSL_OP_NO_TLSv1: number; + const SSL_OP_NO_TLSv1_1: number; + const SSL_OP_NO_TLSv1_2: number; + /** Instructs OpenSSL to disable version rollback attack detection. */ + const SSL_OP_TLS_ROLLBACK_BUG: number; + const ENGINE_METHOD_RSA: number; + const ENGINE_METHOD_DSA: number; + const ENGINE_METHOD_DH: number; + const ENGINE_METHOD_RAND: number; + const ENGINE_METHOD_EC: number; + const ENGINE_METHOD_CIPHERS: number; + const ENGINE_METHOD_DIGESTS: number; + const ENGINE_METHOD_PKEY_METHS: number; + const ENGINE_METHOD_PKEY_ASN1_METHS: number; + const ENGINE_METHOD_ALL: number; + const ENGINE_METHOD_NONE: number; + const DH_CHECK_P_NOT_SAFE_PRIME: number; + const DH_CHECK_P_NOT_PRIME: number; + const DH_UNABLE_TO_CHECK_GENERATOR: number; + const DH_NOT_SUITABLE_GENERATOR: number; + const RSA_PKCS1_PADDING: number; + const RSA_SSLV23_PADDING: number; + const RSA_NO_PADDING: number; + const RSA_PKCS1_OAEP_PADDING: number; + const RSA_X931_PADDING: number; + const RSA_PKCS1_PSS_PADDING: number; + /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ + const RSA_PSS_SALTLEN_DIGEST: number; + /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ + const RSA_PSS_SALTLEN_MAX_SIGN: number; + /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ + const RSA_PSS_SALTLEN_AUTO: number; + const POINT_CONVERSION_COMPRESSED: number; + const POINT_CONVERSION_UNCOMPRESSED: number; + const POINT_CONVERSION_HYBRID: number; + /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ + const defaultCoreCipherList: string; + /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ + const defaultCipherList: string; + } + interface HashOptions extends stream.TransformOptions { + /** + * For XOF hash functions such as `shake256`, the + * outputLength option can be used to specify the desired output length in bytes. + */ + outputLength?: number | undefined; + } + /** @deprecated since v10.0.0 */ + const fips: boolean; + /** + * Creates and returns a `Hash` object that can be used to generate hash digests + * using the given `algorithm`. Optional `options` argument controls stream + * behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option + * can be used to specify the desired output length in bytes. + * + * The `algorithm` is dependent on the available algorithms supported by the + * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. + * On recent releases of OpenSSL, `openssl list -digest-algorithms` will + * display the available digest algorithms. + * + * Example: generating the sha256 sum of a file + * + * ```js + * import { + * createReadStream, + * } from 'node:fs'; + * import { argv } from 'node:process'; + * const { + * createHash, + * } = await import('node:crypto'); + * + * const filename = argv[2]; + * + * const hash = createHash('sha256'); + * + * const input = createReadStream(filename); + * input.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = input.read(); + * if (data) + * hash.update(data); + * else { + * console.log(`${hash.digest('hex')} ${filename}`); + * } + * }); + * ``` + * @since v0.1.92 + * @param options `stream.transform` options + */ + function createHash(algorithm: string, options?: HashOptions): Hash; + /** + * Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. + * Optional `options` argument controls stream behavior. + * + * The `algorithm` is dependent on the available algorithms supported by the + * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. + * On recent releases of OpenSSL, `openssl list -digest-algorithms` will + * display the available digest algorithms. + * + * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is + * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was + * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not + * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). + * + * Example: generating the sha256 HMAC of a file + * + * ```js + * import { + * createReadStream, + * } from 'node:fs'; + * import { argv } from 'node:process'; + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const filename = argv[2]; + * + * const hmac = createHmac('sha256', 'a secret'); + * + * const input = createReadStream(filename); + * input.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = input.read(); + * if (data) + * hmac.update(data); + * else { + * console.log(`${hmac.digest('hex')} ${filename}`); + * } + * }); + * ``` + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac; + // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings + type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex' | 'binary'; + type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1'; + type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2'; + type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding; + type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid'; + /** + * The `Hash` class is a utility for creating hash digests of data. It can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where data is written + * to produce a computed hash digest on the readable side, or + * * Using the `hash.update()` and `hash.digest()` methods to produce the + * computed hash. + * + * The {@link createHash} method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword. + * + * Example: Using `Hash` objects as streams: + * + * ```js + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = hash.read(); + * if (data) { + * console.log(data.toString('hex')); + * // Prints: + * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + * } + * }); + * + * hash.write('some data to hash'); + * hash.end(); + * ``` + * + * Example: Using `Hash` and piped streams: + * + * ```js + * import { createReadStream } from 'node:fs'; + * import { stdout } from 'node:process'; + * const { createHash } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * const input = createReadStream('test.js'); + * input.pipe(hash).setEncoding('hex').pipe(stdout); + * ``` + * + * Example: Using the `hash.update()` and `hash.digest()` methods: + * + * ```js + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.update('some data to hash'); + * console.log(hash.digest('hex')); + * // Prints: + * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + * ``` + * @since v0.1.92 + */ + class Hash extends stream.Transform { + private constructor(); + /** + * Creates a new `Hash` object that contains a deep copy of the internal state + * of the current `Hash` object. + * + * The optional `options` argument controls stream behavior. For XOF hash + * functions such as `'shake256'`, the `outputLength` option can be used to + * specify the desired output length in bytes. + * + * An error is thrown when an attempt is made to copy the `Hash` object after + * its `hash.digest()` method has been called. + * + * ```js + * // Calculate a rolling hash. + * const { + * createHash, + * } = await import('node:crypto'); + * + * const hash = createHash('sha256'); + * + * hash.update('one'); + * console.log(hash.copy().digest('hex')); + * + * hash.update('two'); + * console.log(hash.copy().digest('hex')); + * + * hash.update('three'); + * console.log(hash.copy().digest('hex')); + * + * // Etc. + * ``` + * @since v13.1.0 + * @param options `stream.transform` options + */ + copy(options?: stream.TransformOptions): Hash; + /** + * Updates the hash content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Hash; + update(data: string, inputEncoding: Encoding): Hash; + /** + * Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method). + * If `encoding` is provided a string will be returned; otherwise + * a `Buffer` is returned. + * + * The `Hash` object can not be used again after `hash.digest()` method has been + * called. Multiple calls will cause an error to be thrown. + * @since v0.1.92 + * @param encoding The `encoding` of the return value. + */ + digest(): Buffer; + digest(encoding: BinaryToTextEncoding): string; + } + /** + * The `Hmac` class is a utility for creating cryptographic HMAC digests. It can + * be used in one of two ways: + * + * * As a `stream` that is both readable and writable, where data is written + * to produce a computed HMAC digest on the readable side, or + * * Using the `hmac.update()` and `hmac.digest()` methods to produce the + * computed HMAC digest. + * + * The {@link createHmac} method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword. + * + * Example: Using `Hmac` objects as streams: + * + * ```js + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * hmac.on('readable', () => { + * // Only one element is going to be produced by the + * // hash stream. + * const data = hmac.read(); + * if (data) { + * console.log(data.toString('hex')); + * // Prints: + * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + * } + * }); + * + * hmac.write('some data to hash'); + * hmac.end(); + * ``` + * + * Example: Using `Hmac` and piped streams: + * + * ```js + * import { createReadStream } from 'node:fs'; + * import { stdout } from 'node:process'; + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * const input = createReadStream('test.js'); + * input.pipe(hmac).pipe(stdout); + * ``` + * + * Example: Using the `hmac.update()` and `hmac.digest()` methods: + * + * ```js + * const { + * createHmac, + * } = await import('node:crypto'); + * + * const hmac = createHmac('sha256', 'a secret'); + * + * hmac.update('some data to hash'); + * console.log(hmac.digest('hex')); + * // Prints: + * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + * ``` + * @since v0.1.94 + */ + class Hmac extends stream.Transform { + private constructor(); + /** + * Updates the `Hmac` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Hmac; + update(data: string, inputEncoding: Encoding): Hmac; + /** + * Calculates the HMAC digest of all of the data passed using `hmac.update()`. + * If `encoding` is + * provided a string is returned; otherwise a `Buffer` is returned; + * + * The `Hmac` object can not be used again after `hmac.digest()` has been + * called. Multiple calls to `hmac.digest()` will result in an error being thrown. + * @since v0.1.94 + * @param encoding The `encoding` of the return value. + */ + digest(): Buffer; + digest(encoding: BinaryToTextEncoding): string; + } + type KeyObjectType = 'secret' | 'public' | 'private'; + interface KeyExportOptions { + type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1'; + format: T; + cipher?: string | undefined; + passphrase?: string | Buffer | undefined; + } + interface JwkKeyExportOptions { + format: 'jwk'; + } + interface JsonWebKey { + crv?: string | undefined; + d?: string | undefined; + dp?: string | undefined; + dq?: string | undefined; + e?: string | undefined; + k?: string | undefined; + kty?: string | undefined; + n?: string | undefined; + p?: string | undefined; + q?: string | undefined; + qi?: string | undefined; + x?: string | undefined; + y?: string | undefined; + [key: string]: unknown; + } + interface AsymmetricKeyDetails { + /** + * Key size in bits (RSA, DSA). + */ + modulusLength?: number | undefined; + /** + * Public exponent (RSA). + */ + publicExponent?: bigint | undefined; + /** + * Name of the message digest (RSA-PSS). + */ + hashAlgorithm?: string | undefined; + /** + * Name of the message digest used by MGF1 (RSA-PSS). + */ + mgf1HashAlgorithm?: string | undefined; + /** + * Minimal salt length in bytes (RSA-PSS). + */ + saltLength?: number | undefined; + /** + * Size of q in bits (DSA). + */ + divisorLength?: number | undefined; + /** + * Name of the curve (EC). + */ + namedCurve?: string | undefined; + } + /** + * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key, + * and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject` + * objects are not to be created directly using the `new`keyword. + * + * Most applications should consider using the new `KeyObject` API instead of + * passing keys as strings or `Buffer`s due to improved security features. + * + * `KeyObject` instances can be passed to other threads via `postMessage()`. + * The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to + * be listed in the `transferList` argument. + * @since v11.6.0 + */ + class KeyObject { + private constructor(); + /** + * Example: Converting a `CryptoKey` instance to a `KeyObject`: + * + * ```js + * const { KeyObject } = await import('node:crypto'); + * const { subtle } = globalThis.crypto; + * + * const key = await subtle.generateKey({ + * name: 'HMAC', + * hash: 'SHA-256', + * length: 256, + * }, true, ['sign', 'verify']); + * + * const keyObject = KeyObject.from(key); + * console.log(keyObject.symmetricKeySize); + * // Prints: 32 (symmetric key size in bytes) + * ``` + * @since v15.0.0 + */ + static from(key: webcrypto.CryptoKey): KeyObject; + /** + * For asymmetric keys, this property represents the type of the key. Supported key + * types are: + * + * * `'rsa'` (OID 1.2.840.113549.1.1.1) + * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10) + * * `'dsa'` (OID 1.2.840.10040.4.1) + * * `'ec'` (OID 1.2.840.10045.2.1) + * * `'x25519'` (OID 1.3.101.110) + * * `'x448'` (OID 1.3.101.111) + * * `'ed25519'` (OID 1.3.101.112) + * * `'ed448'` (OID 1.3.101.113) + * * `'dh'` (OID 1.2.840.113549.1.3.1) + * + * This property is `undefined` for unrecognized `KeyObject` types and symmetric + * keys. + * @since v11.6.0 + */ + asymmetricKeyType?: KeyType | undefined; + /** + * For asymmetric keys, this property represents the size of the embedded key in + * bytes. This property is `undefined` for symmetric keys. + */ + asymmetricKeySize?: number | undefined; + /** + * This property exists only on asymmetric keys. Depending on the type of the key, + * this object contains information about the key. None of the information obtained + * through this property can be used to uniquely identify a key or to compromise + * the security of the key. + * + * For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence, + * the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be + * set. + * + * Other key details might be exposed via this API using additional attributes. + * @since v15.7.0 + */ + asymmetricKeyDetails?: AsymmetricKeyDetails | undefined; + /** + * For symmetric keys, the following encoding options can be used: + * + * For public keys, the following encoding options can be used: + * + * For private keys, the following encoding options can be used: + * + * The result type depends on the selected encoding format, when PEM the + * result is a string, when DER it will be a buffer containing the data + * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object. + * + * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are + * ignored. + * + * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of + * the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be + * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for + * encrypted private keys. Since PKCS#8 defines its own + * encryption mechanism, PEM-level encryption is not supported when encrypting + * a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for + * PKCS#1 and SEC1 encryption. + * @since v11.6.0 + */ + export(options: KeyExportOptions<'pem'>): string | Buffer; + export(options?: KeyExportOptions<'der'>): Buffer; + export(options?: JwkKeyExportOptions): JsonWebKey; + /** + * For secret keys, this property represents the size of the key in bytes. This + * property is `undefined` for asymmetric keys. + * @since v11.6.0 + */ + symmetricKeySize?: number | undefined; + /** + * Depending on the type of this `KeyObject`, this property is either`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys + * or `'private'` for private (asymmetric) keys. + * @since v11.6.0 + */ + type: KeyObjectType; + } + type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305'; + type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm'; + type CipherOCBTypes = 'aes-128-ocb' | 'aes-192-ocb' | 'aes-256-ocb'; + type BinaryLike = string | NodeJS.ArrayBufferView; + type CipherKey = BinaryLike | KeyObject; + interface CipherCCMOptions extends stream.TransformOptions { + authTagLength: number; + } + interface CipherGCMOptions extends stream.TransformOptions { + authTagLength?: number | undefined; + } + interface CipherOCBOptions extends stream.TransformOptions { + authTagLength: number; + } + /** + * Creates and returns a `Cipher` object that uses the given `algorithm` and`password`. + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication + * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On + * recent OpenSSL releases, `openssl list -cipher-algorithms` will + * display the available cipher algorithms. + * + * The `password` is used to derive the cipher key and initialization vector (IV). + * The value must be either a `'latin1'` encoded string, a `Buffer`, a`TypedArray`, or a `DataView`. + * + * **This function is semantically insecure for all** + * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,** + * **GCM, or CCM).** + * + * The implementation of `crypto.createCipher()` derives keys using the OpenSSL + * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one + * iteration, and no salt. The lack of salt allows dictionary attacks as the same + * password always creates the same key. The low iteration count and + * non-cryptographically secure hash algorithm allow passwords to be tested very + * rapidly. + * + * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that + * developers derive a key and IV on + * their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode + * (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when + * they are used in order to avoid the risk of IV reuse that causes + * vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. + * @since v0.1.94 + * @deprecated Since v10.0.0 - Use {@link createCipheriv} instead. + * @param options `stream.transform` options + */ + function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM; + /** @deprecated since v10.0.0 use `createCipheriv()` */ + function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM; + /** @deprecated since v10.0.0 use `createCipheriv()` */ + function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher; + /** + * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and + * initialization vector (`iv`). + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication + * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On + * recent OpenSSL releases, `openssl list -cipher-algorithms` will + * display the available cipher algorithms. + * + * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded + * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be + * a `KeyObject` of type `secret`. If the cipher does not need + * an initialization vector, `iv` may be `null`. + * + * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * Initialization vectors should be unpredictable and unique; ideally, they will be + * cryptographically random. They do not have to be secret: IVs are typically just + * added to ciphertext messages unencrypted. It may sound contradictory that + * something has to be unpredictable and unique, but does not have to be secret; + * remember that an attacker must not be able to predict ahead of time what a + * given IV will be. + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createCipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): CipherCCM; + function createCipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): CipherOCB; + function createCipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): CipherGCM; + function createCipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Cipher; + /** + * Instances of the `Cipher` class are used to encrypt data. The class can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where plain unencrypted + * data is written to produce encrypted data on the readable side, or + * * Using the `cipher.update()` and `cipher.final()` methods to produce + * the encrypted data. + * + * The {@link createCipher} or {@link createCipheriv} methods are + * used to create `Cipher` instances. `Cipher` objects are not to be created + * directly using the `new` keyword. + * + * Example: Using `Cipher` objects as streams: + * + * ```js + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * // Once we have the key and iv, we can create and use the cipher... + * const cipher = createCipheriv(algorithm, key, iv); + * + * let encrypted = ''; + * cipher.setEncoding('hex'); + * + * cipher.on('data', (chunk) => encrypted += chunk); + * cipher.on('end', () => console.log(encrypted)); + * + * cipher.write('some clear text data'); + * cipher.end(); + * }); + * }); + * ``` + * + * Example: Using `Cipher` and piped streams: + * + * ```js + * import { + * createReadStream, + * createWriteStream, + * } from 'node:fs'; + * + * import { + * pipeline, + * } from 'node:stream'; + * + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * const cipher = createCipheriv(algorithm, key, iv); + * + * const input = createReadStream('test.js'); + * const output = createWriteStream('test.enc'); + * + * pipeline(input, cipher, output, (err) => { + * if (err) throw err; + * }); + * }); + * }); + * ``` + * + * Example: Using the `cipher.update()` and `cipher.final()` methods: + * + * ```js + * const { + * scrypt, + * randomFill, + * createCipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * + * // First, we'll generate the key. The key length is dependent on the algorithm. + * // In this case for aes192, it is 24 bytes (192 bits). + * scrypt(password, 'salt', 24, (err, key) => { + * if (err) throw err; + * // Then, we'll generate a random initialization vector + * randomFill(new Uint8Array(16), (err, iv) => { + * if (err) throw err; + * + * const cipher = createCipheriv(algorithm, key, iv); + * + * let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); + * encrypted += cipher.final('hex'); + * console.log(encrypted); + * }); + * }); + * ``` + * @since v0.1.94 + */ + class Cipher extends stream.Transform { + private constructor(); + /** + * Updates the cipher with `data`. If the `inputEncoding` argument is given, + * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or`DataView`. If `data` is a `Buffer`, + * `TypedArray`, or `DataView`, then`inputEncoding` is ignored. + * + * The `outputEncoding` specifies the output format of the enciphered + * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. + * + * The `cipher.update()` method can be called multiple times with new data until `cipher.final()` is called. Calling `cipher.update()` after `cipher.final()` will result in an error being + * thrown. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the data. + * @param outputEncoding The `encoding` of the return value. + */ + update(data: BinaryLike): Buffer; + update(data: string, inputEncoding: Encoding): Buffer; + update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; + update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; + /** + * Once the `cipher.final()` method has been called, the `Cipher` object can no + * longer be used to encrypt data. Attempts to call `cipher.final()` more than + * once will result in an error being thrown. + * @since v0.1.94 + * @param outputEncoding The `encoding` of the return value. + * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. + */ + final(): Buffer; + final(outputEncoding: BufferEncoding): string; + /** + * When using block encryption algorithms, the `Cipher` class will automatically + * add padding to the input data to the appropriate block size. To disable the + * default padding call `cipher.setAutoPadding(false)`. + * + * When `autoPadding` is `false`, the length of the entire input data must be a + * multiple of the cipher's block size or `cipher.final()` will throw an error. + * Disabling automatic padding is useful for non-standard padding, for instance + * using `0x0` instead of PKCS padding. + * + * The `cipher.setAutoPadding()` method must be called before `cipher.final()`. + * @since v0.7.1 + * @param [autoPadding=true] + * @return for method chaining. + */ + setAutoPadding(autoPadding?: boolean): this; + } + interface CipherCCM extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options: { + plaintextLength: number; + } + ): this; + getAuthTag(): Buffer; + } + interface CipherGCM extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + } + ): this; + getAuthTag(): Buffer; + } + interface CipherOCB extends Cipher { + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + } + ): this; + getAuthTag(): Buffer; + } + /** + * Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key). + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * **This function is semantically insecure for all** + * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,** + * **GCM, or CCM).** + * + * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL + * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one + * iteration, and no salt. The lack of salt allows dictionary attacks as the same + * password always creates the same key. The low iteration count and + * non-cryptographically secure hash algorithm allow passwords to be tested very + * rapidly. + * + * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that + * developers derive a key and IV on + * their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object. + * @since v0.1.94 + * @deprecated Since v10.0.0 - Use {@link createDecipheriv} instead. + * @param options `stream.transform` options + */ + function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; + /** @deprecated since v10.0.0 use `createDecipheriv()` */ + function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM; + /** @deprecated since v10.0.0 use `createDecipheriv()` */ + function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher; + /** + * Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`). + * + * The `options` argument controls stream behavior and is optional except when a + * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the + * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags + * to those with the specified length. + * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. + * + * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On + * recent OpenSSL releases, `openssl list -cipher-algorithms` will + * display the available cipher algorithms. + * + * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded + * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be + * a `KeyObject` of type `secret`. If the cipher does not need + * an initialization vector, `iv` may be `null`. + * + * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * Initialization vectors should be unpredictable and unique; ideally, they will be + * cryptographically random. They do not have to be secret: IVs are typically just + * added to ciphertext messages unencrypted. It may sound contradictory that + * something has to be unpredictable and unique, but does not have to be secret; + * remember that an attacker must not be able to predict ahead of time what a given + * IV will be. + * @since v0.1.94 + * @param options `stream.transform` options + */ + function createDecipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): DecipherCCM; + function createDecipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): DecipherOCB; + function createDecipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): DecipherGCM; + function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher; + /** + * Instances of the `Decipher` class are used to decrypt data. The class can be + * used in one of two ways: + * + * * As a `stream` that is both readable and writable, where plain encrypted + * data is written to produce unencrypted data on the readable side, or + * * Using the `decipher.update()` and `decipher.final()` methods to + * produce the unencrypted data. + * + * The {@link createDecipher} or {@link createDecipheriv} methods are + * used to create `Decipher` instances. `Decipher` objects are not to be created + * directly using the `new` keyword. + * + * Example: Using `Decipher` objects as streams: + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Key length is dependent on the algorithm. In this case for aes192, it is + * // 24 bytes (192 bits). + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * let decrypted = ''; + * decipher.on('readable', () => { + * let chunk; + * while (null !== (chunk = decipher.read())) { + * decrypted += chunk.toString('utf8'); + * } + * }); + * decipher.on('end', () => { + * console.log(decrypted); + * // Prints: some clear text data + * }); + * + * // Encrypted with same algorithm, key and iv. + * const encrypted = + * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; + * decipher.write(encrypted, 'hex'); + * decipher.end(); + * ``` + * + * Example: Using `Decipher` and piped streams: + * + * ```js + * import { + * createReadStream, + * createWriteStream, + * } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * const input = createReadStream('test.enc'); + * const output = createWriteStream('test.js'); + * + * input.pipe(decipher).pipe(output); + * ``` + * + * Example: Using the `decipher.update()` and `decipher.final()` methods: + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * scryptSync, + * createDecipheriv, + * } = await import('node:crypto'); + * + * const algorithm = 'aes-192-cbc'; + * const password = 'Password used to generate key'; + * // Use the async `crypto.scrypt()` instead. + * const key = scryptSync(password, 'salt', 24); + * // The IV is usually passed along with the ciphertext. + * const iv = Buffer.alloc(16, 0); // Initialization vector. + * + * const decipher = createDecipheriv(algorithm, key, iv); + * + * // Encrypted using same algorithm, key and iv. + * const encrypted = + * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; + * let decrypted = decipher.update(encrypted, 'hex', 'utf8'); + * decrypted += decipher.final('utf8'); + * console.log(decrypted); + * // Prints: some clear text data + * ``` + * @since v0.1.94 + */ + class Decipher extends stream.Transform { + private constructor(); + /** + * Updates the decipher with `data`. If the `inputEncoding` argument is given, + * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is + * ignored. + * + * The `outputEncoding` specifies the output format of the enciphered + * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. + * + * The `decipher.update()` method can be called multiple times with new data until `decipher.final()` is called. Calling `decipher.update()` after `decipher.final()` will result in an error + * being thrown. + * @since v0.1.94 + * @param inputEncoding The `encoding` of the `data` string. + * @param outputEncoding The `encoding` of the return value. + */ + update(data: NodeJS.ArrayBufferView): Buffer; + update(data: string, inputEncoding: Encoding): Buffer; + update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; + update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; + /** + * Once the `decipher.final()` method has been called, the `Decipher` object can + * no longer be used to decrypt data. Attempts to call `decipher.final()` more + * than once will result in an error being thrown. + * @since v0.1.94 + * @param outputEncoding The `encoding` of the return value. + * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. + */ + final(): Buffer; + final(outputEncoding: BufferEncoding): string; + /** + * When data has been encrypted without standard block padding, calling`decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and + * removing padding. + * + * Turning auto padding off will only work if the input data's length is a + * multiple of the ciphers block size. + * + * The `decipher.setAutoPadding()` method must be called before `decipher.final()`. + * @since v0.7.1 + * @param [autoPadding=true] + * @return for method chaining. + */ + setAutoPadding(auto_padding?: boolean): this; + } + interface DecipherCCM extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options: { + plaintextLength: number; + } + ): this; + } + interface DecipherGCM extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + } + ): this; + } + interface DecipherOCB extends Decipher { + setAuthTag(buffer: NodeJS.ArrayBufferView): this; + setAAD( + buffer: NodeJS.ArrayBufferView, + options?: { + plaintextLength: number; + } + ): this; + } + interface PrivateKeyInput { + key: string | Buffer; + format?: KeyFormat | undefined; + type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined; + passphrase?: string | Buffer | undefined; + encoding?: string | undefined; + } + interface PublicKeyInput { + key: string | Buffer; + format?: KeyFormat | undefined; + type?: 'pkcs1' | 'spki' | undefined; + encoding?: string | undefined; + } + /** + * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`. + * + * ```js + * const { + * generateKey, + * } = await import('node:crypto'); + * + * generateKey('hmac', { length: 512 }, (err, key) => { + * if (err) throw err; + * console.log(key.export().toString('hex')); // 46e..........620 + * }); + * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. + * @since v15.0.0 + * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. + */ + function generateKey( + type: 'hmac' | 'aes', + options: { + length: number; + }, + callback: (err: Error | null, key: KeyObject) => void + ): void; + /** + * Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`. + * + * ```js + * const { + * generateKeySync, + * } = await import('node:crypto'); + * + * const key = generateKeySync('hmac', { length: 512 }); + * console.log(key.export().toString('hex')); // e89..........41e + * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. + * @since v15.0.0 + * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. + */ + function generateKeySync( + type: 'hmac' | 'aes', + options: { + length: number; + } + ): KeyObject; + interface JsonWebKeyInput { + key: JsonWebKey; + format: 'jwk'; + } + /** + * Creates and returns a new key object containing a private key. If `key` is a + * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key`must be an object with the properties described above. + * + * If the private key is encrypted, a `passphrase` must be specified. The length + * of the passphrase is limited to 1024 bytes. + * @since v11.6.0 + */ + function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject; + /** + * Creates and returns a new key object containing a public key. If `key` is a + * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject`with type `'private'`, the public key is derived from the given private key; + * otherwise, `key` must be an object with the properties described above. + * + * If the format is `'pem'`, the `'key'` may also be an X.509 certificate. + * + * Because public keys can be derived from private keys, a private key may be + * passed instead of a public key. In that case, this function behaves as if {@link createPrivateKey} had been called, except that the type of the + * returned `KeyObject` will be `'public'` and that the private key cannot be + * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type`'private'` is given, a new `KeyObject` with type `'public'` will be returned + * and it will be impossible to extract the private key from the returned object. + * @since v11.6.0 + */ + function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject; + /** + * Creates and returns a new key object containing a secret key for symmetric + * encryption or `Hmac`. + * @since v11.6.0 + * @param encoding The string encoding when `key` is a string. + */ + function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject; + function createSecretKey(key: string, encoding: BufferEncoding): KeyObject; + /** + * Creates and returns a `Sign` object that uses the given `algorithm`. Use {@link getHashes} to obtain the names of the available digest algorithms. + * Optional `options` argument controls the `stream.Writable` behavior. + * + * In some cases, a `Sign` instance can be created using the name of a signature + * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use + * the corresponding digest algorithm. This does not work for all signature + * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest + * algorithm names. + * @since v0.1.92 + * @param options `stream.Writable` options + */ + function createSign(algorithm: string, options?: stream.WritableOptions): Sign; + type DSAEncoding = 'der' | 'ieee-p1363'; + interface SigningOptions { + /** + * @see crypto.constants.RSA_PKCS1_PADDING + */ + padding?: number | undefined; + saltLength?: number | undefined; + dsaEncoding?: DSAEncoding | undefined; + } + interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {} + interface SignKeyObjectInput extends SigningOptions { + key: KeyObject; + } + interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {} + interface VerifyKeyObjectInput extends SigningOptions { + key: KeyObject; + } + interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {} + type KeyLike = string | Buffer | KeyObject; + /** + * The `Sign` class is a utility for generating signatures. It can be used in one + * of two ways: + * + * * As a writable `stream`, where data to be signed is written and the `sign.sign()` method is used to generate and return the signature, or + * * Using the `sign.update()` and `sign.sign()` methods to produce the + * signature. + * + * The {@link createSign} method is used to create `Sign` instances. The + * argument is the string name of the hash function to use. `Sign` objects are not + * to be created directly using the `new` keyword. + * + * Example: Using `Sign` and `Verify` objects as streams: + * + * ```js + * const { + * generateKeyPairSync, + * createSign, + * createVerify, + * } = await import('node:crypto'); + * + * const { privateKey, publicKey } = generateKeyPairSync('ec', { + * namedCurve: 'sect239k1', + * }); + * + * const sign = createSign('SHA256'); + * sign.write('some data to sign'); + * sign.end(); + * const signature = sign.sign(privateKey, 'hex'); + * + * const verify = createVerify('SHA256'); + * verify.write('some data to sign'); + * verify.end(); + * console.log(verify.verify(publicKey, signature, 'hex')); + * // Prints: true + * ``` + * + * Example: Using the `sign.update()` and `verify.update()` methods: + * + * ```js + * const { + * generateKeyPairSync, + * createSign, + * createVerify, + * } = await import('node:crypto'); + * + * const { privateKey, publicKey } = generateKeyPairSync('rsa', { + * modulusLength: 2048, + * }); + * + * const sign = createSign('SHA256'); + * sign.update('some data to sign'); + * sign.end(); + * const signature = sign.sign(privateKey); + * + * const verify = createVerify('SHA256'); + * verify.update('some data to sign'); + * verify.end(); + * console.log(verify.verify(publicKey, signature)); + * // Prints: true + * ``` + * @since v0.1.92 + */ + class Sign extends stream.Writable { + private constructor(); + /** + * Updates the `Sign` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `encoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): this; + update(data: string, inputEncoding: Encoding): this; + /** + * Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the following additional properties can be passed: + * + * If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned. + * + * The `Sign` object can not be again used after `sign.sign()` method has been + * called. Multiple calls to `sign.sign()` will result in an error being thrown. + * @since v0.1.92 + */ + sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; + sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, outputFormat: BinaryToTextEncoding): string; + } + /** + * Creates and returns a `Verify` object that uses the given algorithm. + * Use {@link getHashes} to obtain an array of names of the available + * signing algorithms. Optional `options` argument controls the`stream.Writable` behavior. + * + * In some cases, a `Verify` instance can be created using the name of a signature + * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use + * the corresponding digest algorithm. This does not work for all signature + * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest + * algorithm names. + * @since v0.1.92 + * @param options `stream.Writable` options + */ + function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; + /** + * The `Verify` class is a utility for verifying signatures. It can be used in one + * of two ways: + * + * * As a writable `stream` where written data is used to validate against the + * supplied signature, or + * * Using the `verify.update()` and `verify.verify()` methods to verify + * the signature. + * + * The {@link createVerify} method is used to create `Verify` instances.`Verify` objects are not to be created directly using the `new` keyword. + * + * See `Sign` for examples. + * @since v0.1.92 + */ + class Verify extends stream.Writable { + private constructor(); + /** + * Updates the `Verify` content with the given `data`, the encoding of which + * is given in `inputEncoding`. + * If `inputEncoding` is not provided, and the `data` is a string, an + * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. + * + * This can be called many times with new data as it is streamed. + * @since v0.1.92 + * @param inputEncoding The `encoding` of the `data` string. + */ + update(data: BinaryLike): Verify; + update(data: string, inputEncoding: Encoding): Verify; + /** + * Verifies the provided data using the given `object` and `signature`. + * + * If `object` is not a `KeyObject`, this function behaves as if`object` had been passed to {@link createPublicKey}. If it is an + * object, the following additional properties can be passed: + * + * The `signature` argument is the previously calculated signature for the data, in + * the `signatureEncoding`. + * If a `signatureEncoding` is specified, the `signature` is expected to be a + * string; otherwise `signature` is expected to be a `Buffer`,`TypedArray`, or `DataView`. + * + * The `verify` object can not be used again after `verify.verify()` has been + * called. Multiple calls to `verify.verify()` will result in an error being + * thrown. + * + * Because public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v0.1.92 + */ + verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean; + verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean; + } + /** + * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an + * optional specific `generator`. + * + * The `generator` argument can be a number, string, or `Buffer`. If`generator` is not specified, the value `2` is used. + * + * If `primeEncoding` is specified, `prime` is expected to be a string; otherwise + * a `Buffer`, `TypedArray`, or `DataView` is expected. + * + * If `generatorEncoding` is specified, `generator` is expected to be a string; + * otherwise a number, `Buffer`, `TypedArray`, or `DataView` is expected. + * @since v0.11.12 + * @param primeEncoding The `encoding` of the `prime` string. + * @param [generator=2] + * @param generatorEncoding The `encoding` of the `generator` string. + */ + function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman; + function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman; + function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman; + function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman; + function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman; + /** + * The `DiffieHellman` class is a utility for creating Diffie-Hellman key + * exchanges. + * + * Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function. + * + * ```js + * import assert from 'node:assert'; + * + * const { + * createDiffieHellman, + * } = await import('node:crypto'); + * + * // Generate Alice's keys... + * const alice = createDiffieHellman(2048); + * const aliceKey = alice.generateKeys(); + * + * // Generate Bob's keys... + * const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator()); + * const bobKey = bob.generateKeys(); + * + * // Exchange and generate the secret... + * const aliceSecret = alice.computeSecret(bobKey); + * const bobSecret = bob.computeSecret(aliceKey); + * + * // OK + * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); + * ``` + * @since v0.5.0 + */ + class DiffieHellman { + private constructor(); + /** + * Generates private and public Diffie-Hellman key values unless they have been + * generated or computed already, and returns + * the public key in the specified `encoding`. This key should be + * transferred to the other party. + * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. + * + * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular, + * once a private key has been generated or set, calling this function only updates + * the public key but does not generate a new private key. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + generateKeys(): Buffer; + generateKeys(encoding: BinaryToTextEncoding): string; + /** + * Computes the shared secret using `otherPublicKey` as the other + * party's public key and returns the computed shared secret. The supplied + * key is interpreted using the specified `inputEncoding`, and secret is + * encoded using specified `outputEncoding`. + * If the `inputEncoding` is not + * provided, `otherPublicKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`. + * + * If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned. + * @since v0.5.0 + * @param inputEncoding The `encoding` of an `otherPublicKey` string. + * @param outputEncoding The `encoding` of the return value. + */ + computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer; + computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman prime in the specified `encoding`. + * If `encoding` is provided a string is + * returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPrime(): Buffer; + getPrime(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman generator in the specified `encoding`. + * If `encoding` is provided a string is + * returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getGenerator(): Buffer; + getGenerator(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman public key in the specified `encoding`. + * If `encoding` is provided a + * string is returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPublicKey(): Buffer; + getPublicKey(encoding: BinaryToTextEncoding): string; + /** + * Returns the Diffie-Hellman private key in the specified `encoding`. + * If `encoding` is provided a + * string is returned; otherwise a `Buffer` is returned. + * @since v0.5.0 + * @param encoding The `encoding` of the return value. + */ + getPrivateKey(): Buffer; + getPrivateKey(encoding: BinaryToTextEncoding): string; + /** + * Sets the Diffie-Hellman public key. If the `encoding` argument is provided,`publicKey` is expected + * to be a string. If no `encoding` is provided, `publicKey` is expected + * to be a `Buffer`, `TypedArray`, or `DataView`. + * @since v0.5.0 + * @param encoding The `encoding` of the `publicKey` string. + */ + setPublicKey(publicKey: NodeJS.ArrayBufferView): void; + setPublicKey(publicKey: string, encoding: BufferEncoding): void; + /** + * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected + * to be a string. If no `encoding` is provided, `privateKey` is expected + * to be a `Buffer`, `TypedArray`, or `DataView`. + * + * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be + * used to manually provide the public key or to automatically derive it. + * @since v0.5.0 + * @param encoding The `encoding` of the `privateKey` string. + */ + setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; + setPrivateKey(privateKey: string, encoding: BufferEncoding): void; + /** + * A bit field containing any warnings and/or errors resulting from a check + * performed during initialization of the `DiffieHellman` object. + * + * The following values are valid for this property (as defined in `node:constants` module): + * + * * `DH_CHECK_P_NOT_SAFE_PRIME` + * * `DH_CHECK_P_NOT_PRIME` + * * `DH_UNABLE_TO_CHECK_GENERATOR` + * * `DH_NOT_SUITABLE_GENERATOR` + * @since v0.11.12 + */ + verifyError: number; + } + /** + * The `DiffieHellmanGroup` class takes a well-known modp group as its argument. + * It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. + * In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. + * + * ```js + * const { createDiffieHellmanGroup } = await import('node:crypto'); + * const dh = createDiffieHellmanGroup('modp1'); + * ``` + * The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt): + * ```bash + * $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h + * modp1 # 768 bits + * modp2 # 1024 bits + * modp5 # 1536 bits + * modp14 # 2048 bits + * modp15 # etc. + * modp16 + * modp17 + * modp18 + * ``` + * @since v0.7.5 + */ + const DiffieHellmanGroup: DiffieHellmanGroupConstructor; + interface DiffieHellmanGroupConstructor { + new (name: string): DiffieHellmanGroup; + (name: string): DiffieHellmanGroup; + readonly prototype: DiffieHellmanGroup; + } + type DiffieHellmanGroup = Omit; + /** + * Creates a predefined `DiffieHellmanGroup` key exchange object. The + * supported groups are listed in the documentation for `DiffieHellmanGroup`. + * + * The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing + * the keys (with `diffieHellman.setPublicKey()`, for example). The + * advantage of using this method is that the parties do not have to + * generate nor exchange a group modulus beforehand, saving both processor + * and communication time. + * + * Example (obtaining a shared secret): + * + * ```js + * const { + * getDiffieHellman, + * } = await import('node:crypto'); + * const alice = getDiffieHellman('modp14'); + * const bob = getDiffieHellman('modp14'); + * + * alice.generateKeys(); + * bob.generateKeys(); + * + * const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); + * const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + * + * // aliceSecret and bobSecret should be the same + * console.log(aliceSecret === bobSecret); + * ``` + * @since v0.7.5 + */ + function getDiffieHellman(groupName: string): DiffieHellmanGroup; + /** + * An alias for {@link getDiffieHellman} + * @since v0.9.3 + */ + function createDiffieHellmanGroup(name: string): DiffieHellmanGroup; + /** + * Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) + * implementation. A selected HMAC digest algorithm specified by `digest` is + * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`. + * + * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an error occurs while deriving the key, `err` will be set; + * otherwise `err` will be `null`. By default, the successfully generated`derivedKey` will be passed to the callback as a `Buffer`. An error will be + * thrown if any of the input arguments specify invalid values or types. + * + * The `iterations` argument must be a number set as high as possible. The + * higher the number of iterations, the more secure the derived key will be, + * but will take a longer amount of time to complete. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * ```js + * const { + * pbkdf2, + * } = await import('node:crypto'); + * + * pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' + * }); + * ``` + * + * An array of supported digest functions can be retrieved using {@link getHashes}. + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * @since v0.5.5 + */ + function pbkdf2(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => void): void; + /** + * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) + * implementation. A selected HMAC digest algorithm specified by `digest` is + * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`. + * + * If an error occurs an `Error` will be thrown, otherwise the derived key will be + * returned as a `Buffer`. + * + * The `iterations` argument must be a number set as high as possible. The + * higher the number of iterations, the more secure the derived key will be, + * but will take a longer amount of time to complete. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * ```js + * const { + * pbkdf2Sync, + * } = await import('node:crypto'); + * + * const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); + * console.log(key.toString('hex')); // '3745e48...08d59ae' + * ``` + * + * An array of supported digest functions can be retrieved using {@link getHashes}. + * @since v0.9.3 + */ + function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer; + /** + * Generates cryptographically strong pseudorandom data. The `size` argument + * is a number indicating the number of bytes to generate. + * + * If a `callback` function is provided, the bytes are generated asynchronously + * and the `callback` function is invoked with two arguments: `err` and `buf`. + * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The`buf` argument is a `Buffer` containing the generated bytes. + * + * ```js + * // Asynchronous + * const { + * randomBytes, + * } = await import('node:crypto'); + * + * randomBytes(256, (err, buf) => { + * if (err) throw err; + * console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); + * }); + * ``` + * + * If the `callback` function is not provided, the random bytes are generated + * synchronously and returned as a `Buffer`. An error will be thrown if + * there is a problem generating the bytes. + * + * ```js + * // Synchronous + * const { + * randomBytes, + * } = await import('node:crypto'); + * + * const buf = randomBytes(256); + * console.log( + * `${buf.length} bytes of random data: ${buf.toString('hex')}`); + * ``` + * + * The `crypto.randomBytes()` method will not complete until there is + * sufficient entropy available. + * This should normally never take longer than a few milliseconds. The only time + * when generating the random bytes may conceivably block for a longer period of + * time is right after boot, when the whole system is still low on entropy. + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * + * The asynchronous version of `crypto.randomBytes()` is carried out in a single + * threadpool request. To minimize threadpool task length variation, partition + * large `randomBytes` requests when doing so as part of fulfilling a client + * request. + * @since v0.5.8 + * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`. + * @return if the `callback` function is not provided. + */ + function randomBytes(size: number): Buffer; + function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; + function pseudoRandomBytes(size: number): Buffer; + function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; + /** + * Return a random integer `n` such that `min <= n < max`. This + * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias). + * + * The range (`max - min`) must be less than 248. `min` and `max` must + * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger). + * + * If the `callback` function is not provided, the random integer is + * generated synchronously. + * + * ```js + * // Asynchronous + * const { + * randomInt, + * } = await import('node:crypto'); + * + * randomInt(3, (err, n) => { + * if (err) throw err; + * console.log(`Random number chosen from (0, 1, 2): ${n}`); + * }); + * ``` + * + * ```js + * // Synchronous + * const { + * randomInt, + * } = await import('node:crypto'); + * + * const n = randomInt(3); + * console.log(`Random number chosen from (0, 1, 2): ${n}`); + * ``` + * + * ```js + * // With `min` argument + * const { + * randomInt, + * } = await import('node:crypto'); + * + * const n = randomInt(1, 7); + * console.log(`The dice rolled: ${n}`); + * ``` + * @since v14.10.0, v12.19.0 + * @param [min=0] Start of random range (inclusive). + * @param max End of random range (exclusive). + * @param callback `function(err, n) {}`. + */ + function randomInt(max: number): number; + function randomInt(min: number, max: number): number; + function randomInt(max: number, callback: (err: Error | null, value: number) => void): void; + function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void; + /** + * Synchronous version of {@link randomFill}. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFillSync } = await import('node:crypto'); + * + * const buf = Buffer.alloc(10); + * console.log(randomFillSync(buf).toString('hex')); + * + * randomFillSync(buf, 5); + * console.log(buf.toString('hex')); + * + * // The above is equivalent to the following: + * randomFillSync(buf, 5, 5); + * console.log(buf.toString('hex')); + * ``` + * + * Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFillSync } = await import('node:crypto'); + * + * const a = new Uint32Array(10); + * console.log(Buffer.from(randomFillSync(a).buffer, + * a.byteOffset, a.byteLength).toString('hex')); + * + * const b = new DataView(new ArrayBuffer(10)); + * console.log(Buffer.from(randomFillSync(b).buffer, + * b.byteOffset, b.byteLength).toString('hex')); + * + * const c = new ArrayBuffer(10); + * console.log(Buffer.from(randomFillSync(c)).toString('hex')); + * ``` + * @since v7.10.0, v6.13.0 + * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. + * @param [offset=0] + * @param [size=buffer.length - offset] + * @return The object passed as `buffer` argument. + */ + function randomFillSync(buffer: T, offset?: number, size?: number): T; + /** + * This function is similar to {@link randomBytes} but requires the first + * argument to be a `Buffer` that will be filled. It also + * requires that a callback is passed in. + * + * If the `callback` function is not provided, an error will be thrown. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFill } = await import('node:crypto'); + * + * const buf = Buffer.alloc(10); + * randomFill(buf, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * + * randomFill(buf, 5, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * + * // The above is equivalent to the following: + * randomFill(buf, 5, 5, (err, buf) => { + * if (err) throw err; + * console.log(buf.toString('hex')); + * }); + * ``` + * + * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as`buffer`. + * + * While this includes instances of `Float32Array` and `Float64Array`, this + * function should not be used to generate random floating-point numbers. The + * result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array + * contains finite numbers only, they are not drawn from a uniform random + * distribution and have no meaningful lower or upper bounds. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { randomFill } = await import('node:crypto'); + * + * const a = new Uint32Array(10); + * randomFill(a, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + * .toString('hex')); + * }); + * + * const b = new DataView(new ArrayBuffer(10)); + * randomFill(b, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + * .toString('hex')); + * }); + * + * const c = new ArrayBuffer(10); + * randomFill(c, (err, buf) => { + * if (err) throw err; + * console.log(Buffer.from(buf).toString('hex')); + * }); + * ``` + * + * This API uses libuv's threadpool, which can have surprising and + * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. + * + * The asynchronous version of `crypto.randomFill()` is carried out in a single + * threadpool request. To minimize threadpool task length variation, partition + * large `randomFill` requests when doing so as part of fulfilling a client + * request. + * @since v7.10.0, v6.13.0 + * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. + * @param [offset=0] + * @param [size=buffer.length - offset] + * @param callback `function(err, buf) {}`. + */ + function randomFill(buffer: T, callback: (err: Error | null, buf: T) => void): void; + function randomFill(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void; + function randomFill(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void; + interface ScryptOptions { + cost?: number | undefined; + blockSize?: number | undefined; + parallelization?: number | undefined; + N?: number | undefined; + r?: number | undefined; + p?: number | undefined; + maxmem?: number | undefined; + } + /** + * Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based + * key derivation function that is designed to be expensive computationally and + * memory-wise in order to make brute-force attacks unrewarding. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * The `callback` function is called with two arguments: `err` and `derivedKey`.`err` is an exception object when key derivation fails, otherwise `err` is`null`. `derivedKey` is passed to the + * callback as a `Buffer`. + * + * An exception is thrown when any of the input arguments specify invalid values + * or types. + * + * ```js + * const { + * scrypt, + * } = await import('node:crypto'); + * + * // Using the factory defaults. + * scrypt('password', 'salt', 64, (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' + * }); + * // Using a custom N parameter. Must be a power of two. + * scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => { + * if (err) throw err; + * console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' + * }); + * ``` + * @since v10.5.0 + */ + function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void): void; + function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, options: ScryptOptions, callback: (err: Error | null, derivedKey: Buffer) => void): void; + /** + * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based + * key derivation function that is designed to be expensive computationally and + * memory-wise in order to make brute-force attacks unrewarding. + * + * The `salt` should be as unique as possible. It is recommended that a salt is + * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + * + * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. + * + * An exception is thrown when key derivation fails, otherwise the derived key is + * returned as a `Buffer`. + * + * An exception is thrown when any of the input arguments specify invalid values + * or types. + * + * ```js + * const { + * scryptSync, + * } = await import('node:crypto'); + * // Using the factory defaults. + * + * const key1 = scryptSync('password', 'salt', 64); + * console.log(key1.toString('hex')); // '3745e48...08d59ae' + * // Using a custom N parameter. Must be a power of two. + * const key2 = scryptSync('password', 'salt', 64, { N: 1024 }); + * console.log(key2.toString('hex')); // '3745e48...aa39b34' + * ``` + * @since v10.5.0 + */ + function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; + interface RsaPublicKey { + key: KeyLike; + padding?: number | undefined; + } + interface RsaPrivateKey { + key: KeyLike; + passphrase?: string | undefined; + /** + * @default 'sha1' + */ + oaepHash?: string | undefined; + oaepLabel?: NodeJS.TypedArray | undefined; + padding?: number | undefined; + } + /** + * Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using + * the corresponding private key, for example using {@link privateDecrypt}. + * + * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`. + * + * Because RSA public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v0.11.14 + */ + function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Decrypts `buffer` with `key`.`buffer` was previously encrypted using + * the corresponding private key, for example using {@link privateEncrypt}. + * + * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`. + * + * Because RSA public keys can be derived from private keys, a private key may + * be passed instead of a public key. + * @since v1.1.0 + */ + function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using + * the corresponding public key, for example using {@link publicEncrypt}. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`. + * @since v0.11.14 + */ + function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using + * the corresponding public key, for example using {@link publicDecrypt}. + * + * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an + * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`. + * @since v1.1.0 + */ + function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + /** + * ```js + * const { + * getCiphers, + * } = await import('node:crypto'); + * + * console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...] + * ``` + * @since v0.9.3 + * @return An array with the names of the supported cipher algorithms. + */ + function getCiphers(): string[]; + /** + * ```js + * const { + * getCurves, + * } = await import('node:crypto'); + * + * console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] + * ``` + * @since v2.3.0 + * @return An array with the names of the supported elliptic curves. + */ + function getCurves(): string[]; + /** + * @since v10.0.0 + * @return `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}. + */ + function getFips(): 1 | 0; + /** + * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. + * Throws an error if FIPS mode is not available. + * @since v10.0.0 + * @param bool `true` to enable FIPS mode. + */ + function setFips(bool: boolean): void; + /** + * ```js + * const { + * getHashes, + * } = await import('node:crypto'); + * + * console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] + * ``` + * @since v0.9.3 + * @return An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. + */ + function getHashes(): string[]; + /** + * The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) + * key exchanges. + * + * Instances of the `ECDH` class can be created using the {@link createECDH} function. + * + * ```js + * import assert from 'node:assert'; + * + * const { + * createECDH, + * } = await import('node:crypto'); + * + * // Generate Alice's keys... + * const alice = createECDH('secp521r1'); + * const aliceKey = alice.generateKeys(); + * + * // Generate Bob's keys... + * const bob = createECDH('secp521r1'); + * const bobKey = bob.generateKeys(); + * + * // Exchange and generate the secret... + * const aliceSecret = alice.computeSecret(bobKey); + * const bobSecret = bob.computeSecret(aliceKey); + * + * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); + * // OK + * ``` + * @since v0.11.14 + */ + class ECDH { + private constructor(); + /** + * Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the + * format specified by `format`. The `format` argument specifies point encoding + * and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is + * interpreted using the specified `inputEncoding`, and the returned key is encoded + * using the specified `outputEncoding`. + * + * Use {@link getCurves} to obtain a list of available curve names. + * On recent OpenSSL releases, `openssl ecparam -list_curves` will also display + * the name and description of each available elliptic curve. + * + * If `format` is not specified the point will be returned in `'uncompressed'`format. + * + * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`,`TypedArray`, or `DataView`. + * + * Example (uncompressing a key): + * + * ```js + * const { + * createECDH, + * ECDH, + * } = await import('node:crypto'); + * + * const ecdh = createECDH('secp256k1'); + * ecdh.generateKeys(); + * + * const compressedKey = ecdh.getPublicKey('hex', 'compressed'); + * + * const uncompressedKey = ECDH.convertKey(compressedKey, + * 'secp256k1', + * 'hex', + * 'hex', + * 'uncompressed'); + * + * // The converted key and the uncompressed public key should be the same + * console.log(uncompressedKey === ecdh.getPublicKey('hex')); + * ``` + * @since v10.0.0 + * @param inputEncoding The `encoding` of the `key` string. + * @param outputEncoding The `encoding` of the return value. + * @param [format='uncompressed'] + */ + static convertKey( + key: BinaryLike, + curve: string, + inputEncoding?: BinaryToTextEncoding, + outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url', + format?: 'uncompressed' | 'compressed' | 'hybrid' + ): Buffer | string; + /** + * Generates private and public EC Diffie-Hellman key values, and returns + * the public key in the specified `format` and `encoding`. This key should be + * transferred to the other party. + * + * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format. + * + * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @param [format='uncompressed'] + */ + generateKeys(): Buffer; + generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; + /** + * Computes the shared secret using `otherPublicKey` as the other + * party's public key and returns the computed shared secret. The supplied + * key is interpreted using specified `inputEncoding`, and the returned secret + * is encoded using the specified `outputEncoding`. + * If the `inputEncoding` is not + * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or`DataView`. + * + * If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned. + * + * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey`lies outside of the elliptic curve. Since `otherPublicKey` is + * usually supplied from a remote user over an insecure network, + * be sure to handle this exception accordingly. + * @since v0.11.14 + * @param inputEncoding The `encoding` of the `otherPublicKey` string. + * @param outputEncoding The `encoding` of the return value. + */ + computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer; + computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string; + computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string; + /** + * If `encoding` is specified, a string is returned; otherwise a `Buffer` is + * returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @return The EC Diffie-Hellman in the specified `encoding`. + */ + getPrivateKey(): Buffer; + getPrivateKey(encoding: BinaryToTextEncoding): string; + /** + * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format. + * + * If `encoding` is specified, a string is returned; otherwise a `Buffer` is + * returned. + * @since v0.11.14 + * @param encoding The `encoding` of the return value. + * @param [format='uncompressed'] + * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`. + */ + getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer; + getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; + /** + * Sets the EC Diffie-Hellman private key. + * If `encoding` is provided, `privateKey` is expected + * to be a string; otherwise `privateKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`. + * + * If `privateKey` is not valid for the curve specified when the `ECDH` object was + * created, an error is thrown. Upon setting the private key, the associated + * public point (key) is also generated and set in the `ECDH` object. + * @since v0.11.14 + * @param encoding The `encoding` of the `privateKey` string. + */ + setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; + setPrivateKey(privateKey: string, encoding: BinaryToTextEncoding): void; + } + /** + * Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a + * predefined curve specified by the `curveName` string. Use {@link getCurves} to obtain a list of available curve names. On recent + * OpenSSL releases, `openssl ecparam -list_curves` will also display the name + * and description of each available elliptic curve. + * @since v0.11.14 + */ + function createECDH(curveName: string): ECDH; + /** + * This function compares the underlying bytes that represent the given`ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time + * algorithm. + * + * This function does not leak timing information that + * would allow an attacker to guess one of the values. This is suitable for + * comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/). + * + * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they + * must have the same byte length. An error is thrown if `a` and `b` have + * different byte lengths. + * + * If at least one of `a` and `b` is a `TypedArray` with more than one byte per + * entry, such as `Uint16Array`, the result will be computed using the platform + * byte order. + * + * **When both of the inputs are `Float32Array`s or`Float64Array`s, this function might return unexpected results due to IEEE 754** + * **encoding of floating-point numbers. In particular, neither `x === y` nor`Object.is(x, y)` implies that the byte representations of two floating-point** + * **numbers `x` and `y` are equal.** + * + * Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code + * is timing-safe. Care should be taken to ensure that the surrounding code does + * not introduce timing vulnerabilities. + * @since v6.6.0 + */ + function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; + type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448'; + type KeyFormat = 'pem' | 'der' | 'jwk'; + interface BasePrivateKeyEncodingOptions { + format: T; + cipher?: string | undefined; + passphrase?: string | undefined; + } + interface KeyPairKeyObjectResult { + publicKey: KeyObject; + privateKey: KeyObject; + } + interface ED25519KeyPairKeyObjectOptions {} + interface ED448KeyPairKeyObjectOptions {} + interface X25519KeyPairKeyObjectOptions {} + interface X448KeyPairKeyObjectOptions {} + interface ECKeyPairKeyObjectOptions { + /** + * Name of the curve to use + */ + namedCurve: string; + } + interface RSAKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + } + interface RSAPSSKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + /** + * Name of the message digest + */ + hashAlgorithm?: string; + /** + * Name of the message digest used by MGF1 + */ + mgf1HashAlgorithm?: string; + /** + * Minimal salt length in bytes + */ + saltLength?: string; + } + interface DSAKeyPairKeyObjectOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Size of q in bits + */ + divisorLength: number; + } + interface RSAKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + publicKeyEncoding: { + type: 'pkcs1' | 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs1' | 'pkcs8'; + }; + } + interface RSAPSSKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Public exponent + * @default 0x10001 + */ + publicExponent?: number | undefined; + /** + * Name of the message digest + */ + hashAlgorithm?: string; + /** + * Name of the message digest used by MGF1 + */ + mgf1HashAlgorithm?: string; + /** + * Minimal salt length in bytes + */ + saltLength?: string; + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface DSAKeyPairOptions { + /** + * Key size in bits + */ + modulusLength: number; + /** + * Size of q in bits + */ + divisorLength: number; + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface ECKeyPairOptions { + /** + * Name of the curve to use. + */ + namedCurve: string; + publicKeyEncoding: { + type: 'pkcs1' | 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'sec1' | 'pkcs8'; + }; + } + interface ED25519KeyPairOptions { + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface ED448KeyPairOptions { + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface X25519KeyPairOptions { + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface X448KeyPairOptions { + publicKeyEncoding: { + type: 'spki'; + format: PubF; + }; + privateKeyEncoding: BasePrivateKeyEncodingOptions & { + type: 'pkcs8'; + }; + } + interface KeyPairSyncResult { + publicKey: T1; + privateKey: T2; + } + /** + * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, + * Ed25519, Ed448, X25519, X448, and DH are currently supported. + * + * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function + * behaves as if `keyObject.export()` had been called on its result. Otherwise, + * the respective part of the key is returned as a `KeyObject`. + * + * When encoding public keys, it is recommended to use `'spki'`. When encoding + * private keys, it is recommended to use `'pkcs8'` with a strong passphrase, + * and to keep the passphrase confidential. + * + * ```js + * const { + * generateKeyPairSync, + * } = await import('node:crypto'); + * + * const { + * publicKey, + * privateKey, + * } = generateKeyPairSync('rsa', { + * modulusLength: 4096, + * publicKeyEncoding: { + * type: 'spki', + * format: 'pem', + * }, + * privateKeyEncoding: { + * type: 'pkcs8', + * format: 'pem', + * cipher: 'aes-256-cbc', + * passphrase: 'top secret', + * }, + * }); + * ``` + * + * The return value `{ publicKey, privateKey }` represents the generated key pair. + * When PEM encoding was selected, the respective key will be a string, otherwise + * it will be a buffer containing the data encoded as DER. + * @since v10.12.0 + * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. + */ + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult; + function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; + /** + * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, + * Ed25519, Ed448, X25519, X448, and DH are currently supported. + * + * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function + * behaves as if `keyObject.export()` had been called on its result. Otherwise, + * the respective part of the key is returned as a `KeyObject`. + * + * It is recommended to encode public keys as `'spki'` and private keys as`'pkcs8'` with encryption for long-term storage: + * + * ```js + * const { + * generateKeyPair, + * } = await import('node:crypto'); + * + * generateKeyPair('rsa', { + * modulusLength: 4096, + * publicKeyEncoding: { + * type: 'spki', + * format: 'pem', + * }, + * privateKeyEncoding: { + * type: 'pkcs8', + * format: 'pem', + * cipher: 'aes-256-cbc', + * passphrase: 'top secret', + * }, + * }, (err, publicKey, privateKey) => { + * // Handle errors and use the generated key pair. + * }); + * ``` + * + * On completion, `callback` will be called with `err` set to `undefined` and`publicKey` / `privateKey` representing the generated key pair. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a `Promise` for an `Object` with `publicKey` and `privateKey` properties. + * @since v10.12.0 + * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. + */ + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void; + function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void; + namespace generateKeyPair { + function __promisify__( + type: 'rsa', + options: RSAKeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'rsa', + options: RSAKeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'rsa', + options: RSAKeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'rsa', + options: RSAKeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'rsa-pss', + options: RSAPSSKeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'rsa-pss', + options: RSAPSSKeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'rsa-pss', + options: RSAPSSKeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'rsa-pss', + options: RSAPSSKeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'dsa', + options: DSAKeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'dsa', + options: DSAKeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'dsa', + options: DSAKeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'dsa', + options: DSAKeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'ec', + options: ECKeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'ec', + options: ECKeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'ec', + options: ECKeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'ec', + options: ECKeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'ed25519', + options: ED25519KeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'ed25519', + options: ED25519KeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'ed25519', + options: ED25519KeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'ed25519', + options: ED25519KeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'ed448', + options: ED448KeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'ed448', + options: ED448KeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'ed448', + options: ED448KeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'ed448', + options: ED448KeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'x25519', + options: X25519KeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'x25519', + options: X25519KeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'x25519', + options: X25519KeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'x25519', + options: X25519KeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): Promise; + function __promisify__( + type: 'x448', + options: X448KeyPairOptions<'pem', 'pem'> + ): Promise<{ + publicKey: string; + privateKey: string; + }>; + function __promisify__( + type: 'x448', + options: X448KeyPairOptions<'pem', 'der'> + ): Promise<{ + publicKey: string; + privateKey: Buffer; + }>; + function __promisify__( + type: 'x448', + options: X448KeyPairOptions<'der', 'pem'> + ): Promise<{ + publicKey: Buffer; + privateKey: string; + }>; + function __promisify__( + type: 'x448', + options: X448KeyPairOptions<'der', 'der'> + ): Promise<{ + publicKey: Buffer; + privateKey: Buffer; + }>; + function __promisify__(type: 'x448', options?: X448KeyPairKeyObjectOptions): Promise; + } + /** + * Calculates and returns the signature for `data` using the given private key and + * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is + * dependent upon the key type (especially Ed25519 and Ed448). + * + * If `key` is not a `KeyObject`, this function behaves as if `key` had been + * passed to {@link createPrivateKey}. If it is an object, the following + * additional properties can be passed: + * + * If the `callback` function is provided this function uses libuv's threadpool. + * @since v12.0.0 + */ + function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; + function sign( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, + callback: (error: Error | null, data: Buffer) => void + ): void; + /** + * Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the + * key type (especially Ed25519 and Ed448). + * + * If `key` is not a `KeyObject`, this function behaves as if `key` had been + * passed to {@link createPublicKey}. If it is an object, the following + * additional properties can be passed: + * + * The `signature` argument is the previously calculated signature for the `data`. + * + * Because public keys can be derived from private keys, a private key or a public + * key may be passed for `key`. + * + * If the `callback` function is provided this function uses libuv's threadpool. + * @since v12.0.0 + */ + function verify( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, + signature: NodeJS.ArrayBufferView + ): boolean; + function verify( + algorithm: string | null | undefined, + data: NodeJS.ArrayBufferView, + key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, + signature: NodeJS.ArrayBufferView, + callback: (error: Error | null, result: boolean) => void + ): void; + /** + * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`. + * Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'`(for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES). + * @since v13.9.0, v12.17.0 + */ + function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer; + type CipherMode = 'cbc' | 'ccm' | 'cfb' | 'ctr' | 'ecb' | 'gcm' | 'ocb' | 'ofb' | 'stream' | 'wrap' | 'xts'; + interface CipherInfoOptions { + /** + * A test key length. + */ + keyLength?: number | undefined; + /** + * A test IV length. + */ + ivLength?: number | undefined; + } + interface CipherInfo { + /** + * The name of the cipher. + */ + name: string; + /** + * The nid of the cipher. + */ + nid: number; + /** + * The block size of the cipher in bytes. + * This property is omitted when mode is 'stream'. + */ + blockSize?: number | undefined; + /** + * The expected or default initialization vector length in bytes. + * This property is omitted if the cipher does not use an initialization vector. + */ + ivLength?: number | undefined; + /** + * The expected or default key length in bytes. + */ + keyLength: number; + /** + * The cipher mode. + */ + mode: CipherMode; + } + /** + * Returns information about a given cipher. + * + * Some ciphers accept variable length keys and initialization vectors. By default, + * the `crypto.getCipherInfo()` method will return the default values for these + * ciphers. To test if a given key length or iv length is acceptable for given + * cipher, use the `keyLength` and `ivLength` options. If the given values are + * unacceptable, `undefined` will be returned. + * @since v15.0.0 + * @param nameOrNid The name or nid of the cipher to query. + */ + function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined; + /** + * HKDF is a simple key derivation function defined in RFC 5869\. The given `ikm`,`salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. + * + * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an errors occurs while deriving the key, `err` will be set; + * otherwise `err` will be `null`. The successfully generated `derivedKey` will + * be passed to the callback as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any + * of the input arguments specify invalid values or types. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * hkdf, + * } = await import('node:crypto'); + * + * hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => { + * if (err) throw err; + * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' + * }); + * ``` + * @since v15.0.0 + * @param digest The digest algorithm to use. + * @param ikm The input keying material. Must be provided but can be zero-length. + * @param salt The salt value. Must be provided but can be zero-length. + * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. + * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` + * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). + */ + function hkdf(digest: string, irm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => void): void; + /** + * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The + * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes. + * + * The successfully generated `derivedKey` will be returned as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). + * + * An error will be thrown if any of the input arguments specify invalid values or + * types, or if the derived key cannot be generated. + * + * ```js + * import { Buffer } from 'node:buffer'; + * const { + * hkdfSync, + * } = await import('node:crypto'); + * + * const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); + * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' + * ``` + * @since v15.0.0 + * @param digest The digest algorithm to use. + * @param ikm The input keying material. Must be provided but can be zero-length. + * @param salt The salt value. Must be provided but can be zero-length. + * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. + * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` + * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). + */ + function hkdfSync(digest: string, ikm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number): ArrayBuffer; + interface SecureHeapUsage { + /** + * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag. + */ + total: number; + /** + * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag. + */ + min: number; + /** + * The total number of bytes currently allocated from the secure heap. + */ + used: number; + /** + * The calculated ratio of `used` to `total` allocated bytes. + */ + utilization: number; + } + /** + * @since v15.6.0 + */ + function secureHeapUsed(): SecureHeapUsage; + interface RandomUUIDOptions { + /** + * By default, to improve performance, + * Node.js will pre-emptively generate and persistently cache enough + * random data to generate up to 128 random UUIDs. To generate a UUID + * without using the cache, set `disableEntropyCache` to `true`. + * + * @default `false` + */ + disableEntropyCache?: boolean | undefined; + } + /** + * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a + * cryptographic pseudorandom number generator. + * @since v15.6.0, v14.17.0 + */ + function randomUUID(options?: RandomUUIDOptions): string; + interface X509CheckOptions { + /** + * @default 'always' + */ + subject?: 'always' | 'default' | 'never'; + /** + * @default true + */ + wildcards?: boolean; + /** + * @default true + */ + partialWildcards?: boolean; + /** + * @default false + */ + multiLabelWildcards?: boolean; + /** + * @default false + */ + singleLabelSubdomains?: boolean; + } + /** + * Encapsulates an X509 certificate and provides read-only access to + * its information. + * + * ```js + * const { X509Certificate } = await import('node:crypto'); + * + * const x509 = new X509Certificate('{... pem encoded cert ...}'); + * + * console.log(x509.subject); + * ``` + * @since v15.6.0 + */ + class X509Certificate { + /** + * Will be \`true\` if this is a Certificate Authority (CA) certificate. + * @since v15.6.0 + */ + readonly ca: boolean; + /** + * The SHA-1 fingerprint of this certificate. + * + * Because SHA-1 is cryptographically broken and because the security of SHA-1 is + * significantly worse than that of algorithms that are commonly used to sign + * certificates, consider using `x509.fingerprint256` instead. + * @since v15.6.0 + */ + readonly fingerprint: string; + /** + * The SHA-256 fingerprint of this certificate. + * @since v15.6.0 + */ + readonly fingerprint256: string; + /** + * The SHA-512 fingerprint of this certificate. + * + * Because computing the SHA-256 fingerprint is usually faster and because it is + * only half the size of the SHA-512 fingerprint, `x509.fingerprint256` may be + * a better choice. While SHA-512 presumably provides a higher level of security in + * general, the security of SHA-256 matches that of most algorithms that are + * commonly used to sign certificates. + * @since v17.2.0, v16.14.0 + */ + readonly fingerprint512: string; + /** + * The complete subject of this certificate. + * @since v15.6.0 + */ + readonly subject: string; + /** + * The subject alternative name specified for this certificate. + * + * This is a comma-separated list of subject alternative names. Each entry begins + * with a string identifying the kind of the subject alternative name followed by + * a colon and the value associated with the entry. + * + * Earlier versions of Node.js incorrectly assumed that it is safe to split this + * property at the two-character sequence `', '` (see [CVE-2021-44532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532)). However, + * both malicious and legitimate certificates can contain subject alternative names + * that include this sequence when represented as a string. + * + * After the prefix denoting the type of the entry, the remainder of each entry + * might be enclosed in quotes to indicate that the value is a JSON string literal. + * For backward compatibility, Node.js only uses JSON string literals within this + * property when necessary to avoid ambiguity. Third-party code should be prepared + * to handle both possible entry formats. + * @since v15.6.0 + */ + readonly subjectAltName: string | undefined; + /** + * A textual representation of the certificate's authority information access + * extension. + * + * This is a line feed separated list of access descriptions. Each line begins with + * the access method and the kind of the access location, followed by a colon and + * the value associated with the access location. + * + * After the prefix denoting the access method and the kind of the access location, + * the remainder of each line might be enclosed in quotes to indicate that the + * value is a JSON string literal. For backward compatibility, Node.js only uses + * JSON string literals within this property when necessary to avoid ambiguity. + * Third-party code should be prepared to handle both possible entry formats. + * @since v15.6.0 + */ + readonly infoAccess: string | undefined; + /** + * An array detailing the key usages for this certificate. + * @since v15.6.0 + */ + readonly keyUsage: string[]; + /** + * The issuer identification included in this certificate. + * @since v15.6.0 + */ + readonly issuer: string; + /** + * The issuer certificate or `undefined` if the issuer certificate is not + * available. + * @since v15.9.0 + */ + readonly issuerCertificate?: X509Certificate | undefined; + /** + * The public key `KeyObject` for this certificate. + * @since v15.6.0 + */ + readonly publicKey: KeyObject; + /** + * A `Buffer` containing the DER encoding of this certificate. + * @since v15.6.0 + */ + readonly raw: Buffer; + /** + * The serial number of this certificate. + * + * Serial numbers are assigned by certificate authorities and do not uniquely + * identify certificates. Consider using `x509.fingerprint256` as a unique + * identifier instead. + * @since v15.6.0 + */ + readonly serialNumber: string; + /** + * The date/time from which this certificate is considered valid. + * @since v15.6.0 + */ + readonly validFrom: string; + /** + * The date/time until which this certificate is considered valid. + * @since v15.6.0 + */ + readonly validTo: string; + constructor(buffer: BinaryLike); + /** + * Checks whether the certificate matches the given email address. + * + * If the `'subject'` option is undefined or set to `'default'`, the certificate + * subject is only considered if the subject alternative name extension either does + * not exist or does not contain any email addresses. + * + * If the `'subject'` option is set to `'always'` and if the subject alternative + * name extension either does not exist or does not contain a matching email + * address, the certificate subject is considered. + * + * If the `'subject'` option is set to `'never'`, the certificate subject is never + * considered, even if the certificate contains no subject alternative names. + * @since v15.6.0 + * @return Returns `email` if the certificate matches, `undefined` if it does not. + */ + checkEmail(email: string, options?: Pick): string | undefined; + /** + * Checks whether the certificate matches the given host name. + * + * If the certificate matches the given host name, the matching subject name is + * returned. The returned name might be an exact match (e.g., `foo.example.com`) + * or it might contain wildcards (e.g., `*.example.com`). Because host name + * comparisons are case-insensitive, the returned subject name might also differ + * from the given `name` in capitalization. + * + * If the `'subject'` option is undefined or set to `'default'`, the certificate + * subject is only considered if the subject alternative name extension either does + * not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS"). + * + * If the `'subject'` option is set to `'always'` and if the subject alternative + * name extension either does not exist or does not contain a matching DNS name, + * the certificate subject is considered. + * + * If the `'subject'` option is set to `'never'`, the certificate subject is never + * considered, even if the certificate contains no subject alternative names. + * @since v15.6.0 + * @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`. + */ + checkHost(name: string, options?: X509CheckOptions): string | undefined; + /** + * Checks whether the certificate matches the given IP address (IPv4 or IPv6). + * + * Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they + * must match the given `ip` address exactly. Other subject alternative names as + * well as the subject field of the certificate are ignored. + * @since v15.6.0 + * @return Returns `ip` if the certificate matches, `undefined` if it does not. + */ + checkIP(ip: string): string | undefined; + /** + * Checks whether this certificate was issued by the given `otherCert`. + * @since v15.6.0 + */ + checkIssued(otherCert: X509Certificate): boolean; + /** + * Checks whether the public key for this certificate is consistent with + * the given private key. + * @since v15.6.0 + * @param privateKey A private key. + */ + checkPrivateKey(privateKey: KeyObject): boolean; + /** + * There is no standard JSON encoding for X509 certificates. The`toJSON()` method returns a string containing the PEM encoded + * certificate. + * @since v15.6.0 + */ + toJSON(): string; + /** + * Returns information about this certificate using the legacy `certificate object` encoding. + * @since v15.6.0 + */ + toLegacyObject(): PeerCertificate; + /** + * Returns the PEM-encoded certificate. + * @since v15.6.0 + */ + toString(): string; + /** + * Verifies that this certificate was signed by the given public key. + * Does not perform any other validation checks on the certificate. + * @since v15.6.0 + * @param publicKey A public key. + */ + verify(publicKey: KeyObject): boolean; + } + type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint; + interface GeneratePrimeOptions { + add?: LargeNumberLike | undefined; + rem?: LargeNumberLike | undefined; + /** + * @default false + */ + safe?: boolean | undefined; + bigint?: boolean | undefined; + } + interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions { + bigint: true; + } + interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions { + bigint?: false | undefined; + } + /** + * Generates a pseudorandom prime of `size` bits. + * + * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime. + * + * The `options.add` and `options.rem` parameters can be used to enforce additional + * requirements, e.g., for Diffie-Hellman: + * + * * If `options.add` and `options.rem` are both set, the prime will satisfy the + * condition that `prime % add = rem`. + * * If only `options.add` is set and `options.safe` is not `true`, the prime will + * satisfy the condition that `prime % add = 1`. + * * If only `options.add` is set and `options.safe` is set to `true`, the prime + * will instead satisfy the condition that `prime % add = 3`. This is necessary + * because `prime % add = 1` for `options.add > 2` would contradict the condition + * enforced by `options.safe`. + * * `options.rem` is ignored if `options.add` is not given. + * + * Both `options.add` and `options.rem` must be encoded as big-endian sequences + * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`. + * + * By default, the prime is encoded as a big-endian sequence of octets + * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. + * @since v15.8.0 + * @param size The size (in bits) of the prime to generate. + */ + function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void; + function generatePrime(size: number, options: GeneratePrimeOptionsBigInt, callback: (err: Error | null, prime: bigint) => void): void; + function generatePrime(size: number, options: GeneratePrimeOptionsArrayBuffer, callback: (err: Error | null, prime: ArrayBuffer) => void): void; + function generatePrime(size: number, options: GeneratePrimeOptions, callback: (err: Error | null, prime: ArrayBuffer | bigint) => void): void; + /** + * Generates a pseudorandom prime of `size` bits. + * + * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime. + * + * The `options.add` and `options.rem` parameters can be used to enforce additional + * requirements, e.g., for Diffie-Hellman: + * + * * If `options.add` and `options.rem` are both set, the prime will satisfy the + * condition that `prime % add = rem`. + * * If only `options.add` is set and `options.safe` is not `true`, the prime will + * satisfy the condition that `prime % add = 1`. + * * If only `options.add` is set and `options.safe` is set to `true`, the prime + * will instead satisfy the condition that `prime % add = 3`. This is necessary + * because `prime % add = 1` for `options.add > 2` would contradict the condition + * enforced by `options.safe`. + * * `options.rem` is ignored if `options.add` is not given. + * + * Both `options.add` and `options.rem` must be encoded as big-endian sequences + * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`. + * + * By default, the prime is encoded as a big-endian sequence of octets + * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. + * @since v15.8.0 + * @param size The size (in bits) of the prime to generate. + */ + function generatePrimeSync(size: number): ArrayBuffer; + function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint; + function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer; + function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint; + interface CheckPrimeOptions { + /** + * The number of Miller-Rabin probabilistic primality iterations to perform. + * When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most `2**-64` for random input. + * Care must be used when selecting a number of checks. + * Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details. + * + * @default 0 + */ + checks?: number | undefined; + } + /** + * Checks the primality of the `candidate`. + * @since v15.8.0 + * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. + */ + function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void; + function checkPrime(value: LargeNumberLike, options: CheckPrimeOptions, callback: (err: Error | null, result: boolean) => void): void; + /** + * Checks the primality of the `candidate`. + * @since v15.8.0 + * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. + * @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`. + */ + function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean; + /** + * Load and set the `engine` for some or all OpenSSL functions (selected by flags). + * + * `engine` could be either an id or a path to the engine's shared library. + * + * The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags`is a bit field taking one of or a mix of the following flags (defined in`crypto.constants`): + * + * * `crypto.constants.ENGINE_METHOD_RSA` + * * `crypto.constants.ENGINE_METHOD_DSA` + * * `crypto.constants.ENGINE_METHOD_DH` + * * `crypto.constants.ENGINE_METHOD_RAND` + * * `crypto.constants.ENGINE_METHOD_EC` + * * `crypto.constants.ENGINE_METHOD_CIPHERS` + * * `crypto.constants.ENGINE_METHOD_DIGESTS` + * * `crypto.constants.ENGINE_METHOD_PKEY_METHS` + * * `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` + * * `crypto.constants.ENGINE_METHOD_ALL` + * * `crypto.constants.ENGINE_METHOD_NONE` + * @since v0.11.11 + * @param flags + */ + function setEngine(engine: string, flags?: number): void; + /** + * A convenient alias for {@link webcrypto.getRandomValues}. This + * implementation is not compliant with the Web Crypto spec, to write + * web-compatible code use {@link webcrypto.getRandomValues} instead. + * @since v17.4.0 + * @return Returns `typedArray`. + */ + function getRandomValues(typedArray: T): T; + /** + * A convenient alias for `crypto.webcrypto.subtle`. + * @since v17.4.0 + */ + const subtle: webcrypto.SubtleCrypto; + /** + * An implementation of the Web Crypto API standard. + * + * See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details. + * @since v15.0.0 + */ + const webcrypto: webcrypto.Crypto; + namespace webcrypto { + type BufferSource = ArrayBufferView | ArrayBuffer; + type KeyFormat = 'jwk' | 'pkcs8' | 'raw' | 'spki'; + type KeyType = 'private' | 'public' | 'secret'; + type KeyUsage = 'decrypt' | 'deriveBits' | 'deriveKey' | 'encrypt' | 'sign' | 'unwrapKey' | 'verify' | 'wrapKey'; + type AlgorithmIdentifier = Algorithm | string; + type HashAlgorithmIdentifier = AlgorithmIdentifier; + type NamedCurve = string; + type BigInteger = Uint8Array; + interface AesCbcParams extends Algorithm { + iv: BufferSource; + } + interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; + } + interface AesDerivedKeyParams extends Algorithm { + length: number; + } + interface AesGcmParams extends Algorithm { + additionalData?: BufferSource; + iv: BufferSource; + tagLength?: number; + } + interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; + } + interface AesKeyGenParams extends Algorithm { + length: number; + } + interface Algorithm { + name: string; + } + interface EcKeyAlgorithm extends KeyAlgorithm { + namedCurve: NamedCurve; + } + interface EcKeyGenParams extends Algorithm { + namedCurve: NamedCurve; + } + interface EcKeyImportParams extends Algorithm { + namedCurve: NamedCurve; + } + interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; + } + interface EcdsaParams extends Algorithm { + hash: HashAlgorithmIdentifier; + } + interface Ed448Params extends Algorithm { + context?: BufferSource; + } + interface HkdfParams extends Algorithm { + hash: HashAlgorithmIdentifier; + info: BufferSource; + salt: BufferSource; + } + interface HmacImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; + } + interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: KeyAlgorithm; + length: number; + } + interface HmacKeyGenParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; + } + interface JsonWebKey { + alg?: string; + crv?: string; + d?: string; + dp?: string; + dq?: string; + e?: string; + ext?: boolean; + k?: string; + key_ops?: string[]; + kty?: string; + n?: string; + oth?: RsaOtherPrimesInfo[]; + p?: string; + q?: string; + qi?: string; + use?: string; + x?: string; + y?: string; + } + interface KeyAlgorithm { + name: string; + } + interface Pbkdf2Params extends Algorithm { + hash: HashAlgorithmIdentifier; + iterations: number; + salt: BufferSource; + } + interface RsaHashedImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + } + interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: KeyAlgorithm; + } + interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: HashAlgorithmIdentifier; + } + interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: BigInteger; + } + interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: BigInteger; + } + interface RsaOaepParams extends Algorithm { + label?: BufferSource; + } + interface RsaOtherPrimesInfo { + d?: string; + r?: string; + t?: string; + } + interface RsaPssParams extends Algorithm { + saltLength: number; + } + /** + * Calling `require('node:crypto').webcrypto` returns an instance of the `Crypto` class. + * `Crypto` is a singleton that provides access to the remainder of the crypto API. + * @since v15.0.0 + */ + interface Crypto { + /** + * Provides access to the `SubtleCrypto` API. + * @since v15.0.0 + */ + readonly subtle: SubtleCrypto; + /** + * Generates cryptographically strong random values. + * The given `typedArray` is filled with random values, and a reference to `typedArray` is returned. + * + * The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted. + * + * An error will be thrown if the given `typedArray` is larger than 65,536 bytes. + * @since v15.0.0 + */ + getRandomValues>(typedArray: T): T; + /** + * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID. + * The UUID is generated using a cryptographic pseudorandom number generator. + * @since v16.7.0 + */ + randomUUID(): string; + CryptoKey: CryptoKeyConstructor; + } + // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable. + interface CryptoKeyConstructor { + /** Illegal constructor */ + (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user. + readonly length: 0; + readonly name: 'CryptoKey'; + readonly prototype: CryptoKey; + } + /** + * @since v15.0.0 + */ + interface CryptoKey { + /** + * An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters. + * @since v15.0.0 + */ + readonly algorithm: KeyAlgorithm; + /** + * When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`. + * @since v15.0.0 + */ + readonly extractable: boolean; + /** + * A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key. + * @since v15.0.0 + */ + readonly type: KeyType; + /** + * An array of strings identifying the operations for which the key may be used. + * + * The possible usages are: + * - `'encrypt'` - The key may be used to encrypt data. + * - `'decrypt'` - The key may be used to decrypt data. + * - `'sign'` - The key may be used to generate digital signatures. + * - `'verify'` - The key may be used to verify digital signatures. + * - `'deriveKey'` - The key may be used to derive a new key. + * - `'deriveBits'` - The key may be used to derive bits. + * - `'wrapKey'` - The key may be used to wrap another key. + * - `'unwrapKey'` - The key may be used to unwrap another key. + * + * Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`). + * @since v15.0.0 + */ + readonly usages: KeyUsage[]; + } + /** + * The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair. + * @since v15.0.0 + */ + interface CryptoKeyPair { + /** + * A {@link CryptoKey} whose type will be `'private'`. + * @since v15.0.0 + */ + privateKey: CryptoKey; + /** + * A {@link CryptoKey} whose type will be `'public'`. + * @since v15.0.0 + */ + publicKey: CryptoKey; + } + /** + * @since v15.0.0 + */ + interface SubtleCrypto { + /** + * Using the method and parameters specified in `algorithm` and the keying material provided by `key`, + * `subtle.decrypt()` attempts to decipher the provided `data`. If successful, + * the returned promise will be resolved with an `` containing the plaintext result. + * + * The algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * @since v15.0.0 + */ + decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; + /** + * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, + * `subtle.deriveBits()` attempts to generate `length` bits. + * The Node.js implementation requires that when `length` is a number it must be multiple of `8`. + * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed + * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms. + * If successful, the returned promise will be resolved with an `` containing the generated data. + * + * The algorithms currently supported include: + * + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HKDF'` + * - `'PBKDF2'` + * @since v15.0.0 + */ + deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise; + deriveBits(algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise; + /** + * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, + * `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. + * + * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, + * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. + * + * The algorithms currently supported include: + * + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HKDF'` + * - `'PBKDF2'` + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + deriveKey( + algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, + baseKey: CryptoKey, + derivedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, + extractable: boolean, + keyUsages: ReadonlyArray + ): Promise; + /** + * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`. + * If successful, the returned promise is resolved with an `` containing the computed digest. + * + * If `algorithm` is provided as a ``, it must be one of: + * + * - `'SHA-1'` + * - `'SHA-256'` + * - `'SHA-384'` + * - `'SHA-512'` + * + * If `algorithm` is provided as an ``, it must have a `name` property whose value is one of the above. + * @since v15.0.0 + */ + digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise; + /** + * Using the method and parameters specified by `algorithm` and the keying material provided by `key`, + * `subtle.encrypt()` attempts to encipher `data`. If successful, + * the returned promise is resolved with an `` containing the encrypted result. + * + * The algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * @since v15.0.0 + */ + encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise; + /** + * Exports the given key into the specified format, if supported. + * + * If the `` is not extractable, the returned promise will reject. + * + * When `format` is either `'pkcs8'` or `'spki'` and the export is successful, + * the returned promise will be resolved with an `` containing the exported key data. + * + * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a + * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification. + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @returns `` containing ``. + * @since v15.0.0 + */ + exportKey(format: 'jwk', key: CryptoKey): Promise; + exportKey(format: Exclude, key: CryptoKey): Promise; + /** + * Using the method and parameters provided in `algorithm`, + * `subtle.generateKey()` attempts to generate new keying material. + * Depending the method used, the method may generate either a single `` or a ``. + * + * The `` (public and private key) generating algorithms supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'RSA-OAEP'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * The `` (secret key) generating algorithms supported include: + * + * - `'HMAC'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray): Promise; + generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray): Promise; + generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise; + /** + * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format` + * to create a `` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments. + * If the import is successful, the returned promise will be resolved with the created ``. + * + * If importing a `'PBKDF2'` key, `extractable` must be `false`. + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + importKey( + format: 'jwk', + keyData: JsonWebKey, + algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, + extractable: boolean, + keyUsages: ReadonlyArray + ): Promise; + importKey( + format: Exclude, + keyData: BufferSource, + algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, + extractable: boolean, + keyUsages: KeyUsage[] + ): Promise; + /** + * Using the method and parameters given by `algorithm` and the keying material provided by `key`, + * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful, + * the returned promise is resolved with an `` containing the generated signature. + * + * The algorithms currently supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'HMAC'` + * @since v15.0.0 + */ + sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, data: BufferSource): Promise; + /** + * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. + * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `` instance. + * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input) + * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs. + * If successful, the returned promise is resolved with a `` object. + * + * The wrapping algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * + * The unwrapped key algorithms supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'RSA-OAEP'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'ECDH'` + * - `'X25519'` + * - `'X448'` + * - `'HMAC'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. + * @since v15.0.0 + */ + unwrapKey( + format: KeyFormat, + wrappedKey: BufferSource, + unwrappingKey: CryptoKey, + unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, + unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm, + extractable: boolean, + keyUsages: KeyUsage[] + ): Promise; + /** + * Using the method and parameters given in `algorithm` and the keying material provided by `key`, + * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`. + * The returned promise is resolved with either `true` or `false`. + * + * The algorithms currently supported include: + * + * - `'RSASSA-PKCS1-v1_5'` + * - `'RSA-PSS'` + * - `'ECDSA'` + * - `'Ed25519'` + * - `'Ed448'` + * - `'HMAC'` + * @since v15.0.0 + */ + verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise; + /** + * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. + * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`, + * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`. + * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments, + * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs. + * If successful, the returned promise will be resolved with an `` containing the encrypted key data. + * + * The wrapping algorithms currently supported include: + * + * - `'RSA-OAEP'` + * - `'AES-CTR'` + * - `'AES-CBC'` + * - `'AES-GCM'` + * - `'AES-KW'` + * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. + * @since v15.0.0 + */ + wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise; + } + } +} +declare module 'node:crypto' { + export * from 'crypto'; +} diff --git a/node_modules/@types/node/ts4.8/dgram.d.ts b/node_modules/@types/node/ts4.8/dgram.d.ts new file mode 100755 index 0000000..5b183b8 --- /dev/null +++ b/node_modules/@types/node/ts4.8/dgram.d.ts @@ -0,0 +1,550 @@ +/** + * The `node:dgram` module provides an implementation of UDP datagram sockets. + * + * ```js + * import dgram from 'node:dgram'; + * + * const server = dgram.createSocket('udp4'); + * + * server.on('error', (err) => { + * console.error(`server error:\n${err.stack}`); + * server.close(); + * }); + * + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * + * server.on('listening', () => { + * const address = server.address(); + * console.log(`server listening ${address.address}:${address.port}`); + * }); + * + * server.bind(41234); + * // Prints: server listening 0.0.0.0:41234 + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dgram.js) + */ +declare module 'dgram' { + import { AddressInfo } from 'node:net'; + import * as dns from 'node:dns'; + import { EventEmitter, Abortable } from 'node:events'; + interface RemoteInfo { + address: string; + family: 'IPv4' | 'IPv6'; + port: number; + size: number; + } + interface BindOptions { + port?: number | undefined; + address?: string | undefined; + exclusive?: boolean | undefined; + fd?: number | undefined; + } + type SocketType = 'udp4' | 'udp6'; + interface SocketOptions extends Abortable { + type: SocketType; + reuseAddr?: boolean | undefined; + /** + * @default false + */ + ipv6Only?: boolean | undefined; + recvBufferSize?: number | undefined; + sendBufferSize?: number | undefined; + lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined; + } + /** + * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram + * messages. When `address` and `port` are not passed to `socket.bind()` the + * method will bind the socket to the "all interfaces" address on a random port + * (it does the right thing for both `udp4` and `udp6` sockets). The bound address + * and port can be retrieved using `socket.address().address` and `socket.address().port`. + * + * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket: + * + * ```js + * const controller = new AbortController(); + * const { signal } = controller; + * const server = dgram.createSocket({ type: 'udp4', signal }); + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * // Later, when you want to close the server. + * controller.abort(); + * ``` + * @since v0.11.13 + * @param options Available options are: + * @param callback Attached as a listener for `'message'` events. Optional. + */ + function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + /** + * Encapsulates the datagram functionality. + * + * New instances of `dgram.Socket` are created using {@link createSocket}. + * The `new` keyword is not to be used to create `dgram.Socket` instances. + * @since v0.1.99 + */ + class Socket extends EventEmitter { + /** + * Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not + * specified, the operating system will choose + * one interface and will add membership to it. To add membership to every + * available interface, call `addMembership` multiple times, once per interface. + * + * When called on an unbound socket, this method will implicitly bind to a random + * port, listening on all interfaces. + * + * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur: + * + * ```js + * import cluster from 'node:cluster'; + * import dgram from 'node:dgram'; + * + * if (cluster.isPrimary) { + * cluster.fork(); // Works ok. + * cluster.fork(); // Fails with EADDRINUSE. + * } else { + * const s = dgram.createSocket('udp4'); + * s.bind(1234, () => { + * s.addMembership('224.0.0.114'); + * }); + * } + * ``` + * @since v0.6.9 + */ + addMembership(multicastAddress: string, multicastInterface?: string): void; + /** + * Returns an object containing the address information for a socket. + * For UDP sockets, this object will contain `address`, `family`, and `port`properties. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.1.99 + */ + address(): AddressInfo; + /** + * For UDP sockets, causes the `dgram.Socket` to listen for datagram + * messages on a named `port` and optional `address`. If `port` is not + * specified or is `0`, the operating system will attempt to bind to a + * random port. If `address` is not specified, the operating system will + * attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is + * called. + * + * Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very + * useful. + * + * A bound datagram socket keeps the Node.js process running to receive + * datagram messages. + * + * If binding fails, an `'error'` event is generated. In rare case (e.g. + * attempting to bind with a closed socket), an `Error` may be thrown. + * + * Example of a UDP server listening on port 41234: + * + * ```js + * import dgram from 'node:dgram'; + * + * const server = dgram.createSocket('udp4'); + * + * server.on('error', (err) => { + * console.error(`server error:\n${err.stack}`); + * server.close(); + * }); + * + * server.on('message', (msg, rinfo) => { + * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); + * }); + * + * server.on('listening', () => { + * const address = server.address(); + * console.log(`server listening ${address.address}:${address.port}`); + * }); + * + * server.bind(41234); + * // Prints: server listening 0.0.0.0:41234 + * ``` + * @since v0.1.99 + * @param callback with no parameters. Called when binding is complete. + */ + bind(port?: number, address?: string, callback?: () => void): this; + bind(port?: number, callback?: () => void): this; + bind(callback?: () => void): this; + bind(options: BindOptions, callback?: () => void): this; + /** + * Close the underlying socket and stop listening for data on it. If a callback is + * provided, it is added as a listener for the `'close'` event. + * @since v0.1.99 + * @param callback Called when the socket has been closed. + */ + close(callback?: () => void): this; + /** + * Associates the `dgram.Socket` to a remote address and port. Every + * message sent by this handle is automatically sent to that destination. Also, + * the socket will only receive messages from that remote peer. + * Trying to call `connect()` on an already connected socket will result + * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not + * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) + * will be used by default. Once the connection is complete, a `'connect'` event + * is emitted and the optional `callback` function is called. In case of failure, + * the `callback` is called or, failing this, an `'error'` event is emitted. + * @since v12.0.0 + * @param callback Called when the connection is completed or on error. + */ + connect(port: number, address?: string, callback?: () => void): void; + connect(port: number, callback: () => void): void; + /** + * A synchronous function that disassociates a connected `dgram.Socket` from + * its remote address. Trying to call `disconnect()` on an unbound or already + * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception. + * @since v12.0.0 + */ + disconnect(): void; + /** + * Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the + * kernel when the socket is closed or the process terminates, so most apps will + * never have reason to call this. + * + * If `multicastInterface` is not specified, the operating system will attempt to + * drop membership on all valid interfaces. + * @since v0.6.9 + */ + dropMembership(multicastAddress: string, multicastInterface?: string): void; + /** + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + * @return the `SO_RCVBUF` socket receive buffer size in bytes. + */ + getRecvBufferSize(): number; + /** + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + * @return the `SO_SNDBUF` socket send buffer size in bytes. + */ + getSendBufferSize(): number; + /** + * By default, binding a socket will cause it to block the Node.js process from + * exiting as long as the socket is open. The `socket.unref()` method can be used + * to exclude the socket from the reference counting that keeps the Node.js + * process active. The `socket.ref()` method adds the socket back to the reference + * counting and restores the default behavior. + * + * Calling `socket.ref()` multiples times will have no additional effect. + * + * The `socket.ref()` method returns a reference to the socket so calls can be + * chained. + * @since v0.9.1 + */ + ref(): this; + /** + * Returns an object containing the `address`, `family`, and `port` of the remote + * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception + * if the socket is not connected. + * @since v12.0.0 + */ + remoteAddress(): AddressInfo; + /** + * Broadcasts a datagram on the socket. + * For connectionless sockets, the destination `port` and `address` must be + * specified. Connected sockets, on the other hand, will use their associated + * remote endpoint, so the `port` and `address` arguments must not be set. + * + * The `msg` argument contains the message to be sent. + * Depending on its type, different behavior can apply. If `msg` is a `Buffer`, + * any `TypedArray` or a `DataView`, + * the `offset` and `length` specify the offset within the `Buffer` where the + * message begins and the number of bytes in the message, respectively. + * If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that + * contain multi-byte characters, `offset` and `length` will be calculated with + * respect to `byte length` and not the character position. + * If `msg` is an array, `offset` and `length` must not be specified. + * + * The `address` argument is a string. If the value of `address` is a host name, + * DNS will be used to resolve the address of the host. If `address` is not + * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default. + * + * If the socket has not been previously bound with a call to `bind`, the socket + * is assigned a random port number and is bound to the "all interfaces" address + * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.) + * + * An optional `callback` function may be specified to as a way of reporting + * DNS errors or for determining when it is safe to reuse the `buf` object. + * DNS lookups delay the time to send for at least one tick of the + * Node.js event loop. + * + * The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be + * passed as the first argument to the `callback`. If a `callback` is not given, + * the error is emitted as an `'error'` event on the `socket` object. + * + * Offset and length are optional but both _must_ be set if either are used. + * They are supported only when the first argument is a `Buffer`, a `TypedArray`, + * or a `DataView`. + * + * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket. + * + * Example of sending a UDP packet to a port on `localhost`; + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const message = Buffer.from('Some bytes'); + * const client = dgram.createSocket('udp4'); + * client.send(message, 41234, 'localhost', (err) => { + * client.close(); + * }); + * ``` + * + * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`; + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const buf1 = Buffer.from('Some '); + * const buf2 = Buffer.from('bytes'); + * const client = dgram.createSocket('udp4'); + * client.send([buf1, buf2], 41234, (err) => { + * client.close(); + * }); + * ``` + * + * Sending multiple buffers might be faster or slower depending on the + * application and operating system. Run benchmarks to + * determine the optimal strategy on a case-by-case basis. Generally speaking, + * however, sending multiple buffers is faster. + * + * Example of sending a UDP packet using a socket connected to a port on`localhost`: + * + * ```js + * import dgram from 'node:dgram'; + * import { Buffer } from 'node:buffer'; + * + * const message = Buffer.from('Some bytes'); + * const client = dgram.createSocket('udp4'); + * client.connect(41234, 'localhost', (err) => { + * client.send(message, (err) => { + * client.close(); + * }); + * }); + * ``` + * @since v0.1.99 + * @param msg Message to be sent. + * @param offset Offset in the buffer where the message starts. + * @param length Number of bytes in the message. + * @param port Destination port. + * @param address Destination host name or IP address. + * @param callback Called when the message has been sent. + */ + send(msg: string | Uint8Array | ReadonlyArray, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array | ReadonlyArray, port?: number, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array | ReadonlyArray, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void; + send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void; + /** + * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP + * packets may be sent to a local interface's broadcast address. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.6.9 + */ + setBroadcast(flag: boolean): void; + /** + * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC + * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_ + * _with a scope index is written as `'IP%scope'` where scope is an interface name_ + * _or interface number._ + * + * Sets the default outgoing multicast interface of the socket to a chosen + * interface or back to system interface selection. The `multicastInterface` must + * be a valid string representation of an IP from the socket's family. + * + * For IPv4 sockets, this should be the IP configured for the desired physical + * interface. All packets sent to multicast on the socket will be sent on the + * interface determined by the most recent successful use of this call. + * + * For IPv6 sockets, `multicastInterface` should include a scope to indicate the + * interface as in the examples that follow. In IPv6, individual `send` calls can + * also use explicit scope in addresses, so only packets sent to a multicast + * address without specifying an explicit scope are affected by the most recent + * successful use of this call. + * + * This method throws `EBADF` if called on an unbound socket. + * + * #### Example: IPv6 outgoing multicast interface + * + * On most systems, where scope format uses the interface name: + * + * ```js + * const socket = dgram.createSocket('udp6'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('::%eth1'); + * }); + * ``` + * + * On Windows, where scope format uses an interface number: + * + * ```js + * const socket = dgram.createSocket('udp6'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('::%2'); + * }); + * ``` + * + * #### Example: IPv4 outgoing multicast interface + * + * All systems use an IP of the host on the desired physical interface: + * + * ```js + * const socket = dgram.createSocket('udp4'); + * + * socket.bind(1234, () => { + * socket.setMulticastInterface('10.0.0.2'); + * }); + * ``` + * @since v8.6.0 + */ + setMulticastInterface(multicastInterface: string): void; + /** + * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, + * multicast packets will also be received on the local interface. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.3.8 + */ + setMulticastLoopback(flag: boolean): boolean; + /** + * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for + * "Time to Live", in this context it specifies the number of IP hops that a + * packet is allowed to travel through, specifically for multicast traffic. Each + * router or gateway that forwards a packet decrements the TTL. If the TTL is + * decremented to 0 by a router, it will not be forwarded. + * + * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.3.8 + */ + setMulticastTTL(ttl: number): number; + /** + * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer + * in bytes. + * + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + */ + setRecvBufferSize(size: number): void; + /** + * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer + * in bytes. + * + * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. + * @since v8.7.0 + */ + setSendBufferSize(size: number): void; + /** + * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", + * in this context it specifies the number of IP hops that a packet is allowed to + * travel through. Each router or gateway that forwards a packet decrements the + * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. + * Changing TTL values is typically done for network probes or when multicasting. + * + * The `ttl` argument may be between 1 and 255\. The default on most systems + * is 64. + * + * This method throws `EBADF` if called on an unbound socket. + * @since v0.1.101 + */ + setTTL(ttl: number): number; + /** + * By default, binding a socket will cause it to block the Node.js process from + * exiting as long as the socket is open. The `socket.unref()` method can be used + * to exclude the socket from the reference counting that keeps the Node.js + * process active, allowing the process to exit even if the socket is still + * listening. + * + * Calling `socket.unref()` multiple times will have no addition effect. + * + * The `socket.unref()` method returns a reference to the socket so calls can be + * chained. + * @since v0.9.1 + */ + unref(): this; + /** + * Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket + * option. If the `multicastInterface` argument + * is not specified, the operating system will choose one interface and will add + * membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface. + * + * When called on an unbound socket, this method will implicitly bind to a random + * port, listening on all interfaces. + * @since v13.1.0, v12.16.0 + */ + addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; + /** + * Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is + * automatically called by the kernel when the + * socket is closed or the process terminates, so most apps will never have + * reason to call this. + * + * If `multicastInterface` is not specified, the operating system will attempt to + * drop membership on all valid interfaces. + * @since v13.1.0, v12.16.0 + */ + dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; + /** + * events.EventEmitter + * 1. close + * 2. connect + * 3. error + * 4. listening + * 5. message + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'connect', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'listening', listener: () => void): this; + addListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'connect'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'listening'): boolean; + emit(event: 'message', msg: Buffer, rinfo: RemoteInfo): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'connect', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'listening', listener: () => void): this; + on(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'connect', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'listening', listener: () => void): this; + once(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'connect', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'listening', listener: () => void): this; + prependListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'connect', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'listening', listener: () => void): this; + prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; + /** + * Calls `socket.close()` and returns a promise that fulfills when the socket has closed. + * @since v20.5.0 + */ + [Symbol.asyncDispose](): Promise; + } +} +declare module 'node:dgram' { + export * from 'dgram'; +} diff --git a/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts b/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts new file mode 100755 index 0000000..5f19b20 --- /dev/null +++ b/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts @@ -0,0 +1,191 @@ +/** + * The `node:diagnostics_channel` module provides an API to create named channels + * to report arbitrary message data for diagnostics purposes. + * + * It can be accessed using: + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * ``` + * + * It is intended that a module writer wanting to report diagnostics messages + * will create one or many top-level channels to report messages through. + * Channels may also be acquired at runtime but it is not encouraged + * due to the additional overhead of doing so. Channels may be exported for + * convenience, but as long as the name is known it can be acquired anywhere. + * + * If you intend for your module to produce diagnostics data for others to + * consume it is recommended that you include documentation of what named + * channels are used along with the shape of the message data. Channel names + * should generally include the module name to avoid collisions with data from + * other modules. + * @since v15.1.0, v14.17.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js) + */ +declare module 'diagnostics_channel' { + /** + * Check if there are active subscribers to the named channel. This is helpful if + * the message you want to send might be expensive to prepare. + * + * This API is optional but helpful when trying to publish messages from very + * performance-sensitive code. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * if (diagnostics_channel.hasSubscribers('my-channel')) { + * // There are subscribers, prepare and publish message + * } + * ``` + * @since v15.1.0, v14.17.0 + * @param name The channel name + * @return If there are active subscribers + */ + function hasSubscribers(name: string | symbol): boolean; + /** + * This is the primary entry-point for anyone wanting to publish to a named + * channel. It produces a channel object which is optimized to reduce overhead at + * publish time as much as possible. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * ``` + * @since v15.1.0, v14.17.0 + * @param name The channel name + * @return The named channel object + */ + function channel(name: string | symbol): Channel; + type ChannelListener = (message: unknown, name: string | symbol) => void; + /** + * Register a message handler to subscribe to this channel. This message handler + * will be run synchronously whenever a message is published to the channel. Any + * errors thrown in the message handler will trigger an `'uncaughtException'`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * diagnostics_channel.subscribe('my-channel', (message, name) => { + * // Received data + * }); + * ``` + * @since v18.7.0, v16.17.0 + * @param name The channel name + * @param onMessage The handler to receive channel messages + */ + function subscribe(name: string | symbol, onMessage: ChannelListener): void; + /** + * Remove a message handler previously registered to this channel with {@link subscribe}. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * function onMessage(message, name) { + * // Received data + * } + * + * diagnostics_channel.subscribe('my-channel', onMessage); + * + * diagnostics_channel.unsubscribe('my-channel', onMessage); + * ``` + * @since v18.7.0, v16.17.0 + * @param name The channel name + * @param onMessage The previous subscribed handler to remove + * @return `true` if the handler was found, `false` otherwise. + */ + function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean; + /** + * The class `Channel` represents an individual named channel within the data + * pipeline. It is used to track subscribers and to publish messages when there + * are subscribers present. It exists as a separate object to avoid channel + * lookups at publish time, enabling very fast publish speeds and allowing + * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly + * with `new Channel(name)` is not supported. + * @since v15.1.0, v14.17.0 + */ + class Channel { + readonly name: string | symbol; + /** + * Check if there are active subscribers to this channel. This is helpful if + * the message you want to send might be expensive to prepare. + * + * This API is optional but helpful when trying to publish messages from very + * performance-sensitive code. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * if (channel.hasSubscribers) { + * // There are subscribers, prepare and publish message + * } + * ``` + * @since v15.1.0, v14.17.0 + */ + readonly hasSubscribers: boolean; + private constructor(name: string | symbol); + /** + * Publish a message to any subscribers to the channel. This will trigger + * message handlers synchronously so they will execute within the same context. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.publish({ + * some: 'message', + * }); + * ``` + * @since v15.1.0, v14.17.0 + * @param message The message to send to the channel subscribers + */ + publish(message: unknown): void; + /** + * Register a message handler to subscribe to this channel. This message handler + * will be run synchronously whenever a message is published to the channel. Any + * errors thrown in the message handler will trigger an `'uncaughtException'`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * channel.subscribe((message, name) => { + * // Received data + * }); + * ``` + * @since v15.1.0, v14.17.0 + * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)} + * @param onMessage The handler to receive channel messages + */ + subscribe(onMessage: ChannelListener): void; + /** + * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`. + * + * ```js + * import diagnostics_channel from 'node:diagnostics_channel'; + * + * const channel = diagnostics_channel.channel('my-channel'); + * + * function onMessage(message, name) { + * // Received data + * } + * + * channel.subscribe(onMessage); + * + * channel.unsubscribe(onMessage); + * ``` + * @since v15.1.0, v14.17.0 + * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)} + * @param onMessage The previous subscribed handler to remove + * @return `true` if the handler was found, `false` otherwise. + */ + unsubscribe(onMessage: ChannelListener): void; + } +} +declare module 'node:diagnostics_channel' { + export * from 'diagnostics_channel'; +} diff --git a/node_modules/@types/node/ts4.8/dns.d.ts b/node_modules/@types/node/ts4.8/dns.d.ts new file mode 100755 index 0000000..db3febc --- /dev/null +++ b/node_modules/@types/node/ts4.8/dns.d.ts @@ -0,0 +1,668 @@ +/** + * The `node:dns` module enables name resolution. For example, use it to look up IP + * addresses of host names. + * + * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the + * DNS protocol for lookups. {@link lookup} uses the operating system + * facilities to perform name resolution. It may not need to perform any network + * communication. To perform name resolution the way other applications on the same + * system do, use {@link lookup}. + * + * ```js + * const dns = require('node:dns'); + * + * dns.lookup('example.org', (err, address, family) => { + * console.log('address: %j family: IPv%s', address, family); + * }); + * // address: "93.184.216.34" family: IPv4 + * ``` + * + * All other functions in the `node:dns` module connect to an actual DNS server to + * perform name resolution. They will always use the network to perform DNS + * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform + * DNS queries, bypassing other name-resolution facilities. + * + * ```js + * const dns = require('node:dns'); + * + * dns.resolve4('archive.org', (err, addresses) => { + * if (err) throw err; + * + * console.log(`addresses: ${JSON.stringify(addresses)}`); + * + * addresses.forEach((a) => { + * dns.reverse(a, (err, hostnames) => { + * if (err) { + * throw err; + * } + * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); + * }); + * }); + * }); + * ``` + * + * See the `Implementation considerations section` for more information. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dns.js) + */ +declare module 'dns' { + import * as dnsPromises from 'node:dns/promises'; + // Supported getaddrinfo flags. + export const ADDRCONFIG: number; + export const V4MAPPED: number; + /** + * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as + * well as IPv4 mapped IPv6 addresses. + */ + export const ALL: number; + export interface LookupOptions { + family?: number | undefined; + hints?: number | undefined; + all?: boolean | undefined; + /** + * @default true + */ + verbatim?: boolean | undefined; + } + export interface LookupOneOptions extends LookupOptions { + all?: false | undefined; + } + export interface LookupAllOptions extends LookupOptions { + all: true; + } + export interface LookupAddress { + address: string; + family: number; + } + /** + * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or + * AAAA (IPv6) record. All `option` properties are optional. If `options` is an + * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then + * IPv4 and IPv6 addresses are both returned if found. + * + * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the + * properties `address` and `family`. + * + * On error, `err` is an `Error` object, where `err.code` is the error code. + * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when + * the host name does not exist but also when the lookup fails in other ways + * such as no available file descriptors. + * + * `dns.lookup()` does not necessarily have anything to do with the DNS protocol. + * The implementation uses an operating system facility that can associate names + * with addresses and vice versa. This implementation can have subtle but + * important consequences on the behavior of any Node.js program. Please take some + * time to consult the `Implementation considerations section` before using`dns.lookup()`. + * + * Example usage: + * + * ```js + * const dns = require('node:dns'); + * const options = { + * family: 6, + * hints: dns.ADDRCONFIG | dns.V4MAPPED, + * }; + * dns.lookup('example.com', options, (err, address, family) => + * console.log('address: %j family: IPv%s', address, family)); + * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 + * + * // When options.all is true, the result will be an Array. + * options.all = true; + * dns.lookup('example.com', options, (err, addresses) => + * console.log('addresses: %j', addresses)); + * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] + * ``` + * + * If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties. + * @since v0.1.90 + */ + export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void; + export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void; + export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void; + export namespace lookup { + function __promisify__(hostname: string, options: LookupAllOptions): Promise; + function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; + function __promisify__(hostname: string, options: LookupOptions): Promise; + } + /** + * Resolves the given `address` and `port` into a host name and service using + * the operating system's underlying `getnameinfo` implementation. + * + * If `address` is not a valid IP address, a `TypeError` will be thrown. + * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. + * + * On an error, `err` is an `Error` object, where `err.code` is the error code. + * + * ```js + * const dns = require('node:dns'); + * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { + * console.log(hostname, service); + * // Prints: localhost ssh + * }); + * ``` + * + * If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties. + * @since v0.11.14 + */ + export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void; + export namespace lookupService { + function __promisify__( + address: string, + port: number + ): Promise<{ + hostname: string; + service: string; + }>; + } + export interface ResolveOptions { + ttl: boolean; + } + export interface ResolveWithTtlOptions extends ResolveOptions { + ttl: true; + } + export interface RecordWithTtl { + address: string; + ttl: number; + } + /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */ + export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; + export interface AnyARecord extends RecordWithTtl { + type: 'A'; + } + export interface AnyAaaaRecord extends RecordWithTtl { + type: 'AAAA'; + } + export interface CaaRecord { + critical: number; + issue?: string | undefined; + issuewild?: string | undefined; + iodef?: string | undefined; + contactemail?: string | undefined; + contactphone?: string | undefined; + } + export interface MxRecord { + priority: number; + exchange: string; + } + export interface AnyMxRecord extends MxRecord { + type: 'MX'; + } + export interface NaptrRecord { + flags: string; + service: string; + regexp: string; + replacement: string; + order: number; + preference: number; + } + export interface AnyNaptrRecord extends NaptrRecord { + type: 'NAPTR'; + } + export interface SoaRecord { + nsname: string; + hostmaster: string; + serial: number; + refresh: number; + retry: number; + expire: number; + minttl: number; + } + export interface AnySoaRecord extends SoaRecord { + type: 'SOA'; + } + export interface SrvRecord { + priority: number; + weight: number; + port: number; + name: string; + } + export interface AnySrvRecord extends SrvRecord { + type: 'SRV'; + } + export interface AnyTxtRecord { + type: 'TXT'; + entries: string[]; + } + export interface AnyNsRecord { + type: 'NS'; + value: string; + } + export interface AnyPtrRecord { + type: 'PTR'; + value: string; + } + export interface AnyCnameRecord { + type: 'CNAME'; + value: string; + } + export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord; + /** + * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array + * of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource + * records. The type and structure of individual results varies based on `rrtype`: + * + * + * + * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`. + * @since v0.1.27 + * @param hostname Host name to resolve. + * @param [rrtype='A'] Resource record type. + */ + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; + export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void; + export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; + export function resolve( + hostname: string, + rrtype: string, + callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void + ): void; + export namespace resolve { + function __promisify__(hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise; + function __promisify__(hostname: string, rrtype: 'ANY'): Promise; + function __promisify__(hostname: string, rrtype: 'MX'): Promise; + function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise; + function __promisify__(hostname: string, rrtype: 'SOA'): Promise; + function __promisify__(hostname: string, rrtype: 'SRV'): Promise; + function __promisify__(hostname: string, rrtype: 'TXT'): Promise; + function __promisify__(hostname: string, rrtype: string): Promise; + } + /** + * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function + * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`). + * @since v0.1.16 + * @param hostname Host name to resolve. + */ + export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; + export namespace resolve4 { + function __promisify__(hostname: string): Promise; + function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; + function __promisify__(hostname: string, options?: ResolveOptions): Promise; + } + /** + * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function + * will contain an array of IPv6 addresses. + * @since v0.1.16 + * @param hostname Host name to resolve. + */ + export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void; + export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void; + export namespace resolve6 { + function __promisify__(hostname: string): Promise; + function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; + function __promisify__(hostname: string, options?: ResolveOptions): Promise; + } + /** + * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function + * will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`). + * @since v0.3.2 + */ + export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export namespace resolveCname { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function + * will contain an array of certification authority authorization records + * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`). + * @since v15.0.0, v14.17.0 + */ + export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void; + export namespace resolveCaa { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will + * contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). + * @since v0.1.27 + */ + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void; + export namespace resolveMx { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of + * objects with the following properties: + * + * * `flags` + * * `service` + * * `regexp` + * * `replacement` + * * `order` + * * `preference` + * + * ```js + * { + * flags: 's', + * service: 'SIP+D2U', + * regexp: '', + * replacement: '_sip._udp.example.com', + * order: 30, + * preference: 100 + * } + * ``` + * @since v0.9.12 + */ + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void; + export namespace resolveNaptr { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will + * contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`). + * @since v0.1.90 + */ + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export namespace resolveNs { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will + * be an array of strings containing the reply records. + * @since v6.0.0 + */ + export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void; + export namespace resolvePtr { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for + * the `hostname`. The `address` argument passed to the `callback` function will + * be an object with the following properties: + * + * * `nsname` + * * `hostmaster` + * * `serial` + * * `refresh` + * * `retry` + * * `expire` + * * `minttl` + * + * ```js + * { + * nsname: 'ns.example.com', + * hostmaster: 'root.example.com', + * serial: 2013101809, + * refresh: 10000, + * retry: 2400, + * expire: 604800, + * minttl: 3600 + * } + * ``` + * @since v0.11.10 + */ + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void; + export namespace resolveSoa { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will + * be an array of objects with the following properties: + * + * * `priority` + * * `weight` + * * `port` + * * `name` + * + * ```js + * { + * priority: 10, + * weight: 5, + * port: 21223, + * name: 'service.example.com' + * } + * ``` + * @since v0.1.27 + */ + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void; + export namespace resolveSrv { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a + * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of + * one record. Depending on the use case, these could be either joined together or + * treated separately. + * @since v0.1.27 + */ + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void; + export namespace resolveTxt { + function __promisify__(hostname: string): Promise; + } + /** + * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). + * The `ret` argument passed to the `callback` function will be an array containing + * various types of records. Each object has a property `type` that indicates the + * type of the current record. And depending on the `type`, additional properties + * will be present on the object: + * + * + * + * Here is an example of the `ret` object passed to the callback: + * + * ```js + * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, + * { type: 'CNAME', value: 'example.com' }, + * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, + * { type: 'NS', value: 'ns1.example.com' }, + * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, + * { type: 'SOA', + * nsname: 'ns1.example.com', + * hostmaster: 'admin.example.com', + * serial: 156696742, + * refresh: 900, + * retry: 900, + * expire: 1800, + * minttl: 60 } ] + * ``` + * + * DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC + * 8482](https://tools.ietf.org/html/rfc8482). + */ + export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void; + export namespace resolveAny { + function __promisify__(hostname: string): Promise; + } + /** + * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an + * array of host names. + * + * On error, `err` is an `Error` object, where `err.code` is + * one of the `DNS error codes`. + * @since v0.1.16 + */ + export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void; + /** + * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: + * + * * `ipv4first`: for `verbatim` defaulting to `false`. + * * `verbatim`: for `verbatim` defaulting to `true`. + * @since v20.1.0 + */ + export function getDefaultResultOrder(): 'ipv4first' | 'verbatim'; + /** + * Sets the IP address and port of servers to be used when performing DNS + * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted + * addresses. If the port is the IANA default DNS port (53) it can be omitted. + * + * ```js + * dns.setServers([ + * '4.4.4.4', + * '[2001:4860:4860::8888]', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ]); + * ``` + * + * An error will be thrown if an invalid address is provided. + * + * The `dns.setServers()` method must not be called while a DNS query is in + * progress. + * + * The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). + * + * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). + * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with + * subsequent servers provided. Fallback DNS servers will only be used if the + * earlier ones time out or result in some other error. + * @since v0.11.3 + * @param servers array of `RFC 5952` formatted addresses + */ + export function setServers(servers: ReadonlyArray): void; + /** + * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), + * that are currently configured for DNS resolution. A string will include a port + * section if a custom port is used. + * + * ```js + * [ + * '4.4.4.4', + * '2001:4860:4860::8888', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ] + * ``` + * @since v0.11.3 + */ + export function getServers(): string[]; + /** + * Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: + * + * * `ipv4first`: sets default `verbatim` `false`. + * * `verbatim`: sets default `verbatim` `true`. + * + * The default is `verbatim` and {@link setDefaultResultOrder} have higher + * priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default + * dns orders in workers. + * @since v16.4.0, v14.18.0 + * @param order must be `'ipv4first'` or `'verbatim'`. + */ + export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void; + // Error codes + export const NODATA: string; + export const FORMERR: string; + export const SERVFAIL: string; + export const NOTFOUND: string; + export const NOTIMP: string; + export const REFUSED: string; + export const BADQUERY: string; + export const BADNAME: string; + export const BADFAMILY: string; + export const BADRESP: string; + export const CONNREFUSED: string; + export const TIMEOUT: string; + export const EOF: string; + export const FILE: string; + export const NOMEM: string; + export const DESTRUCTION: string; + export const BADSTR: string; + export const BADFLAGS: string; + export const NONAME: string; + export const BADHINTS: string; + export const NOTINITIALIZED: string; + export const LOADIPHLPAPI: string; + export const ADDRGETNETWORKPARAMS: string; + export const CANCELLED: string; + export interface ResolverOptions { + timeout?: number | undefined; + /** + * @default 4 + */ + tries?: number; + } + /** + * An independent resolver for DNS requests. + * + * Creating a new resolver uses the default server settings. Setting + * the servers used for a resolver using `resolver.setServers()` does not affect + * other resolvers: + * + * ```js + * const { Resolver } = require('node:dns'); + * const resolver = new Resolver(); + * resolver.setServers(['4.4.4.4']); + * + * // This request will use the server at 4.4.4.4, independent of global settings. + * resolver.resolve4('example.org', (err, addresses) => { + * // ... + * }); + * ``` + * + * The following methods from the `node:dns` module are available: + * + * * `resolver.getServers()` + * * `resolver.resolve()` + * * `resolver.resolve4()` + * * `resolver.resolve6()` + * * `resolver.resolveAny()` + * * `resolver.resolveCaa()` + * * `resolver.resolveCname()` + * * `resolver.resolveMx()` + * * `resolver.resolveNaptr()` + * * `resolver.resolveNs()` + * * `resolver.resolvePtr()` + * * `resolver.resolveSoa()` + * * `resolver.resolveSrv()` + * * `resolver.resolveTxt()` + * * `resolver.reverse()` + * * `resolver.setServers()` + * @since v8.3.0 + */ + export class Resolver { + constructor(options?: ResolverOptions); + /** + * Cancel all outstanding DNS queries made by this resolver. The corresponding + * callbacks will be called with an error with code `ECANCELLED`. + * @since v8.3.0 + */ + cancel(): void; + getServers: typeof getServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCaa: typeof resolveCaa; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + /** + * The resolver instance will send its requests from the specified IP address. + * This allows programs to specify outbound interfaces when used on multi-homed + * systems. + * + * If a v4 or v6 address is not specified, it is set to the default and the + * operating system will choose a local address automatically. + * + * The resolver will use the v4 local address when making requests to IPv4 DNS + * servers, and the v6 local address when making requests to IPv6 DNS servers. + * The `rrtype` of resolution requests has no impact on the local address used. + * @since v15.1.0, v14.17.0 + * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. + * @param [ipv6='::0'] A string representation of an IPv6 address. + */ + setLocalAddress(ipv4?: string, ipv6?: string): void; + setServers: typeof setServers; + } + export { dnsPromises as promises }; +} +declare module 'node:dns' { + export * from 'dns'; +} diff --git a/node_modules/@types/node/ts4.8/dns/promises.d.ts b/node_modules/@types/node/ts4.8/dns/promises.d.ts new file mode 100755 index 0000000..4c151e4 --- /dev/null +++ b/node_modules/@types/node/ts4.8/dns/promises.d.ts @@ -0,0 +1,414 @@ +/** + * The `dns.promises` API provides an alternative set of asynchronous DNS methods + * that return `Promise` objects rather than using callbacks. The API is accessible + * via `require('node:dns').promises` or `require('node:dns/promises')`. + * @since v10.6.0 + */ +declare module 'dns/promises' { + import { + LookupAddress, + LookupOneOptions, + LookupAllOptions, + LookupOptions, + AnyRecord, + CaaRecord, + MxRecord, + NaptrRecord, + SoaRecord, + SrvRecord, + ResolveWithTtlOptions, + RecordWithTtl, + ResolveOptions, + ResolverOptions, + } from 'node:dns'; + /** + * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), + * that are currently configured for DNS resolution. A string will include a port + * section if a custom port is used. + * + * ```js + * [ + * '4.4.4.4', + * '2001:4860:4860::8888', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ] + * ``` + * @since v10.6.0 + */ + function getServers(): string[]; + /** + * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or + * AAAA (IPv6) record. All `option` properties are optional. If `options` is an + * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 + * and IPv6 addresses are both returned if found. + * + * With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`. + * + * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. + * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when + * the host name does not exist but also when the lookup fails in other ways + * such as no available file descriptors. + * + * `dnsPromises.lookup()` does not necessarily have anything to do with the DNS + * protocol. The implementation uses an operating system facility that can + * associate names with addresses and vice versa. This implementation can have + * subtle but important consequences on the behavior of any Node.js program. Please + * take some time to consult the `Implementation considerations section` before + * using `dnsPromises.lookup()`. + * + * Example usage: + * + * ```js + * const dns = require('node:dns'); + * const dnsPromises = dns.promises; + * const options = { + * family: 6, + * hints: dns.ADDRCONFIG | dns.V4MAPPED, + * }; + * + * dnsPromises.lookup('example.com', options).then((result) => { + * console.log('address: %j family: IPv%s', result.address, result.family); + * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 + * }); + * + * // When options.all is true, the result will be an Array. + * options.all = true; + * dnsPromises.lookup('example.com', options).then((result) => { + * console.log('addresses: %j', result); + * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] + * }); + * ``` + * @since v10.6.0 + */ + function lookup(hostname: string, family: number): Promise; + function lookup(hostname: string, options: LookupOneOptions): Promise; + function lookup(hostname: string, options: LookupAllOptions): Promise; + function lookup(hostname: string, options: LookupOptions): Promise; + function lookup(hostname: string): Promise; + /** + * Resolves the given `address` and `port` into a host name and service using + * the operating system's underlying `getnameinfo` implementation. + * + * If `address` is not a valid IP address, a `TypeError` will be thrown. + * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. + * + * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. + * + * ```js + * const dnsPromises = require('node:dns').promises; + * dnsPromises.lookupService('127.0.0.1', 22).then((result) => { + * console.log(result.hostname, result.service); + * // Prints: localhost ssh + * }); + * ``` + * @since v10.6.0 + */ + function lookupService( + address: string, + port: number + ): Promise<{ + hostname: string; + service: string; + }>; + /** + * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array + * of the resource records. When successful, the `Promise` is resolved with an + * array of resource records. The type and structure of individual results vary + * based on `rrtype`: + * + * + * + * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. + * @since v10.6.0 + * @param hostname Host name to resolve. + * @param [rrtype='A'] Resource record type. + */ + function resolve(hostname: string): Promise; + function resolve(hostname: string, rrtype: 'A'): Promise; + function resolve(hostname: string, rrtype: 'AAAA'): Promise; + function resolve(hostname: string, rrtype: 'ANY'): Promise; + function resolve(hostname: string, rrtype: 'CAA'): Promise; + function resolve(hostname: string, rrtype: 'CNAME'): Promise; + function resolve(hostname: string, rrtype: 'MX'): Promise; + function resolve(hostname: string, rrtype: 'NAPTR'): Promise; + function resolve(hostname: string, rrtype: 'NS'): Promise; + function resolve(hostname: string, rrtype: 'PTR'): Promise; + function resolve(hostname: string, rrtype: 'SOA'): Promise; + function resolve(hostname: string, rrtype: 'SRV'): Promise; + function resolve(hostname: string, rrtype: 'TXT'): Promise; + function resolve(hostname: string, rrtype: string): Promise; + /** + * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4 + * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). + * @since v10.6.0 + * @param hostname Host name to resolve. + */ + function resolve4(hostname: string): Promise; + function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; + function resolve4(hostname: string, options: ResolveOptions): Promise; + /** + * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6 + * addresses. + * @since v10.6.0 + * @param hostname Host name to resolve. + */ + function resolve6(hostname: string): Promise; + function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; + function resolve6(hostname: string, options: ResolveOptions): Promise; + /** + * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). + * On success, the `Promise` is resolved with an array containing various types of + * records. Each object has a property `type` that indicates the type of the + * current record. And depending on the `type`, additional properties will be + * present on the object: + * + * + * + * Here is an example of the result object: + * + * ```js + * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, + * { type: 'CNAME', value: 'example.com' }, + * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, + * { type: 'NS', value: 'ns1.example.com' }, + * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, + * { type: 'SOA', + * nsname: 'ns1.example.com', + * hostmaster: 'admin.example.com', + * serial: 156696742, + * refresh: 900, + * retry: 900, + * expire: 1800, + * minttl: 60 } ] + * ``` + * @since v10.6.0 + */ + function resolveAny(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success, + * the `Promise` is resolved with an array of objects containing available + * certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`). + * @since v15.0.0, v14.17.0 + */ + function resolveCaa(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success, + * the `Promise` is resolved with an array of canonical name records available for + * the `hostname` (e.g. `['bar.example.com']`). + * @since v10.6.0 + */ + function resolveCname(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects + * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`). + * @since v10.6.0 + */ + function resolveMx(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array + * of objects with the following properties: + * + * * `flags` + * * `service` + * * `regexp` + * * `replacement` + * * `order` + * * `preference` + * + * ```js + * { + * flags: 's', + * service: 'SIP+D2U', + * regexp: '', + * replacement: '_sip._udp.example.com', + * order: 30, + * preference: 100 + * } + * ``` + * @since v10.6.0 + */ + function resolveNaptr(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server + * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`). + * @since v10.6.0 + */ + function resolveNs(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings + * containing the reply records. + * @since v10.6.0 + */ + function resolvePtr(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for + * the `hostname`. On success, the `Promise` is resolved with an object with the + * following properties: + * + * * `nsname` + * * `hostmaster` + * * `serial` + * * `refresh` + * * `retry` + * * `expire` + * * `minttl` + * + * ```js + * { + * nsname: 'ns.example.com', + * hostmaster: 'root.example.com', + * serial: 2013101809, + * refresh: 10000, + * retry: 2400, + * expire: 604800, + * minttl: 3600 + * } + * ``` + * @since v10.6.0 + */ + function resolveSoa(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with + * the following properties: + * + * * `priority` + * * `weight` + * * `port` + * * `name` + * + * ```js + * { + * priority: 10, + * weight: 5, + * port: 21223, + * name: 'service.example.com' + * } + * ``` + * @since v10.6.0 + */ + function resolveSrv(hostname: string): Promise; + /** + * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array + * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of + * one record. Depending on the use case, these could be either joined together or + * treated separately. + * @since v10.6.0 + */ + function resolveTxt(hostname: string): Promise; + /** + * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an + * array of host names. + * + * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. + * @since v10.6.0 + */ + function reverse(ip: string): Promise; + /** + * Sets the IP address and port of servers to be used when performing DNS + * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted + * addresses. If the port is the IANA default DNS port (53) it can be omitted. + * + * ```js + * dnsPromises.setServers([ + * '4.4.4.4', + * '[2001:4860:4860::8888]', + * '4.4.4.4:1053', + * '[2001:4860:4860::8888]:1053', + * ]); + * ``` + * + * An error will be thrown if an invalid address is provided. + * + * The `dnsPromises.setServers()` method must not be called while a DNS query is in + * progress. + * + * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). + * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with + * subsequent servers provided. Fallback DNS servers will only be used if the + * earlier ones time out or result in some other error. + * @since v10.6.0 + * @param servers array of `RFC 5952` formatted addresses + */ + function setServers(servers: ReadonlyArray): void; + /** + * Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be: + * + * * `ipv4first`: sets default `verbatim` `false`. + * * `verbatim`: sets default `verbatim` `true`. + * + * The default is `verbatim` and `dnsPromises.setDefaultResultOrder()` have + * higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the + * default dns orders in workers. + * @since v16.4.0, v14.18.0 + * @param order must be `'ipv4first'` or `'verbatim'`. + */ + function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void; + /** + * An independent resolver for DNS requests. + * + * Creating a new resolver uses the default server settings. Setting + * the servers used for a resolver using `resolver.setServers()` does not affect + * other resolvers: + * + * ```js + * const { Resolver } = require('node:dns').promises; + * const resolver = new Resolver(); + * resolver.setServers(['4.4.4.4']); + * + * // This request will use the server at 4.4.4.4, independent of global settings. + * resolver.resolve4('example.org').then((addresses) => { + * // ... + * }); + * + * // Alternatively, the same code can be written using async-await style. + * (async function() { + * const addresses = await resolver.resolve4('example.org'); + * })(); + * ``` + * + * The following methods from the `dnsPromises` API are available: + * + * * `resolver.getServers()` + * * `resolver.resolve()` + * * `resolver.resolve4()` + * * `resolver.resolve6()` + * * `resolver.resolveAny()` + * * `resolver.resolveCaa()` + * * `resolver.resolveCname()` + * * `resolver.resolveMx()` + * * `resolver.resolveNaptr()` + * * `resolver.resolveNs()` + * * `resolver.resolvePtr()` + * * `resolver.resolveSoa()` + * * `resolver.resolveSrv()` + * * `resolver.resolveTxt()` + * * `resolver.reverse()` + * * `resolver.setServers()` + * @since v10.6.0 + */ + class Resolver { + constructor(options?: ResolverOptions); + cancel(): void; + getServers: typeof getServers; + resolve: typeof resolve; + resolve4: typeof resolve4; + resolve6: typeof resolve6; + resolveAny: typeof resolveAny; + resolveCaa: typeof resolveCaa; + resolveCname: typeof resolveCname; + resolveMx: typeof resolveMx; + resolveNaptr: typeof resolveNaptr; + resolveNs: typeof resolveNs; + resolvePtr: typeof resolvePtr; + resolveSoa: typeof resolveSoa; + resolveSrv: typeof resolveSrv; + resolveTxt: typeof resolveTxt; + reverse: typeof reverse; + setLocalAddress(ipv4?: string, ipv6?: string): void; + setServers: typeof setServers; + } +} +declare module 'node:dns/promises' { + export * from 'dns/promises'; +} diff --git a/node_modules/@types/node/ts4.8/dom-events.d.ts b/node_modules/@types/node/ts4.8/dom-events.d.ts new file mode 100755 index 0000000..b9c1c3a --- /dev/null +++ b/node_modules/@types/node/ts4.8/dom-events.d.ts @@ -0,0 +1,126 @@ +export {}; // Don't export anything! + +//// DOM-like Events +// NB: The Event / EventTarget / EventListener implementations below were copied +// from lib.dom.d.ts, then edited to reflect Node's documentation at +// https://nodejs.org/api/events.html#class-eventtarget. +// Please read that link to understand important implementation differences. + +// This conditional type will be the existing global Event in a browser, or +// the copy below in a Node environment. +type __Event = typeof globalThis extends { onmessage: any, Event: any } +? {} +: { + /** This is not used in Node.js and is provided purely for completeness. */ + readonly bubbles: boolean; + /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */ + cancelBubble: () => void; + /** True if the event was created with the cancelable option */ + readonly cancelable: boolean; + /** This is not used in Node.js and is provided purely for completeness. */ + readonly composed: boolean; + /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */ + composedPath(): [EventTarget?] + /** Alias for event.target. */ + readonly currentTarget: EventTarget | null; + /** Is true if cancelable is true and event.preventDefault() has been called. */ + readonly defaultPrevented: boolean; + /** This is not used in Node.js and is provided purely for completeness. */ + readonly eventPhase: 0 | 2; + /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */ + readonly isTrusted: boolean; + /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */ + preventDefault(): void; + /** This is not used in Node.js and is provided purely for completeness. */ + returnValue: boolean; + /** Alias for event.target. */ + readonly srcElement: EventTarget | null; + /** Stops the invocation of event listeners after the current one completes. */ + stopImmediatePropagation(): void; + /** This is not used in Node.js and is provided purely for completeness. */ + stopPropagation(): void; + /** The `EventTarget` dispatching the event */ + readonly target: EventTarget | null; + /** The millisecond timestamp when the Event object was created. */ + readonly timeStamp: number; + /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ + readonly type: string; +}; + +// See comment above explaining conditional type +type __EventTarget = typeof globalThis extends { onmessage: any, EventTarget: any } +? {} +: { + /** + * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value. + * + * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched. + * + * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification. + * Specifically, the `capture` option is used as part of the key when registering a `listener`. + * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`. + */ + addEventListener( + type: string, + listener: EventListener | EventListenerObject, + options?: AddEventListenerOptions | boolean, + ): void; + /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ + dispatchEvent(event: Event): boolean; + /** Removes the event listener in target's event listener list with the same type, callback, and options. */ + removeEventListener( + type: string, + listener: EventListener | EventListenerObject, + options?: EventListenerOptions | boolean, + ): void; +}; + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; +} + +interface EventListenerOptions { + /** Not directly used by Node.js. Added for API completeness. Default: `false`. */ + capture?: boolean; +} + +interface AddEventListenerOptions extends EventListenerOptions { + /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */ + once?: boolean; + /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */ + passive?: boolean; +} + +interface EventListener { + (evt: Event): void; +} + +interface EventListenerObject { + handleEvent(object: Event): void; +} + +import {} from 'events'; // Make this an ambient declaration +declare global { + /** An event which takes place in the DOM. */ + interface Event extends __Event {} + var Event: typeof globalThis extends { onmessage: any, Event: infer T } + ? T + : { + prototype: __Event; + new (type: string, eventInitDict?: EventInit): __Event; + }; + + /** + * EventTarget is a DOM interface implemented by objects that can + * receive events and may have listeners for them. + */ + interface EventTarget extends __EventTarget {} + var EventTarget: typeof globalThis extends { onmessage: any, EventTarget: infer T } + ? T + : { + prototype: __EventTarget; + new (): __EventTarget; + }; +} diff --git a/node_modules/@types/node/ts4.8/domain.d.ts b/node_modules/@types/node/ts4.8/domain.d.ts new file mode 100755 index 0000000..e49b87f --- /dev/null +++ b/node_modules/@types/node/ts4.8/domain.d.ts @@ -0,0 +1,170 @@ +/** + * **This module is pending deprecation.** Once a replacement API has been + * finalized, this module will be fully deprecated. Most developers should + * **not** have cause to use this module. Users who absolutely must have + * the functionality that domains provide may rely on it for the time being + * but should expect to have to migrate to a different solution + * in the future. + * + * Domains provide a way to handle multiple different IO operations as a + * single group. If any of the event emitters or callbacks registered to a + * domain emit an `'error'` event, or throw an error, then the domain object + * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to + * exit immediately with an error code. + * @deprecated Since v1.4.2 - Deprecated + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/domain.js) + */ +declare module 'domain' { + import EventEmitter = require('node:events'); + /** + * The `Domain` class encapsulates the functionality of routing errors and + * uncaught exceptions to the active `Domain` object. + * + * To handle the errors that it catches, listen to its `'error'` event. + */ + class Domain extends EventEmitter { + /** + * An array of timers and event emitters that have been explicitly added + * to the domain. + */ + members: Array; + /** + * The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly + * pushes the domain onto the domain + * stack managed by the domain module (see {@link exit} for details on the + * domain stack). The call to `enter()` delimits the beginning of a chain of + * asynchronous calls and I/O operations bound to a domain. + * + * Calling `enter()` changes only the active domain, and does not alter the domain + * itself. `enter()` and `exit()` can be called an arbitrary number of times on a + * single domain. + */ + enter(): void; + /** + * The `exit()` method exits the current domain, popping it off the domain stack. + * Any time execution is going to switch to the context of a different chain of + * asynchronous calls, it's important to ensure that the current domain is exited. + * The call to `exit()` delimits either the end of or an interruption to the chain + * of asynchronous calls and I/O operations bound to a domain. + * + * If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain. + * + * Calling `exit()` changes only the active domain, and does not alter the domain + * itself. `enter()` and `exit()` can be called an arbitrary number of times on a + * single domain. + */ + exit(): void; + /** + * Run the supplied function in the context of the domain, implicitly + * binding all event emitters, timers, and low-level requests that are + * created in that context. Optionally, arguments can be passed to + * the function. + * + * This is the most basic way to use a domain. + * + * ```js + * const domain = require('node:domain'); + * const fs = require('node:fs'); + * const d = domain.create(); + * d.on('error', (er) => { + * console.error('Caught error!', er); + * }); + * d.run(() => { + * process.nextTick(() => { + * setTimeout(() => { // Simulating some various async stuff + * fs.open('non-existent file', 'r', (er, fd) => { + * if (er) throw er; + * // proceed... + * }); + * }, 100); + * }); + * }); + * ``` + * + * In this example, the `d.on('error')` handler will be triggered, rather + * than crashing the program. + */ + run(fn: (...args: any[]) => T, ...args: any[]): T; + /** + * Explicitly adds an emitter to the domain. If any event handlers called by + * the emitter throw an error, or if the emitter emits an `'error'` event, it + * will be routed to the domain's `'error'` event, just like with implicit + * binding. + * + * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by + * the domain `'error'` handler. + * + * If the Timer or `EventEmitter` was already bound to a domain, it is removed + * from that one, and bound to this one instead. + * @param emitter emitter or timer to be added to the domain + */ + add(emitter: EventEmitter | NodeJS.Timer): void; + /** + * The opposite of {@link add}. Removes domain handling from the + * specified emitter. + * @param emitter emitter or timer to be removed from the domain + */ + remove(emitter: EventEmitter | NodeJS.Timer): void; + /** + * The returned function will be a wrapper around the supplied callback + * function. When the returned function is called, any errors that are + * thrown will be routed to the domain's `'error'` event. + * + * ```js + * const d = domain.create(); + * + * function readSomeFile(filename, cb) { + * fs.readFile(filename, 'utf8', d.bind((er, data) => { + * // If this throws, it will also be passed to the domain. + * return cb(er, data ? JSON.parse(data) : null); + * })); + * } + * + * d.on('error', (er) => { + * // An error occurred somewhere. If we throw it now, it will crash the program + * // with the normal line number and stack message. + * }); + * ``` + * @param callback The callback function + * @return The bound function + */ + bind(callback: T): T; + /** + * This method is almost identical to {@link bind}. However, in + * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function. + * + * In this way, the common `if (err) return callback(err);` pattern can be replaced + * with a single error handler in a single place. + * + * ```js + * const d = domain.create(); + * + * function readSomeFile(filename, cb) { + * fs.readFile(filename, 'utf8', d.intercept((data) => { + * // Note, the first argument is never passed to the + * // callback since it is assumed to be the 'Error' argument + * // and thus intercepted by the domain. + * + * // If this throws, it will also be passed to the domain + * // so the error-handling logic can be moved to the 'error' + * // event on the domain instead of being repeated throughout + * // the program. + * return cb(null, JSON.parse(data)); + * })); + * } + * + * d.on('error', (er) => { + * // An error occurred somewhere. If we throw it now, it will crash the program + * // with the normal line number and stack message. + * }); + * ``` + * @param callback The callback function + * @return The intercepted function + */ + intercept(callback: T): T; + } + function create(): Domain; +} +declare module 'node:domain' { + export * from 'domain'; +} diff --git a/node_modules/@types/node/ts4.8/events.d.ts b/node_modules/@types/node/ts4.8/events.d.ts new file mode 100755 index 0000000..d9a97f6 --- /dev/null +++ b/node_modules/@types/node/ts4.8/events.d.ts @@ -0,0 +1,788 @@ +/** + * Much of the Node.js core API is built around an idiomatic asynchronous + * event-driven architecture in which certain kinds of objects (called "emitters") + * emit named events that cause `Function` objects ("listeners") to be called. + * + * For instance: a `net.Server` object emits an event each time a peer + * connects to it; a `fs.ReadStream` emits an event when the file is opened; + * a `stream` emits an event whenever data is available to be read. + * + * All objects that emit events are instances of the `EventEmitter` class. These + * objects expose an `eventEmitter.on()` function that allows one or more + * functions to be attached to named events emitted by the object. Typically, + * event names are camel-cased strings but any valid JavaScript property key + * can be used. + * + * When the `EventEmitter` object emits an event, all of the functions attached + * to that specific event are called _synchronously_. Any values returned by the + * called listeners are _ignored_ and discarded. + * + * The following example shows a simple `EventEmitter` instance with a single + * listener. The `eventEmitter.on()` method is used to register listeners, while + * the `eventEmitter.emit()` method is used to trigger the event. + * + * ```js + * import { EventEmitter } from 'node:events'; + * + * class MyEmitter extends EventEmitter {} + * + * const myEmitter = new MyEmitter(); + * myEmitter.on('event', () => { + * console.log('an event occurred!'); + * }); + * myEmitter.emit('event'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js) + */ +declare module 'events' { + // NOTE: This class is in the docs but is **not actually exported** by Node. + // If https://github.com/nodejs/node/issues/39903 gets resolved and Node + // actually starts exporting the class, uncomment below. + // import { EventListener, EventListenerObject } from '__dom-events'; + // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ + // interface NodeEventTarget extends EventTarget { + // /** + // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. + // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. + // */ + // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; + // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ + // eventNames(): string[]; + // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ + // listenerCount(type: string): number; + // /** Node.js-specific alias for `eventTarget.removeListener()`. */ + // off(type: string, listener: EventListener | EventListenerObject): this; + // /** Node.js-specific alias for `eventTarget.addListener()`. */ + // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; + // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ + // once(type: string, listener: EventListener | EventListenerObject): this; + // /** + // * Node.js-specific extension to the `EventTarget` class. + // * If `type` is specified, removes all registered listeners for `type`, + // * otherwise removes all registered listeners. + // */ + // removeAllListeners(type: string): this; + // /** + // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. + // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. + // */ + // removeListener(type: string, listener: EventListener | EventListenerObject): this; + // } + interface EventEmitterOptions { + /** + * Enables automatic capturing of promise rejection. + */ + captureRejections?: boolean | undefined; + } + // Any EventTarget with a Node-style `once` function + interface _NodeEventTarget { + once(eventName: string | symbol, listener: (...args: any[]) => void): this; + } + // Any EventTarget with a DOM-style `addEventListener` + interface _DOMEventTarget { + addEventListener( + eventName: string, + listener: (...args: any[]) => void, + opts?: { + once: boolean; + } + ): any; + } + interface StaticEventEmitterOptions { + signal?: AbortSignal | undefined; + } + interface EventEmitter extends NodeJS.EventEmitter {} + /** + * The `EventEmitter` class is defined and exposed by the `node:events` module: + * + * ```js + * import { EventEmitter } from 'node:events'; + * ``` + * + * All `EventEmitter`s emit the event `'newListener'` when new listeners are + * added and `'removeListener'` when existing listeners are removed. + * + * It supports the following option: + * @since v0.1.26 + */ + class EventEmitter { + constructor(options?: EventEmitterOptions); + /** + * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given + * event or that is rejected if the `EventEmitter` emits `'error'` while waiting. + * The `Promise` will resolve with an array of all the arguments emitted to the + * given event. + * + * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event + * semantics and does not listen to the `'error'` event. + * + * ```js + * import { once, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ee = new EventEmitter(); + * + * process.nextTick(() => { + * ee.emit('myevent', 42); + * }); + * + * const [value] = await once(ee, 'myevent'); + * console.log(value); + * + * const err = new Error('kaboom'); + * process.nextTick(() => { + * ee.emit('error', err); + * }); + * + * try { + * await once(ee, 'myevent'); + * } catch (err) { + * console.error('error happened', err); + * } + * ``` + * + * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the + * '`error'` event itself, then it is treated as any other kind of event without + * special handling: + * + * ```js + * import { EventEmitter, once } from 'node:events'; + * + * const ee = new EventEmitter(); + * + * once(ee, 'error') + * .then(([err]) => console.log('ok', err.message)) + * .catch((err) => console.error('error', err.message)); + * + * ee.emit('error', new Error('boom')); + * + * // Prints: ok boom + * ``` + * + * An `AbortSignal` can be used to cancel waiting for the event: + * + * ```js + * import { EventEmitter, once } from 'node:events'; + * + * const ee = new EventEmitter(); + * const ac = new AbortController(); + * + * async function foo(emitter, event, signal) { + * try { + * await once(emitter, event, { signal }); + * console.log('event emitted!'); + * } catch (error) { + * if (error.name === 'AbortError') { + * console.error('Waiting for the event was canceled!'); + * } else { + * console.error('There was an error', error.message); + * } + * } + * } + * + * foo(ee, 'foo', ac.signal); + * ac.abort(); // Abort waiting for the event + * ee.emit('foo'); // Prints: Waiting for the event was canceled! + * ``` + * @since v11.13.0, v10.16.0 + */ + static once(emitter: _NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise; + static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise; + /** + * ```js + * import { on, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ee = new EventEmitter(); + * + * // Emit later on + * process.nextTick(() => { + * ee.emit('foo', 'bar'); + * ee.emit('foo', 42); + * }); + * + * for await (const event of on(ee, 'foo')) { + * // The execution of this inner block is synchronous and it + * // processes one event at a time (even with await). Do not use + * // if concurrent execution is required. + * console.log(event); // prints ['bar'] [42] + * } + * // Unreachable here + * ``` + * + * Returns an `AsyncIterator` that iterates `eventName` events. It will throw + * if the `EventEmitter` emits `'error'`. It removes all listeners when + * exiting the loop. The `value` returned by each iteration is an array + * composed of the emitted event arguments. + * + * An `AbortSignal` can be used to cancel waiting on events: + * + * ```js + * import { on, EventEmitter } from 'node:events'; + * import process from 'node:process'; + * + * const ac = new AbortController(); + * + * (async () => { + * const ee = new EventEmitter(); + * + * // Emit later on + * process.nextTick(() => { + * ee.emit('foo', 'bar'); + * ee.emit('foo', 42); + * }); + * + * for await (const event of on(ee, 'foo', { signal: ac.signal })) { + * // The execution of this inner block is synchronous and it + * // processes one event at a time (even with await). Do not use + * // if concurrent execution is required. + * console.log(event); // prints ['bar'] [42] + * } + * // Unreachable here + * })(); + * + * process.nextTick(() => ac.abort()); + * ``` + * @since v13.6.0, v12.16.0 + * @param eventName The name of the event being listened for + * @return that iterates `eventName` events emitted by the `emitter` + */ + static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator; + /** + * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. + * + * ```js + * import { EventEmitter, listenerCount } from 'node:events'; + * + * const myEmitter = new EventEmitter(); + * myEmitter.on('event', () => {}); + * myEmitter.on('event', () => {}); + * console.log(listenerCount(myEmitter, 'event')); + * // Prints: 2 + * ``` + * @since v0.9.12 + * @deprecated Since v3.2.0 - Use `listenerCount` instead. + * @param emitter The emitter to query + * @param eventName The event name + */ + static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number; + /** + * Returns a copy of the array of listeners for the event named `eventName`. + * + * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on + * the emitter. + * + * For `EventTarget`s this is the only way to get the event listeners for the + * event target. This is useful for debugging and diagnostic purposes. + * + * ```js + * import { getEventListeners, EventEmitter } from 'node:events'; + * + * { + * const ee = new EventEmitter(); + * const listener = () => console.log('Events are fun'); + * ee.on('foo', listener); + * console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ] + * } + * { + * const et = new EventTarget(); + * const listener = () => console.log('Events are fun'); + * et.addEventListener('foo', listener); + * console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ] + * } + * ``` + * @since v15.2.0, v14.17.0 + */ + static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[]; + /** + * Returns the currently set max amount of listeners. + * + * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on + * the emitter. + * + * For `EventTarget`s this is the only way to get the max event listeners for the + * event target. If the number of event handlers on a single EventTarget exceeds + * the max set, the EventTarget will print a warning. + * + * ```js + * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events'; + * + * { + * const ee = new EventEmitter(); + * console.log(getMaxListeners(ee)); // 10 + * setMaxListeners(11, ee); + * console.log(getMaxListeners(ee)); // 11 + * } + * { + * const et = new EventTarget(); + * console.log(getMaxListeners(et)); // 10 + * setMaxListeners(11, et); + * console.log(getMaxListeners(et)); // 11 + * } + * ``` + * @since v19.9.0 + */ + static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number; + /** + * ```js + * import { setMaxListeners, EventEmitter } from 'node:events'; + * + * const target = new EventTarget(); + * const emitter = new EventEmitter(); + * + * setMaxListeners(5, target, emitter); + * ``` + * @since v15.4.0 + * @param n A non-negative number. The maximum number of listeners per `EventTarget` event. + * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter} + * objects. + */ + static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void; + /** + * Listens once to the `abort` event on the provided `signal`. + * + * Listening to the `abort` event on abort signals is unsafe and may + * lead to resource leaks since another third party with the signal can + * call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change + * this since it would violate the web standard. Additionally, the original + * API makes it easy to forget to remove listeners. + * + * This API allows safely using `AbortSignal`s in Node.js APIs by solving these + * two issues by listening to the event such that `stopImmediatePropagation` does + * not prevent the listener from running. + * + * Returns a disposable so that it may be unsubscribed from more easily. + * + * ```js + * import { addAbortListener } from 'node:events'; + * + * function example(signal) { + * let disposable; + * try { + * signal.addEventListener('abort', (e) => e.stopImmediatePropagation()); + * disposable = addAbortListener(signal, (e) => { + * // Do something when signal is aborted. + * }); + * } finally { + * disposable?.[Symbol.dispose](); + * } + * } + * ``` + * @since v20.5.0 + * @experimental + * @return that removes the `abort` listener. + */ + static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable; + /** + * This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called. + * + * Installing a listener using this symbol does not change the behavior once an`'error'` event is emitted. Therefore, the process will still crash if no + * regular `'error'` listener is installed. + * @since v13.6.0, v12.17.0 + */ + static readonly errorMonitor: unique symbol; + /** + * Value: `Symbol.for('nodejs.rejection')` + * + * See how to write a custom `rejection handler`. + * @since v13.4.0, v12.16.0 + */ + static readonly captureRejectionSymbol: unique symbol; + /** + * Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + * + * Change the default `captureRejections` option on all new `EventEmitter` objects. + * @since v13.4.0, v12.16.0 + */ + static captureRejections: boolean; + /** + * By default, a maximum of `10` listeners can be registered for any single + * event. This limit can be changed for individual `EventEmitter` instances + * using the `emitter.setMaxListeners(n)` method. To change the default + * for _all_`EventEmitter` instances, the `events.defaultMaxListeners`property can be used. If this value is not a positive number, a `RangeError`is thrown. + * + * Take caution when setting the `events.defaultMaxListeners` because the + * change affects _all_`EventEmitter` instances, including those created before + * the change is made. However, calling `emitter.setMaxListeners(n)` still has + * precedence over `events.defaultMaxListeners`. + * + * This is not a hard limit. The `EventEmitter` instance will allow + * more listeners to be added but will output a trace warning to stderr indicating + * that a "possible EventEmitter memory leak" has been detected. For any single`EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()`methods can be used to + * temporarily avoid this warning: + * + * ```js + * import { EventEmitter } from 'node:events'; + * const emitter = new EventEmitter(); + * emitter.setMaxListeners(emitter.getMaxListeners() + 1); + * emitter.once('event', () => { + * // do stuff + * emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0)); + * }); + * ``` + * + * The `--trace-warnings` command-line flag can be used to display the + * stack trace for such warnings. + * + * The emitted warning can be inspected with `process.on('warning')` and will + * have the additional `emitter`, `type`, and `count` properties, referring to + * the event emitter instance, the event's name and the number of attached + * listeners, respectively. + * Its `name` property is set to `'MaxListenersExceededWarning'`. + * @since v0.11.2 + */ + static defaultMaxListeners: number; + } + import internal = require('node:events'); + namespace EventEmitter { + // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4 + export { internal as EventEmitter }; + export interface Abortable { + /** + * When provided the corresponding `AbortController` can be used to cancel an asynchronous action. + */ + signal?: AbortSignal | undefined; + } + } + global { + namespace NodeJS { + interface EventEmitter { + /** + * Alias for `emitter.on(eventName, listener)`. + * @since v0.1.26 + */ + addListener(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Adds the `listener` function to the end of the listeners array for the + * event named `eventName`. No checks are made to see if the `listener` has + * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple + * times. + * + * ```js + * server.on('connection', (stream) => { + * console.log('someone connected!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * + * By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the + * event listener to the beginning of the listeners array. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEE = new EventEmitter(); + * myEE.on('foo', () => console.log('a')); + * myEE.prependListener('foo', () => console.log('b')); + * myEE.emit('foo'); + * // Prints: + * // b + * // a + * ``` + * @since v0.1.101 + * @param eventName The name of the event. + * @param listener The callback function + */ + on(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Adds a **one-time**`listener` function for the event named `eventName`. The + * next time `eventName` is triggered, this listener is removed and then invoked. + * + * ```js + * server.once('connection', (stream) => { + * console.log('Ah, we have our first user!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * + * By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the + * event listener to the beginning of the listeners array. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEE = new EventEmitter(); + * myEE.once('foo', () => console.log('a')); + * myEE.prependOnceListener('foo', () => console.log('b')); + * myEE.emit('foo'); + * // Prints: + * // b + * // a + * ``` + * @since v0.3.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + once(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Removes the specified `listener` from the listener array for the event named`eventName`. + * + * ```js + * const callback = (stream) => { + * console.log('someone connected!'); + * }; + * server.on('connection', callback); + * // ... + * server.removeListener('connection', callback); + * ``` + * + * `removeListener()` will remove, at most, one instance of a listener from the + * listener array. If any single listener has been added multiple times to the + * listener array for the specified `eventName`, then `removeListener()` must be + * called multiple times to remove each instance. + * + * Once an event is emitted, all listeners attached to it at the + * time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution + * will not remove them from`emit()` in progress. Subsequent events behave as expected. + * + * ```js + * import { EventEmitter } from 'node:events'; + * class MyEmitter extends EventEmitter {} + * const myEmitter = new MyEmitter(); + * + * const callbackA = () => { + * console.log('A'); + * myEmitter.removeListener('event', callbackB); + * }; + * + * const callbackB = () => { + * console.log('B'); + * }; + * + * myEmitter.on('event', callbackA); + * + * myEmitter.on('event', callbackB); + * + * // callbackA removes listener callbackB but it will still be called. + * // Internal listener array at time of emit [callbackA, callbackB] + * myEmitter.emit('event'); + * // Prints: + * // A + * // B + * + * // callbackB is now removed. + * // Internal listener array [callbackA] + * myEmitter.emit('event'); + * // Prints: + * // A + * ``` + * + * Because listeners are managed using an internal array, calling this will + * change the position indices of any listener registered _after_ the listener + * being removed. This will not impact the order in which listeners are called, + * but it means that any copies of the listener array as returned by + * the `emitter.listeners()` method will need to be recreated. + * + * When a single function has been added as a handler multiple times for a single + * event (as in the example below), `removeListener()` will remove the most + * recently added instance. In the example the `once('ping')`listener is removed: + * + * ```js + * import { EventEmitter } from 'node:events'; + * const ee = new EventEmitter(); + * + * function pong() { + * console.log('pong'); + * } + * + * ee.on('ping', pong); + * ee.once('ping', pong); + * ee.removeListener('ping', pong); + * + * ee.emit('ping'); + * ee.emit('ping'); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.1.26 + */ + removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Alias for `emitter.removeListener()`. + * @since v10.0.0 + */ + off(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Removes all listeners, or those of the specified `eventName`. + * + * It is bad practice to remove listeners added elsewhere in the code, + * particularly when the `EventEmitter` instance was created by some other + * component or module (e.g. sockets or file streams). + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.1.26 + */ + removeAllListeners(event?: string | symbol): this; + /** + * By default `EventEmitter`s will print a warning if more than `10` listeners are + * added for a particular event. This is a useful default that helps finding + * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be + * modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v0.3.5 + */ + setMaxListeners(n: number): this; + /** + * Returns the current max listener value for the `EventEmitter` which is either + * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}. + * @since v1.0.0 + */ + getMaxListeners(): number; + /** + * Returns a copy of the array of listeners for the event named `eventName`. + * + * ```js + * server.on('connection', (stream) => { + * console.log('someone connected!'); + * }); + * console.log(util.inspect(server.listeners('connection'))); + * // Prints: [ [Function] ] + * ``` + * @since v0.1.26 + */ + listeners(eventName: string | symbol): Function[]; + /** + * Returns a copy of the array of listeners for the event named `eventName`, + * including any wrappers (such as those created by `.once()`). + * + * ```js + * import { EventEmitter } from 'node:events'; + * const emitter = new EventEmitter(); + * emitter.once('log', () => console.log('log once')); + * + * // Returns a new Array with a function `onceWrapper` which has a property + * // `listener` which contains the original listener bound above + * const listeners = emitter.rawListeners('log'); + * const logFnWrapper = listeners[0]; + * + * // Logs "log once" to the console and does not unbind the `once` event + * logFnWrapper.listener(); + * + * // Logs "log once" to the console and removes the listener + * logFnWrapper(); + * + * emitter.on('log', () => console.log('log persistently')); + * // Will return a new Array with a single function bound by `.on()` above + * const newListeners = emitter.rawListeners('log'); + * + * // Logs "log persistently" twice + * newListeners[0](); + * emitter.emit('log'); + * ``` + * @since v9.4.0 + */ + rawListeners(eventName: string | symbol): Function[]; + /** + * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments + * to each. + * + * Returns `true` if the event had listeners, `false` otherwise. + * + * ```js + * import { EventEmitter } from 'node:events'; + * const myEmitter = new EventEmitter(); + * + * // First listener + * myEmitter.on('event', function firstListener() { + * console.log('Helloooo! first listener'); + * }); + * // Second listener + * myEmitter.on('event', function secondListener(arg1, arg2) { + * console.log(`event with parameters ${arg1}, ${arg2} in second listener`); + * }); + * // Third listener + * myEmitter.on('event', function thirdListener(...args) { + * const parameters = args.join(', '); + * console.log(`event with parameters ${parameters} in third listener`); + * }); + * + * console.log(myEmitter.listeners('event')); + * + * myEmitter.emit('event', 1, 2, 3, 4, 5); + * + * // Prints: + * // [ + * // [Function: firstListener], + * // [Function: secondListener], + * // [Function: thirdListener] + * // ] + * // Helloooo! first listener + * // event with parameters 1, 2 in second listener + * // event with parameters 1, 2, 3, 4, 5 in third listener + * ``` + * @since v0.1.26 + */ + emit(eventName: string | symbol, ...args: any[]): boolean; + /** + * Returns the number of listeners listening for the event named `eventName`. + * If `listener` is provided, it will return how many times the listener is found + * in the list of the listeners of the event. + * @since v3.2.0 + * @param eventName The name of the event being listened for + * @param listener The event handler function + */ + listenerCount(eventName: string | symbol, listener?: Function): number; + /** + * Adds the `listener` function to the _beginning_ of the listeners array for the + * event named `eventName`. No checks are made to see if the `listener` has + * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple + * times. + * + * ```js + * server.prependListener('connection', (stream) => { + * console.log('someone connected!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v6.0.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this + * listener is removed, and then invoked. + * + * ```js + * server.prependOnceListener('connection', (stream) => { + * console.log('Ah, we have our first user!'); + * }); + * ``` + * + * Returns a reference to the `EventEmitter`, so that calls can be chained. + * @since v6.0.0 + * @param eventName The name of the event. + * @param listener The callback function + */ + prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this; + /** + * Returns an array listing the events for which the emitter has registered + * listeners. The values in the array are strings or `Symbol`s. + * + * ```js + * import { EventEmitter } from 'node:events'; + * + * const myEE = new EventEmitter(); + * myEE.on('foo', () => {}); + * myEE.on('bar', () => {}); + * + * const sym = Symbol('symbol'); + * myEE.on(sym, () => {}); + * + * console.log(myEE.eventNames()); + * // Prints: [ 'foo', 'bar', Symbol(symbol) ] + * ``` + * @since v6.0.0 + */ + eventNames(): Array; + } + } + } + export = EventEmitter; +} +declare module 'node:events' { + import events = require('events'); + export = events; +} diff --git a/node_modules/@types/node/ts4.8/fs.d.ts b/node_modules/@types/node/ts4.8/fs.d.ts new file mode 100755 index 0000000..88dc63e --- /dev/null +++ b/node_modules/@types/node/ts4.8/fs.d.ts @@ -0,0 +1,4082 @@ +/** + * The `node:fs` module enables interacting with the file system in a + * way modeled on standard POSIX functions. + * + * To use the promise-based APIs: + * + * ```js + * import * as fs from 'node:fs/promises'; + * ``` + * + * To use the callback and sync APIs: + * + * ```js + * import * as fs from 'node:fs'; + * ``` + * + * All file system operations have synchronous, callback, and promise-based + * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM). + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/fs.js) + */ +declare module 'fs' { + import * as stream from 'node:stream'; + import { Abortable, EventEmitter } from 'node:events'; + import { URL } from 'node:url'; + import * as promises from 'node:fs/promises'; + export { promises }; + /** + * Valid types for path values in "fs". + */ + export type PathLike = string | Buffer | URL; + export type PathOrFileDescriptor = PathLike | number; + export type TimeLike = string | number | Date; + export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; + export type BufferEncodingOption = + | 'buffer' + | { + encoding: 'buffer'; + }; + export interface ObjectEncodingOptions { + encoding?: BufferEncoding | null | undefined; + } + export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null; + export type OpenMode = number | string; + export type Mode = number | string; + export interface StatsBase { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: T; + ino: T; + mode: T; + nlink: T; + uid: T; + gid: T; + rdev: T; + size: T; + blksize: T; + blocks: T; + atimeMs: T; + mtimeMs: T; + ctimeMs: T; + birthtimeMs: T; + atime: Date; + mtime: Date; + ctime: Date; + birthtime: Date; + } + export interface Stats extends StatsBase {} + /** + * A `fs.Stats` object provides information about a file. + * + * Objects returned from {@link stat}, {@link lstat}, {@link fstat}, and + * their synchronous counterparts are of this type. + * If `bigint` in the `options` passed to those methods is true, the numeric values + * will be `bigint` instead of `number`, and the object will contain additional + * nanosecond-precision properties suffixed with `Ns`. + * + * ```console + * Stats { + * dev: 2114, + * ino: 48064969, + * mode: 33188, + * nlink: 1, + * uid: 85, + * gid: 100, + * rdev: 0, + * size: 527, + * blksize: 4096, + * blocks: 8, + * atimeMs: 1318289051000.1, + * mtimeMs: 1318289051000.1, + * ctimeMs: 1318289051000.1, + * birthtimeMs: 1318289051000.1, + * atime: Mon, 10 Oct 2011 23:24:11 GMT, + * mtime: Mon, 10 Oct 2011 23:24:11 GMT, + * ctime: Mon, 10 Oct 2011 23:24:11 GMT, + * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } + * ``` + * + * `bigint` version: + * + * ```console + * BigIntStats { + * dev: 2114n, + * ino: 48064969n, + * mode: 33188n, + * nlink: 1n, + * uid: 85n, + * gid: 100n, + * rdev: 0n, + * size: 527n, + * blksize: 4096n, + * blocks: 8n, + * atimeMs: 1318289051000n, + * mtimeMs: 1318289051000n, + * ctimeMs: 1318289051000n, + * birthtimeMs: 1318289051000n, + * atimeNs: 1318289051000000000n, + * mtimeNs: 1318289051000000000n, + * ctimeNs: 1318289051000000000n, + * birthtimeNs: 1318289051000000000n, + * atime: Mon, 10 Oct 2011 23:24:11 GMT, + * mtime: Mon, 10 Oct 2011 23:24:11 GMT, + * ctime: Mon, 10 Oct 2011 23:24:11 GMT, + * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } + * ``` + * @since v0.1.21 + */ + export class Stats {} + export interface StatsFsBase { + /** Type of file system. */ + type: T; + /** Optimal transfer block size. */ + bsize: T; + /** Total data blocks in file system. */ + blocks: T; + /** Free blocks in file system. */ + bfree: T; + /** Available blocks for unprivileged users */ + bavail: T; + /** Total file nodes in file system. */ + files: T; + /** Free file nodes in file system. */ + ffree: T; + } + export interface StatsFs extends StatsFsBase {} + /** + * Provides information about a mounted file system. + * + * Objects returned from {@link statfs} and its synchronous counterpart are of + * this type. If `bigint` in the `options` passed to those methods is `true`, the + * numeric values will be `bigint` instead of `number`. + * + * ```console + * StatFs { + * type: 1397114950, + * bsize: 4096, + * blocks: 121938943, + * bfree: 61058895, + * bavail: 61058895, + * files: 999, + * ffree: 1000000 + * } + * ``` + * + * `bigint` version: + * + * ```console + * StatFs { + * type: 1397114950n, + * bsize: 4096n, + * blocks: 121938943n, + * bfree: 61058895n, + * bavail: 61058895n, + * files: 999n, + * ffree: 1000000n + * } + * ``` + * @since v19.6.0, v18.15.0 + */ + export class StatsFs {} + export interface BigIntStatsFs extends StatsFsBase {} + export interface StatFsOptions { + bigint?: boolean | undefined; + } + /** + * A representation of a directory entry, which can be a file or a subdirectory + * within the directory, as returned by reading from an `fs.Dir`. The + * directory entry is a combination of the file name and file type pairs. + * + * Additionally, when {@link readdir} or {@link readdirSync} is called with + * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s. + * @since v10.10.0 + */ + export class Dirent { + /** + * Returns `true` if the `fs.Dirent` object describes a regular file. + * @since v10.10.0 + */ + isFile(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a file system + * directory. + * @since v10.10.0 + */ + isDirectory(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a block device. + * @since v10.10.0 + */ + isBlockDevice(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a character device. + * @since v10.10.0 + */ + isCharacterDevice(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a symbolic link. + * @since v10.10.0 + */ + isSymbolicLink(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a first-in-first-out + * (FIFO) pipe. + * @since v10.10.0 + */ + isFIFO(): boolean; + /** + * Returns `true` if the `fs.Dirent` object describes a socket. + * @since v10.10.0 + */ + isSocket(): boolean; + /** + * The file name that this `fs.Dirent` object refers to. The type of this + * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}. + * @since v10.10.0 + */ + name: string; + /** + * The base path that this `fs.Dirent` object refers to. + * @since v20.1.0 + */ + path: string; + } + /** + * A class representing a directory stream. + * + * Created by {@link opendir}, {@link opendirSync}, or `fsPromises.opendir()`. + * + * ```js + * import { opendir } from 'node:fs/promises'; + * + * try { + * const dir = await opendir('./'); + * for await (const dirent of dir) + * console.log(dirent.name); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * When using the async iterator, the `fs.Dir` object will be automatically + * closed after the iterator exits. + * @since v12.12.0 + */ + export class Dir implements AsyncIterable { + /** + * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`. + * @since v12.12.0 + */ + readonly path: string; + /** + * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. + */ + [Symbol.asyncIterator](): AsyncIterableIterator; + /** + * Asynchronously close the directory's underlying resource handle. + * Subsequent reads will result in errors. + * + * A promise is returned that will be resolved after the resource has been + * closed. + * @since v12.12.0 + */ + close(): Promise; + close(cb: NoParamCallback): void; + /** + * Synchronously close the directory's underlying resource handle. + * Subsequent reads will result in errors. + * @since v12.12.0 + */ + closeSync(): void; + /** + * Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an `fs.Dirent`. + * + * A promise is returned that will be resolved with an `fs.Dirent`, or `null`if there are no more directory entries to read. + * + * Directory entries returned by this function are in no particular order as + * provided by the operating system's underlying directory mechanisms. + * Entries added or removed while iterating over the directory might not be + * included in the iteration results. + * @since v12.12.0 + * @return containing {fs.Dirent|null} + */ + read(): Promise; + read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; + /** + * Synchronously read the next directory entry as an `fs.Dirent`. See the + * POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail. + * + * If there are no more directory entries to read, `null` will be returned. + * + * Directory entries returned by this function are in no particular order as + * provided by the operating system's underlying directory mechanisms. + * Entries added or removed while iterating over the directory might not be + * included in the iteration results. + * @since v12.12.0 + */ + readSync(): Dirent | null; + } + /** + * Class: fs.StatWatcher + * @since v14.3.0, v12.20.0 + * Extends `EventEmitter` + * A successful call to {@link watchFile} method will return a new fs.StatWatcher object. + */ + export interface StatWatcher extends EventEmitter { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have + * no effect. + * + * By default, all `fs.StatWatcher` objects are "ref'ed", making it normally + * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been + * called previously. + * @since v14.3.0, v12.20.0 + */ + ref(): this; + /** + * When called, the active `fs.StatWatcher` object will not require the Node.js + * event loop to remain active. If there is no other activity keeping the + * event loop running, the process may exit before the `fs.StatWatcher` object's + * callback is invoked. Calling `watcher.unref()` multiple times will have + * no effect. + * @since v14.3.0, v12.20.0 + */ + unref(): this; + } + export interface FSWatcher extends EventEmitter { + /** + * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable. + * @since v0.5.8 + */ + close(): void; + /** + * events.EventEmitter + * 1. change + * 2. error + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + addListener(event: 'error', listener: (error: Error) => void): this; + addListener(event: 'close', listener: () => void): this; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + on(event: 'error', listener: (error: Error) => void): this; + on(event: 'close', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + once(event: 'error', listener: (error: Error) => void): this; + once(event: 'close', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + prependListener(event: 'error', listener: (error: Error) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this; + prependOnceListener(event: 'error', listener: (error: Error) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + } + /** + * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function. + * @since v0.1.93 + */ + export class ReadStream extends stream.Readable { + close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; + /** + * The number of bytes that have been read so far. + * @since v6.4.0 + */ + bytesRead: number; + /** + * The path to the file the stream is reading from as specified in the first + * argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a + * `Buffer`. If `fd` is specified, then`readStream.path` will be `undefined`. + * @since v0.1.93 + */ + path: string | Buffer; + /** + * This property is `true` if the underlying file has not been opened yet, + * i.e. before the `'ready'` event is emitted. + * @since v11.2.0, v10.16.0 + */ + pending: boolean; + /** + * events.EventEmitter + * 1. open + * 2. close + * 3. ready + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'open', listener: (fd: number) => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'readable', listener: () => void): this; + addListener(event: 'ready', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: Buffer | string) => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'open', listener: (fd: number) => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'readable', listener: () => void): this; + on(event: 'ready', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: Buffer | string) => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'open', listener: (fd: number) => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'readable', listener: () => void): this; + once(event: 'ready', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'open', listener: (fd: number) => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'readable', listener: () => void): this; + prependListener(event: 'ready', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'open', listener: (fd: number) => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'readable', listener: () => void): this; + prependOnceListener(event: 'ready', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * * Extends `stream.Writable` + * + * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function. + * @since v0.1.93 + */ + export class WriteStream extends stream.Writable { + /** + * Closes `writeStream`. Optionally accepts a + * callback that will be executed once the `writeStream`is closed. + * @since v0.9.4 + */ + close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; + /** + * The number of bytes written so far. Does not include data that is still queued + * for writing. + * @since v0.4.7 + */ + bytesWritten: number; + /** + * The path to the file the stream is writing to as specified in the first + * argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a `Buffer`, then`writeStream.path` will be a + * `Buffer`. + * @since v0.1.93 + */ + path: string | Buffer; + /** + * This property is `true` if the underlying file has not been opened yet, + * i.e. before the `'ready'` event is emitted. + * @since v11.2.0 + */ + pending: boolean; + /** + * events.EventEmitter + * 1. open + * 2. close + * 3. ready + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'open', listener: (fd: number) => void): this; + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'ready', listener: () => void): this; + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'open', listener: (fd: number) => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'ready', listener: () => void): this; + on(event: 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'open', listener: (fd: number) => void): this; + once(event: 'pipe', listener: (src: stream.Readable) => void): this; + once(event: 'ready', listener: () => void): this; + once(event: 'unpipe', listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'open', listener: (fd: number) => void): this; + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'ready', listener: () => void): this; + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'open', listener: (fd: number) => void): this; + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'ready', listener: () => void): this; + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * Asynchronously rename file at `oldPath` to the pathname provided + * as `newPath`. In the case that `newPath` already exists, it will + * be overwritten. If there is a directory at `newPath`, an error will + * be raised instead. No arguments other than a possible exception are + * given to the completion callback. + * + * See also: [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html). + * + * ```js + * import { rename } from 'node:fs'; + * + * rename('oldFile.txt', 'newFile.txt', (err) => { + * if (err) throw err; + * console.log('Rename complete!'); + * }); + * ``` + * @since v0.0.2 + */ + export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; + export namespace rename { + /** + * Asynchronous rename(2) - Change the name or location of a file or directory. + * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; + } + /** + * Renames the file from `oldPath` to `newPath`. Returns `undefined`. + * + * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details. + * @since v0.1.21 + */ + export function renameSync(oldPath: PathLike, newPath: PathLike): void; + /** + * Truncates the file. No arguments other than a possible exception are + * given to the completion callback. A file descriptor can also be passed as the + * first argument. In this case, `fs.ftruncate()` is called. + * + * ```js + * import { truncate } from 'node:fs'; + * // Assuming that 'path/file.txt' is a regular file. + * truncate('path/file.txt', (err) => { + * if (err) throw err; + * console.log('path/file.txt was truncated'); + * }); + * ``` + * + * Passing a file descriptor is deprecated and may result in an error being thrown + * in the future. + * + * See the POSIX [`truncate(2)`](http://man7.org/linux/man-pages/man2/truncate.2.html) documentation for more details. + * @since v0.8.6 + * @param [len=0] + */ + export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void; + /** + * Asynchronous truncate(2) - Truncate a file to a specified length. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function truncate(path: PathLike, callback: NoParamCallback): void; + export namespace truncate { + /** + * Asynchronous truncate(2) - Truncate a file to a specified length. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param len If not specified, defaults to `0`. + */ + function __promisify__(path: PathLike, len?: number | null): Promise; + } + /** + * Truncates the file. Returns `undefined`. A file descriptor can also be + * passed as the first argument. In this case, `fs.ftruncateSync()` is called. + * + * Passing a file descriptor is deprecated and may result in an error being thrown + * in the future. + * @since v0.8.6 + * @param [len=0] + */ + export function truncateSync(path: PathLike, len?: number | null): void; + /** + * Truncates the file descriptor. No arguments other than a possible exception are + * given to the completion callback. + * + * See the POSIX [`ftruncate(2)`](http://man7.org/linux/man-pages/man2/ftruncate.2.html) documentation for more detail. + * + * If the file referred to by the file descriptor was larger than `len` bytes, only + * the first `len` bytes will be retained in the file. + * + * For example, the following program retains only the first four bytes of the + * file: + * + * ```js + * import { open, close, ftruncate } from 'node:fs'; + * + * function closeFd(fd) { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * + * open('temp.txt', 'r+', (err, fd) => { + * if (err) throw err; + * + * try { + * ftruncate(fd, 4, (err) => { + * closeFd(fd); + * if (err) throw err; + * }); + * } catch (err) { + * closeFd(fd); + * if (err) throw err; + * } + * }); + * ``` + * + * If the file previously was shorter than `len` bytes, it is extended, and the + * extended part is filled with null bytes (`'\0'`): + * + * If `len` is negative then `0` will be used. + * @since v0.8.6 + * @param [len=0] + */ + export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void; + /** + * Asynchronous ftruncate(2) - Truncate a file to a specified length. + * @param fd A file descriptor. + */ + export function ftruncate(fd: number, callback: NoParamCallback): void; + export namespace ftruncate { + /** + * Asynchronous ftruncate(2) - Truncate a file to a specified length. + * @param fd A file descriptor. + * @param len If not specified, defaults to `0`. + */ + function __promisify__(fd: number, len?: number | null): Promise; + } + /** + * Truncates the file descriptor. Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link ftruncate}. + * @since v0.8.6 + * @param [len=0] + */ + export function ftruncateSync(fd: number, len?: number | null): void; + /** + * Asynchronously changes owner and group of a file. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. + * @since v0.1.97 + */ + export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; + export namespace chown { + /** + * Asynchronous chown(2) - Change ownership of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, uid: number, gid: number): Promise; + } + /** + * Synchronously changes owner and group of a file. Returns `undefined`. + * This is the synchronous version of {@link chown}. + * + * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. + * @since v0.1.97 + */ + export function chownSync(path: PathLike, uid: number, gid: number): void; + /** + * Sets the owner of the file. No arguments other than a possible exception are + * given to the completion callback. + * + * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; + export namespace fchown { + /** + * Asynchronous fchown(2) - Change ownership of a file. + * @param fd A file descriptor. + */ + function __promisify__(fd: number, uid: number, gid: number): Promise; + } + /** + * Sets the owner of the file. Returns `undefined`. + * + * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. + * @since v0.4.7 + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + */ + export function fchownSync(fd: number, uid: number, gid: number): void; + /** + * Set the owner of the symbolic link. No arguments other than a possible + * exception are given to the completion callback. + * + * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail. + */ + export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; + export namespace lchown { + /** + * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, uid: number, gid: number): Promise; + } + /** + * Set the owner for the path. Returns `undefined`. + * + * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more details. + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + */ + export function lchownSync(path: PathLike, uid: number, gid: number): void; + /** + * Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic + * link, then the link is not dereferenced: instead, the timestamps of the + * symbolic link itself are changed. + * + * No arguments other than a possible exception are given to the completion + * callback. + * @since v14.5.0, v12.19.0 + */ + export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace lutimes { + /** + * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, + * with the difference that if the path refers to a symbolic link, then the link is not + * dereferenced: instead, the timestamps of the symbolic link itself are changed. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Change the file system timestamps of the symbolic link referenced by `path`. + * Returns `undefined`, or throws an exception when parameters are incorrect or + * the operation fails. This is the synchronous version of {@link lutimes}. + * @since v14.5.0, v12.19.0 + */ + export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; + /** + * Asynchronously changes the permissions of a file. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. + * + * ```js + * import { chmod } from 'node:fs'; + * + * chmod('my_file.txt', 0o775, (err) => { + * if (err) throw err; + * console.log('The permissions for file "my_file.txt" have been changed!'); + * }); + * ``` + * @since v0.1.30 + */ + export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; + export namespace chmod { + /** + * Asynchronous chmod(2) - Change permissions of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(path: PathLike, mode: Mode): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link chmod}. + * + * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. + * @since v0.6.7 + */ + export function chmodSync(path: PathLike, mode: Mode): void; + /** + * Sets the permissions on the file. No arguments other than a possible exception + * are given to the completion callback. + * + * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void; + export namespace fchmod { + /** + * Asynchronous fchmod(2) - Change permissions of a file. + * @param fd A file descriptor. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(fd: number, mode: Mode): Promise; + } + /** + * Sets the permissions on the file. Returns `undefined`. + * + * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. + * @since v0.4.7 + */ + export function fchmodSync(fd: number, mode: Mode): void; + /** + * Changes the permissions on a symbolic link. No arguments other than a possible + * exception are given to the completion callback. + * + * This method is only implemented on macOS. + * + * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. + * @deprecated Since v0.4.7 + */ + export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; + /** @deprecated */ + export namespace lchmod { + /** + * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function __promisify__(path: PathLike, mode: Mode): Promise; + } + /** + * Changes the permissions on a symbolic link. Returns `undefined`. + * + * This method is only implemented on macOS. + * + * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. + * @deprecated Since v0.4.7 + */ + export function lchmodSync(path: PathLike, mode: Mode): void; + /** + * Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * + * {@link stat} follows symbolic links. Use {@link lstat} to look at the + * links themselves. + * + * Using `fs.stat()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. + * Instead, user code should open/read/write the file directly and handle the + * error raised if the file is not available. + * + * To check if a file exists without manipulating it afterwards, {@link access} is recommended. + * + * For example, given the following directory structure: + * + * ```text + * - txtDir + * -- file.txt + * - app.js + * ``` + * + * The next program will check for the stats of the given paths: + * + * ```js + * import { stat } from 'node:fs'; + * + * const pathsToCheck = ['./txtDir', './txtDir/file.txt']; + * + * for (let i = 0; i < pathsToCheck.length; i++) { + * stat(pathsToCheck[i], (err, stats) => { + * console.log(stats.isDirectory()); + * console.log(stats); + * }); + * } + * ``` + * + * The resulting output will resemble: + * + * ```console + * true + * Stats { + * dev: 16777220, + * mode: 16877, + * nlink: 3, + * uid: 501, + * gid: 20, + * rdev: 0, + * blksize: 4096, + * ino: 14214262, + * size: 96, + * blocks: 0, + * atimeMs: 1561174653071.963, + * mtimeMs: 1561174614583.3518, + * ctimeMs: 1561174626623.5366, + * birthtimeMs: 1561174126937.2893, + * atime: 2019-06-22T03:37:33.072Z, + * mtime: 2019-06-22T03:36:54.583Z, + * ctime: 2019-06-22T03:37:06.624Z, + * birthtime: 2019-06-22T03:28:46.937Z + * } + * false + * Stats { + * dev: 16777220, + * mode: 33188, + * nlink: 1, + * uid: 501, + * gid: 20, + * rdev: 0, + * blksize: 4096, + * ino: 14214074, + * size: 8, + * blocks: 8, + * atimeMs: 1561174616618.8555, + * mtimeMs: 1561174614584, + * ctimeMs: 1561174614583.8145, + * birthtimeMs: 1561174007710.7478, + * atime: 2019-06-22T03:36:56.619Z, + * mtime: 2019-06-22T03:36:54.584Z, + * ctime: 2019-06-22T03:36:54.584Z, + * birthtime: 2019-06-22T03:26:47.711Z + * } + * ``` + * @since v0.0.2 + */ + export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function stat( + path: PathLike, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void + ): void; + export function stat( + path: PathLike, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void + ): void; + export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; + export namespace stat { + /** + * Asynchronous stat(2) - Get file status. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__( + path: PathLike, + options?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function __promisify__( + path: PathLike, + options: StatOptions & { + bigint: true; + } + ): Promise; + function __promisify__(path: PathLike, options?: StatOptions): Promise; + } + export interface StatSyncFn extends Function { + (path: PathLike, options?: undefined): Stats; + ( + path: PathLike, + options?: StatSyncOptions & { + bigint?: false | undefined; + throwIfNoEntry: false; + } + ): Stats | undefined; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: true; + throwIfNoEntry: false; + } + ): BigIntStats | undefined; + ( + path: PathLike, + options?: StatSyncOptions & { + bigint?: false | undefined; + } + ): Stats; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: true; + } + ): BigIntStats; + ( + path: PathLike, + options: StatSyncOptions & { + bigint: boolean; + throwIfNoEntry?: false | undefined; + } + ): Stats | BigIntStats; + (path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined; + } + /** + * Synchronous stat(2) - Get file status. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export const statSync: StatSyncFn; + /** + * Invokes the callback with the `fs.Stats` for the file descriptor. + * + * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. + * @since v0.1.95 + */ + export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function fstat( + fd: number, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void + ): void; + export function fstat( + fd: number, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void + ): void; + export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; + export namespace fstat { + /** + * Asynchronous fstat(2) - Get file status. + * @param fd A file descriptor. + */ + function __promisify__( + fd: number, + options?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function __promisify__( + fd: number, + options: StatOptions & { + bigint: true; + } + ): Promise; + function __promisify__(fd: number, options?: StatOptions): Promise; + } + /** + * Retrieves the `fs.Stats` for the file descriptor. + * + * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. + * @since v0.1.95 + */ + export function fstatSync( + fd: number, + options?: StatOptions & { + bigint?: false | undefined; + } + ): Stats; + export function fstatSync( + fd: number, + options: StatOptions & { + bigint: true; + } + ): BigIntStats; + export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats; + /** + * Retrieves the `fs.Stats` for the symbolic link referred to by the path. + * The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic + * link, then the link itself is stat-ed, not the file that it refers to. + * + * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details. + * @since v0.1.30 + */ + export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; + export function lstat( + path: PathLike, + options: + | (StatOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void + ): void; + export function lstat( + path: PathLike, + options: StatOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void + ): void; + export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void; + export namespace lstat { + /** + * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__( + path: PathLike, + options?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function __promisify__( + path: PathLike, + options: StatOptions & { + bigint: true; + } + ): Promise; + function __promisify__(path: PathLike, options?: StatOptions): Promise; + } + /** + * Asynchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which + * contains `path`. The callback gets two arguments `(err, stats)` where `stats`is an `fs.StatFs` object. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * @since v19.6.0, v18.15.0 + * @param path A path to an existing file or directory on the file system to be queried. + */ + export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void; + export function statfs( + path: PathLike, + options: + | (StatFsOptions & { + bigint?: false | undefined; + }) + | undefined, + callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void + ): void; + export function statfs( + path: PathLike, + options: StatFsOptions & { + bigint: true; + }, + callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void + ): void; + export function statfs(path: PathLike, options: StatFsOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void): void; + export namespace statfs { + /** + * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an object. + * @param path A path to an existing file or directory on the file system to be queried. + */ + function __promisify__( + path: PathLike, + options?: StatFsOptions & { + bigint?: false | undefined; + } + ): Promise; + function __promisify__( + path: PathLike, + options: StatFsOptions & { + bigint: true; + } + ): Promise; + function __promisify__(path: PathLike, options?: StatFsOptions): Promise; + } + /** + * Synchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which + * contains `path`. + * + * In case of an error, the `err.code` will be one of `Common System Errors`. + * @since v19.6.0, v18.15.0 + * @param path A path to an existing file or directory on the file system to be queried. + */ + export function statfsSync( + path: PathLike, + options?: StatFsOptions & { + bigint?: false | undefined; + } + ): StatsFs; + export function statfsSync( + path: PathLike, + options: StatFsOptions & { + bigint: true; + } + ): BigIntStatsFs; + export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs; + /** + * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export const lstatSync: StatSyncFn; + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than + * a possible + * exception are given to the completion callback. + * @since v0.1.31 + */ + export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; + export namespace link { + /** + * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. + * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; + } + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`. + * @since v0.1.31 + */ + export function linkSync(existingPath: PathLike, newPath: PathLike): void; + /** + * Creates the link called `path` pointing to `target`. No arguments other than a + * possible exception are given to the completion callback. + * + * See the POSIX [`symlink(2)`](http://man7.org/linux/man-pages/man2/symlink.2.html) documentation for more details. + * + * The `type` argument is only available on Windows and ignored on other platforms. + * It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is + * not a string, Node.js will autodetect `target` type and use `'file'` or `'dir'`. + * If the `target` does not exist, `'file'` will be used. Windows junction points + * require the destination path to be absolute. When using `'junction'`, the`target` argument will automatically be normalized to absolute path. Junction + * points on NTFS volumes can only point to directories. + * + * Relative targets are relative to the link's parent directory. + * + * ```js + * import { symlink } from 'node:fs'; + * + * symlink('./mew', './mewtwo', callback); + * ``` + * + * The above example creates a symbolic link `mewtwo` which points to `mew` in the + * same directory: + * + * ```bash + * $ tree . + * . + * ├── mew + * └── mewtwo -> ./mew + * ``` + * @since v0.1.31 + * @param [type='null'] + */ + export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void; + /** + * Asynchronous symlink(2) - Create a new symbolic link to an existing file. + * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. + * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + */ + export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; + export namespace symlink { + /** + * Asynchronous symlink(2) - Create a new symbolic link to an existing file. + * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. + * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). + * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. + */ + function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; + type Type = 'dir' | 'file' | 'junction'; + } + /** + * Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link symlink}. + * @since v0.1.31 + * @param [type='null'] + */ + export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; + /** + * Reads the contents of the symbolic link referred to by `path`. The callback gets + * two arguments `(err, linkString)`. + * + * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path passed to the callback. If the `encoding` is set to `'buffer'`, + * the link path returned will be passed as a `Buffer` object. + * @since v0.1.31 + */ + export function readlink(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlink(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlink(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void; + export namespace readlink { + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + } + /** + * Returns the symbolic link's string value. + * + * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path returned. If the `encoding` is set to `'buffer'`, + * the link path returned will be passed as a `Buffer` object. + * @since v0.1.31 + */ + export function readlinkSync(path: PathLike, options?: EncodingOption): string; + /** + * Synchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer; + /** + * Synchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer; + /** + * Asynchronously computes the canonical pathname by resolving `.`, `..`, and + * symbolic links. + * + * A canonical pathname is not necessarily unique. Hard links and bind mounts can + * expose a file system entity through many pathnames. + * + * This function behaves like [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html), with some exceptions: + * + * 1. No case conversion is performed on case-insensitive file systems. + * 2. The maximum number of symbolic links is platform-independent and generally + * (much) higher than what the native [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html) implementation supports. + * + * The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd`to resolve relative paths. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path passed to the callback. If the `encoding` is set to `'buffer'`, + * the path returned will be passed as a `Buffer` object. + * + * If `path` resolves to a socket or a pipe, the function will return a system + * dependent name for that object. + * @since v0.1.31 + */ + export function realpath(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpath(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpath(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; + export namespace realpath { + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(path: PathLike, options?: EncodingOption): Promise; + /** + * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html). + * + * The `callback` gets two arguments `(err, resolvedPath)`. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path passed to the callback. If the `encoding` is set to `'buffer'`, + * the path returned will be passed as a `Buffer` object. + * + * On Linux, when Node.js is linked against musl libc, the procfs file system must + * be mounted on `/proc` in order for this function to work. Glibc does not have + * this restriction. + * @since v9.2.0 + */ + function native(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; + function native(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void; + function native(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void; + function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void; + } + /** + * Returns the resolved pathname. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link realpath}. + * @since v0.1.31 + */ + export function realpathSync(path: PathLike, options?: EncodingOption): string; + /** + * Synchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer; + /** + * Synchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer; + export namespace realpathSync { + function native(path: PathLike, options?: EncodingOption): string; + function native(path: PathLike, options: BufferEncodingOption): Buffer; + function native(path: PathLike, options?: EncodingOption): string | Buffer; + } + /** + * Asynchronously removes a file or symbolic link. No arguments other than a + * possible exception are given to the completion callback. + * + * ```js + * import { unlink } from 'node:fs'; + * // Assuming that 'path/file.txt' is a regular file. + * unlink('path/file.txt', (err) => { + * if (err) throw err; + * console.log('path/file.txt was deleted'); + * }); + * ``` + * + * `fs.unlink()` will not work on a directory, empty or otherwise. To remove a + * directory, use {@link rmdir}. + * + * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details. + * @since v0.0.2 + */ + export function unlink(path: PathLike, callback: NoParamCallback): void; + export namespace unlink { + /** + * Asynchronous unlink(2) - delete a name and possibly the file it refers to. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike): Promise; + } + /** + * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`. + * @since v0.1.21 + */ + export function unlinkSync(path: PathLike): void; + export interface RmDirOptions { + /** + * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + * `EPERM` error is encountered, Node.js will retry the operation with a linear + * backoff wait of `retryDelay` ms longer on each try. This option represents the + * number of retries. This option is ignored if the `recursive` option is not + * `true`. + * @default 0 + */ + maxRetries?: number | undefined; + /** + * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning + * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file. + * Use `fs.rm(path, { recursive: true, force: true })` instead. + * + * If `true`, perform a recursive directory removal. In + * recursive mode, operations are retried on failure. + * @default false + */ + recursive?: boolean | undefined; + /** + * The amount of time in milliseconds to wait between retries. + * This option is ignored if the `recursive` option is not `true`. + * @default 100 + */ + retryDelay?: number | undefined; + } + /** + * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given + * to the completion callback. + * + * Using `fs.rmdir()` on a file (not a directory) results in an `ENOENT` error on + * Windows and an `ENOTDIR` error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`. + * @since v0.0.2 + */ + export function rmdir(path: PathLike, callback: NoParamCallback): void; + export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; + export namespace rmdir { + /** + * Asynchronous rmdir(2) - delete a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function __promisify__(path: PathLike, options?: RmDirOptions): Promise; + } + /** + * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`. + * + * Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error + * on Windows and an `ENOTDIR` error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`. + * @since v0.1.21 + */ + export function rmdirSync(path: PathLike, options?: RmDirOptions): void; + export interface RmOptions { + /** + * When `true`, exceptions will be ignored if `path` does not exist. + * @default false + */ + force?: boolean | undefined; + /** + * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + * `EPERM` error is encountered, Node.js will retry the operation with a linear + * backoff wait of `retryDelay` ms longer on each try. This option represents the + * number of retries. This option is ignored if the `recursive` option is not + * `true`. + * @default 0 + */ + maxRetries?: number | undefined; + /** + * If `true`, perform a recursive directory removal. In + * recursive mode, operations are retried on failure. + * @default false + */ + recursive?: boolean | undefined; + /** + * The amount of time in milliseconds to wait between retries. + * This option is ignored if the `recursive` option is not `true`. + * @default 100 + */ + retryDelay?: number | undefined; + } + /** + * Asynchronously removes files and directories (modeled on the standard POSIX `rm`utility). No arguments other than a possible exception are given to the + * completion callback. + * @since v14.14.0 + */ + export function rm(path: PathLike, callback: NoParamCallback): void; + export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void; + export namespace rm { + /** + * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). + */ + function __promisify__(path: PathLike, options?: RmOptions): Promise; + } + /** + * Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). Returns `undefined`. + * @since v14.14.0 + */ + export function rmSync(path: PathLike, options?: RmOptions): void; + export interface MakeDirectoryOptions { + /** + * Indicates whether parent folders should be created. + * If a folder was created, the path to the first created folder will be returned. + * @default false + */ + recursive?: boolean | undefined; + /** + * A file mode. If a string is passed, it is parsed as an octal integer. If not specified + * @default 0o777 + */ + mode?: Mode | undefined; + } + /** + * Asynchronously creates a directory. + * + * The callback is given a possible exception and, if `recursive` is `true`, the + * first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was + * created (for instance, if it was previously created). + * + * The optional `options` argument can be an integer specifying `mode` (permission + * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fs.mkdir()` when `path` is a directory that + * exists results in an error only + * when `recursive` is false. If `recursive` is false and the directory exists, + * an `EEXIST` error occurs. + * + * ```js + * import { mkdir } from 'node:fs'; + * + * // Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist. + * mkdir('./tmp/a/apple', { recursive: true }, (err) => { + * if (err) throw err; + * }); + * ``` + * + * On Windows, using `fs.mkdir()` on the root directory even with recursion will + * result in an error: + * + * ```js + * import { mkdir } from 'node:fs'; + * + * mkdir('/', { recursive: true }, (err) => { + * // => [Error: EPERM: operation not permitted, mkdir 'C:\'] + * }); + * ``` + * + * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. + * @since v0.1.8 + */ + export function mkdir( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + }, + callback: (err: NodeJS.ErrnoException | null, path?: string) => void + ): void; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdir( + path: PathLike, + options: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + | undefined, + callback: NoParamCallback + ): void; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdir(path: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void; + /** + * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function mkdir(path: PathLike, callback: NoParamCallback): void; + export namespace mkdir { + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + } + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function __promisify__(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; + } + /** + * Synchronously creates a directory. Returns `undefined`, or if `recursive` is`true`, the first directory path created. + * This is the synchronous version of {@link mkdir}. + * + * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. + * @since v0.1.21 + */ + export function mkdirSync( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + } + ): string | undefined; + /** + * Synchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdirSync( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + ): void; + /** + * Synchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined; + /** + * Creates a unique temporary directory. + * + * Generates six random characters to be appended behind a required`prefix` to create a unique temporary directory. Due to platform + * inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, + * notably the BSDs, can return more than six random characters, and replace + * trailing `X` characters in `prefix` with random characters. + * + * The created directory path is passed as a string to the callback's second + * parameter. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * + * ```js + * import { mkdtemp } from 'node:fs'; + * import { join } from 'node:path'; + * import { tmpdir } from 'node:os'; + * + * mkdtemp(join(tmpdir(), 'foo-'), (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2 + * }); + * ``` + * + * The `fs.mkdtemp()` method will append the six randomly selected characters + * directly to the `prefix` string. For instance, given a directory `/tmp`, if the + * intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator + * (`require('node:path').sep`). + * + * ```js + * import { tmpdir } from 'node:os'; + * import { mkdtemp } from 'node:fs'; + * + * // The parent directory for the new temporary directory + * const tmpDir = tmpdir(); + * + * // This method is *INCORRECT*: + * mkdtemp(tmpDir, (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Will print something similar to `/tmpabc123`. + * // A new temporary directory is created at the file system root + * // rather than *within* the /tmp directory. + * }); + * + * // This method is *CORRECT*: + * import { sep } from 'node:path'; + * mkdtemp(`${tmpDir}${sep}`, (err, directory) => { + * if (err) throw err; + * console.log(directory); + * // Will print something similar to `/tmp/abc123`. + * // A new temporary directory is created within + * // the /tmp directory. + * }); + * ``` + * @since v5.10.0 + */ + export function mkdtemp(prefix: string, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtemp( + prefix: string, + options: + | 'buffer' + | { + encoding: 'buffer'; + }, + callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void + ): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtemp(prefix: string, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + */ + export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; + export namespace mkdtemp { + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options?: EncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options: BufferEncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__(prefix: string, options?: EncodingOption): Promise; + } + /** + * Returns the created directory path. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link mkdtemp}. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * @since v5.10.0 + */ + export function mkdtempSync(prefix: string, options?: EncodingOption): string; + /** + * Synchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer; + /** + * Synchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer; + /** + * Reads the contents of a directory. The callback gets two arguments `(err, files)`where `files` is an array of the names of the files in the directory excluding`'.'` and `'..'`. + * + * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames passed to the callback. If the `encoding` is set to `'buffer'`, + * the filenames returned will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects. + * @since v0.1.8 + */ + export function readdir( + path: PathLike, + options: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, files: string[]) => void + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir( + path: PathLike, + options: + | { + encoding: 'buffer'; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | 'buffer', + callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir( + path: PathLike, + options: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void + ): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + export function readdir( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + }, + callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void + ): void; + export namespace readdir { + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options?: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | null + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options: + | 'buffer' + | { + encoding: 'buffer'; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function __promisify__( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent + */ + function __promisify__( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + } + ): Promise; + } + /** + * Reads the contents of the directory. + * + * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames returned. If the `encoding` is set to `'buffer'`, + * the filenames returned will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects. + * @since v0.1.21 + */ + export function readdirSync( + path: PathLike, + options?: + | { + encoding: BufferEncoding | null; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | BufferEncoding + | null + ): string[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync( + path: PathLike, + options: + | { + encoding: 'buffer'; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | 'buffer' + ): Buffer[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null + ): string[] | Buffer[]; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + export function readdirSync( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + } + ): Dirent[]; + /** + * Closes the file descriptor. No arguments other than a possible exception are + * given to the completion callback. + * + * Calling `fs.close()` on any file descriptor (`fd`) that is currently in use + * through any other `fs` operation may lead to undefined behavior. + * + * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. + * @since v0.0.2 + */ + export function close(fd: number, callback?: NoParamCallback): void; + export namespace close { + /** + * Asynchronous close(2) - close a file descriptor. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Closes the file descriptor. Returns `undefined`. + * + * Calling `fs.closeSync()` on any file descriptor (`fd`) that is currently in use + * through any other `fs` operation may lead to undefined behavior. + * + * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. + * @since v0.1.21 + */ + export function closeSync(fd: number): void; + /** + * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details. + * + * `mode` sets the file mode (permission and sticky bits), but only if the file was + * created. On Windows, only the write permission can be manipulated; see {@link chmod}. + * + * The callback gets two arguments `(err, fd)`. + * + * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented + * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains + * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). + * + * Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc. + * @since v0.0.2 + * @param [flags='r'] See `support of file system `flags``. + * @param [mode=0o666] + */ + export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; + /** + * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param [flags='r'] See `support of file system `flags``. + */ + export function open(path: PathLike, flags: OpenMode | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; + /** + * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; + export namespace open { + /** + * Asynchronous open(2) - open and possibly create a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. + */ + function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise; + } + /** + * Returns an integer representing the file descriptor. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link open}. + * @since v0.1.21 + * @param [flags='r'] + * @param [mode=0o666] + */ + export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number; + /** + * Change the file system timestamps of the object referenced by `path`. + * + * The `atime` and `mtime` arguments follow these rules: + * + * * Values can be either numbers representing Unix epoch time in seconds,`Date`s, or a numeric string like `'123456789.0'`. + * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown. + * @since v0.4.2 + */ + export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace utimes { + /** + * Asynchronously change file timestamps of the file referenced by the supplied path. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Returns `undefined`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link utimes}. + * @since v0.4.2 + */ + export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; + /** + * Change the file system timestamps of the object referenced by the supplied file + * descriptor. See {@link utimes}. + * @since v0.4.2 + */ + export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; + export namespace futimes { + /** + * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function __promisify__(fd: number, atime: TimeLike, mtime: TimeLike): Promise; + } + /** + * Synchronous version of {@link futimes}. Returns `undefined`. + * @since v0.4.2 + */ + export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void; + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. No arguments other + * than a possible exception are given to the completion callback. + * @since v0.1.96 + */ + export function fsync(fd: number, callback: NoParamCallback): void; + export namespace fsync { + /** + * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`. + * @since v0.1.96 + */ + export function fsyncSync(fd: number): void; + /** + * Write `buffer` to the file specified by `fd`. + * + * `offset` determines the part of the buffer to be written, and `length` is + * an integer specifying the number of bytes to write. + * + * `position` refers to the offset from the beginning of the file where this data + * should be written. If `typeof position !== 'number'`, the data will be written + * at the current position. See [`pwrite(2)`](http://man7.org/linux/man-pages/man2/pwrite.2.html). + * + * The callback will be given three arguments `(err, bytesWritten, buffer)` where`bytesWritten` specifies how many _bytes_ were written from `buffer`. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesWritten` and `buffer` properties. + * + * It is unsafe to use `fs.write()` multiple times on the same file without waiting + * for the callback. For this scenario, {@link createWriteStream} is + * recommended. + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v0.0.2 + * @param [offset=0] + * @param [length=buffer.byteLength - offset] + * @param [position='null'] + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + length: number | undefined | null, + position: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + length: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + */ + export function write( + fd: number, + buffer: TBuffer, + offset: number | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void + ): void; + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + */ + export function write(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + export function write( + fd: number, + string: string, + position: number | undefined | null, + encoding: BufferEncoding | undefined | null, + callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void + ): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + */ + export function write(fd: number, string: string, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + */ + export function write(fd: number, string: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; + export namespace write { + /** + * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + */ + function __promisify__( + fd: number, + buffer?: TBuffer, + offset?: number, + length?: number, + position?: number | null + ): Promise<{ + bytesWritten: number; + buffer: TBuffer; + }>; + /** + * Asynchronously writes `string` to the file referenced by the supplied file descriptor. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + function __promisify__( + fd: number, + string: string, + position?: number | null, + encoding?: BufferEncoding | null + ): Promise<{ + bytesWritten: number; + buffer: string; + }>; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link write}. + * @since v0.1.21 + * @param [offset=0] + * @param [length=buffer.byteLength - offset] + * @param [position='null'] + * @return The number of bytes written. + */ + export function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number; + /** + * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. + * @param fd A file descriptor. + * @param string A string to write. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number; + export type ReadPosition = number | bigint; + export interface ReadSyncOptions { + /** + * @default 0 + */ + offset?: number | undefined; + /** + * @default `length of buffer` + */ + length?: number | undefined; + /** + * @default null + */ + position?: ReadPosition | null | undefined; + } + export interface ReadAsyncOptions extends ReadSyncOptions { + buffer?: TBuffer; + } + /** + * Read data from the file specified by `fd`. + * + * The callback is given the three arguments, `(err, bytesRead, buffer)`. + * + * If the file is not modified concurrently, the end-of-file is reached when the + * number of bytes read is zero. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesRead` and `buffer` properties. + * @since v0.0.2 + * @param buffer The buffer that the data will be written to. + * @param offset The position in `buffer` to write the data to. + * @param length The number of bytes to read. + * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If + * `position` is an integer, the file position will be unchanged. + */ + export function read( + fd: number, + buffer: TBuffer, + offset: number, + length: number, + position: ReadPosition | null, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void + ): void; + /** + * Similar to the above `fs.read` function, this version takes an optional `options` object. + * If not otherwise specified in an `options` object, + * `buffer` defaults to `Buffer.alloc(16384)`, + * `offset` defaults to `0`, + * `length` defaults to `buffer.byteLength`, `- offset` as of Node 17.6.0 + * `position` defaults to `null` + * @since v12.17.0, 13.11.0 + */ + export function read( + fd: number, + options: ReadAsyncOptions, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void + ): void; + export function read(fd: number, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void): void; + export namespace read { + /** + * @param fd A file descriptor. + * @param buffer The buffer that the data will be written to. + * @param offset The offset in the buffer at which to start writing. + * @param length The number of bytes to read. + * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. + */ + function __promisify__( + fd: number, + buffer: TBuffer, + offset: number, + length: number, + position: number | null + ): Promise<{ + bytesRead: number; + buffer: TBuffer; + }>; + function __promisify__( + fd: number, + options: ReadAsyncOptions + ): Promise<{ + bytesRead: number; + buffer: TBuffer; + }>; + function __promisify__(fd: number): Promise<{ + bytesRead: number; + buffer: NodeJS.ArrayBufferView; + }>; + } + /** + * Returns the number of `bytesRead`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link read}. + * @since v0.1.21 + * @param [position='null'] + */ + export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: ReadPosition | null): number; + /** + * Similar to the above `fs.readSync` function, this version takes an optional `options` object. + * If no `options` object is specified, it will default with the above values. + */ + export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number; + /** + * Asynchronously reads the entire contents of a file. + * + * ```js + * import { readFile } from 'node:fs'; + * + * readFile('/etc/passwd', (err, data) => { + * if (err) throw err; + * console.log(data); + * }); + * ``` + * + * The callback is passed two arguments `(err, data)`, where `data` is the + * contents of the file. + * + * If no encoding is specified, then the raw buffer is returned. + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { readFile } from 'node:fs'; + * + * readFile('/etc/passwd', 'utf8', callback); + * ``` + * + * When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an + * error will be returned. On FreeBSD, a representation of the directory's contents + * will be returned. + * + * ```js + * import { readFile } from 'node:fs'; + * + * // macOS, Linux, and Windows + * readFile('', (err, data) => { + * // => [Error: EISDIR: illegal operation on a directory, read ] + * }); + * + * // FreeBSD + * readFile('', (err, data) => { + * // => null, + * }); + * ``` + * + * It is possible to abort an ongoing request using an `AbortSignal`. If a + * request is aborted the callback is called with an `AbortError`: + * + * ```js + * import { readFile } from 'node:fs'; + * + * const controller = new AbortController(); + * const signal = controller.signal; + * readFile(fileInfo[0].name, { signal }, (err, buf) => { + * // ... + * }); + * // When you want to abort the request + * controller.abort(); + * ``` + * + * The `fs.readFile()` function buffers the entire file. To minimize memory costs, + * when possible prefer streaming via `fs.createReadStream()`. + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.readFile` performs. + * @since v0.1.29 + * @param path filename or file descriptor + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | ({ + encoding?: null | undefined; + flag?: string | undefined; + } & Abortable) + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | ({ + encoding: BufferEncoding; + flag?: string | undefined; + } & Abortable) + | BufferEncoding, + callback: (err: NodeJS.ErrnoException | null, data: string) => void + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFile( + path: PathOrFileDescriptor, + options: + | (ObjectEncodingOptions & { + flag?: string | undefined; + } & Abortable) + | BufferEncoding + | undefined + | null, + callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void + ): void; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + */ + export function readFile(path: PathOrFileDescriptor, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; + export namespace readFile { + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options?: { + encoding?: null | undefined; + flag?: string | undefined; + } | null + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options: + | { + encoding: BufferEncoding; + flag?: string | undefined; + } + | BufferEncoding + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function __promisify__( + path: PathOrFileDescriptor, + options?: + | (ObjectEncodingOptions & { + flag?: string | undefined; + }) + | BufferEncoding + | null + ): Promise; + } + /** + * Returns the contents of the `path`. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link readFile}. + * + * If the `encoding` option is specified then this function returns a + * string. Otherwise it returns a buffer. + * + * Similar to {@link readFile}, when the path is a directory, the behavior of`fs.readFileSync()` is platform-specific. + * + * ```js + * import { readFileSync } from 'node:fs'; + * + * // macOS, Linux, and Windows + * readFileSync(''); + * // => [Error: EISDIR: illegal operation on a directory, read ] + * + * // FreeBSD + * readFileSync(''); // => + * ``` + * @since v0.1.8 + * @param path filename or file descriptor + */ + export function readFileSync( + path: PathOrFileDescriptor, + options?: { + encoding?: null | undefined; + flag?: string | undefined; + } | null + ): Buffer; + /** + * Synchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFileSync( + path: PathOrFileDescriptor, + options: + | { + encoding: BufferEncoding; + flag?: string | undefined; + } + | BufferEncoding + ): string; + /** + * Synchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + export function readFileSync( + path: PathOrFileDescriptor, + options?: + | (ObjectEncodingOptions & { + flag?: string | undefined; + }) + | BufferEncoding + | null + ): string | Buffer; + export type WriteFileOptions = + | (ObjectEncodingOptions & + Abortable & { + mode?: Mode | undefined; + flag?: string | undefined; + }) + | BufferEncoding + | null; + /** + * When `file` is a filename, asynchronously writes data to the file, replacing the + * file if it already exists. `data` can be a string or a buffer. + * + * When `file` is a file descriptor, the behavior is similar to calling`fs.write()` directly (which is recommended). See the notes below on using + * a file descriptor. + * + * The `encoding` option is ignored if `data` is a buffer. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { writeFile } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * writeFile('message.txt', data, (err) => { + * if (err) throw err; + * console.log('The file has been saved!'); + * }); + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { writeFile } from 'node:fs'; + * + * writeFile('message.txt', 'Hello Node.js', 'utf8', callback); + * ``` + * + * It is unsafe to use `fs.writeFile()` multiple times on the same file without + * waiting for the callback. For this scenario, {@link createWriteStream} is + * recommended. + * + * Similarly to `fs.readFile` \- `fs.writeFile` is a convenience method that + * performs multiple `write` calls internally to write the buffer passed to it. + * For performance sensitive code consider using {@link createWriteStream}. + * + * It is possible to use an `AbortSignal` to cancel an `fs.writeFile()`. + * Cancelation is "best effort", and some amount of data is likely still + * to be written. + * + * ```js + * import { writeFile } from 'node:fs'; + * import { Buffer } from 'node:buffer'; + * + * const controller = new AbortController(); + * const { signal } = controller; + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * writeFile('message.txt', data, { signal }, (err) => { + * // When a request is aborted - the callback is called with an AbortError + * }); + * // When the request should be aborted + * controller.abort(); + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.writeFile` performs. + * @since v0.1.29 + * @param file filename or file descriptor + */ + export function writeFile(file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void; + /** + * Asynchronously writes data to a file, replacing the file if it already exists. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + */ + export function writeFile(path: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void; + export namespace writeFile { + /** + * Asynchronously writes data to a file, replacing the file if it already exists. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'w'` is used. + */ + function __promisify__(path: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise; + } + /** + * Returns `undefined`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link writeFile}. + * @since v0.1.29 + * @param file filename or file descriptor + */ + export function writeFileSync(file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): void; + /** + * Asynchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { appendFile } from 'node:fs'; + * + * appendFile('message.txt', 'data to append', (err) => { + * if (err) throw err; + * console.log('The "data to append" was appended to file!'); + * }); + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { appendFile } from 'node:fs'; + * + * appendFile('message.txt', 'data to append', 'utf8', callback); + * ``` + * + * The `path` may be specified as a numeric file descriptor that has been opened + * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will + * not be closed automatically. + * + * ```js + * import { open, close, appendFile } from 'node:fs'; + * + * function closeFd(fd) { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * + * open('message.txt', 'a', (err, fd) => { + * if (err) throw err; + * + * try { + * appendFile(fd, 'data to append', 'utf8', (err) => { + * closeFd(fd); + * if (err) throw err; + * }); + * } catch (err) { + * closeFd(fd); + * throw err; + * } + * }); + * ``` + * @since v0.6.7 + * @param path filename or file descriptor + */ + export function appendFile(path: PathOrFileDescriptor, data: string | Uint8Array, options: WriteFileOptions, callback: NoParamCallback): void; + /** + * Asynchronously append data to a file, creating the file if it does not exist. + * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + */ + export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void; + export namespace appendFile { + /** + * Asynchronously append data to a file, creating the file if it does not exist. + * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a file descriptor is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'a'` is used. + */ + function __promisify__(file: PathOrFileDescriptor, data: string | Uint8Array, options?: WriteFileOptions): Promise; + } + /** + * Synchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * The `mode` option only affects the newly created file. See {@link open} for more details. + * + * ```js + * import { appendFileSync } from 'node:fs'; + * + * try { + * appendFileSync('message.txt', 'data to append'); + * console.log('The "data to append" was appended to file!'); + * } catch (err) { + * // Handle the error + * } + * ``` + * + * If `options` is a string, then it specifies the encoding: + * + * ```js + * import { appendFileSync } from 'node:fs'; + * + * appendFileSync('message.txt', 'data to append', 'utf8'); + * ``` + * + * The `path` may be specified as a numeric file descriptor that has been opened + * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will + * not be closed automatically. + * + * ```js + * import { openSync, closeSync, appendFileSync } from 'node:fs'; + * + * let fd; + * + * try { + * fd = openSync('message.txt', 'a'); + * appendFileSync(fd, 'data to append', 'utf8'); + * } catch (err) { + * // Handle the error + * } finally { + * if (fd !== undefined) + * closeSync(fd); + * } + * ``` + * @since v0.6.7 + * @param path filename or file descriptor + */ + export function appendFileSync(path: PathOrFileDescriptor, data: string | Uint8Array, options?: WriteFileOptions): void; + /** + * Watch for changes on `filename`. The callback `listener` will be called each + * time the file is accessed. + * + * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates + * whether the process should continue to run as long as files are being watched. + * The `options` object may specify an `interval` property indicating how often the + * target should be polled in milliseconds. + * + * The `listener` gets two arguments the current stat object and the previous + * stat object: + * + * ```js + * import { watchFile } from 'fs'; + * + * watchFile('message.text', (curr, prev) => { + * console.log(`the current mtime is: ${curr.mtime}`); + * console.log(`the previous mtime was: ${prev.mtime}`); + * }); + * ``` + * + * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, + * the numeric values in these objects are specified as `BigInt`s. + * + * To be notified when the file was modified, not just accessed, it is necessary + * to compare `curr.mtimeMs` and `prev.mtimeMs`. + * + * When an `fs.watchFile` operation results in an `ENOENT` error, it + * will invoke the listener once, with all the fields zeroed (or, for dates, the + * Unix Epoch). If the file is created later on, the listener will be called + * again, with the latest stat objects. This is a change in functionality since + * v0.10. + * + * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible. + * + * When a file being watched by `fs.watchFile()` disappears and reappears, + * then the contents of `previous` in the second callback event (the file's + * reappearance) will be the same as the contents of `previous` in the first + * callback event (its disappearance). + * + * This happens when: + * + * * the file is deleted, followed by a restore + * * the file is renamed and then renamed a second time back to its original name + * @since v0.1.31 + */ + export interface WatchFileOptions { + bigint?: boolean | undefined; + persistent?: boolean | undefined; + interval?: number | undefined; + } + /** + * Watch for changes on `filename`. The callback `listener` will be called each + * time the file is accessed. + * + * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates + * whether the process should continue to run as long as files are being watched. + * The `options` object may specify an `interval` property indicating how often the + * target should be polled in milliseconds. + * + * The `listener` gets two arguments the current stat object and the previous + * stat object: + * + * ```js + * import { watchFile } from 'node:fs'; + * + * watchFile('message.text', (curr, prev) => { + * console.log(`the current mtime is: ${curr.mtime}`); + * console.log(`the previous mtime was: ${prev.mtime}`); + * }); + * ``` + * + * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, + * the numeric values in these objects are specified as `BigInt`s. + * + * To be notified when the file was modified, not just accessed, it is necessary + * to compare `curr.mtimeMs` and `prev.mtimeMs`. + * + * When an `fs.watchFile` operation results in an `ENOENT` error, it + * will invoke the listener once, with all the fields zeroed (or, for dates, the + * Unix Epoch). If the file is created later on, the listener will be called + * again, with the latest stat objects. This is a change in functionality since + * v0.10. + * + * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible. + * + * When a file being watched by `fs.watchFile()` disappears and reappears, + * then the contents of `previous` in the second callback event (the file's + * reappearance) will be the same as the contents of `previous` in the first + * callback event (its disappearance). + * + * This happens when: + * + * * the file is deleted, followed by a restore + * * the file is renamed and then renamed a second time back to its original name + * @since v0.1.31 + */ + export function watchFile( + filename: PathLike, + options: + | (WatchFileOptions & { + bigint?: false | undefined; + }) + | undefined, + listener: StatsListener + ): StatWatcher; + export function watchFile( + filename: PathLike, + options: + | (WatchFileOptions & { + bigint: true; + }) + | undefined, + listener: BigIntStatsListener + ): StatWatcher; + /** + * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher; + /** + * Stop watching for changes on `filename`. If `listener` is specified, only that + * particular listener is removed. Otherwise, _all_ listeners are removed, + * effectively stopping watching of `filename`. + * + * Calling `fs.unwatchFile()` with a filename that is not being watched is a + * no-op, not an error. + * + * Using {@link watch} is more efficient than `fs.watchFile()` and`fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()`and `fs.unwatchFile()` when possible. + * @since v0.1.31 + * @param listener Optional, a listener previously attached using `fs.watchFile()` + */ + export function unwatchFile(filename: PathLike, listener?: StatsListener): void; + export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void; + export interface WatchOptions extends Abortable { + encoding?: BufferEncoding | 'buffer' | undefined; + persistent?: boolean | undefined; + recursive?: boolean | undefined; + } + export type WatchEventType = 'rename' | 'change'; + export type WatchListener = (event: WatchEventType, filename: T | null) => void; + export type StatsListener = (curr: Stats, prev: Stats) => void; + export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void; + /** + * Watch for changes on `filename`, where `filename` is either a file or a + * directory. + * + * The second argument is optional. If `options` is provided as a string, it + * specifies the `encoding`. Otherwise `options` should be passed as an object. + * + * The listener callback gets two arguments `(eventType, filename)`. `eventType`is either `'rename'` or `'change'`, and `filename` is the name of the file + * which triggered the event. + * + * On most platforms, `'rename'` is emitted whenever a filename appears or + * disappears in the directory. + * + * The listener callback is attached to the `'change'` event fired by `fs.FSWatcher`, but it is not the same thing as the `'change'` value of`eventType`. + * + * If a `signal` is passed, aborting the corresponding AbortController will close + * the returned `fs.FSWatcher`. + * @since v0.5.10 + * @param listener + */ + export function watch( + filename: PathLike, + options: + | (WatchOptions & { + encoding: 'buffer'; + }) + | 'buffer', + listener?: WatchListener + ): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + export function watch(filename: PathLike, options?: WatchOptions | BufferEncoding | null, listener?: WatchListener): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + export function watch(filename: PathLike, options: WatchOptions | string, listener?: WatchListener): FSWatcher; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function watch(filename: PathLike, listener?: WatchListener): FSWatcher; + /** + * Test whether or not the given path exists by checking with the file system. + * Then call the `callback` argument with either true or false: + * + * ```js + * import { exists } from 'node:fs'; + * + * exists('/etc/passwd', (e) => { + * console.log(e ? 'it exists' : 'no passwd!'); + * }); + * ``` + * + * **The parameters for this callback are not consistent with other Node.js** + * **callbacks.** Normally, the first parameter to a Node.js callback is an `err`parameter, optionally followed by other parameters. The `fs.exists()` callback + * has only one boolean parameter. This is one reason `fs.access()` is recommended + * instead of `fs.exists()`. + * + * Using `fs.exists()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing + * so introduces a race condition, since other processes may change the file's + * state between the two calls. Instead, user code should open/read/write the + * file directly and handle the error raised if the file does not exist. + * + * **write (NOT RECOMMENDED)** + * + * ```js + * import { exists, open, close } from 'node:fs'; + * + * exists('myfile', (e) => { + * if (e) { + * console.error('myfile already exists'); + * } else { + * open('myfile', 'wx', (err, fd) => { + * if (err) throw err; + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * } + * }); + * ``` + * + * **write (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * open('myfile', 'wx', (err, fd) => { + * if (err) { + * if (err.code === 'EEXIST') { + * console.error('myfile already exists'); + * return; + * } + * + * throw err; + * } + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * **read (NOT RECOMMENDED)** + * + * ```js + * import { open, close, exists } from 'node:fs'; + * + * exists('myfile', (e) => { + * if (e) { + * open('myfile', 'r', (err, fd) => { + * if (err) throw err; + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * } else { + * console.error('myfile does not exist'); + * } + * }); + * ``` + * + * **read (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'r', (err, fd) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * The "not recommended" examples above check for existence and then use the + * file; the "recommended" examples are better because they use the file directly + * and handle the error, if any. + * + * In general, check for the existence of a file only if the file won't be + * used directly, for example when its existence is a signal from another + * process. + * @since v0.0.2 + * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead. + */ + export function exists(path: PathLike, callback: (exists: boolean) => void): void; + /** @deprecated */ + export namespace exists { + /** + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(path: PathLike): Promise; + } + /** + * Returns `true` if the path exists, `false` otherwise. + * + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link exists}. + * + * `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback`parameter to `fs.exists()` accepts parameters that are inconsistent with other + * Node.js callbacks. `fs.existsSync()` does not use a callback. + * + * ```js + * import { existsSync } from 'node:fs'; + * + * if (existsSync('/etc/passwd')) + * console.log('The path exists.'); + * ``` + * @since v0.1.21 + */ + export function existsSync(path: PathLike): boolean; + export namespace constants { + // File Access Constants + /** Constant for fs.access(). File is visible to the calling process. */ + const F_OK: number; + /** Constant for fs.access(). File can be read by the calling process. */ + const R_OK: number; + /** Constant for fs.access(). File can be written by the calling process. */ + const W_OK: number; + /** Constant for fs.access(). File can be executed by the calling process. */ + const X_OK: number; + // File Copy Constants + /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ + const COPYFILE_EXCL: number; + /** + * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. + * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. + */ + const COPYFILE_FICLONE: number; + /** + * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. + * If the underlying platform does not support copy-on-write, then the operation will fail with an error. + */ + const COPYFILE_FICLONE_FORCE: number; + // File Open Constants + /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ + const O_RDONLY: number; + /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ + const O_WRONLY: number; + /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ + const O_RDWR: number; + /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ + const O_CREAT: number; + /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ + const O_EXCL: number; + /** + * Constant for fs.open(). Flag indicating that if path identifies a terminal device, + * opening the path shall not cause that terminal to become the controlling terminal for the process + * (if the process does not already have one). + */ + const O_NOCTTY: number; + /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ + const O_TRUNC: number; + /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ + const O_APPEND: number; + /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ + const O_DIRECTORY: number; + /** + * constant for fs.open(). + * Flag indicating reading accesses to the file system will no longer result in + * an update to the atime information associated with the file. + * This flag is available on Linux operating systems only. + */ + const O_NOATIME: number; + /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ + const O_NOFOLLOW: number; + /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ + const O_SYNC: number; + /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ + const O_DSYNC: number; + /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ + const O_SYMLINK: number; + /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ + const O_DIRECT: number; + /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ + const O_NONBLOCK: number; + // File Type Constants + /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ + const S_IFMT: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ + const S_IFREG: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ + const S_IFDIR: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ + const S_IFCHR: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ + const S_IFBLK: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ + const S_IFIFO: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ + const S_IFLNK: number; + /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ + const S_IFSOCK: number; + // File Mode Constants + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ + const S_IRWXU: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ + const S_IRUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ + const S_IWUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ + const S_IXUSR: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ + const S_IRWXG: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ + const S_IRGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ + const S_IWGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ + const S_IXGRP: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ + const S_IRWXO: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ + const S_IROTH: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ + const S_IWOTH: number; + /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ + const S_IXOTH: number; + /** + * When set, a memory file mapping is used to access the file. This flag + * is available on Windows operating systems only. On other operating systems, + * this flag is ignored. + */ + const UV_FS_O_FILEMAP: number; + } + /** + * Tests a user's permissions for the file or directory specified by `path`. + * The `mode` argument is an optional integer that specifies the accessibility + * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK` + * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * The final argument, `callback`, is a callback function that is invoked with + * a possible error argument. If any of the accessibility checks fail, the error + * argument will be an `Error` object. The following examples check if`package.json` exists, and if it is readable or writable. + * + * ```js + * import { access, constants } from 'node:fs'; + * + * const file = 'package.json'; + * + * // Check if the file exists in the current directory. + * access(file, constants.F_OK, (err) => { + * console.log(`${file} ${err ? 'does not exist' : 'exists'}`); + * }); + * + * // Check if the file is readable. + * access(file, constants.R_OK, (err) => { + * console.log(`${file} ${err ? 'is not readable' : 'is readable'}`); + * }); + * + * // Check if the file is writable. + * access(file, constants.W_OK, (err) => { + * console.log(`${file} ${err ? 'is not writable' : 'is writable'}`); + * }); + * + * // Check if the file is readable and writable. + * access(file, constants.R_OK | constants.W_OK, (err) => { + * console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`); + * }); + * ``` + * + * Do not use `fs.access()` to check for the accessibility of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()`. Doing + * so introduces a race condition, since other processes may change the file's + * state between the two calls. Instead, user code should open/read/write the + * file directly and handle the error raised if the file is not accessible. + * + * **write (NOT RECOMMENDED)** + * + * ```js + * import { access, open, close } from 'node:fs'; + * + * access('myfile', (err) => { + * if (!err) { + * console.error('myfile already exists'); + * return; + * } + * + * open('myfile', 'wx', (err, fd) => { + * if (err) throw err; + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * }); + * ``` + * + * **write (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'wx', (err, fd) => { + * if (err) { + * if (err.code === 'EEXIST') { + * console.error('myfile already exists'); + * return; + * } + * + * throw err; + * } + * + * try { + * writeMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * **read (NOT RECOMMENDED)** + * + * ```js + * import { access, open, close } from 'node:fs'; + * access('myfile', (err) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * open('myfile', 'r', (err, fd) => { + * if (err) throw err; + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * }); + * ``` + * + * **read (RECOMMENDED)** + * + * ```js + * import { open, close } from 'node:fs'; + * + * open('myfile', 'r', (err, fd) => { + * if (err) { + * if (err.code === 'ENOENT') { + * console.error('myfile does not exist'); + * return; + * } + * + * throw err; + * } + * + * try { + * readMyData(fd); + * } finally { + * close(fd, (err) => { + * if (err) throw err; + * }); + * } + * }); + * ``` + * + * The "not recommended" examples above check for accessibility and then use the + * file; the "recommended" examples are better because they use the file directly + * and handle the error, if any. + * + * In general, check for the accessibility of a file only if the file will not be + * used directly, for example when its accessibility is a signal from another + * process. + * + * On Windows, access-control policies (ACLs) on a directory may limit access to + * a file or directory. The `fs.access()` function, however, does not check the + * ACL and therefore may report that a path is accessible even if the ACL restricts + * the user from reading or writing to it. + * @since v0.11.15 + * @param [mode=fs.constants.F_OK] + */ + export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; + /** + * Asynchronously tests a user's permissions for the file specified by path. + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + */ + export function access(path: PathLike, callback: NoParamCallback): void; + export namespace access { + /** + * Asynchronously tests a user's permissions for the file specified by path. + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function __promisify__(path: PathLike, mode?: number): Promise; + } + /** + * Synchronously tests a user's permissions for the file or directory specified + * by `path`. The `mode` argument is an optional integer that specifies the + * accessibility checks to be performed. `mode` should be either the value`fs.constants.F_OK` or a mask consisting of the bitwise OR of any of`fs.constants.R_OK`, `fs.constants.W_OK`, and + * `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * If any of the accessibility checks fail, an `Error` will be thrown. Otherwise, + * the method will return `undefined`. + * + * ```js + * import { accessSync, constants } from 'node:fs'; + * + * try { + * accessSync('etc/passwd', constants.R_OK | constants.W_OK); + * console.log('can read/write'); + * } catch (err) { + * console.error('no access!'); + * } + * ``` + * @since v0.11.15 + * @param [mode=fs.constants.F_OK] + */ + export function accessSync(path: PathLike, mode?: number): void; + interface StreamOptions { + flags?: string | undefined; + encoding?: BufferEncoding | undefined; + fd?: number | promises.FileHandle | undefined; + mode?: number | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + signal?: AbortSignal | null | undefined; + } + interface FSImplementation { + open?: (...args: any[]) => any; + close?: (...args: any[]) => any; + } + interface CreateReadStreamFSImplementation extends FSImplementation { + read: (...args: any[]) => any; + } + interface CreateWriteStreamFSImplementation extends FSImplementation { + write: (...args: any[]) => any; + writev?: (...args: any[]) => any; + } + interface ReadStreamOptions extends StreamOptions { + fs?: CreateReadStreamFSImplementation | null | undefined; + end?: number | undefined; + highWaterMark?: number | undefined; + } + interface WriteStreamOptions extends StreamOptions { + fs?: CreateWriteStreamFSImplementation | null | undefined; + } + /** + * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream + * returned by this method has a default `highWaterMark` of 64 KiB. + * + * `options` can include `start` and `end` values to read a range of bytes from + * the file instead of the entire file. Both `start` and `end` are inclusive and + * start counting at 0, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `fd` is specified and `start` is + * omitted or `undefined`, `fs.createReadStream()` reads sequentially from the + * current file position. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `fd` is specified, `ReadStream` will ignore the `path` argument and will use + * the specified file descriptor. This means that no `'open'` event will be + * emitted. `fd` should be blocking; non-blocking `fd`s should be passed to `net.Socket`. + * + * If `fd` points to a character device that only supports blocking reads + * (such as keyboard or sound card), read operations do not finish until data is + * available. This can prevent the process from exiting and the stream from + * closing naturally. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * By providing the `fs` option, it is possible to override the corresponding `fs`implementations for `open`, `read`, and `close`. When providing the `fs` option, + * an override for `read` is required. If no `fd` is provided, an override for`open` is also required. If `autoClose` is `true`, an override for `close` is + * also required. + * + * ```js + * import { createReadStream } from 'node:fs'; + * + * // Create a stream from some character device. + * const stream = createReadStream('/dev/input/event0'); + * setTimeout(() => { + * stream.close(); // This may not close the stream. + * // Artificially marking end-of-stream, as if the underlying resource had + * // indicated end-of-file by itself, allows the stream to close. + * // This does not cancel pending read operations, and if there is such an + * // operation, the process may still not be able to exit successfully + * // until it finishes. + * stream.push(null); + * stream.read(0); + * }, 100); + * ``` + * + * If `autoClose` is false, then the file descriptor won't be closed, even if + * there's an error. It is the application's responsibility to close it and make + * sure there's no file descriptor leak. If `autoClose` is set to true (default + * behavior), on `'error'` or `'end'` the file descriptor will be closed + * automatically. + * + * `mode` sets the file mode (permission and sticky bits), but only if the + * file was created. + * + * An example to read the last 10 bytes of a file which is 100 bytes long: + * + * ```js + * import { createReadStream } from 'node:fs'; + * + * createReadStream('sample.txt', { start: 90, end: 99 }); + * ``` + * + * If `options` is a string, then it specifies the encoding. + * @since v0.1.31 + */ + export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream; + /** + * `options` may also include a `start` option to allow writing data at some + * position past the beginning of the file, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than + * replacing it may require the `flags` option to be set to `r+` rather than the + * default `w`. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false, + * then the file descriptor won't be closed, even if there's an error. + * It is the application's responsibility to close it and make sure there's no + * file descriptor leak. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * By providing the `fs` option it is possible to override the corresponding `fs`implementations for `open`, `write`, `writev`, and `close`. Overriding `write()`without `writev()` can reduce + * performance as some optimizations (`_writev()`) + * will be disabled. When providing the `fs` option, overrides for at least one of`write` and `writev` are required. If no `fd` option is supplied, an override + * for `open` is also required. If `autoClose` is `true`, an override for `close`is also required. + * + * Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the`path` argument and will use the specified file descriptor. This means that no`'open'` event will be + * emitted. `fd` should be blocking; non-blocking `fd`s + * should be passed to `net.Socket`. + * + * If `options` is a string, then it specifies the encoding. + * @since v0.1.31 + */ + export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream; + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other + * than a possible + * exception are given to the completion callback. + * @since v0.1.96 + */ + export function fdatasync(fd: number, callback: NoParamCallback): void; + export namespace fdatasync { + /** + * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + * @param fd A file descriptor. + */ + function __promisify__(fd: number): Promise; + } + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`. + * @since v0.1.96 + */ + export function fdatasyncSync(fd: number): void; + /** + * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. No arguments other than a possible exception are given to the + * callback function. Node.js makes no guarantees about the atomicity of the copy + * operation. If an error occurs after the destination file has been opened for + * writing, Node.js will attempt to remove the destination. + * + * `mode` is an optional integer that specifies the behavior + * of the copy operation. It is possible to create a mask consisting of the bitwise + * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). + * + * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already + * exists. + * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a + * copy-on-write reflink. If the platform does not support copy-on-write, then a + * fallback copy mechanism is used. + * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to + * create a copy-on-write reflink. If the platform does not support + * copy-on-write, then the operation will fail. + * + * ```js + * import { copyFile, constants } from 'node:fs'; + * + * function callback(err) { + * if (err) throw err; + * console.log('source.txt was copied to destination.txt'); + * } + * + * // destination.txt will be created or overwritten by default. + * copyFile('source.txt', 'destination.txt', callback); + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL, callback); + * ``` + * @since v8.5.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] modifiers for copy operation. + */ + export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; + export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void; + export namespace copyFile { + function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise; + } + /** + * Synchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. Returns `undefined`. Node.js makes no guarantees about the + * atomicity of the copy operation. If an error occurs after the destination file + * has been opened for writing, Node.js will attempt to remove the destination. + * + * `mode` is an optional integer that specifies the behavior + * of the copy operation. It is possible to create a mask consisting of the bitwise + * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). + * + * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already + * exists. + * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a + * copy-on-write reflink. If the platform does not support copy-on-write, then a + * fallback copy mechanism is used. + * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to + * create a copy-on-write reflink. If the platform does not support + * copy-on-write, then the operation will fail. + * + * ```js + * import { copyFileSync, constants } from 'node:fs'; + * + * // destination.txt will be created or overwritten by default. + * copyFileSync('source.txt', 'destination.txt'); + * console.log('source.txt was copied to destination.txt'); + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * copyFileSync('source.txt', 'destination.txt', constants.COPYFILE_EXCL); + * ``` + * @since v8.5.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] modifiers for copy operation. + */ + export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void; + /** + * Write an array of `ArrayBufferView`s to the file specified by `fd` using`writev()`. + * + * `position` is the offset from the beginning of the file where this data + * should be written. If `typeof position !== 'number'`, the data will be written + * at the current position. + * + * The callback will be given three arguments: `err`, `bytesWritten`, and`buffers`. `bytesWritten` is how many bytes were written from `buffers`. + * + * If this method is `util.promisify()` ed, it returns a promise for an`Object` with `bytesWritten` and `buffers` properties. + * + * It is unsafe to use `fs.writev()` multiple times on the same file without + * waiting for the callback. For this scenario, use {@link createWriteStream}. + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v12.9.0 + * @param [position='null'] + */ + export function writev(fd: number, buffers: ReadonlyArray, cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void): void; + export function writev( + fd: number, + buffers: ReadonlyArray, + position: number, + cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void + ): void; + export interface WriteVResult { + bytesWritten: number; + buffers: NodeJS.ArrayBufferView[]; + } + export namespace writev { + function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link writev}. + * @since v12.9.0 + * @param [position='null'] + * @return The number of bytes written. + */ + export function writevSync(fd: number, buffers: ReadonlyArray, position?: number): number; + /** + * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s + * using `readv()`. + * + * `position` is the offset from the beginning of the file from where data + * should be read. If `typeof position !== 'number'`, the data will be read + * from the current position. + * + * The callback will be given three arguments: `err`, `bytesRead`, and`buffers`. `bytesRead` is how many bytes were read from the file. + * + * If this method is invoked as its `util.promisify()` ed version, it returns + * a promise for an `Object` with `bytesRead` and `buffers` properties. + * @since v13.13.0, v12.17.0 + * @param [position='null'] + */ + export function readv(fd: number, buffers: ReadonlyArray, cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void): void; + export function readv( + fd: number, + buffers: ReadonlyArray, + position: number, + cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void + ): void; + export interface ReadVResult { + bytesRead: number; + buffers: NodeJS.ArrayBufferView[]; + } + export namespace readv { + function __promisify__(fd: number, buffers: ReadonlyArray, position?: number): Promise; + } + /** + * For detailed information, see the documentation of the asynchronous version of + * this API: {@link readv}. + * @since v13.13.0, v12.17.0 + * @param [position='null'] + * @return The number of bytes read. + */ + export function readvSync(fd: number, buffers: ReadonlyArray, position?: number): number; + + export interface OpenAsBlobOptions { + /** + * An optional mime type for the blob. + * + * @default 'undefined' + */ + type?: string | undefined; + } + + /** + * Returns a Blob whose data is backed by the given file. + * + * The file must not be modified after the `Blob` is created. + * Any modifications will cause reading the `Blob` data to fail with a `DOMException` error. + * Synchronous stat operations on the file when the `Blob` is created, and before each read in order to detect whether the file data has been modified on disk. + * + * @param path + * @param [options] + * + * @experimental + * @since v19.8.0 + */ + export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise; + + export interface OpenDirOptions { + /** + * @default 'utf8' + */ + encoding?: BufferEncoding | undefined; + /** + * Number of directory entries that are buffered + * internally when reading from the directory. Higher values lead to better + * performance but higher memory usage. + * @default 32 + */ + bufferSize?: number | undefined; + /** + * @default false + */ + recursive?: boolean; + } + /** + * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html). + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * @since v12.12.0 + */ + export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir; + /** + * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for + * more details. + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * @since v12.12.0 + */ + export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; + export function opendir(path: PathLike, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; + export namespace opendir { + function __promisify__(path: PathLike, options?: OpenDirOptions): Promise; + } + export interface BigIntStats extends StatsBase { + atimeNs: bigint; + mtimeNs: bigint; + ctimeNs: bigint; + birthtimeNs: bigint; + } + export interface BigIntOptions { + bigint: true; + } + export interface StatOptions { + bigint?: boolean | undefined; + } + export interface StatSyncOptions extends StatOptions { + throwIfNoEntry?: boolean | undefined; + } + interface CopyOptionsBase { + /** + * Dereference symlinks + * @default false + */ + dereference?: boolean; + /** + * When `force` is `false`, and the destination + * exists, throw an error. + * @default false + */ + errorOnExist?: boolean; + /** + * Overwrite existing file or directory. _The copy + * operation will ignore errors if you set this to false and the destination + * exists. Use the `errorOnExist` option to change this behavior. + * @default true + */ + force?: boolean; + /** + * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()} + */ + mode?: number; + /** + * When `true` timestamps from `src` will + * be preserved. + * @default false + */ + preserveTimestamps?: boolean; + /** + * Copy directories recursively. + * @default false + */ + recursive?: boolean; + /** + * When true, path resolution for symlinks will be skipped + * @default false + */ + verbatimSymlinks?: boolean; + } + export interface CopyOptions extends CopyOptionsBase { + /** + * Function to filter copied files/directories. Return + * `true` to copy the item, `false` to ignore it. + */ + filter?(source: string, destination: string): boolean | Promise; + } + export interface CopySyncOptions extends CopyOptionsBase { + /** + * Function to filter copied files/directories. Return + * `true` to copy the item, `false` to ignore it. + */ + filter?(source: string, destination: string): boolean; + } + /** + * Asynchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + */ + export function cp(source: string | URL, destination: string | URL, callback: (err: NodeJS.ErrnoException | null) => void): void; + export function cp(source: string | URL, destination: string | URL, opts: CopyOptions, callback: (err: NodeJS.ErrnoException | null) => void): void; + /** + * Synchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + */ + export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void; +} +declare module 'node:fs' { + export * from 'fs'; +} diff --git a/node_modules/@types/node/ts4.8/fs/promises.d.ts b/node_modules/@types/node/ts4.8/fs/promises.d.ts new file mode 100755 index 0000000..6082ff8 --- /dev/null +++ b/node_modules/@types/node/ts4.8/fs/promises.d.ts @@ -0,0 +1,1202 @@ +/** + * The `fs/promises` API provides asynchronous file system methods that return + * promises. + * + * The promise APIs use the underlying Node.js threadpool to perform file + * system operations off the event loop thread. These operations are not + * synchronized or threadsafe. Care must be taken when performing multiple + * concurrent modifications on the same file or data corruption may occur. + * @since v10.0.0 + */ +declare module 'fs/promises' { + import { Abortable } from 'node:events'; + import { Stream } from 'node:stream'; + import { ReadableStream } from 'node:stream/web'; + import { + BigIntStats, + BigIntStatsFs, + BufferEncodingOption, + constants as fsConstants, + CopyOptions, + Dir, + Dirent, + MakeDirectoryOptions, + Mode, + ObjectEncodingOptions, + OpenDirOptions, + OpenMode, + PathLike, + ReadStream, + ReadVResult, + RmDirOptions, + RmOptions, + StatOptions, + StatFsOptions, + Stats, + StatsFs, + TimeLike, + WatchEventType, + WatchOptions, + WriteStream, + WriteVResult, + } from 'node:fs'; + import { Interface as ReadlineInterface } from 'node:readline'; + interface FileChangeInfo { + eventType: WatchEventType; + filename: T | null; + } + interface FlagAndOpenMode { + mode?: Mode | undefined; + flag?: OpenMode | undefined; + } + interface FileReadResult { + bytesRead: number; + buffer: T; + } + interface FileReadOptions { + /** + * @default `Buffer.alloc(0xffff)` + */ + buffer?: T; + /** + * @default 0 + */ + offset?: number | null; + /** + * @default `buffer.byteLength` + */ + length?: number | null; + position?: number | null; + } + interface CreateReadStreamOptions { + encoding?: BufferEncoding | null | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + end?: number | undefined; + highWaterMark?: number | undefined; + } + interface CreateWriteStreamOptions { + encoding?: BufferEncoding | null | undefined; + autoClose?: boolean | undefined; + emitClose?: boolean | undefined; + start?: number | undefined; + } + interface ReadableWebStreamOptions { + /** + * Whether to open a normal or a `'bytes'` stream. + * @since v20.0.0 + */ + type?: 'bytes' | undefined; + } + // TODO: Add `EventEmitter` close + interface FileHandle { + /** + * The numeric file descriptor managed by the {FileHandle} object. + * @since v10.0.0 + */ + readonly fd: number; + /** + * Alias of `filehandle.writeFile()`. + * + * When operating on file handles, the mode cannot be changed from what it was set + * to with `fsPromises.open()`. Therefore, this is equivalent to `filehandle.writeFile()`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + appendFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise; + /** + * Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html). + * @since v10.0.0 + * @param uid The file's new owner's user id. + * @param gid The file's new group's group id. + * @return Fulfills with `undefined` upon success. + */ + chown(uid: number, gid: number): Promise; + /** + * Modifies the permissions on the file. See [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html). + * @since v10.0.0 + * @param mode the file mode bit mask. + * @return Fulfills with `undefined` upon success. + */ + chmod(mode: Mode): Promise; + /** + * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream + * returned by this method has a default `highWaterMark` of 64 KiB. + * + * `options` can include `start` and `end` values to read a range of bytes from + * the file instead of the entire file. Both `start` and `end` are inclusive and + * start counting at 0, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `start` is + * omitted or `undefined`, `filehandle.createReadStream()` reads sequentially from + * the current file position. The `encoding` can be any one of those accepted by `Buffer`. + * + * If the `FileHandle` points to a character device that only supports blocking + * reads (such as keyboard or sound card), read operations do not finish until data + * is available. This can prevent the process from exiting and the stream from + * closing naturally. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const fd = await open('/dev/input/event0'); + * // Create a stream from some character device. + * const stream = fd.createReadStream(); + * setTimeout(() => { + * stream.close(); // This may not close the stream. + * // Artificially marking end-of-stream, as if the underlying resource had + * // indicated end-of-file by itself, allows the stream to close. + * // This does not cancel pending read operations, and if there is such an + * // operation, the process may still not be able to exit successfully + * // until it finishes. + * stream.push(null); + * stream.read(0); + * }, 100); + * ``` + * + * If `autoClose` is false, then the file descriptor won't be closed, even if + * there's an error. It is the application's responsibility to close it and make + * sure there's no file descriptor leak. If `autoClose` is set to true (default + * behavior), on `'error'` or `'end'` the file descriptor will be closed + * automatically. + * + * An example to read the last 10 bytes of a file which is 100 bytes long: + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const fd = await open('sample.txt'); + * fd.createReadStream({ start: 90, end: 99 }); + * ``` + * @since v16.11.0 + */ + createReadStream(options?: CreateReadStreamOptions): ReadStream; + /** + * `options` may also include a `start` option to allow writing data at some + * position past the beginning of the file, allowed values are in the + * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than + * replacing it may require the `flags` `open` option to be set to `r+` rather than + * the default `r`. The `encoding` can be any one of those accepted by `Buffer`. + * + * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false, + * then the file descriptor won't be closed, even if there's an error. + * It is the application's responsibility to close it and make sure there's no + * file descriptor leak. + * + * By default, the stream will emit a `'close'` event after it has been + * destroyed. Set the `emitClose` option to `false` to change this behavior. + * @since v16.11.0 + */ + createWriteStream(options?: CreateWriteStreamOptions): WriteStream; + /** + * Forces all currently queued I/O operations associated with the file to the + * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. + * + * Unlike `filehandle.sync` this method does not flush modified metadata. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + datasync(): Promise; + /** + * Request that all data for the open file descriptor is flushed to the storage + * device. The specific implementation is operating system and device specific. + * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + sync(): Promise; + /** + * Reads data from the file and stores that in the given buffer. + * + * If the file is not modified concurrently, the end-of-file is reached when the + * number of bytes read is zero. + * @since v10.0.0 + * @param buffer A buffer that will be filled with the file data read. + * @param offset The location in the buffer at which to start filling. + * @param length The number of bytes to read. + * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an + * integer, the current file position will remain unchanged. + * @return Fulfills upon success with an object with two properties: + */ + read(buffer: T, offset?: number | null, length?: number | null, position?: number | null): Promise>; + read(options?: FileReadOptions): Promise>; + /** + * Returns a `ReadableStream` that may be used to read the files data. + * + * An error will be thrown if this method is called more than once or is called + * after the `FileHandle` is closed or closing. + * + * ```js + * import { + * open, + * } from 'node:fs/promises'; + * + * const file = await open('./some/file/to/read'); + * + * for await (const chunk of file.readableWebStream()) + * console.log(chunk); + * + * await file.close(); + * ``` + * + * While the `ReadableStream` will read the file to completion, it will not + * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method. + * @since v17.0.0 + * @experimental + */ + readableWebStream(options?: ReadableWebStreamOptions): ReadableStream; + /** + * Asynchronously reads the entire contents of a file. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `FileHandle` has to support reading. + * + * If one or more `filehandle.read()` calls are made on a file handle and then a`filehandle.readFile()` call is made, the data will be read from the current + * position till the end of the file. It doesn't always read from the beginning + * of the file. + * @since v10.0.0 + * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the + * data will be a string. + */ + readFile( + options?: { + encoding?: null | undefined; + flag?: OpenMode | undefined; + } | null + ): Promise; + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile( + options: + | { + encoding: BufferEncoding; + flag?: OpenMode | undefined; + } + | BufferEncoding + ): Promise; + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile( + options?: + | (ObjectEncodingOptions & { + flag?: OpenMode | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Convenience method to create a `readline` interface and stream over the file. + * See `filehandle.createReadStream()` for the options. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * const file = await open('./some/file/to/read'); + * + * for await (const line of file.readLines()) { + * console.log(line); + * } + * ``` + * @since v18.11.0 + */ + readLines(options?: CreateReadStreamOptions): ReadlineInterface; + /** + * @since v10.0.0 + * @return Fulfills with an {fs.Stats} for the file. + */ + stat( + opts?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + stat( + opts: StatOptions & { + bigint: true; + } + ): Promise; + stat(opts?: StatOptions): Promise; + /** + * Truncates the file. + * + * If the file was larger than `len` bytes, only the first `len` bytes will be + * retained in the file. + * + * The following example retains only the first four bytes of the file: + * + * ```js + * import { open } from 'node:fs/promises'; + * + * let filehandle = null; + * try { + * filehandle = await open('temp.txt', 'r+'); + * await filehandle.truncate(4); + * } finally { + * await filehandle?.close(); + * } + * ``` + * + * If the file previously was shorter than `len` bytes, it is extended, and the + * extended part is filled with null bytes (`'\0'`): + * + * If `len` is negative then `0` will be used. + * @since v10.0.0 + * @param [len=0] + * @return Fulfills with `undefined` upon success. + */ + truncate(len?: number): Promise; + /** + * Change the file system timestamps of the object referenced by the `FileHandle` then resolves the promise with no arguments upon success. + * @since v10.0.0 + */ + utimes(atime: TimeLike, mtime: TimeLike): Promise; + /** + * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an + * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an + * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. + * The promise is resolved with no arguments upon success. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `FileHandle` has to support writing. + * + * It is unsafe to use `filehandle.writeFile()` multiple times on the same file + * without waiting for the promise to be resolved (or rejected). + * + * If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the + * current position till the end of the file. It doesn't always write from the + * beginning of the file. + * @since v10.0.0 + */ + writeFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode & Abortable) | BufferEncoding | null): Promise; + /** + * Write `buffer` to the file. + * + * The promise is resolved with an object containing two properties: + * + * It is unsafe to use `filehandle.write()` multiple times on the same file + * without waiting for the promise to be resolved (or rejected). For this + * scenario, use `filehandle.createWriteStream()`. + * + * On Linux, positional writes do not work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v10.0.0 + * @param offset The start position from within `buffer` where the data to write begins. + * @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write. + * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current + * position. See the POSIX pwrite(2) documentation for more detail. + */ + write( + buffer: TBuffer, + offset?: number | null, + length?: number | null, + position?: number | null + ): Promise<{ + bytesWritten: number; + buffer: TBuffer; + }>; + write( + data: string, + position?: number | null, + encoding?: BufferEncoding | null + ): Promise<{ + bytesWritten: number; + buffer: string; + }>; + /** + * Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file. + * + * The promise is resolved with an object containing a two properties: + * + * It is unsafe to call `writev()` multiple times on the same file without waiting + * for the promise to be resolved (or rejected). + * + * On Linux, positional writes don't work when the file is opened in append mode. + * The kernel ignores the position argument and always appends the data to + * the end of the file. + * @since v12.9.0 + * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current + * position. + */ + writev(buffers: ReadonlyArray, position?: number): Promise; + /** + * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s + * @since v13.13.0, v12.17.0 + * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position. + * @return Fulfills upon success an object containing two properties: + */ + readv(buffers: ReadonlyArray, position?: number): Promise; + /** + * Closes the file handle after waiting for any pending operation on the handle to + * complete. + * + * ```js + * import { open } from 'node:fs/promises'; + * + * let filehandle; + * try { + * filehandle = await open('thefile.txt', 'r'); + * } finally { + * await filehandle?.close(); + * } + * ``` + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + close(): Promise; + /** + * An alias for {@link FileHandle.close()}. + * @since v20.4.0 + */ + [Symbol.asyncDispose](): Promise; + } + const constants: typeof fsConstants; + /** + * Tests a user's permissions for the file or directory specified by `path`. + * The `mode` argument is an optional integer that specifies the accessibility + * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK` + * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for + * possible values of `mode`. + * + * If the accessibility check is successful, the promise is resolved with no + * value. If any of the accessibility checks fail, the promise is rejected + * with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and + * written by the current process. + * + * ```js + * import { access, constants } from 'node:fs/promises'; + * + * try { + * await access('/etc/passwd', constants.R_OK | constants.W_OK); + * console.log('can access'); + * } catch { + * console.error('cannot access'); + * } + * ``` + * + * Using `fsPromises.access()` to check for the accessibility of a file before + * calling `fsPromises.open()` is not recommended. Doing so introduces a race + * condition, since other processes may change the file's state between the two + * calls. Instead, user code should open/read/write the file directly and handle + * the error raised if the file is not accessible. + * @since v10.0.0 + * @param [mode=fs.constants.F_OK] + * @return Fulfills with `undefined` upon success. + */ + function access(path: PathLike, mode?: number): Promise; + /** + * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it + * already exists. + * + * No guarantees are made about the atomicity of the copy operation. If an + * error occurs after the destination file has been opened for writing, an attempt + * will be made to remove the destination. + * + * ```js + * import { copyFile, constants } from 'node:fs/promises'; + * + * try { + * await copyFile('source.txt', 'destination.txt'); + * console.log('source.txt was copied to destination.txt'); + * } catch { + * console.error('The file could not be copied'); + * } + * + * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. + * try { + * await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL); + * console.log('source.txt was copied to destination.txt'); + * } catch { + * console.error('The file could not be copied'); + * } + * ``` + * @since v10.0.0 + * @param src source filename to copy + * @param dest destination filename of the copy operation + * @param [mode=0] Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. + * `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`) + * @return Fulfills with `undefined` upon success. + */ + function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise; + /** + * Opens a `FileHandle`. + * + * Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail. + * + * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented + * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains + * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). + * @since v10.0.0 + * @param [flags='r'] See `support of file system `flags``. + * @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created. + * @return Fulfills with a {FileHandle} object. + */ + function open(path: PathLike, flags?: string | number, mode?: Mode): Promise; + /** + * Renames `oldPath` to `newPath`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function rename(oldPath: PathLike, newPath: PathLike): Promise; + /** + * Truncates (shortens or extends the length) of the content at `path` to `len`bytes. + * @since v10.0.0 + * @param [len=0] + * @return Fulfills with `undefined` upon success. + */ + function truncate(path: PathLike, len?: number): Promise; + /** + * Removes the directory identified by `path`. + * + * Using `fsPromises.rmdir()` on a file (not a directory) results in the + * promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR`error on POSIX. + * + * To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function rmdir(path: PathLike, options?: RmDirOptions): Promise; + /** + * Removes files and directories (modeled on the standard POSIX `rm` utility). + * @since v14.14.0 + * @return Fulfills with `undefined` upon success. + */ + function rm(path: PathLike, options?: RmOptions): Promise; + /** + * Asynchronously creates a directory. + * + * The optional `options` argument can be an integer specifying `mode` (permission + * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory + * that exists results in a + * rejection only when `recursive` is false. + * + * ```js + * import { mkdir } from 'node:fs/promises'; + * + * try { + * const projectFolder = new URL('./test/project/', import.meta.url); + * const createDir = await mkdir(projectFolder, { recursive: true }); + * + * console.log(`created ${createDir}`); + * } catch (err) { + * console.error(err.message); + * } + * ``` + * @since v10.0.0 + * @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`. + */ + function mkdir( + path: PathLike, + options: MakeDirectoryOptions & { + recursive: true; + } + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function mkdir( + path: PathLike, + options?: + | Mode + | (MakeDirectoryOptions & { + recursive?: false | undefined; + }) + | null + ): Promise; + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders + * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function mkdir(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; + /** + * Reads the contents of a directory. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the filenames. If the `encoding` is set to `'buffer'`, the filenames returned + * will be passed as `Buffer` objects. + * + * If `options.withFileTypes` is set to `true`, the resolved array will contain `fs.Dirent` objects. + * + * ```js + * import { readdir } from 'node:fs/promises'; + * + * try { + * const files = await readdir(path); + * for (const file of files) + * console.log(file); + * } catch (err) { + * console.error(err); + * } + * ``` + * @since v10.0.0 + * @return Fulfills with an array of the names of the files in the directory excluding `'.'` and `'..'`. + */ + function readdir( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir( + path: PathLike, + options: + | { + encoding: 'buffer'; + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + } + | 'buffer' + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir( + path: PathLike, + options?: + | (ObjectEncodingOptions & { + withFileTypes?: false | undefined; + recursive?: boolean | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. + */ + function readdir( + path: PathLike, + options: ObjectEncodingOptions & { + withFileTypes: true; + recursive?: boolean | undefined; + } + ): Promise; + /** + * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is + * resolved with the`linkString` upon success. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the link path returned. If the `encoding` is set to `'buffer'`, the link path + * returned will be passed as a `Buffer` object. + * @since v10.0.0 + * @return Fulfills with the `linkString` upon success. + */ + function readlink(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise; + /** + * Creates a symbolic link. + * + * The `type` argument is only used on Windows platforms and can be one of `'dir'`,`'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will + * autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not + * exist, `'file'` will be used. Windows junction points require the destination + * path to be absolute. When using `'junction'`, the `target` argument will + * automatically be normalized to absolute path. Junction points on NTFS volumes + * can only point to directories. + * @since v10.0.0 + * @param [type='null'] + * @return Fulfills with `undefined` upon success. + */ + function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; + /** + * Equivalent to `fsPromises.stat()` unless `path` refers to a symbolic link, + * in which case the link itself is stat-ed, not the file that it refers to. + * Refer to the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) document for more detail. + * @since v10.0.0 + * @return Fulfills with the {fs.Stats} object for the given symbolic link `path`. + */ + function lstat( + path: PathLike, + opts?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function lstat( + path: PathLike, + opts: StatOptions & { + bigint: true; + } + ): Promise; + function lstat(path: PathLike, opts?: StatOptions): Promise; + /** + * @since v10.0.0 + * @return Fulfills with the {fs.Stats} object for the given `path`. + */ + function stat( + path: PathLike, + opts?: StatOptions & { + bigint?: false | undefined; + } + ): Promise; + function stat( + path: PathLike, + opts: StatOptions & { + bigint: true; + } + ): Promise; + function stat(path: PathLike, opts?: StatOptions): Promise; + /** + * @since v19.6.0, v18.15.0 + * @return Fulfills with the {fs.StatFs} object for the given `path`. + */ + function statfs( + path: PathLike, + opts?: StatFsOptions & { + bigint?: false | undefined; + } + ): Promise; + function statfs( + path: PathLike, + opts: StatFsOptions & { + bigint: true; + } + ): Promise; + function statfs(path: PathLike, opts?: StatFsOptions): Promise; + /** + * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function link(existingPath: PathLike, newPath: PathLike): Promise; + /** + * If `path` refers to a symbolic link, then the link is removed without affecting + * the file or directory to which that link refers. If the `path` refers to a file + * path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more detail. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function unlink(path: PathLike): Promise; + /** + * Changes the permissions of a file. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function chmod(path: PathLike, mode: Mode): Promise; + /** + * Changes the permissions on a symbolic link. + * + * This method is only implemented on macOS. + * @deprecated Since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function lchmod(path: PathLike, mode: Mode): Promise; + /** + * Changes the ownership on a symbolic link. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function lchown(path: PathLike, uid: number, gid: number): Promise; + /** + * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, with the difference that if the path refers to a + * symbolic link, then the link is not dereferenced: instead, the timestamps of + * the symbolic link itself are changed. + * @since v14.5.0, v12.19.0 + * @return Fulfills with `undefined` upon success. + */ + function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + /** + * Changes the ownership of a file. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function chown(path: PathLike, uid: number, gid: number): Promise; + /** + * Change the file system timestamps of the object referenced by `path`. + * + * The `atime` and `mtime` arguments follow these rules: + * + * * Values can be either numbers representing Unix epoch time, `Date`s, or a + * numeric string like `'123456789.0'`. + * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown. + * @since v10.0.0 + * @return Fulfills with `undefined` upon success. + */ + function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; + /** + * Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function. + * + * Only paths that can be converted to UTF8 strings are supported. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use for + * the path. If the `encoding` is set to `'buffer'`, the path returned will be + * passed as a `Buffer` object. + * + * On Linux, when Node.js is linked against musl libc, the procfs file system must + * be mounted on `/proc` in order for this function to work. Glibc does not have + * this restriction. + * @since v10.0.0 + * @return Fulfills with the resolved path upon success. + */ + function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath(path: PathLike, options: BufferEncodingOption): Promise; + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Creates a unique temporary directory. A unique directory name is generated by + * appending six random characters to the end of the provided `prefix`. Due to + * platform inconsistencies, avoid trailing `X` characters in `prefix`. Some + * platforms, notably the BSDs, can return more than six random characters, and + * replace trailing `X` characters in `prefix` with random characters. + * + * The optional `options` argument can be a string specifying an encoding, or an + * object with an `encoding` property specifying the character encoding to use. + * + * ```js + * import { mkdtemp } from 'node:fs/promises'; + * import { join } from 'node:path'; + * import { tmpdir } from 'node:os'; + * + * try { + * await mkdtemp(join(tmpdir(), 'foo-')); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * The `fsPromises.mkdtemp()` method will append the six randomly selected + * characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing + * platform-specific path separator + * (`require('node:path').sep`). + * @since v10.0.0 + * @return Fulfills with a string containing the file system path of the newly created temporary directory. + */ + function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; + /** + * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an + * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an + * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. + * + * The `encoding` option is ignored if `data` is a buffer. + * + * If `options` is a string, then it specifies the encoding. + * + * The `mode` option only affects the newly created file. See `fs.open()` for more details. + * + * Any specified `FileHandle` has to support writing. + * + * It is unsafe to use `fsPromises.writeFile()` multiple times on the same file + * without waiting for the promise to be settled. + * + * Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience + * method that performs multiple `write` calls internally to write the buffer + * passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`. + * + * It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`. + * Cancelation is "best effort", and some amount of data is likely still + * to be written. + * + * ```js + * import { writeFile } from 'node:fs/promises'; + * import { Buffer } from 'node:buffer'; + * + * try { + * const controller = new AbortController(); + * const { signal } = controller; + * const data = new Uint8Array(Buffer.from('Hello Node.js')); + * const promise = writeFile('message.txt', data, { signal }); + * + * // Abort the request before the promise settles. + * controller.abort(); + * + * await promise; + * } catch (err) { + * // When a request is aborted - err is an AbortError + * console.error(err); + * } + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.writeFile` performs. + * @since v10.0.0 + * @param file filename or `FileHandle` + * @return Fulfills with `undefined` upon success. + */ + function writeFile( + file: PathLike | FileHandle, + data: string | NodeJS.ArrayBufferView | Iterable | AsyncIterable | Stream, + options?: + | (ObjectEncodingOptions & { + mode?: Mode | undefined; + flag?: OpenMode | undefined; + } & Abortable) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronously append data to a file, creating the file if it does not yet + * exist. `data` can be a string or a `Buffer`. + * + * If `options` is a string, then it specifies the `encoding`. + * + * The `mode` option only affects the newly created file. See `fs.open()` for more details. + * + * The `path` may be specified as a `FileHandle` that has been opened + * for appending (using `fsPromises.open()`). + * @since v10.0.0 + * @param path filename or {FileHandle} + * @return Fulfills with `undefined` upon success. + */ + function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise; + /** + * Asynchronously reads the entire contents of a file. + * + * If no encoding is specified (using `options.encoding`), the data is returned + * as a `Buffer` object. Otherwise, the data will be a string. + * + * If `options` is a string, then it specifies the encoding. + * + * When the `path` is a directory, the behavior of `fsPromises.readFile()` is + * platform-specific. On macOS, Linux, and Windows, the promise will be rejected + * with an error. On FreeBSD, a representation of the directory's contents will be + * returned. + * + * An example of reading a `package.json` file located in the same directory of the + * running code: + * + * ```js + * import { readFile } from 'node:fs/promises'; + * try { + * const filePath = new URL('./package.json', import.meta.url); + * const contents = await readFile(filePath, { encoding: 'utf8' }); + * console.log(contents); + * } catch (err) { + * console.error(err.message); + * } + * ``` + * + * It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a + * request is aborted the promise returned is rejected with an `AbortError`: + * + * ```js + * import { readFile } from 'node:fs/promises'; + * + * try { + * const controller = new AbortController(); + * const { signal } = controller; + * const promise = readFile(fileName, { signal }); + * + * // Abort the request before the promise settles. + * controller.abort(); + * + * await promise; + * } catch (err) { + * // When a request is aborted - err is an AbortError + * console.error(err); + * } + * ``` + * + * Aborting an ongoing request does not abort individual operating + * system requests but rather the internal buffering `fs.readFile` performs. + * + * Any specified `FileHandle` has to support reading. + * @since v10.0.0 + * @param path filename or `FileHandle` + * @return Fulfills with the contents of the file. + */ + function readFile( + path: PathLike | FileHandle, + options?: + | ({ + encoding?: null | undefined; + flag?: OpenMode | undefined; + } & Abortable) + | null + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile( + path: PathLike | FileHandle, + options: + | ({ + encoding: BufferEncoding; + flag?: OpenMode | undefined; + } & Abortable) + | BufferEncoding + ): Promise; + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile( + path: PathLike | FileHandle, + options?: + | (ObjectEncodingOptions & + Abortable & { + flag?: OpenMode | undefined; + }) + | BufferEncoding + | null + ): Promise; + /** + * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail. + * + * Creates an `fs.Dir`, which contains all further functions for reading from + * and cleaning up the directory. + * + * The `encoding` option sets the encoding for the `path` while opening the + * directory and subsequent read operations. + * + * Example using async iteration: + * + * ```js + * import { opendir } from 'node:fs/promises'; + * + * try { + * const dir = await opendir('./'); + * for await (const dirent of dir) + * console.log(dirent.name); + * } catch (err) { + * console.error(err); + * } + * ``` + * + * When using the async iterator, the `fs.Dir` object will be automatically + * closed after the iterator exits. + * @since v12.12.0 + * @return Fulfills with an {fs.Dir}. + */ + function opendir(path: PathLike, options?: OpenDirOptions): Promise; + /** + * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory. + * + * ```js + * const { watch } = require('node:fs/promises'); + * + * const ac = new AbortController(); + * const { signal } = ac; + * setTimeout(() => ac.abort(), 10000); + * + * (async () => { + * try { + * const watcher = watch(__filename, { signal }); + * for await (const event of watcher) + * console.log(event); + * } catch (err) { + * if (err.name === 'AbortError') + * return; + * throw err; + * } + * })(); + * ``` + * + * On most platforms, `'rename'` is emitted whenever a filename appears or + * disappears in the directory. + * + * All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`. + * @since v15.9.0, v14.18.0 + * @return of objects with the properties: + */ + function watch( + filename: PathLike, + options: + | (WatchOptions & { + encoding: 'buffer'; + }) + | 'buffer' + ): AsyncIterable>; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable>; + /** + * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. + * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `persistent` is not supplied, the default of `true` is used. + * If `recursive` is not supplied, the default of `false` is used. + */ + function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable> | AsyncIterable>; + /** + * Asynchronously copies the entire directory structure from `src` to `dest`, + * including subdirectories and files. + * + * When copying a directory to another directory, globs are not supported and + * behavior is similar to `cp dir1/ dir2/`. + * @since v16.7.0 + * @experimental + * @param src source path to copy. + * @param dest destination path to copy to. + * @return Fulfills with `undefined` upon success. + */ + function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise; +} +declare module 'node:fs/promises' { + export * from 'fs/promises'; +} diff --git a/node_modules/@types/node/ts4.8/globals.d.ts b/node_modules/@types/node/ts4.8/globals.d.ts new file mode 100755 index 0000000..1336d61 --- /dev/null +++ b/node_modules/@types/node/ts4.8/globals.d.ts @@ -0,0 +1,325 @@ +// Declare "static" methods in Error +interface ErrorConstructor { + /** Create .stack property on a target object */ + captureStackTrace(targetObject: object, constructorOpt?: Function): void; + + /** + * Optional override for formatting stack traces + * + * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces + */ + prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; + + stackTraceLimit: number; +} + +/*-----------------------------------------------* + * * + * GLOBAL * + * * + ------------------------------------------------*/ + +// For backwards compability +interface NodeRequire extends NodeJS.Require { } +interface RequireResolve extends NodeJS.RequireResolve { } +interface NodeModule extends NodeJS.Module { } + +declare var process: NodeJS.Process; +declare var console: Console; + +declare var __filename: string; +declare var __dirname: string; + +declare var require: NodeRequire; +declare var module: NodeModule; + +// Same as module.exports +declare var exports: any; + +/** + * Only available if `--expose-gc` is passed to the process. + */ +declare var gc: undefined | (() => void); + +//#region borrowed +// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib +/** A controller object that allows you to abort one or more DOM requests as and when desired. */ +interface AbortController { + /** + * Returns the AbortSignal object associated with this object. + */ + + readonly signal: AbortSignal; + /** + * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. + */ + abort(reason?: any): void; +} + +/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ +interface AbortSignal extends EventTarget { + /** + * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + */ + readonly aborted: boolean; + readonly reason: any; + onabort: null | ((this: AbortSignal, event: Event) => any); + throwIfAborted(): void; +} + +declare var AbortController: typeof globalThis extends {onmessage: any; AbortController: infer T} + ? T + : { + prototype: AbortController; + new(): AbortController; + }; + +declare var AbortSignal: typeof globalThis extends {onmessage: any; AbortSignal: infer T} + ? T + : { + prototype: AbortSignal; + new(): AbortSignal; + abort(reason?: any): AbortSignal; + timeout(milliseconds: number): AbortSignal; + }; +//#endregion borrowed + +//#region Disposable +interface SymbolConstructor { + /** + * A method that is used to release resources held by an object. Called by the semantics of the `using` statement. + */ + readonly dispose: unique symbol; + + /** + * A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement. + */ + readonly asyncDispose: unique symbol; +} + +interface Disposable { + [Symbol.dispose](): void; +} + +interface AsyncDisposable { + [Symbol.asyncDispose](): PromiseLike; +} +//#endregion Disposable + +//#region ArrayLike.at() +interface RelativeIndexable { + /** + * Takes an integer value and returns the item at that index, + * allowing for positive and negative integers. + * Negative integers count back from the last item in the array. + */ + at(index: number): T | undefined; +} +interface String extends RelativeIndexable {} +interface Array extends RelativeIndexable {} +interface ReadonlyArray extends RelativeIndexable {} +interface Int8Array extends RelativeIndexable {} +interface Uint8Array extends RelativeIndexable {} +interface Uint8ClampedArray extends RelativeIndexable {} +interface Int16Array extends RelativeIndexable {} +interface Uint16Array extends RelativeIndexable {} +interface Int32Array extends RelativeIndexable {} +interface Uint32Array extends RelativeIndexable {} +interface Float32Array extends RelativeIndexable {} +interface Float64Array extends RelativeIndexable {} +interface BigInt64Array extends RelativeIndexable {} +interface BigUint64Array extends RelativeIndexable {} +//#endregion ArrayLike.at() end + +/** + * @since v17.0.0 + * + * Creates a deep clone of an object. + */ +declare function structuredClone( + value: T, + transfer?: { transfer: ReadonlyArray }, +): T; + +/*----------------------------------------------* +* * +* GLOBAL INTERFACES * +* * +*-----------------------------------------------*/ +declare namespace NodeJS { + interface CallSite { + /** + * Value of "this" + */ + getThis(): unknown; + + /** + * Type of "this" as a string. + * This is the name of the function stored in the constructor field of + * "this", if available. Otherwise the object's [[Class]] internal + * property. + */ + getTypeName(): string | null; + + /** + * Current function + */ + getFunction(): Function | undefined; + + /** + * Name of the current function, typically its name property. + * If a name property is not available an attempt will be made to try + * to infer a name from the function's context. + */ + getFunctionName(): string | null; + + /** + * Name of the property [of "this" or one of its prototypes] that holds + * the current function + */ + getMethodName(): string | null; + + /** + * Name of the script [if this function was defined in a script] + */ + getFileName(): string | undefined; + + /** + * Current line number [if this function was defined in a script] + */ + getLineNumber(): number | null; + + /** + * Current column number [if this function was defined in a script] + */ + getColumnNumber(): number | null; + + /** + * A call site object representing the location where eval was called + * [if this function was created using a call to eval] + */ + getEvalOrigin(): string | undefined; + + /** + * Is this a toplevel invocation, that is, is "this" the global object? + */ + isToplevel(): boolean; + + /** + * Does this call take place in code defined by a call to eval? + */ + isEval(): boolean; + + /** + * Is this call in native V8 code? + */ + isNative(): boolean; + + /** + * Is this a constructor call? + */ + isConstructor(): boolean; + } + + interface ErrnoException extends Error { + errno?: number | undefined; + code?: string | undefined; + path?: string | undefined; + syscall?: string | undefined; + } + + interface ReadableStream extends EventEmitter { + readable: boolean; + read(size?: number): string | Buffer; + setEncoding(encoding: BufferEncoding): this; + pause(): this; + resume(): this; + isPaused(): boolean; + pipe(destination: T, options?: { end?: boolean | undefined; }): T; + unpipe(destination?: WritableStream): this; + unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; + wrap(oldStream: ReadableStream): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + + interface WritableStream extends EventEmitter { + writable: boolean; + write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; + write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; + end(cb?: () => void): this; + end(data: string | Uint8Array, cb?: () => void): this; + end(str: string, encoding?: BufferEncoding, cb?: () => void): this; + } + + interface ReadWriteStream extends ReadableStream, WritableStream { } + + interface RefCounted { + ref(): this; + unref(): this; + } + + type TypedArray = + | Uint8Array + | Uint8ClampedArray + | Uint16Array + | Uint32Array + | Int8Array + | Int16Array + | Int32Array + | BigUint64Array + | BigInt64Array + | Float32Array + | Float64Array; + type ArrayBufferView = TypedArray | DataView; + + interface Require { + (id: string): any; + resolve: RequireResolve; + cache: Dict; + /** + * @deprecated + */ + extensions: RequireExtensions; + main: Module | undefined; + } + + interface RequireResolve { + (id: string, options?: { paths?: string[] | undefined; }): string; + paths(request: string): string[] | null; + } + + interface RequireExtensions extends Dict<(m: Module, filename: string) => any> { + '.js': (m: Module, filename: string) => any; + '.json': (m: Module, filename: string) => any; + '.node': (m: Module, filename: string) => any; + } + interface Module { + /** + * `true` if the module is running during the Node.js preload + */ + isPreloading: boolean; + exports: any; + require: Require; + id: string; + filename: string; + loaded: boolean; + /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */ + parent: Module | null | undefined; + children: Module[]; + /** + * @since v11.14.0 + * + * The directory name of the module. This is usually the same as the path.dirname() of the module.id. + */ + path: string; + paths: string[]; + } + + interface Dict { + [key: string]: T | undefined; + } + + interface ReadOnlyDict { + readonly [key: string]: T | undefined; + } +} diff --git a/node_modules/@types/node/ts4.8/globals.global.d.ts b/node_modules/@types/node/ts4.8/globals.global.d.ts new file mode 100755 index 0000000..ef1198c --- /dev/null +++ b/node_modules/@types/node/ts4.8/globals.global.d.ts @@ -0,0 +1 @@ +declare var global: typeof globalThis; diff --git a/node_modules/@types/node/ts4.8/http.d.ts b/node_modules/@types/node/ts4.8/http.d.ts new file mode 100755 index 0000000..cb50335 --- /dev/null +++ b/node_modules/@types/node/ts4.8/http.d.ts @@ -0,0 +1,1724 @@ +/** + * To use the HTTP server and client one must `require('node:http')`. + * + * The HTTP interfaces in Node.js are designed to support many features + * of the protocol which have been traditionally difficult to use. + * In particular, large, possibly chunk-encoded, messages. The interface is + * careful to never buffer entire requests or responses, so the + * user is able to stream data. + * + * HTTP message headers are represented by an object like this: + * + * ```js + * { 'content-length': '123', + * 'content-type': 'text/plain', + * 'connection': 'keep-alive', + * 'host': 'example.com', + * 'accept': '*' } + * ``` + * + * Keys are lowercased. Values are not modified. + * + * In order to support the full spectrum of possible HTTP applications, the Node.js + * HTTP API is very low-level. It deals with stream handling and message + * parsing only. It parses a message into headers and body but it does not + * parse the actual headers or the body. + * + * See `message.headers` for details on how duplicate headers are handled. + * + * The raw headers as they were received are retained in the `rawHeaders`property, which is an array of `[key, value, key2, value2, ...]`. For + * example, the previous message header object might have a `rawHeaders`list like the following: + * + * ```js + * [ 'ConTent-Length', '123456', + * 'content-LENGTH', '123', + * 'content-type', 'text/plain', + * 'CONNECTION', 'keep-alive', + * 'Host', 'example.com', + * 'accepT', '*' ] + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http.js) + */ +declare module 'http' { + import * as stream from 'node:stream'; + import { URL } from 'node:url'; + import { LookupOptions } from 'node:dns'; + import { EventEmitter } from 'node:events'; + import { TcpSocketConnectOpts, Socket, Server as NetServer, LookupFunction } from 'node:net'; + // incoming headers will never contain number + interface IncomingHttpHeaders extends NodeJS.Dict { + accept?: string | undefined; + 'accept-language'?: string | undefined; + 'accept-patch'?: string | undefined; + 'accept-ranges'?: string | undefined; + 'access-control-allow-credentials'?: string | undefined; + 'access-control-allow-headers'?: string | undefined; + 'access-control-allow-methods'?: string | undefined; + 'access-control-allow-origin'?: string | undefined; + 'access-control-expose-headers'?: string | undefined; + 'access-control-max-age'?: string | undefined; + 'access-control-request-headers'?: string | undefined; + 'access-control-request-method'?: string | undefined; + age?: string | undefined; + allow?: string | undefined; + 'alt-svc'?: string | undefined; + authorization?: string | undefined; + 'cache-control'?: string | undefined; + connection?: string | undefined; + 'content-disposition'?: string | undefined; + 'content-encoding'?: string | undefined; + 'content-language'?: string | undefined; + 'content-length'?: string | undefined; + 'content-location'?: string | undefined; + 'content-range'?: string | undefined; + 'content-type'?: string | undefined; + cookie?: string | undefined; + date?: string | undefined; + etag?: string | undefined; + expect?: string | undefined; + expires?: string | undefined; + forwarded?: string | undefined; + from?: string | undefined; + host?: string | undefined; + 'if-match'?: string | undefined; + 'if-modified-since'?: string | undefined; + 'if-none-match'?: string | undefined; + 'if-unmodified-since'?: string | undefined; + 'last-modified'?: string | undefined; + location?: string | undefined; + origin?: string | undefined; + pragma?: string | undefined; + 'proxy-authenticate'?: string | undefined; + 'proxy-authorization'?: string | undefined; + 'public-key-pins'?: string | undefined; + range?: string | undefined; + referer?: string | undefined; + 'retry-after'?: string | undefined; + 'sec-websocket-accept'?: string | undefined; + 'sec-websocket-extensions'?: string | undefined; + 'sec-websocket-key'?: string | undefined; + 'sec-websocket-protocol'?: string | undefined; + 'sec-websocket-version'?: string | undefined; + 'set-cookie'?: string[] | undefined; + 'strict-transport-security'?: string | undefined; + tk?: string | undefined; + trailer?: string | undefined; + 'transfer-encoding'?: string | undefined; + upgrade?: string | undefined; + 'user-agent'?: string | undefined; + vary?: string | undefined; + via?: string | undefined; + warning?: string | undefined; + 'www-authenticate'?: string | undefined; + } + // outgoing headers allows numbers (as they are converted internally to strings) + type OutgoingHttpHeader = number | string | string[]; + interface OutgoingHttpHeaders extends NodeJS.Dict {} + interface ClientRequestArgs { + _defaultAgent?: Agent | undefined; + agent?: Agent | boolean | undefined; + auth?: string | null | undefined; + // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 + createConnection?: + | ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) + | undefined; + defaultPort?: number | string | undefined; + family?: number | undefined; + headers?: OutgoingHttpHeaders | undefined; + hints?: LookupOptions['hints']; + host?: string | null | undefined; + hostname?: string | null | undefined; + insecureHTTPParser?: boolean | undefined; + localAddress?: string | undefined; + localPort?: number | undefined; + lookup?: LookupFunction | undefined; + /** + * @default 16384 + */ + maxHeaderSize?: number | undefined; + method?: string | undefined; + path?: string | null | undefined; + port?: number | string | null | undefined; + protocol?: string | null | undefined; + setHost?: boolean | undefined; + signal?: AbortSignal | undefined; + socketPath?: string | undefined; + timeout?: number | undefined; + uniqueHeaders?: Array | undefined; + joinDuplicateHeaders?: boolean; + } + interface ServerOptions< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + > { + /** + * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`. + */ + IncomingMessage?: Request | undefined; + /** + * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`. + */ + ServerResponse?: Response | undefined; + /** + * Sets the timeout value in milliseconds for receiving the entire request from the client. + * @see Server.requestTimeout for more information. + * @default 300000 + * @since v18.0.0 + */ + requestTimeout?: number | undefined; + /** + * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates. + * @default false + * @since v18.14.0 + */ + joinDuplicateHeaders?: boolean; + /** + * The number of milliseconds of inactivity a server needs to wait for additional incoming data, + * after it has finished writing the last response, before a socket will be destroyed. + * @see Server.keepAliveTimeout for more information. + * @default 5000 + * @since v18.0.0 + */ + keepAliveTimeout?: number | undefined; + /** + * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests. + * @default 30000 + */ + connectionsCheckingInterval?: number | undefined; + /** + * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. + * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. + * Default: @see stream.getDefaultHighWaterMark(). + * @since v20.1.0 + */ + highWaterMark?: number | undefined; + /** + * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`. + * Using the insecure parser should be avoided. + * See --insecure-http-parser for more information. + * @default false + */ + insecureHTTPParser?: boolean | undefined; + /** + * Optionally overrides the value of + * `--max-http-header-size` for requests received by this server, i.e. + * the maximum length of request headers in bytes. + * @default 16384 + * @since v13.3.0 + */ + maxHeaderSize?: number | undefined; + /** + * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. + * @default true + * @since v16.5.0 + */ + noDelay?: boolean | undefined; + /** + * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, + * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. + * @default false + * @since v16.5.0 + */ + keepAlive?: boolean | undefined; + /** + * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. + * @default 0 + * @since v16.5.0 + */ + keepAliveInitialDelay?: number | undefined; + /** + * A list of response headers that should be sent only once. + * If the header's value is an array, the items will be joined using `; `. + */ + uniqueHeaders?: Array | undefined; + } + type RequestListener< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + > = (req: InstanceType, res: InstanceType & { req: InstanceType }) => void; + /** + * @since v0.1.17 + */ + class Server< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + > extends NetServer { + constructor(requestListener?: RequestListener); + constructor(options: ServerOptions, requestListener?: RequestListener); + /** + * Sets the timeout value for sockets, and emits a `'timeout'` event on + * the Server object, passing the socket as an argument, if a timeout + * occurs. + * + * If there is a `'timeout'` event listener on the Server object, then it + * will be called with the timed-out socket as an argument. + * + * By default, the Server does not timeout sockets. However, if a callback + * is assigned to the Server's `'timeout'` event, timeouts must be handled + * explicitly. + * @since v0.9.12 + * @param [msecs=0 (no timeout)] + */ + setTimeout(msecs?: number, callback?: () => void): this; + setTimeout(callback: () => void): this; + /** + * Limits maximum incoming headers count. If set to 0, no limit will be applied. + * @since v0.7.0 + */ + maxHeadersCount: number | null; + /** + * The maximum number of requests socket can handle + * before closing keep alive connection. + * + * A value of `0` will disable the limit. + * + * When the limit is reached it will set the `Connection` header value to `close`, + * but will not actually close the connection, subsequent requests sent + * after the limit is reached will get `503 Service Unavailable` as a response. + * @since v16.10.0 + */ + maxRequestsPerSocket: number | null; + /** + * The number of milliseconds of inactivity before a socket is presumed + * to have timed out. + * + * A value of `0` will disable the timeout behavior on incoming connections. + * + * The socket timeout logic is set up on connection, so changing this + * value only affects new connections to the server, not any existing connections. + * @since v0.9.12 + */ + timeout: number; + /** + * Limit the amount of time the parser will wait to receive the complete HTTP + * headers. + * + * If the timeout expires, the server responds with status 408 without + * forwarding the request to the request listener and then closes the connection. + * + * It must be set to a non-zero value (e.g. 120 seconds) to protect against + * potential Denial-of-Service attacks in case the server is deployed without a + * reverse proxy in front. + * @since v11.3.0, v10.14.0 + */ + headersTimeout: number; + /** + * The number of milliseconds of inactivity a server needs to wait for additional + * incoming data, after it has finished writing the last response, before a socket + * will be destroyed. If the server receives new data before the keep-alive + * timeout has fired, it will reset the regular inactivity timeout, i.e.,`server.timeout`. + * + * A value of `0` will disable the keep-alive timeout behavior on incoming + * connections. + * A value of `0` makes the http server behave similarly to Node.js versions prior + * to 8.0.0, which did not have a keep-alive timeout. + * + * The socket timeout logic is set up on connection, so changing this value only + * affects new connections to the server, not any existing connections. + * @since v8.0.0 + */ + keepAliveTimeout: number; + /** + * Sets the timeout value in milliseconds for receiving the entire request from + * the client. + * + * If the timeout expires, the server responds with status 408 without + * forwarding the request to the request listener and then closes the connection. + * + * It must be set to a non-zero value (e.g. 120 seconds) to protect against + * potential Denial-of-Service attacks in case the server is deployed without a + * reverse proxy in front. + * @since v14.11.0 + */ + requestTimeout: number; + /** + * Closes all connections connected to this server. + * @since v18.2.0 + */ + closeAllConnections(): void; + /** + * Closes all connections connected to this server which are not sending a request + * or waiting for a response. + * @since v18.2.0 + */ + closeIdleConnections(): void; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'connection', listener: (socket: Socket) => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'listening', listener: () => void): this; + addListener(event: 'checkContinue', listener: RequestListener): this; + addListener(event: 'checkExpectation', listener: RequestListener): this; + addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + addListener(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + addListener(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + addListener(event: 'request', listener: RequestListener): this; + addListener(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + emit(event: string, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'connection', socket: Socket): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'listening'): boolean; + emit( + event: 'checkContinue', + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit( + event: 'checkExpectation', + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean; + emit(event: 'connect', req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; + emit(event: 'dropRequest', req: InstanceType, socket: stream.Duplex): boolean; + emit( + event: 'request', + req: InstanceType, + res: InstanceType & { req: InstanceType }, + ): boolean; + emit(event: 'upgrade', req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'connection', listener: (socket: Socket) => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'listening', listener: () => void): this; + on(event: 'checkContinue', listener: RequestListener): this; + on(event: 'checkExpectation', listener: RequestListener): this; + on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + on(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + on(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + on(event: 'request', listener: RequestListener): this; + on(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'connection', listener: (socket: Socket) => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'listening', listener: () => void): this; + once(event: 'checkContinue', listener: RequestListener): this; + once(event: 'checkExpectation', listener: RequestListener): this; + once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + once(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + once(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + once(event: 'request', listener: RequestListener): this; + once(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'connection', listener: (socket: Socket) => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'listening', listener: () => void): this; + prependListener(event: 'checkContinue', listener: RequestListener): this; + prependListener(event: 'checkExpectation', listener: RequestListener): this; + prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + prependListener(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + prependListener(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + prependListener(event: 'request', listener: RequestListener): this; + prependListener(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'listening', listener: () => void): this; + prependOnceListener(event: 'checkContinue', listener: RequestListener): this; + prependOnceListener(event: 'checkExpectation', listener: RequestListener): this; + prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this; + prependOnceListener(event: 'connect', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + prependOnceListener(event: 'dropRequest', listener: (req: InstanceType, socket: stream.Duplex) => void): this; + prependOnceListener(event: 'request', listener: RequestListener): this; + prependOnceListener(event: 'upgrade', listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; + } + /** + * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from + * the perspective of the participants of an HTTP transaction. + * @since v0.1.17 + */ + class OutgoingMessage extends stream.Writable { + readonly req: Request; + chunkedEncoding: boolean; + shouldKeepAlive: boolean; + useChunkedEncodingByDefault: boolean; + sendDate: boolean; + /** + * @deprecated Use `writableEnded` instead. + */ + finished: boolean; + /** + * Read-only. `true` if the headers were sent, otherwise `false`. + * @since v0.9.3 + */ + readonly headersSent: boolean; + /** + * Alias of `outgoingMessage.socket`. + * @since v0.3.0 + * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead. + */ + readonly connection: Socket | null; + /** + * Reference to the underlying socket. Usually, users will not want to access + * this property. + * + * After calling `outgoingMessage.end()`, this property will be nulled. + * @since v0.3.0 + */ + readonly socket: Socket | null; + constructor(); + /** + * Once a socket is associated with the message and is connected,`socket.setTimeout()` will be called with `msecs` as the first parameter. + * @since v0.9.12 + * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. + */ + setTimeout(msecs: number, callback?: () => void): this; + /** + * Sets a single header value. If the header already exists in the to-be-sent + * headers, its value will be replaced. Use an array of strings to send multiple + * headers with the same name. + * @since v0.4.0 + * @param name Header name + * @param value Header value + */ + setHeader(name: string, value: number | string | ReadonlyArray): this; + /** + * Append a single header value for the header object. + * + * If the value is an array, this is equivalent of calling this method multiple + * times. + * + * If there were no previous value for the header, this is equivalent of calling `outgoingMessage.setHeader(name, value)`. + * + * Depending of the value of `options.uniqueHeaders` when the client request or the + * server were created, this will end up in the header being sent multiple times or + * a single time with values joined using `; `. + * @since v18.3.0, v16.17.0 + * @param name Header name + * @param value Header value + */ + appendHeader(name: string, value: string | ReadonlyArray): this; + /** + * Gets the value of the HTTP header with the given name. If that header is not + * set, the returned value will be `undefined`. + * @since v0.4.0 + * @param name Name of header + */ + getHeader(name: string): number | string | string[] | undefined; + /** + * Returns a shallow copy of the current outgoing headers. Since a shallow + * copy is used, array values may be mutated without additional calls to + * various header-related HTTP module methods. The keys of the returned + * object are the header names and the values are the respective header + * values. All header names are lowercase. + * + * The object returned by the `outgoingMessage.getHeaders()` method does + * not prototypically inherit from the JavaScript `Object`. This means that + * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, + * and others are not defined and will not work. + * + * ```js + * outgoingMessage.setHeader('Foo', 'bar'); + * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headers = outgoingMessage.getHeaders(); + * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } + * ``` + * @since v7.7.0 + */ + getHeaders(): OutgoingHttpHeaders; + /** + * Returns an array containing the unique names of the current outgoing headers. + * All names are lowercase. + * @since v7.7.0 + */ + getHeaderNames(): string[]; + /** + * Returns `true` if the header identified by `name` is currently set in the + * outgoing headers. The header name is case-insensitive. + * + * ```js + * const hasContentType = outgoingMessage.hasHeader('content-type'); + * ``` + * @since v7.7.0 + */ + hasHeader(name: string): boolean; + /** + * Removes a header that is queued for implicit sending. + * + * ```js + * outgoingMessage.removeHeader('Content-Encoding'); + * ``` + * @since v0.4.0 + * @param name Header name + */ + removeHeader(name: string): void; + /** + * Adds HTTP trailers (headers but at the end of the message) to the message. + * + * Trailers will **only** be emitted if the message is chunked encoded. If not, + * the trailers will be silently discarded. + * + * HTTP requires the `Trailer` header to be sent to emit trailers, + * with a list of header field names in its value, e.g. + * + * ```js + * message.writeHead(200, { 'Content-Type': 'text/plain', + * 'Trailer': 'Content-MD5' }); + * message.write(fileData); + * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' }); + * message.end(); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v0.3.0 + */ + addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; + /** + * Flushes the message headers. + * + * For efficiency reason, Node.js normally buffers the message headers + * until `outgoingMessage.end()` is called or the first chunk of message data + * is written. It then tries to pack the headers and data into a single TCP + * packet. + * + * It is usually desired (it saves a TCP round-trip), but not when the first + * data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the message. + * @since v1.6.0 + */ + flushHeaders(): void; + } + /** + * This object is created internally by an HTTP server, not by the user. It is + * passed as the second parameter to the `'request'` event. + * @since v0.1.17 + */ + class ServerResponse extends OutgoingMessage { + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status code that will be sent to the client when + * the headers get flushed. + * + * ```js + * response.statusCode = 404; + * ``` + * + * After response header was sent to the client, this property indicates the + * status code which was sent out. + * @since v0.4.0 + */ + statusCode: number; + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status message that will be sent to the client when + * the headers get flushed. If this is left as `undefined` then the standard + * message for the status code will be used. + * + * ```js + * response.statusMessage = 'Not found'; + * ``` + * + * After response header was sent to the client, this property indicates the + * status message which was sent out. + * @since v0.11.8 + */ + statusMessage: string; + /** + * If set to `true`, Node.js will check whether the `Content-Length`header value and the size of the body, in bytes, are equal. + * Mismatching the `Content-Length` header value will result + * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. + * @since v18.10.0, v16.18.0 + */ + strictContentLength: boolean; + constructor(req: Request); + assignSocket(socket: Socket): void; + detachSocket(socket: Socket): void; + /** + * Sends an HTTP/1.1 100 Continue message to the client, indicating that + * the request body should be sent. See the `'checkContinue'` event on`Server`. + * @since v0.3.0 + */ + writeContinue(callback?: () => void): void; + /** + * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header, + * indicating that the user agent can preload/preconnect the linked resources. + * The `hints` is an object containing the values of headers to be sent with + * early hints message. The optional `callback` argument will be called when + * the response message has been written. + * + * **Example** + * + * ```js + * const earlyHintsLink = '; rel=preload; as=style'; + * response.writeEarlyHints({ + * 'link': earlyHintsLink, + * }); + * + * const earlyHintsLinks = [ + * '; rel=preload; as=style', + * '; rel=preload; as=script', + * ]; + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * 'x-trace-id': 'id for diagnostics', + * }); + * + * const earlyHintsCallback = () => console.log('early hints message sent'); + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * }, earlyHintsCallback); + * ``` + * @since v18.11.0 + * @param hints An object containing the values of headers + * @param callback Will be called when the response message has been written + */ + writeEarlyHints(hints: Record, callback?: () => void): void; + /** + * Sends a response header to the request. The status code is a 3-digit HTTP + * status code, like `404`. The last argument, `headers`, are the response headers. + * Optionally one can give a human-readable `statusMessage` as the second + * argument. + * + * `headers` may be an `Array` where the keys and values are in the same list. + * It is _not_ a list of tuples. So, the even-numbered offsets are key values, + * and the odd-numbered offsets are the associated values. The array is in the same + * format as `request.rawHeaders`. + * + * Returns a reference to the `ServerResponse`, so that calls can be chained. + * + * ```js + * const body = 'hello world'; + * response + * .writeHead(200, { + * 'Content-Length': Buffer.byteLength(body), + * 'Content-Type': 'text/plain', + * }) + * .end(body); + * ``` + * + * This method must only be called once on a message and it must + * be called before `response.end()` is called. + * + * If `response.write()` or `response.end()` are called before calling + * this, the implicit/mutable headers will be calculated and call this function. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * If this method is called and `response.setHeader()` has not been called, + * it will directly write the supplied header values onto the network channel + * without caching internally, and the `response.getHeader()` on the header + * will not yield the expected result. If progressive population of headers is + * desired with potential future retrieval and modification, use `response.setHeader()` instead. + * + * ```js + * // Returns content-type = text/plain + * const server = http.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain' }); + * res.end('ok'); + * }); + * ``` + * + * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js + * will check whether `Content-Length` and the length of the body which has + * been transmitted are equal or not. + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a \[`Error`\]\[\] being thrown. + * @since v0.1.30 + */ + writeHead( + statusCode: number, + statusMessage?: string, + headers?: OutgoingHttpHeaders | OutgoingHttpHeader[], + ): this; + writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; + /** + * Sends a HTTP/1.1 102 Processing message to the client, indicating that + * the request body should be sent. + * @since v10.0.0 + */ + writeProcessing(): void; + } + interface InformationEvent { + statusCode: number; + statusMessage: string; + httpVersion: string; + httpVersionMajor: number; + httpVersionMinor: number; + headers: IncomingHttpHeaders; + rawHeaders: string[]; + } + /** + * This object is created internally and returned from {@link request}. It + * represents an _in-progress_ request whose header has already been queued. The + * header is still mutable using the `setHeader(name, value)`,`getHeader(name)`, `removeHeader(name)` API. The actual header will + * be sent along with the first data chunk or when calling `request.end()`. + * + * To get the response, add a listener for `'response'` to the request object.`'response'` will be emitted from the request object when the response + * headers have been received. The `'response'` event is executed with one + * argument which is an instance of {@link IncomingMessage}. + * + * During the `'response'` event, one can add listeners to the + * response object; particularly to listen for the `'data'` event. + * + * If no `'response'` handler is added, then the response will be + * entirely discarded. However, if a `'response'` event handler is added, + * then the data from the response object **must** be consumed, either by + * calling `response.read()` whenever there is a `'readable'` event, or + * by adding a `'data'` handler, or by calling the `.resume()` method. + * Until the data is consumed, the `'end'` event will not fire. Also, until + * the data is read it will consume memory that can eventually lead to a + * 'process out of memory' error. + * + * For backward compatibility, `res` will only emit `'error'` if there is an`'error'` listener registered. + * + * Set `Content-Length` header to limit the response body size. + * If `response.strictContentLength` is set to `true`, mismatching the`Content-Length` header value will result in an `Error` being thrown, + * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. + * + * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. + * @since v0.1.17 + */ + class ClientRequest extends OutgoingMessage { + /** + * The `request.aborted` property will be `true` if the request has + * been aborted. + * @since v0.11.14 + * @deprecated Since v17.0.0,v16.12.0 - Check `destroyed` instead. + */ + aborted: boolean; + /** + * The request host. + * @since v14.5.0, v12.19.0 + */ + host: string; + /** + * The request protocol. + * @since v14.5.0, v12.19.0 + */ + protocol: string; + /** + * When sending request through a keep-alive enabled agent, the underlying socket + * might be reused. But if server closes connection at unfortunate time, client + * may run into a 'ECONNRESET' error. + * + * ```js + * const http = require('node:http'); + * + * // Server has a 5 seconds keep-alive timeout by default + * http + * .createServer((req, res) => { + * res.write('hello\n'); + * res.end(); + * }) + * .listen(3000); + * + * setInterval(() => { + * // Adapting a keep-alive agent + * http.get('http://localhost:3000', { agent }, (res) => { + * res.on('data', (data) => { + * // Do nothing + * }); + * }); + * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout + * ``` + * + * By marking a request whether it reused socket or not, we can do + * automatic error retry base on it. + * + * ```js + * const http = require('node:http'); + * const agent = new http.Agent({ keepAlive: true }); + * + * function retriableRequest() { + * const req = http + * .get('http://localhost:3000', { agent }, (res) => { + * // ... + * }) + * .on('error', (err) => { + * // Check if retry is needed + * if (req.reusedSocket && err.code === 'ECONNRESET') { + * retriableRequest(); + * } + * }); + * } + * + * retriableRequest(); + * ``` + * @since v13.0.0, v12.16.0 + */ + reusedSocket: boolean; + /** + * Limits maximum response headers count. If set to 0, no limit will be applied. + */ + maxHeadersCount: number; + constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); + /** + * The request method. + * @since v0.1.97 + */ + method: string; + /** + * The request path. + * @since v0.4.0 + */ + path: string; + /** + * Marks the request as aborting. Calling this will cause remaining data + * in the response to be dropped and the socket to be destroyed. + * @since v0.3.8 + * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead. + */ + abort(): void; + onSocket(socket: Socket): void; + /** + * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called. + * @since v0.5.9 + * @param timeout Milliseconds before a request times out. + * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event. + */ + setTimeout(timeout: number, callback?: () => void): this; + /** + * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called. + * @since v0.5.9 + */ + setNoDelay(noDelay?: boolean): void; + /** + * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called. + * @since v0.5.9 + */ + setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; + /** + * Returns an array containing the unique names of the current outgoing raw + * headers. Header names are returned with their exact casing being set. + * + * ```js + * request.setHeader('Foo', 'bar'); + * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headerNames = request.getRawHeaderNames(); + * // headerNames === ['Foo', 'Set-Cookie'] + * ``` + * @since v15.13.0, v14.17.0 + */ + getRawHeaderNames(): string[]; + /** + * @deprecated + */ + addListener(event: 'abort', listener: () => void): this; + addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + addListener(event: 'continue', listener: () => void): this; + addListener(event: 'information', listener: (info: InformationEvent) => void): this; + addListener(event: 'response', listener: (response: IncomingMessage) => void): this; + addListener(event: 'socket', listener: (socket: Socket) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + on(event: 'abort', listener: () => void): this; + on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + on(event: 'continue', listener: () => void): this; + on(event: 'information', listener: (info: InformationEvent) => void): this; + on(event: 'response', listener: (response: IncomingMessage) => void): this; + on(event: 'socket', listener: (socket: Socket) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + once(event: 'abort', listener: () => void): this; + once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + once(event: 'continue', listener: () => void): this; + once(event: 'information', listener: (info: InformationEvent) => void): this; + once(event: 'response', listener: (response: IncomingMessage) => void): this; + once(event: 'socket', listener: (socket: Socket) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'pipe', listener: (src: stream.Readable) => void): this; + once(event: 'unpipe', listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + prependListener(event: 'abort', listener: () => void): this; + prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + prependListener(event: 'continue', listener: () => void): this; + prependListener(event: 'information', listener: (info: InformationEvent) => void): this; + prependListener(event: 'response', listener: (response: IncomingMessage) => void): this; + prependListener(event: 'socket', listener: (socket: Socket) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + /** + * @deprecated + */ + prependOnceListener(event: 'abort', listener: () => void): this; + prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + prependOnceListener(event: 'continue', listener: () => void): this; + prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this; + prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this; + prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to + * access response + * status, headers, and data. + * + * Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to + * parse and emit the incoming HTTP headers and payload, as the underlying socket + * may be reused multiple times in case of keep-alive. + * @since v0.1.17 + */ + class IncomingMessage extends stream.Readable { + constructor(socket: Socket); + /** + * The `message.aborted` property will be `true` if the request has + * been aborted. + * @since v10.1.0 + * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from stream.Readable. + */ + aborted: boolean; + /** + * In case of server request, the HTTP version sent by the client. In the case of + * client response, the HTTP version of the connected-to server. + * Probably either `'1.1'` or `'1.0'`. + * + * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second. + * @since v0.1.1 + */ + httpVersion: string; + httpVersionMajor: number; + httpVersionMinor: number; + /** + * The `message.complete` property will be `true` if a complete HTTP message has + * been received and successfully parsed. + * + * This property is particularly useful as a means of determining if a client or + * server fully transmitted a message before a connection was terminated: + * + * ```js + * const req = http.request({ + * host: '127.0.0.1', + * port: 8080, + * method: 'POST', + * }, (res) => { + * res.resume(); + * res.on('end', () => { + * if (!res.complete) + * console.error( + * 'The connection was terminated while the message was still being sent'); + * }); + * }); + * ``` + * @since v0.3.0 + */ + complete: boolean; + /** + * Alias for `message.socket`. + * @since v0.1.90 + * @deprecated Since v16.0.0 - Use `socket`. + */ + connection: Socket; + /** + * The `net.Socket` object associated with the connection. + * + * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the + * client's authentication details. + * + * This property is guaranteed to be an instance of the `net.Socket` class, + * a subclass of `stream.Duplex`, unless the user specified a socket + * type other than `net.Socket` or internally nulled. + * @since v0.3.0 + */ + socket: Socket; + /** + * The request/response headers object. + * + * Key-value pairs of header names and values. Header names are lower-cased. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': 'curl/7.22.0', + * // host: '127.0.0.1:8000', + * // accept: '*' } + * console.log(request.headers); + * ``` + * + * Duplicates in raw headers are handled in the following ways, depending on the + * header name: + * + * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,`last-modified`, `location`, + * `max-forwards`, `proxy-authorization`, `referer`,`retry-after`, `server`, or `user-agent` are discarded. + * To allow duplicate values of the headers listed above to be joined, + * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more + * information. + * * `set-cookie` is always an array. Duplicates are added to the array. + * * For duplicate `cookie` headers, the values are joined together with `; `. + * * For all other headers, the values are joined together with `, `. + * @since v0.1.5 + */ + headers: IncomingHttpHeaders; + /** + * Similar to `message.headers`, but there is no join logic and the values are + * always arrays of strings, even for headers received just once. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': ['curl/7.22.0'], + * // host: ['127.0.0.1:8000'], + * // accept: ['*'] } + * console.log(request.headersDistinct); + * ``` + * @since v18.3.0, v16.17.0 + */ + headersDistinct: NodeJS.Dict; + /** + * The raw request/response headers list exactly as they were received. + * + * The keys and values are in the same list. It is _not_ a + * list of tuples. So, the even-numbered offsets are key values, and the + * odd-numbered offsets are the associated values. + * + * Header names are not lowercased, and duplicates are not merged. + * + * ```js + * // Prints something like: + * // + * // [ 'user-agent', + * // 'this is invalid because there can be only one', + * // 'User-Agent', + * // 'curl/7.22.0', + * // 'Host', + * // '127.0.0.1:8000', + * // 'ACCEPT', + * // '*' ] + * console.log(request.rawHeaders); + * ``` + * @since v0.11.6 + */ + rawHeaders: string[]; + /** + * The request/response trailers object. Only populated at the `'end'` event. + * @since v0.3.0 + */ + trailers: NodeJS.Dict; + /** + * Similar to `message.trailers`, but there is no join logic and the values are + * always arrays of strings, even for headers received just once. + * Only populated at the `'end'` event. + * @since v18.3.0, v16.17.0 + */ + trailersDistinct: NodeJS.Dict; + /** + * The raw request/response trailer keys and values exactly as they were + * received. Only populated at the `'end'` event. + * @since v0.11.6 + */ + rawTrailers: string[]; + /** + * Calls `message.socket.setTimeout(msecs, callback)`. + * @since v0.5.9 + */ + setTimeout(msecs: number, callback?: () => void): this; + /** + * **Only valid for request obtained from {@link Server}.** + * + * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`. + * @since v0.1.1 + */ + method?: string | undefined; + /** + * **Only valid for request obtained from {@link Server}.** + * + * Request URL string. This contains only the URL that is present in the actual + * HTTP request. Take the following request: + * + * ```http + * GET /status?name=ryan HTTP/1.1 + * Accept: text/plain + * ``` + * + * To parse the URL into its parts: + * + * ```js + * new URL(request.url, `http://${request.headers.host}`); + * ``` + * + * When `request.url` is `'/status?name=ryan'` and `request.headers.host` is`'localhost:3000'`: + * + * ```console + * $ node + * > new URL(request.url, `http://${request.headers.host}`) + * URL { + * href: 'http://localhost:3000/status?name=ryan', + * origin: 'http://localhost:3000', + * protocol: 'http:', + * username: '', + * password: '', + * host: 'localhost:3000', + * hostname: 'localhost', + * port: '3000', + * pathname: '/status', + * search: '?name=ryan', + * searchParams: URLSearchParams { 'name' => 'ryan' }, + * hash: '' + * } + * ``` + * @since v0.1.90 + */ + url?: string | undefined; + /** + * **Only valid for response obtained from {@link ClientRequest}.** + * + * The 3-digit HTTP response status code. E.G. `404`. + * @since v0.1.1 + */ + statusCode?: number | undefined; + /** + * **Only valid for response obtained from {@link ClientRequest}.** + * + * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. + * @since v0.11.10 + */ + statusMessage?: string | undefined; + /** + * Calls `destroy()` on the socket that received the `IncomingMessage`. If `error`is provided, an `'error'` event is emitted on the socket and `error` is passed + * as an argument to any listeners on the event. + * @since v0.3.0 + */ + destroy(error?: Error): this; + } + interface AgentOptions extends Partial { + /** + * Keep sockets around in a pool to be used by other requests in the future. Default = false + */ + keepAlive?: boolean | undefined; + /** + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + */ + keepAliveMsecs?: number | undefined; + /** + * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity + */ + maxSockets?: number | undefined; + /** + * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity. + */ + maxTotalSockets?: number | undefined; + /** + * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. + */ + maxFreeSockets?: number | undefined; + /** + * Socket timeout in milliseconds. This will set the timeout after the socket is connected. + */ + timeout?: number | undefined; + /** + * Scheduling strategy to apply when picking the next free socket to use. + * @default `lifo` + */ + scheduling?: 'fifo' | 'lifo' | undefined; + } + /** + * An `Agent` is responsible for managing connection persistence + * and reuse for HTTP clients. It maintains a queue of pending requests + * for a given host and port, reusing a single socket connection for each + * until the queue is empty, at which time the socket is either destroyed + * or put into a pool where it is kept to be used again for requests to the + * same host and port. Whether it is destroyed or pooled depends on the`keepAlive` `option`. + * + * Pooled connections have TCP Keep-Alive enabled for them, but servers may + * still close idle connections, in which case they will be removed from the + * pool and a new connection will be made when a new HTTP request is made for + * that host and port. Servers may also refuse to allow multiple requests + * over the same connection, in which case the connection will have to be + * remade for every request and cannot be pooled. The `Agent` will still make + * the requests to that server, but each one will occur over a new connection. + * + * When a connection is closed by the client or the server, it is removed + * from the pool. Any unused sockets in the pool will be unrefed so as not + * to keep the Node.js process running when there are no outstanding requests. + * (see `socket.unref()`). + * + * It is good practice, to `destroy()` an `Agent` instance when it is no + * longer in use, because unused sockets consume OS resources. + * + * Sockets are removed from an agent when the socket emits either + * a `'close'` event or an `'agentRemove'` event. When intending to keep one + * HTTP request open for a long time without keeping it in the agent, something + * like the following may be done: + * + * ```js + * http.get(options, (res) => { + * // Do stuff + * }).on('socket', (socket) => { + * socket.emit('agentRemove'); + * }); + * ``` + * + * An agent may also be used for an individual request. By providing`{agent: false}` as an option to the `http.get()` or `http.request()`functions, a one-time use `Agent` with default options + * will be used + * for the client connection. + * + * `agent:false`: + * + * ```js + * http.get({ + * hostname: 'localhost', + * port: 80, + * path: '/', + * agent: false, // Create a new agent just for this one request + * }, (res) => { + * // Do stuff with response + * }); + * ``` + * @since v0.3.4 + */ + class Agent extends EventEmitter { + /** + * By default set to 256. For agents with `keepAlive` enabled, this + * sets the maximum number of sockets that will be left open in the free + * state. + * @since v0.11.7 + */ + maxFreeSockets: number; + /** + * By default set to `Infinity`. Determines how many concurrent sockets the agent + * can have open per origin. Origin is the returned value of `agent.getName()`. + * @since v0.3.6 + */ + maxSockets: number; + /** + * By default set to `Infinity`. Determines how many concurrent sockets the agent + * can have open. Unlike `maxSockets`, this parameter applies across all origins. + * @since v14.5.0, v12.19.0 + */ + maxTotalSockets: number; + /** + * An object which contains arrays of sockets currently awaiting use by + * the agent when `keepAlive` is enabled. Do not modify. + * + * Sockets in the `freeSockets` list will be automatically destroyed and + * removed from the array on `'timeout'`. + * @since v0.11.4 + */ + readonly freeSockets: NodeJS.ReadOnlyDict; + /** + * An object which contains arrays of sockets currently in use by the + * agent. Do not modify. + * @since v0.3.6 + */ + readonly sockets: NodeJS.ReadOnlyDict; + /** + * An object which contains queues of requests that have not yet been assigned to + * sockets. Do not modify. + * @since v0.5.9 + */ + readonly requests: NodeJS.ReadOnlyDict; + constructor(opts?: AgentOptions); + /** + * Destroy any sockets that are currently in use by the agent. + * + * It is usually not necessary to do this. However, if using an + * agent with `keepAlive` enabled, then it is best to explicitly shut down + * the agent when it is no longer needed. Otherwise, + * sockets might stay open for quite a long time before the server + * terminates them. + * @since v0.11.4 + */ + destroy(): void; + } + const METHODS: string[]; + const STATUS_CODES: { + [errorCode: number]: string | undefined; + [errorCode: string]: string | undefined; + }; + /** + * Returns a new instance of {@link Server}. + * + * The `requestListener` is a function which is automatically + * added to the `'request'` event. + * @since v0.1.13 + */ + function createServer< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + >(requestListener?: RequestListener): Server; + function createServer< + Request extends typeof IncomingMessage = typeof IncomingMessage, + Response extends typeof ServerResponse = typeof ServerResponse, + >( + options: ServerOptions, + requestListener?: RequestListener, + ): Server; + // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, + // create interface RequestOptions would make the naming more clear to developers + interface RequestOptions extends ClientRequestArgs {} + /** + * `options` in `socket.connect()` are also supported. + * + * Node.js maintains several connections per server to make HTTP requests. + * This function allows one to transparently issue requests. + * + * `url` can be a string or a `URL` object. If `url` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * If both `url` and `options` are specified, the objects are merged, with the`options` properties taking precedence. + * + * The optional `callback` parameter will be added as a one-time listener for + * the `'response'` event. + * + * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to + * upload a file with a POST request, then write to the `ClientRequest` object. + * + * ```js + * const http = require('node:http'); + * + * const postData = JSON.stringify({ + * 'msg': 'Hello World!', + * }); + * + * const options = { + * hostname: 'www.google.com', + * port: 80, + * path: '/upload', + * method: 'POST', + * headers: { + * 'Content-Type': 'application/json', + * 'Content-Length': Buffer.byteLength(postData), + * }, + * }; + * + * const req = http.request(options, (res) => { + * console.log(`STATUS: ${res.statusCode}`); + * console.log(`HEADERS: ${JSON.stringify(res.headers)}`); + * res.setEncoding('utf8'); + * res.on('data', (chunk) => { + * console.log(`BODY: ${chunk}`); + * }); + * res.on('end', () => { + * console.log('No more data in response.'); + * }); + * }); + * + * req.on('error', (e) => { + * console.error(`problem with request: ${e.message}`); + * }); + * + * // Write data to request body + * req.write(postData); + * req.end(); + * ``` + * + * In the example `req.end()` was called. With `http.request()` one + * must always call `req.end()` to signify the end of the request - + * even if there is no data being written to the request body. + * + * If any error is encountered during the request (be that with DNS resolution, + * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted + * on the returned request object. As with all `'error'` events, if no listeners + * are registered the error will be thrown. + * + * There are a few special headers that should be noted. + * + * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to + * the server should be persisted until the next request. + * * Sending a 'Content-Length' header will disable the default chunked encoding. + * * Sending an 'Expect' header will immediately send the request headers. + * Usually, when sending 'Expect: 100-continue', both a timeout and a listener + * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more + * information. + * * Sending an Authorization header will override using the `auth` option + * to compute basic authentication. + * + * Example using a `URL` as `options`: + * + * ```js + * const options = new URL('http://abc:xyz@example.com'); + * + * const req = http.request(options, (res) => { + * // ... + * }); + * ``` + * + * In a successful request, the following events will be emitted in the following + * order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * (`'data'` will not be emitted at all if the response body is empty, for + * instance, in most redirects) + * * `'end'` on the `res` object + * * `'close'` + * + * In the case of a connection error, the following events will be emitted: + * + * * `'socket'` + * * `'error'` + * * `'close'` + * + * In the case of a premature connection close before the response is received, + * the following events will be emitted in the following order: + * + * * `'socket'` + * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'` + * * `'close'` + * + * In the case of a premature connection close after the response is received, + * the following events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (connection closed here) + * * `'aborted'` on the `res` object + * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'` + * * `'close'` + * * `'close'` on the `res` object + * + * If `req.destroy()` is called before a socket is assigned, the following + * events will be emitted in the following order: + * + * * (`req.destroy()` called here) + * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` + * + * If `req.destroy()` is called before the connection succeeds, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * (`req.destroy()` called here) + * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` + * + * If `req.destroy()` is called after the response is received, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (`req.destroy()` called here) + * * `'aborted'` on the `res` object + * * `'error'` on the `res` object with an error with message `'Error: aborted'`and code `'ECONNRESET'`, or the error with which `req.destroy()` was called + * * `'close'` + * * `'close'` on the `res` object + * + * If `req.abort()` is called before a socket is assigned, the following + * events will be emitted in the following order: + * + * * (`req.abort()` called here) + * * `'abort'` + * * `'close'` + * + * If `req.abort()` is called before the connection succeeds, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * (`req.abort()` called here) + * * `'abort'` + * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'` + * * `'close'` + * + * If `req.abort()` is called after the response is received, the following + * events will be emitted in the following order: + * + * * `'socket'` + * * `'response'` + * * `'data'` any number of times, on the `res` object + * * (`req.abort()` called here) + * * `'abort'` + * * `'aborted'` on the `res` object + * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`. + * * `'close'` + * * `'close'` on the `res` object + * + * Setting the `timeout` option or using the `setTimeout()` function will + * not abort the request or do anything besides add a `'timeout'` event. + * + * Passing an `AbortSignal` and then calling `abort()` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the + * request. Specifically, the `'error'` event will be emitted with an error with + * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`and the `cause`, if one was provided. + * @since v0.3.6 + */ + function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; + function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; + /** + * Since most requests are GET requests without bodies, Node.js provides this + * convenience method. The only difference between this method and {@link request} is that it sets the method to GET and calls `req.end()`automatically. The callback must take care to consume the + * response + * data for reasons stated in {@link ClientRequest} section. + * + * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}. + * + * JSON fetching example: + * + * ```js + * http.get('http://localhost:8000/', (res) => { + * const { statusCode } = res; + * const contentType = res.headers['content-type']; + * + * let error; + * // Any 2xx status code signals a successful response but + * // here we're only checking for 200. + * if (statusCode !== 200) { + * error = new Error('Request Failed.\n' + + * `Status Code: ${statusCode}`); + * } else if (!/^application\/json/.test(contentType)) { + * error = new Error('Invalid content-type.\n' + + * `Expected application/json but received ${contentType}`); + * } + * if (error) { + * console.error(error.message); + * // Consume response data to free up memory + * res.resume(); + * return; + * } + * + * res.setEncoding('utf8'); + * let rawData = ''; + * res.on('data', (chunk) => { rawData += chunk; }); + * res.on('end', () => { + * try { + * const parsedData = JSON.parse(rawData); + * console.log(parsedData); + * } catch (e) { + * console.error(e.message); + * } + * }); + * }).on('error', (e) => { + * console.error(`Got error: ${e.message}`); + * }); + * + * // Create a local server to receive data from + * const server = http.createServer((req, res) => { + * res.writeHead(200, { 'Content-Type': 'application/json' }); + * res.end(JSON.stringify({ + * data: 'Hello World!', + * })); + * }); + * + * server.listen(8000); + * ``` + * @since v0.3.6 + * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. Properties that are inherited from the prototype are ignored. + */ + function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; + function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; + /** + * Performs the low-level validations on the provided `name` that are done when`res.setHeader(name, value)` is called. + * + * Passing illegal value as `name` will result in a `TypeError` being thrown, + * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`. + * + * It is not necessary to use this method before passing headers to an HTTP request + * or response. The HTTP module will automatically validate such headers. + * Examples: + * + * Example: + * + * ```js + * const { validateHeaderName } = require('node:http'); + * + * try { + * validateHeaderName(''); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN' + * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]' + * } + * ``` + * @since v14.3.0 + * @param [label='Header name'] Label for error message. + */ + function validateHeaderName(name: string): void; + /** + * Performs the low-level validations on the provided `value` that are done when`res.setHeader(name, value)` is called. + * + * Passing illegal value as `value` will result in a `TypeError` being thrown. + * + * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`. + * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`. + * + * It is not necessary to use this method before passing headers to an HTTP request + * or response. The HTTP module will automatically validate such headers. + * + * Examples: + * + * ```js + * const { validateHeaderValue } = require('node:http'); + * + * try { + * validateHeaderValue('x-my-header', undefined); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true + * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"' + * } + * + * try { + * validateHeaderValue('x-my-header', 'oʊmɪɡə'); + * } catch (err) { + * console.error(err instanceof TypeError); // --> true + * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true + * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]' + * } + * ``` + * @since v14.3.0 + * @param name Header name + * @param value Header value + */ + function validateHeaderValue(name: string, value: string): void; + /** + * Set the maximum number of idle HTTP parsers. + * @since v18.8.0, v16.18.0 + * @param [max=1000] + */ + function setMaxIdleHTTPParsers(max: number): void; + let globalAgent: Agent; + /** + * Read-only property specifying the maximum allowed size of HTTP headers in bytes. + * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option. + */ + const maxHeaderSize: number; +} +declare module 'node:http' { + export * from 'http'; +} diff --git a/node_modules/@types/node/ts4.8/http2.d.ts b/node_modules/@types/node/ts4.8/http2.d.ts new file mode 100755 index 0000000..1d29a2c --- /dev/null +++ b/node_modules/@types/node/ts4.8/http2.d.ts @@ -0,0 +1,2129 @@ +/** + * The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol. + * It can be accessed using: + * + * ```js + * const http2 = require('node:http2'); + * ``` + * @since v8.4.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http2.js) + */ +declare module 'http2' { + import EventEmitter = require('node:events'); + import * as fs from 'node:fs'; + import * as net from 'node:net'; + import * as stream from 'node:stream'; + import * as tls from 'node:tls'; + import * as url from 'node:url'; + import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http'; + export { OutgoingHttpHeaders } from 'node:http'; + export interface IncomingHttpStatusHeader { + ':status'?: number | undefined; + } + export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { + ':path'?: string | undefined; + ':method'?: string | undefined; + ':authority'?: string | undefined; + ':scheme'?: string | undefined; + } + // Http2Stream + export interface StreamPriorityOptions { + exclusive?: boolean | undefined; + parent?: number | undefined; + weight?: number | undefined; + silent?: boolean | undefined; + } + export interface StreamState { + localWindowSize?: number | undefined; + state?: number | undefined; + localClose?: number | undefined; + remoteClose?: number | undefined; + sumDependencyWeight?: number | undefined; + weight?: number | undefined; + } + export interface ServerStreamResponseOptions { + endStream?: boolean | undefined; + waitForTrailers?: boolean | undefined; + } + export interface StatOptions { + offset: number; + length: number; + } + export interface ServerStreamFileResponseOptions { + statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean; + waitForTrailers?: boolean | undefined; + offset?: number | undefined; + length?: number | undefined; + } + export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { + onError?(err: NodeJS.ErrnoException): void; + } + export interface Http2Stream extends stream.Duplex { + /** + * Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, + * the `'aborted'` event will have been emitted. + * @since v8.4.0 + */ + readonly aborted: boolean; + /** + * This property shows the number of characters currently buffered to be written. + * See `net.Socket.bufferSize` for details. + * @since v11.2.0, v10.16.0 + */ + readonly bufferSize: number; + /** + * Set to `true` if the `Http2Stream` instance has been closed. + * @since v9.4.0 + */ + readonly closed: boolean; + /** + * Set to `true` if the `Http2Stream` instance has been destroyed and is no longer + * usable. + * @since v8.4.0 + */ + readonly destroyed: boolean; + /** + * Set to `true` if the `END_STREAM` flag was set in the request or response + * HEADERS frame received, indicating that no additional data should be received + * and the readable side of the `Http2Stream` will be closed. + * @since v10.11.0 + */ + readonly endAfterHeaders: boolean; + /** + * The numeric stream identifier of this `Http2Stream` instance. Set to `undefined`if the stream identifier has not yet been assigned. + * @since v8.4.0 + */ + readonly id?: number | undefined; + /** + * Set to `true` if the `Http2Stream` instance has not yet been assigned a + * numeric stream identifier. + * @since v9.4.0 + */ + readonly pending: boolean; + /** + * Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is + * destroyed after either receiving an `RST_STREAM` frame from the connected peer, + * calling `http2stream.close()`, or `http2stream.destroy()`. Will be`undefined` if the `Http2Stream` has not been closed. + * @since v8.4.0 + */ + readonly rstCode: number; + /** + * An object containing the outbound headers sent for this `Http2Stream`. + * @since v9.5.0 + */ + readonly sentHeaders: OutgoingHttpHeaders; + /** + * An array of objects containing the outbound informational (additional) headers + * sent for this `Http2Stream`. + * @since v9.5.0 + */ + readonly sentInfoHeaders?: OutgoingHttpHeaders[] | undefined; + /** + * An object containing the outbound trailers sent for this `HttpStream`. + * @since v9.5.0 + */ + readonly sentTrailers?: OutgoingHttpHeaders | undefined; + /** + * A reference to the `Http2Session` instance that owns this `Http2Stream`. The + * value will be `undefined` after the `Http2Stream` instance is destroyed. + * @since v8.4.0 + */ + readonly session: Http2Session | undefined; + /** + * Provides miscellaneous information about the current state of the`Http2Stream`. + * + * A current state of this `Http2Stream`. + * @since v8.4.0 + */ + readonly state: StreamState; + /** + * Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the + * connected HTTP/2 peer. + * @since v8.4.0 + * @param [code=http2.constants.NGHTTP2_NO_ERROR] Unsigned 32-bit integer identifying the error code. + * @param callback An optional function registered to listen for the `'close'` event. + */ + close(code?: number, callback?: () => void): void; + /** + * Updates the priority for this `Http2Stream` instance. + * @since v8.4.0 + */ + priority(options: StreamPriorityOptions): void; + /** + * ```js + * const http2 = require('node:http2'); + * const client = http2.connect('http://example.org:8000'); + * const { NGHTTP2_CANCEL } = http2.constants; + * const req = client.request({ ':path': '/' }); + * + * // Cancel the stream if there's no activity after 5 seconds + * req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); + * ``` + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method + * will cause the `Http2Stream` to be immediately closed and must only be + * called after the `'wantTrailers'` event has been emitted. When sending a + * request or sending a response, the `options.waitForTrailers` option must be set + * in order to keep the `Http2Stream` open after the final `DATA` frame so that + * trailers can be sent. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond(undefined, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ xyz: 'abc' }); + * }); + * stream.end('Hello World'); + * }); + * ``` + * + * The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header + * fields (e.g. `':method'`, `':path'`, etc). + * @since v10.0.0 + */ + sendTrailers(headers: OutgoingHttpHeaders): void; + addListener(event: 'aborted', listener: () => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'streamClosed', listener: (code: number) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: 'wantTrailers', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'aborted'): boolean; + emit(event: 'close'): boolean; + emit(event: 'data', chunk: Buffer | string): boolean; + emit(event: 'drain'): boolean; + emit(event: 'end'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'finish'): boolean; + emit(event: 'frameError', frameType: number, errorCode: number): boolean; + emit(event: 'pipe', src: stream.Readable): boolean; + emit(event: 'unpipe', src: stream.Readable): boolean; + emit(event: 'streamClosed', code: number): boolean; + emit(event: 'timeout'): boolean; + emit(event: 'trailers', trailers: IncomingHttpHeaders, flags: number): boolean; + emit(event: 'wantTrailers'): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'aborted', listener: () => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: Buffer | string) => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: 'streamClosed', listener: (code: number) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + on(event: 'wantTrailers', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'aborted', listener: () => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: Buffer | string) => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + once(event: 'pipe', listener: (src: stream.Readable) => void): this; + once(event: 'unpipe', listener: (src: stream.Readable) => void): this; + once(event: 'streamClosed', listener: (code: number) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + once(event: 'wantTrailers', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'aborted', listener: () => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'streamClosed', listener: (code: number) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: 'wantTrailers', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'aborted', listener: () => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'frameError', listener: (frameType: number, errorCode: number) => void): this; + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'streamClosed', listener: (code: number) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: 'trailers', listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: 'wantTrailers', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ClientHttp2Stream extends Http2Stream { + addListener(event: 'continue', listener: () => {}): this; + addListener(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + addListener(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'continue'): boolean; + emit(event: 'headers', headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit(event: 'push', headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: 'response', headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'continue', listener: () => {}): this; + on(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + on(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + on(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'continue', listener: () => {}): this; + once(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + once(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + once(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'continue', listener: () => {}): this; + prependListener(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependListener(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'continue', listener: () => {}): this; + prependOnceListener(event: 'headers', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependOnceListener(event: 'push', listener: (headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: 'response', listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ServerHttp2Stream extends Http2Stream { + /** + * True if headers were sent, false otherwise (read-only). + * @since v8.4.0 + */ + readonly headersSent: boolean; + /** + * Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote + * client's most recent `SETTINGS` frame. Will be `true` if the remote peer + * accepts push streams, `false` otherwise. Settings are the same for every`Http2Stream` in the same `Http2Session`. + * @since v8.4.0 + */ + readonly pushAllowed: boolean; + /** + * Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer. + * @since v8.4.0 + */ + additionalHeaders(headers: OutgoingHttpHeaders): void; + /** + * Initiates a push stream. The callback is invoked with the new `Http2Stream`instance created for the push stream passed as the second argument, or an`Error` passed as the first argument. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }); + * stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => { + * if (err) throw err; + * pushStream.respond({ ':status': 200 }); + * pushStream.end('some pushed data'); + * }); + * stream.end('some data'); + * }); + * ``` + * + * Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass + * a `weight` value to `http2stream.priority` with the `silent` option set to`true` to enable server-side bandwidth balancing between concurrent streams. + * + * Calling `http2stream.pushStream()` from within a pushed stream is not permitted + * and will throw an error. + * @since v8.4.0 + * @param callback Callback that is called once the push stream has been initiated. + */ + pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; + pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; + /** + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }); + * stream.end('some data'); + * }); + * ``` + * + * Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event will be emitted immediately after queuing the last chunk + * of payload data to be sent. The `http2stream.sendTrailers()` method can then be + * used to sent trailing header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respond({ ':status': 200 }, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * stream.end('some data'); + * }); + * ``` + * @since v8.4.0 + */ + respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; + /** + * Initiates a response whose data is read from the given file descriptor. No + * validation is performed on the given file descriptor. If an error occurs while + * attempting to read data using the file descriptor, the `Http2Stream` will be + * closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. + * + * When used, the `Http2Stream` object's `Duplex` interface will be closed + * automatically. + * + * ```js + * const http2 = require('node:http2'); + * const fs = require('node:fs'); + * + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * const fd = fs.openSync('/some/file', 'r'); + * + * const stat = fs.fstatSync(fd); + * const headers = { + * 'content-length': stat.size, + * 'last-modified': stat.mtime.toUTCString(), + * 'content-type': 'text/plain; charset=utf-8', + * }; + * stream.respondWithFD(fd, headers); + * stream.on('close', () => fs.closeSync(fd)); + * }); + * ``` + * + * The optional `options.statCheck` function may be specified to give user code + * an opportunity to set additional content headers based on the `fs.Stat` details + * of the given fd. If the `statCheck` function is provided, the`http2stream.respondWithFD()` method will perform an `fs.fstat()` call to + * collect details on the provided file descriptor. + * + * The `offset` and `length` options may be used to limit the response to a + * specific range subset. This can be used, for instance, to support HTTP Range + * requests. + * + * The file descriptor or `FileHandle` is not closed when the stream is closed, + * so it will need to be closed manually once it is no longer needed. + * Using the same file descriptor concurrently for multiple streams + * is not supported and may result in data loss. Re-using a file descriptor + * after a stream has finished is supported. + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * will be emitted immediately after queuing the last chunk of payload data to be + * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing + * header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code _must_ call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * ```js + * const http2 = require('node:http2'); + * const fs = require('node:fs'); + * + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * const fd = fs.openSync('/some/file', 'r'); + * + * const stat = fs.fstatSync(fd); + * const headers = { + * 'content-length': stat.size, + * 'last-modified': stat.mtime.toUTCString(), + * 'content-type': 'text/plain; charset=utf-8', + * }; + * stream.respondWithFD(fd, headers, { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * + * stream.on('close', () => fs.closeSync(fd)); + * }); + * ``` + * @since v8.4.0 + * @param fd A readable file descriptor. + */ + respondWithFD(fd: number | fs.promises.FileHandle, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void; + /** + * Sends a regular file as the response. The `path` must specify a regular file + * or an `'error'` event will be emitted on the `Http2Stream` object. + * + * When used, the `Http2Stream` object's `Duplex` interface will be closed + * automatically. + * + * The optional `options.statCheck` function may be specified to give user code + * an opportunity to set additional content headers based on the `fs.Stat` details + * of the given file: + * + * If an error occurs while attempting to read the file data, the `Http2Stream`will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR`code. If the `onError` callback is + * defined, then it will be called. Otherwise + * the stream will be destroyed. + * + * Example using a file path: + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * function statCheck(stat, headers) { + * headers['last-modified'] = stat.mtime.toUTCString(); + * } + * + * function onError(err) { + * // stream.respond() can throw if the stream has been destroyed by + * // the other side. + * try { + * if (err.code === 'ENOENT') { + * stream.respond({ ':status': 404 }); + * } else { + * stream.respond({ ':status': 500 }); + * } + * } catch (err) { + * // Perform actual error handling. + * console.error(err); + * } + * stream.end(); + * } + * + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { statCheck, onError }); + * }); + * ``` + * + * The `options.statCheck` function may also be used to cancel the send operation + * by returning `false`. For instance, a conditional request may check the stat + * results to determine if the file has been modified to return an appropriate`304` response: + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * function statCheck(stat, headers) { + * // Check the stat here... + * stream.respond({ ':status': 304 }); + * return false; // Cancel the send operation + * } + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { statCheck }); + * }); + * ``` + * + * The `content-length` header field will be automatically set. + * + * The `offset` and `length` options may be used to limit the response to a + * specific range subset. This can be used, for instance, to support HTTP Range + * requests. + * + * The `options.onError` function may also be used to handle all the errors + * that could happen before the delivery of the file is initiated. The + * default behavior is to destroy the stream. + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * will be emitted immediately after queuing the last chunk of payload data to be + * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing + * header fields to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer(); + * server.on('stream', (stream) => { + * stream.respondWithFile('/some/file', + * { 'content-type': 'text/plain; charset=utf-8' }, + * { waitForTrailers: true }); + * stream.on('wantTrailers', () => { + * stream.sendTrailers({ ABC: 'some value to send' }); + * }); + * }); + * ``` + * @since v8.4.0 + */ + respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void; + } + // Http2Session + export interface Settings { + headerTableSize?: number | undefined; + enablePush?: boolean | undefined; + initialWindowSize?: number | undefined; + maxFrameSize?: number | undefined; + maxConcurrentStreams?: number | undefined; + maxHeaderListSize?: number | undefined; + enableConnectProtocol?: boolean | undefined; + } + export interface ClientSessionRequestOptions { + endStream?: boolean | undefined; + exclusive?: boolean | undefined; + parent?: number | undefined; + weight?: number | undefined; + waitForTrailers?: boolean | undefined; + signal?: AbortSignal | undefined; + } + export interface SessionState { + effectiveLocalWindowSize?: number | undefined; + effectiveRecvDataLength?: number | undefined; + nextStreamID?: number | undefined; + localWindowSize?: number | undefined; + lastProcStreamID?: number | undefined; + remoteWindowSize?: number | undefined; + outboundQueueSize?: number | undefined; + deflateDynamicTableSize?: number | undefined; + inflateDynamicTableSize?: number | undefined; + } + export interface Http2Session extends EventEmitter { + /** + * Value will be `undefined` if the `Http2Session` is not yet connected to a + * socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or + * will return the value of the connected `TLSSocket`'s own `alpnProtocol`property. + * @since v9.4.0 + */ + readonly alpnProtocol?: string | undefined; + /** + * Will be `true` if this `Http2Session` instance has been closed, otherwise`false`. + * @since v9.4.0 + */ + readonly closed: boolean; + /** + * Will be `true` if this `Http2Session` instance is still connecting, will be set + * to `false` before emitting `connect` event and/or calling the `http2.connect`callback. + * @since v10.0.0 + */ + readonly connecting: boolean; + /** + * Will be `true` if this `Http2Session` instance has been destroyed and must no + * longer be used, otherwise `false`. + * @since v8.4.0 + */ + readonly destroyed: boolean; + /** + * Value is `undefined` if the `Http2Session` session socket has not yet been + * connected, `true` if the `Http2Session` is connected with a `TLSSocket`, + * and `false` if the `Http2Session` is connected to any other kind of socket + * or stream. + * @since v9.4.0 + */ + readonly encrypted?: boolean | undefined; + /** + * A prototype-less object describing the current local settings of this`Http2Session`. The local settings are local to _this_`Http2Session` instance. + * @since v8.4.0 + */ + readonly localSettings: Settings; + /** + * If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property + * will return an `Array` of origins for which the `Http2Session` may be + * considered authoritative. + * + * The `originSet` property is only available when using a secure TLS connection. + * @since v9.4.0 + */ + readonly originSet?: string[] | undefined; + /** + * Indicates whether the `Http2Session` is currently waiting for acknowledgment of + * a sent `SETTINGS` frame. Will be `true` after calling the`http2session.settings()` method. Will be `false` once all sent `SETTINGS`frames have been acknowledged. + * @since v8.4.0 + */ + readonly pendingSettingsAck: boolean; + /** + * A prototype-less object describing the current remote settings of this`Http2Session`. The remote settings are set by the _connected_ HTTP/2 peer. + * @since v8.4.0 + */ + readonly remoteSettings: Settings; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * limits available methods to ones safe to use with HTTP/2. + * + * `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw + * an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for more information. + * + * `setTimeout` method will be called on this `Http2Session`. + * + * All other interactions will be routed directly to the socket. + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * Provides miscellaneous information about the current state of the`Http2Session`. + * + * An object describing the current status of this `Http2Session`. + * @since v8.4.0 + */ + readonly state: SessionState; + /** + * The `http2session.type` will be equal to`http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a + * server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a + * client. + * @since v8.4.0 + */ + readonly type: number; + /** + * Gracefully closes the `Http2Session`, allowing any existing streams to + * complete on their own and preventing new `Http2Stream` instances from being + * created. Once closed, `http2session.destroy()`_might_ be called if there + * are no open `Http2Stream` instances. + * + * If specified, the `callback` function is registered as a handler for the`'close'` event. + * @since v9.4.0 + */ + close(callback?: () => void): void; + /** + * Immediately terminates the `Http2Session` and the associated `net.Socket` or`tls.TLSSocket`. + * + * Once destroyed, the `Http2Session` will emit the `'close'` event. If `error`is not undefined, an `'error'` event will be emitted immediately before the`'close'` event. + * + * If there are any remaining open `Http2Streams` associated with the`Http2Session`, those will also be destroyed. + * @since v8.4.0 + * @param error An `Error` object if the `Http2Session` is being destroyed due to an error. + * @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`. + */ + destroy(error?: Error, code?: number): void; + /** + * Transmits a `GOAWAY` frame to the connected peer _without_ shutting down the`Http2Session`. + * @since v9.4.0 + * @param code An HTTP/2 error code + * @param lastStreamID The numeric ID of the last processed `Http2Stream` + * @param opaqueData A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame. + */ + goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; + /** + * Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must + * be provided. The method will return `true` if the `PING` was sent, `false`otherwise. + * + * The maximum number of outstanding (unacknowledged) pings is determined by the`maxOutstandingPings` configuration option. The default maximum is 10. + * + * If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView`containing 8 bytes of data that will be transmitted with the `PING` and + * returned with the ping acknowledgment. + * + * The callback will be invoked with three arguments: an error argument that will + * be `null` if the `PING` was successfully acknowledged, a `duration` argument + * that reports the number of milliseconds elapsed since the ping was sent and the + * acknowledgment was received, and a `Buffer` containing the 8-byte `PING`payload. + * + * ```js + * session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { + * if (!err) { + * console.log(`Ping acknowledged in ${duration} milliseconds`); + * console.log(`With payload '${payload.toString()}'`); + * } + * }); + * ``` + * + * If the `payload` argument is not specified, the default payload will be the + * 64-bit timestamp (little endian) marking the start of the `PING` duration. + * @since v8.9.3 + * @param payload Optional ping payload. + */ + ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; + ping(payload: NodeJS.ArrayBufferView, callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; + /** + * Calls `ref()` on this `Http2Session`instance's underlying `net.Socket`. + * @since v9.4.0 + */ + ref(): void; + /** + * Sets the local endpoint's window size. + * The `windowSize` is the total window size to set, not + * the delta. + * + * ```js + * const http2 = require('node:http2'); + * + * const server = http2.createServer(); + * const expectedWindowSize = 2 ** 20; + * server.on('connect', (session) => { + * + * // Set local window size to be 2 ** 20 + * session.setLocalWindowSize(expectedWindowSize); + * }); + * ``` + * @since v15.3.0, v14.18.0 + */ + setLocalWindowSize(windowSize: number): void; + /** + * Used to set a callback function that is called when there is no activity on + * the `Http2Session` after `msecs` milliseconds. The given `callback` is + * registered as a listener on the `'timeout'` event. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * Updates the current local settings for this `Http2Session` and sends a new`SETTINGS` frame to the connected HTTP/2 peer. + * + * Once called, the `http2session.pendingSettingsAck` property will be `true`while the session is waiting for the remote peer to acknowledge the new + * settings. + * + * The new settings will not become effective until the `SETTINGS` acknowledgment + * is received and the `'localSettings'` event is emitted. It is possible to send + * multiple `SETTINGS` frames while acknowledgment is still pending. + * @since v8.4.0 + * @param callback Callback that is called once the session is connected or right away if the session is already connected. + */ + settings(settings: Settings, callback?: (err: Error | null, settings: Settings, duration: number) => void): void; + /** + * Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`. + * @since v9.4.0 + */ + unref(): void; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + addListener(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + addListener(event: 'localSettings', listener: (settings: Settings) => void): this; + addListener(event: 'ping', listener: () => void): this; + addListener(event: 'remoteSettings', listener: (settings: Settings) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'frameError', frameType: number, errorCode: number, streamID: number): boolean; + emit(event: 'goaway', errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean; + emit(event: 'localSettings', settings: Settings): boolean; + emit(event: 'ping'): boolean; + emit(event: 'remoteSettings', settings: Settings): boolean; + emit(event: 'timeout'): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + on(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + on(event: 'localSettings', listener: (settings: Settings) => void): this; + on(event: 'ping', listener: () => void): this; + on(event: 'remoteSettings', listener: (settings: Settings) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + once(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + once(event: 'localSettings', listener: (settings: Settings) => void): this; + once(event: 'ping', listener: () => void): this; + once(event: 'remoteSettings', listener: (settings: Settings) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + prependListener(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + prependListener(event: 'localSettings', listener: (settings: Settings) => void): this; + prependListener(event: 'ping', listener: () => void): this; + prependListener(event: 'remoteSettings', listener: (settings: Settings) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'frameError', listener: (frameType: number, errorCode: number, streamID: number) => void): this; + prependOnceListener(event: 'goaway', listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; + prependOnceListener(event: 'localSettings', listener: (settings: Settings) => void): this; + prependOnceListener(event: 'ping', listener: () => void): this; + prependOnceListener(event: 'remoteSettings', listener: (settings: Settings) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface ClientHttp2Session extends Http2Session { + /** + * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an + * HTTP/2 request to the connected server. + * + * When a `ClientHttp2Session` is first created, the socket may not yet be + * connected. if `clienthttp2session.request()` is called during this time, the + * actual request will be deferred until the socket is ready to go. + * If the `session` is closed before the actual request be executed, an`ERR_HTTP2_GOAWAY_SESSION` is thrown. + * + * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`. + * + * ```js + * const http2 = require('node:http2'); + * const clientSession = http2.connect('https://localhost:1234'); + * const { + * HTTP2_HEADER_PATH, + * HTTP2_HEADER_STATUS, + * } = http2.constants; + * + * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); + * req.on('response', (headers) => { + * console.log(headers[HTTP2_HEADER_STATUS]); + * req.on('data', (chunk) => { // .. }); + * req.on('end', () => { // .. }); + * }); + * ``` + * + * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event + * is emitted immediately after queuing the last chunk of payload data to be sent. + * The `http2stream.sendTrailers()` method can then be called to send trailing + * headers to the peer. + * + * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically + * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. + * + * When `options.signal` is set with an `AbortSignal` and then `abort` on the + * corresponding `AbortController` is called, the request will emit an `'error'`event with an `AbortError` error. + * + * The `:method` and `:path` pseudo-headers are not specified within `headers`, + * they respectively default to: + * + * * `:method` \= `'GET'` + * * `:path` \= `/` + * @since v8.4.0 + */ + request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; + addListener(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + addListener(event: 'origin', listener: (origins: string[]) => void): this; + addListener(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + addListener(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'altsvc', alt: string, origin: string, stream: number): boolean; + emit(event: 'origin', origins: ReadonlyArray): boolean; + emit(event: 'connect', session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; + emit(event: 'stream', stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + on(event: 'origin', listener: (origins: string[]) => void): this; + on(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + on(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + once(event: 'origin', listener: (origins: string[]) => void): this; + once(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + once(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + prependListener(event: 'origin', listener: (origins: string[]) => void): this; + prependListener(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + prependListener(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'altsvc', listener: (alt: string, origin: string, stream: number) => void): this; + prependOnceListener(event: 'origin', listener: (origins: string[]) => void): this; + prependOnceListener(event: 'connect', listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + prependOnceListener(event: 'stream', listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface AlternativeServiceOptions { + origin: number | string | url.URL; + } + export interface ServerHttp2Session extends Http2Session { + readonly server: Http2Server | Http2SecureServer; + /** + * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client. + * + * ```js + * const http2 = require('node:http2'); + * + * const server = http2.createServer(); + * server.on('session', (session) => { + * // Set altsvc for origin https://example.org:80 + * session.altsvc('h2=":8000"', 'https://example.org:80'); + * }); + * + * server.on('stream', (stream) => { + * // Set altsvc for a specific stream + * stream.session.altsvc('h2=":8000"', stream.id); + * }); + * ``` + * + * Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate + * service is associated with the origin of the given `Http2Stream`. + * + * The `alt` and origin string _must_ contain only ASCII bytes and are + * strictly interpreted as a sequence of ASCII bytes. The special value `'clear'`may be passed to clear any previously set alternative service for a given + * domain. + * + * When a string is passed for the `originOrStream` argument, it will be parsed as + * a URL and the origin will be derived. For instance, the origin for the + * HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string + * cannot be parsed as a URL or if a valid origin cannot be derived. + * + * A `URL` object, or any object with an `origin` property, may be passed as`originOrStream`, in which case the value of the `origin` property will be + * used. The value of the `origin` property _must_ be a properly serialized + * ASCII origin. + * @since v9.4.0 + * @param alt A description of the alternative service configuration as defined by `RFC 7838`. + * @param originOrStream Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the + * `http2stream.id` property. + */ + altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; + /** + * Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client + * to advertise the set of origins for which the server is capable of providing + * authoritative responses. + * + * ```js + * const http2 = require('node:http2'); + * const options = getSecureOptionsSomehow(); + * const server = http2.createSecureServer(options); + * server.on('stream', (stream) => { + * stream.respond(); + * stream.end('ok'); + * }); + * server.on('session', (session) => { + * session.origin('https://example.com', 'https://example.org'); + * }); + * ``` + * + * When a string is passed as an `origin`, it will be parsed as a URL and the + * origin will be derived. For instance, the origin for the HTTP URL`'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given + * string + * cannot be parsed as a URL or if a valid origin cannot be derived. + * + * A `URL` object, or any object with an `origin` property, may be passed as + * an `origin`, in which case the value of the `origin` property will be + * used. The value of the `origin` property _must_ be a properly serialized + * ASCII origin. + * + * Alternatively, the `origins` option may be used when creating a new HTTP/2 + * server using the `http2.createSecureServer()` method: + * + * ```js + * const http2 = require('node:http2'); + * const options = getSecureOptionsSomehow(); + * options.origins = ['https://example.com', 'https://example.org']; + * const server = http2.createSecureServer(options); + * server.on('stream', (stream) => { + * stream.respond(); + * stream.end('ok'); + * }); + * ``` + * @since v10.12.0 + * @param origins One or more URL Strings passed as separate arguments. + */ + origin( + ...origins: Array< + | string + | url.URL + | { + origin: string; + } + > + ): void; + addListener(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + addListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'connect', session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; + emit(event: 'stream', stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + on(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + once(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + prependListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'connect', listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; + prependOnceListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + // Http2Server + export interface SessionOptions { + maxDeflateDynamicTableSize?: number | undefined; + maxSessionMemory?: number | undefined; + maxHeaderListPairs?: number | undefined; + maxOutstandingPings?: number | undefined; + maxSendHeaderBlockLength?: number | undefined; + paddingStrategy?: number | undefined; + peerMaxConcurrentStreams?: number | undefined; + settings?: Settings | undefined; + /** + * Specifies a timeout in milliseconds that + * a server should wait when an [`'unknownProtocol'`][] is emitted. If the + * socket has not been destroyed by that time the server will destroy it. + * @default 100000 + */ + unknownProtocolTimeout?: number | undefined; + selectPadding?(frameLen: number, maxFrameLen: number): number; + } + export interface ClientSessionOptions extends SessionOptions { + maxReservedRemoteStreams?: number | undefined; + createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined; + protocol?: 'http:' | 'https:' | undefined; + } + export interface ServerSessionOptions extends SessionOptions { + Http1IncomingMessage?: typeof IncomingMessage | undefined; + Http1ServerResponse?: typeof ServerResponse | undefined; + Http2ServerRequest?: typeof Http2ServerRequest | undefined; + Http2ServerResponse?: typeof Http2ServerResponse | undefined; + } + export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {} + export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {} + export interface ServerOptions extends ServerSessionOptions {} + export interface SecureServerOptions extends SecureServerSessionOptions { + allowHTTP1?: boolean | undefined; + origins?: string[] | undefined; + } + interface HTTP2ServerCommon { + setTimeout(msec?: number, callback?: () => void): this; + /** + * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values. + * Throws ERR_INVALID_ARG_TYPE for invalid settings argument. + */ + updateSettings(settings: Settings): void; + } + export interface Http2Server extends net.Server, HTTP2ServerCommon { + addListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + addListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + addListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + addListener(event: 'sessionError', listener: (err: Error) => void): this; + addListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'checkContinue', request: Http2ServerRequest, response: Http2ServerResponse): boolean; + emit(event: 'request', request: Http2ServerRequest, response: Http2ServerResponse): boolean; + emit(event: 'session', session: ServerHttp2Session): boolean; + emit(event: 'sessionError', err: Error): boolean; + emit(event: 'stream', stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: 'timeout'): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + on(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + on(event: 'session', listener: (session: ServerHttp2Session) => void): this; + on(event: 'sessionError', listener: (err: Error) => void): this; + on(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + once(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + once(event: 'session', listener: (session: ServerHttp2Session) => void): this; + once(event: 'sessionError', listener: (err: Error) => void): this; + once(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + prependListener(event: 'sessionError', listener: (err: Error) => void): this; + prependListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependOnceListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependOnceListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + prependOnceListener(event: 'sessionError', listener: (err: Error) => void): this; + prependOnceListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon { + addListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + addListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + addListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + addListener(event: 'sessionError', listener: (err: Error) => void): this; + addListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + addListener(event: 'timeout', listener: () => void): this; + addListener(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'checkContinue', request: Http2ServerRequest, response: Http2ServerResponse): boolean; + emit(event: 'request', request: Http2ServerRequest, response: Http2ServerResponse): boolean; + emit(event: 'session', session: ServerHttp2Session): boolean; + emit(event: 'sessionError', err: Error): boolean; + emit(event: 'stream', stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; + emit(event: 'timeout'): boolean; + emit(event: 'unknownProtocol', socket: tls.TLSSocket): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + on(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + on(event: 'session', listener: (session: ServerHttp2Session) => void): this; + on(event: 'sessionError', listener: (err: Error) => void): this; + on(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + on(event: 'timeout', listener: () => void): this; + on(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + once(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + once(event: 'session', listener: (session: ServerHttp2Session) => void): this; + once(event: 'sessionError', listener: (err: Error) => void): this; + once(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + once(event: 'timeout', listener: () => void): this; + once(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + prependListener(event: 'sessionError', listener: (err: Error) => void): this; + prependListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependListener(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'checkContinue', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependOnceListener(event: 'request', listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; + prependOnceListener(event: 'session', listener: (session: ServerHttp2Session) => void): this; + prependOnceListener(event: 'sessionError', listener: (err: Error) => void): this; + prependOnceListener(event: 'stream', listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: 'unknownProtocol', listener: (socket: tls.TLSSocket) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status, + * headers, and + * data. + * @since v8.4.0 + */ + export class Http2ServerRequest extends stream.Readable { + constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: ReadonlyArray); + /** + * The `request.aborted` property will be `true` if the request has + * been aborted. + * @since v10.1.0 + */ + readonly aborted: boolean; + /** + * The request authority pseudo header field. Because HTTP/2 allows requests + * to set either `:authority` or `host`, this value is derived from`req.headers[':authority']` if present. Otherwise, it is derived from`req.headers['host']`. + * @since v8.4.0 + */ + readonly authority: string; + /** + * See `request.socket`. + * @since v8.4.0 + * @deprecated Since v13.0.0 - Use `socket`. + */ + readonly connection: net.Socket | tls.TLSSocket; + /** + * The `request.complete` property will be `true` if the request has + * been completed, aborted, or destroyed. + * @since v12.10.0 + */ + readonly complete: boolean; + /** + * The request/response headers object. + * + * Key-value pairs of header names and values. Header names are lower-cased. + * + * ```js + * // Prints something like: + * // + * // { 'user-agent': 'curl/7.22.0', + * // host: '127.0.0.1:8000', + * // accept: '*' } + * console.log(request.headers); + * ``` + * + * See `HTTP/2 Headers Object`. + * + * In HTTP/2, the request path, host name, protocol, and method are represented as + * special headers prefixed with the `:` character (e.g. `':path'`). These special + * headers will be included in the `request.headers` object. Care must be taken not + * to inadvertently modify these special headers or errors may occur. For instance, + * removing all headers from the request will cause errors to occur: + * + * ```js + * removeAllHeaders(request.headers); + * assert(request.url); // Fails because the :path header has been removed + * ``` + * @since v8.4.0 + */ + readonly headers: IncomingHttpHeaders; + /** + * In case of server request, the HTTP version sent by the client. In the case of + * client response, the HTTP version of the connected-to server. Returns`'2.0'`. + * + * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second. + * @since v8.4.0 + */ + readonly httpVersion: string; + readonly httpVersionMinor: number; + readonly httpVersionMajor: number; + /** + * The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`. + * @since v8.4.0 + */ + readonly method: string; + /** + * The raw request/response headers list exactly as they were received. + * + * The keys and values are in the same list. It is _not_ a + * list of tuples. So, the even-numbered offsets are key values, and the + * odd-numbered offsets are the associated values. + * + * Header names are not lowercased, and duplicates are not merged. + * + * ```js + * // Prints something like: + * // + * // [ 'user-agent', + * // 'this is invalid because there can be only one', + * // 'User-Agent', + * // 'curl/7.22.0', + * // 'Host', + * // '127.0.0.1:8000', + * // 'ACCEPT', + * // '*' ] + * console.log(request.rawHeaders); + * ``` + * @since v8.4.0 + */ + readonly rawHeaders: string[]; + /** + * The raw request/response trailer keys and values exactly as they were + * received. Only populated at the `'end'` event. + * @since v8.4.0 + */ + readonly rawTrailers: string[]; + /** + * The request scheme pseudo header field indicating the scheme + * portion of the target URL. + * @since v8.4.0 + */ + readonly scheme: string; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * applies getters, setters, and methods based on HTTP/2 logic. + * + * `destroyed`, `readable`, and `writable` properties will be retrieved from and + * set on `request.stream`. + * + * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`request.stream`. + * + * `setTimeout` method will be called on `request.stream.session`. + * + * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for + * more information. + * + * All other interactions will be routed directly to the socket. With TLS support, + * use `request.socket.getPeerCertificate()` to obtain the client's + * authentication details. + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * The `Http2Stream` object backing the request. + * @since v8.4.0 + */ + readonly stream: ServerHttp2Stream; + /** + * The request/response trailers object. Only populated at the `'end'` event. + * @since v8.4.0 + */ + readonly trailers: IncomingHttpHeaders; + /** + * Request URL string. This contains only the URL that is present in the actual + * HTTP request. If the request is: + * + * ```http + * GET /status?name=ryan HTTP/1.1 + * Accept: text/plain + * ``` + * + * Then `request.url` will be: + * + * ```js + * '/status?name=ryan' + * ``` + * + * To parse the url into its parts, `new URL()` can be used: + * + * ```console + * $ node + * > new URL('/status?name=ryan', 'http://example.com') + * URL { + * href: 'http://example.com/status?name=ryan', + * origin: 'http://example.com', + * protocol: 'http:', + * username: '', + * password: '', + * host: 'example.com', + * hostname: 'example.com', + * port: '', + * pathname: '/status', + * search: '?name=ryan', + * searchParams: URLSearchParams { 'name' => 'ryan' }, + * hash: '' + * } + * ``` + * @since v8.4.0 + */ + url: string; + /** + * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is + * provided, then it is added as a listener on the `'timeout'` event on + * the response object. + * + * If no `'timeout'` listener is added to the request, the response, or + * the server, then `Http2Stream` s are destroyed when they time out. If a + * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + read(size?: number): Buffer | string | null; + addListener(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'readable', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'aborted', hadError: boolean, code: number): boolean; + emit(event: 'close'): boolean; + emit(event: 'data', chunk: Buffer | string): boolean; + emit(event: 'end'): boolean; + emit(event: 'readable'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: Buffer | string) => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'readable', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: Buffer | string) => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'readable', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'readable', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'aborted', listener: (hadError: boolean, code: number) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'readable', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + /** + * This object is created internally by an HTTP server, not by the user. It is + * passed as the second parameter to the `'request'` event. + * @since v8.4.0 + */ + export class Http2ServerResponse extends stream.Writable { + constructor(stream: ServerHttp2Stream); + /** + * See `response.socket`. + * @since v8.4.0 + * @deprecated Since v13.0.0 - Use `socket`. + */ + readonly connection: net.Socket | tls.TLSSocket; + /** + * Boolean value that indicates whether the response has completed. Starts + * as `false`. After `response.end()` executes, the value will be `true`. + * @since v8.4.0 + * @deprecated Since v13.4.0,v12.16.0 - Use `writableEnded`. + */ + readonly finished: boolean; + /** + * True if headers were sent, false otherwise (read-only). + * @since v8.4.0 + */ + readonly headersSent: boolean; + /** + * A reference to the original HTTP2 `request` object. + * @since v15.7.0 + */ + readonly req: Http2ServerRequest; + /** + * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but + * applies getters, setters, and methods based on HTTP/2 logic. + * + * `destroyed`, `readable`, and `writable` properties will be retrieved from and + * set on `response.stream`. + * + * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`response.stream`. + * + * `setTimeout` method will be called on `response.stream.session`. + * + * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for + * more information. + * + * All other interactions will be routed directly to the socket. + * + * ```js + * const http2 = require('node:http2'); + * const server = http2.createServer((req, res) => { + * const ip = req.socket.remoteAddress; + * const port = req.socket.remotePort; + * res.end(`Your IP address is ${ip} and your source port is ${port}.`); + * }).listen(3000); + * ``` + * @since v8.4.0 + */ + readonly socket: net.Socket | tls.TLSSocket; + /** + * The `Http2Stream` object backing the response. + * @since v8.4.0 + */ + readonly stream: ServerHttp2Stream; + /** + * When true, the Date header will be automatically generated and sent in + * the response if it is not already present in the headers. Defaults to true. + * + * This should only be disabled for testing; HTTP requires the Date header + * in responses. + * @since v8.4.0 + */ + sendDate: boolean; + /** + * When using implicit headers (not calling `response.writeHead()` explicitly), + * this property controls the status code that will be sent to the client when + * the headers get flushed. + * + * ```js + * response.statusCode = 404; + * ``` + * + * After response header was sent to the client, this property indicates the + * status code which was sent out. + * @since v8.4.0 + */ + statusCode: number; + /** + * Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns + * an empty string. + * @since v8.4.0 + */ + statusMessage: ''; + /** + * This method adds HTTP trailing headers (a header but at the end of the + * message) to the response. + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v8.4.0 + */ + addTrailers(trailers: OutgoingHttpHeaders): void; + /** + * This method signals to the server that all of the response headers and body + * have been sent; that server should consider this message complete. + * The method, `response.end()`, MUST be called on each response. + * + * If `data` is specified, it is equivalent to calling `response.write(data, encoding)` followed by `response.end(callback)`. + * + * If `callback` is specified, it will be called when the response stream + * is finished. + * @since v8.4.0 + */ + end(callback?: () => void): this; + end(data: string | Uint8Array, callback?: () => void): this; + end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): this; + /** + * Reads out a header that has already been queued but not sent to the client. + * The name is case-insensitive. + * + * ```js + * const contentType = response.getHeader('content-type'); + * ``` + * @since v8.4.0 + */ + getHeader(name: string): string; + /** + * Returns an array containing the unique names of the current outgoing headers. + * All header names are lowercase. + * + * ```js + * response.setHeader('Foo', 'bar'); + * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headerNames = response.getHeaderNames(); + * // headerNames === ['foo', 'set-cookie'] + * ``` + * @since v8.4.0 + */ + getHeaderNames(): string[]; + /** + * Returns a shallow copy of the current outgoing headers. Since a shallow copy + * is used, array values may be mutated without additional calls to various + * header-related http module methods. The keys of the returned object are the + * header names and the values are the respective header values. All header names + * are lowercase. + * + * The object returned by the `response.getHeaders()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`, + * `obj.hasOwnProperty()`, and others + * are not defined and _will not work_. + * + * ```js + * response.setHeader('Foo', 'bar'); + * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); + * + * const headers = response.getHeaders(); + * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } + * ``` + * @since v8.4.0 + */ + getHeaders(): OutgoingHttpHeaders; + /** + * Returns `true` if the header identified by `name` is currently set in the + * outgoing headers. The header name matching is case-insensitive. + * + * ```js + * const hasContentType = response.hasHeader('content-type'); + * ``` + * @since v8.4.0 + */ + hasHeader(name: string): boolean; + /** + * Removes a header that has been queued for implicit sending. + * + * ```js + * response.removeHeader('Content-Encoding'); + * ``` + * @since v8.4.0 + */ + removeHeader(name: string): void; + /** + * Sets a single header value for implicit headers. If this header already exists + * in the to-be-sent headers, its value will be replaced. Use an array of strings + * here to send multiple headers with the same name. + * + * ```js + * response.setHeader('Content-Type', 'text/html; charset=utf-8'); + * ``` + * + * or + * + * ```js + * response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * ```js + * // Returns content-type = text/plain + * const server = http2.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html; charset=utf-8'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); + * res.end('ok'); + * }); + * ``` + * @since v8.4.0 + */ + setHeader(name: string, value: number | string | ReadonlyArray): void; + /** + * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is + * provided, then it is added as a listener on the `'timeout'` event on + * the response object. + * + * If no `'timeout'` listener is added to the request, the response, or + * the server, then `Http2Stream` s are destroyed when they time out. If a + * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. + * @since v8.4.0 + */ + setTimeout(msecs: number, callback?: () => void): void; + /** + * If this method is called and `response.writeHead()` has not been called, + * it will switch to implicit header mode and flush the implicit headers. + * + * This sends a chunk of the response body. This method may + * be called multiple times to provide successive parts of the body. + * + * In the `node:http` module, the response body is omitted when the + * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body. + * + * `chunk` can be a string or a buffer. If `chunk` is a string, + * the second parameter specifies how to encode it into a byte stream. + * By default the `encoding` is `'utf8'`. `callback` will be called when this chunk + * of data is flushed. + * + * This is the raw HTTP body and has nothing to do with higher-level multi-part + * body encodings that may be used. + * + * The first time `response.write()` is called, it will send the buffered + * header information and the first chunk of the body to the client. The second + * time `response.write()` is called, Node.js assumes data will be streamed, + * and sends the new data separately. That is, the response is buffered up to the + * first chunk of the body. + * + * Returns `true` if the entire data was flushed successfully to the kernel + * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is free again. + * @since v8.4.0 + */ + write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; + write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean; + /** + * Sends a status `100 Continue` to the client, indicating that the request body + * should be sent. See the `'checkContinue'` event on `Http2Server` and`Http2SecureServer`. + * @since v8.4.0 + */ + writeContinue(): void; + /** + * Sends a status `103 Early Hints` to the client with a Link header, + * indicating that the user agent can preload/preconnect the linked resources. + * The `hints` is an object containing the values of headers to be sent with + * early hints message. + * + * **Example** + * + * ```js + * const earlyHintsLink = '; rel=preload; as=style'; + * response.writeEarlyHints({ + * 'link': earlyHintsLink, + * }); + * + * const earlyHintsLinks = [ + * '; rel=preload; as=style', + * '; rel=preload; as=script', + * ]; + * response.writeEarlyHints({ + * 'link': earlyHintsLinks, + * }); + * ``` + * @since v18.11.0 + */ + writeEarlyHints(hints: Record): void; + /** + * Sends a response header to the request. The status code is a 3-digit HTTP + * status code, like `404`. The last argument, `headers`, are the response headers. + * + * Returns a reference to the `Http2ServerResponse`, so that calls can be chained. + * + * For compatibility with `HTTP/1`, a human-readable `statusMessage` may be + * passed as the second argument. However, because the `statusMessage` has no + * meaning within HTTP/2, the argument will have no effect and a process warning + * will be emitted. + * + * ```js + * const body = 'hello world'; + * response.writeHead(200, { + * 'Content-Length': Buffer.byteLength(body), + * 'Content-Type': 'text/plain; charset=utf-8', + * }); + * ``` + * + * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a + * given encoding. On outbound messages, Node.js does not check if Content-Length + * and the length of the body being transmitted are equal or not. However, when + * receiving messages, Node.js will automatically reject messages when the`Content-Length` does not match the actual payload size. + * + * This method may be called at most one time on a message before `response.end()` is called. + * + * If `response.write()` or `response.end()` are called before calling + * this, the implicit/mutable headers will be calculated and call this function. + * + * When headers have been set with `response.setHeader()`, they will be merged + * with any headers passed to `response.writeHead()`, with the headers passed + * to `response.writeHead()` given precedence. + * + * ```js + * // Returns content-type = text/plain + * const server = http2.createServer((req, res) => { + * res.setHeader('Content-Type', 'text/html; charset=utf-8'); + * res.setHeader('X-Foo', 'bar'); + * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); + * res.end('ok'); + * }); + * ``` + * + * Attempting to set a header field name or value that contains invalid characters + * will result in a `TypeError` being thrown. + * @since v8.4.0 + */ + writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; + writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; + /** + * Call `http2stream.pushStream()` with the given headers, and wrap the + * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback + * parameter if successful. When `Http2ServerRequest` is closed, the callback is + * called with an error `ERR_HTTP2_INVALID_STREAM`. + * @since v8.4.0 + * @param headers An object describing the headers + * @param callback Called once `http2stream.pushStream()` is finished, or either when the attempt to create the pushed `Http2Stream` has failed or has been rejected, or the state of + * `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method + */ + createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'error', listener: (error: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'drain'): boolean; + emit(event: 'error', error: Error): boolean; + emit(event: 'finish'): boolean; + emit(event: 'pipe', src: stream.Readable): boolean; + emit(event: 'unpipe', src: stream.Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'error', listener: (error: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'unpipe', listener: (src: stream.Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'error', listener: (error: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'pipe', listener: (src: stream.Readable) => void): this; + once(event: 'unpipe', listener: (src: stream.Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'error', listener: (error: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'error', listener: (error: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + export namespace constants { + const NGHTTP2_SESSION_SERVER: number; + const NGHTTP2_SESSION_CLIENT: number; + const NGHTTP2_STREAM_STATE_IDLE: number; + const NGHTTP2_STREAM_STATE_OPEN: number; + const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; + const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; + const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; + const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; + const NGHTTP2_STREAM_STATE_CLOSED: number; + const NGHTTP2_NO_ERROR: number; + const NGHTTP2_PROTOCOL_ERROR: number; + const NGHTTP2_INTERNAL_ERROR: number; + const NGHTTP2_FLOW_CONTROL_ERROR: number; + const NGHTTP2_SETTINGS_TIMEOUT: number; + const NGHTTP2_STREAM_CLOSED: number; + const NGHTTP2_FRAME_SIZE_ERROR: number; + const NGHTTP2_REFUSED_STREAM: number; + const NGHTTP2_CANCEL: number; + const NGHTTP2_COMPRESSION_ERROR: number; + const NGHTTP2_CONNECT_ERROR: number; + const NGHTTP2_ENHANCE_YOUR_CALM: number; + const NGHTTP2_INADEQUATE_SECURITY: number; + const NGHTTP2_HTTP_1_1_REQUIRED: number; + const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; + const NGHTTP2_FLAG_NONE: number; + const NGHTTP2_FLAG_END_STREAM: number; + const NGHTTP2_FLAG_END_HEADERS: number; + const NGHTTP2_FLAG_ACK: number; + const NGHTTP2_FLAG_PADDED: number; + const NGHTTP2_FLAG_PRIORITY: number; + const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; + const DEFAULT_SETTINGS_ENABLE_PUSH: number; + const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; + const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; + const MAX_MAX_FRAME_SIZE: number; + const MIN_MAX_FRAME_SIZE: number; + const MAX_INITIAL_WINDOW_SIZE: number; + const NGHTTP2_DEFAULT_WEIGHT: number; + const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; + const NGHTTP2_SETTINGS_ENABLE_PUSH: number; + const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; + const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; + const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; + const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; + const PADDING_STRATEGY_NONE: number; + const PADDING_STRATEGY_MAX: number; + const PADDING_STRATEGY_CALLBACK: number; + const HTTP2_HEADER_STATUS: string; + const HTTP2_HEADER_METHOD: string; + const HTTP2_HEADER_AUTHORITY: string; + const HTTP2_HEADER_SCHEME: string; + const HTTP2_HEADER_PATH: string; + const HTTP2_HEADER_ACCEPT_CHARSET: string; + const HTTP2_HEADER_ACCEPT_ENCODING: string; + const HTTP2_HEADER_ACCEPT_LANGUAGE: string; + const HTTP2_HEADER_ACCEPT_RANGES: string; + const HTTP2_HEADER_ACCEPT: string; + const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; + const HTTP2_HEADER_AGE: string; + const HTTP2_HEADER_ALLOW: string; + const HTTP2_HEADER_AUTHORIZATION: string; + const HTTP2_HEADER_CACHE_CONTROL: string; + const HTTP2_HEADER_CONNECTION: string; + const HTTP2_HEADER_CONTENT_DISPOSITION: string; + const HTTP2_HEADER_CONTENT_ENCODING: string; + const HTTP2_HEADER_CONTENT_LANGUAGE: string; + const HTTP2_HEADER_CONTENT_LENGTH: string; + const HTTP2_HEADER_CONTENT_LOCATION: string; + const HTTP2_HEADER_CONTENT_MD5: string; + const HTTP2_HEADER_CONTENT_RANGE: string; + const HTTP2_HEADER_CONTENT_TYPE: string; + const HTTP2_HEADER_COOKIE: string; + const HTTP2_HEADER_DATE: string; + const HTTP2_HEADER_ETAG: string; + const HTTP2_HEADER_EXPECT: string; + const HTTP2_HEADER_EXPIRES: string; + const HTTP2_HEADER_FROM: string; + const HTTP2_HEADER_HOST: string; + const HTTP2_HEADER_IF_MATCH: string; + const HTTP2_HEADER_IF_MODIFIED_SINCE: string; + const HTTP2_HEADER_IF_NONE_MATCH: string; + const HTTP2_HEADER_IF_RANGE: string; + const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; + const HTTP2_HEADER_LAST_MODIFIED: string; + const HTTP2_HEADER_LINK: string; + const HTTP2_HEADER_LOCATION: string; + const HTTP2_HEADER_MAX_FORWARDS: string; + const HTTP2_HEADER_PREFER: string; + const HTTP2_HEADER_PROXY_AUTHENTICATE: string; + const HTTP2_HEADER_PROXY_AUTHORIZATION: string; + const HTTP2_HEADER_RANGE: string; + const HTTP2_HEADER_REFERER: string; + const HTTP2_HEADER_REFRESH: string; + const HTTP2_HEADER_RETRY_AFTER: string; + const HTTP2_HEADER_SERVER: string; + const HTTP2_HEADER_SET_COOKIE: string; + const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; + const HTTP2_HEADER_TRANSFER_ENCODING: string; + const HTTP2_HEADER_TE: string; + const HTTP2_HEADER_UPGRADE: string; + const HTTP2_HEADER_USER_AGENT: string; + const HTTP2_HEADER_VARY: string; + const HTTP2_HEADER_VIA: string; + const HTTP2_HEADER_WWW_AUTHENTICATE: string; + const HTTP2_HEADER_HTTP2_SETTINGS: string; + const HTTP2_HEADER_KEEP_ALIVE: string; + const HTTP2_HEADER_PROXY_CONNECTION: string; + const HTTP2_METHOD_ACL: string; + const HTTP2_METHOD_BASELINE_CONTROL: string; + const HTTP2_METHOD_BIND: string; + const HTTP2_METHOD_CHECKIN: string; + const HTTP2_METHOD_CHECKOUT: string; + const HTTP2_METHOD_CONNECT: string; + const HTTP2_METHOD_COPY: string; + const HTTP2_METHOD_DELETE: string; + const HTTP2_METHOD_GET: string; + const HTTP2_METHOD_HEAD: string; + const HTTP2_METHOD_LABEL: string; + const HTTP2_METHOD_LINK: string; + const HTTP2_METHOD_LOCK: string; + const HTTP2_METHOD_MERGE: string; + const HTTP2_METHOD_MKACTIVITY: string; + const HTTP2_METHOD_MKCALENDAR: string; + const HTTP2_METHOD_MKCOL: string; + const HTTP2_METHOD_MKREDIRECTREF: string; + const HTTP2_METHOD_MKWORKSPACE: string; + const HTTP2_METHOD_MOVE: string; + const HTTP2_METHOD_OPTIONS: string; + const HTTP2_METHOD_ORDERPATCH: string; + const HTTP2_METHOD_PATCH: string; + const HTTP2_METHOD_POST: string; + const HTTP2_METHOD_PRI: string; + const HTTP2_METHOD_PROPFIND: string; + const HTTP2_METHOD_PROPPATCH: string; + const HTTP2_METHOD_PUT: string; + const HTTP2_METHOD_REBIND: string; + const HTTP2_METHOD_REPORT: string; + const HTTP2_METHOD_SEARCH: string; + const HTTP2_METHOD_TRACE: string; + const HTTP2_METHOD_UNBIND: string; + const HTTP2_METHOD_UNCHECKOUT: string; + const HTTP2_METHOD_UNLINK: string; + const HTTP2_METHOD_UNLOCK: string; + const HTTP2_METHOD_UPDATE: string; + const HTTP2_METHOD_UPDATEREDIRECTREF: string; + const HTTP2_METHOD_VERSION_CONTROL: string; + const HTTP_STATUS_CONTINUE: number; + const HTTP_STATUS_SWITCHING_PROTOCOLS: number; + const HTTP_STATUS_PROCESSING: number; + const HTTP_STATUS_OK: number; + const HTTP_STATUS_CREATED: number; + const HTTP_STATUS_ACCEPTED: number; + const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; + const HTTP_STATUS_NO_CONTENT: number; + const HTTP_STATUS_RESET_CONTENT: number; + const HTTP_STATUS_PARTIAL_CONTENT: number; + const HTTP_STATUS_MULTI_STATUS: number; + const HTTP_STATUS_ALREADY_REPORTED: number; + const HTTP_STATUS_IM_USED: number; + const HTTP_STATUS_MULTIPLE_CHOICES: number; + const HTTP_STATUS_MOVED_PERMANENTLY: number; + const HTTP_STATUS_FOUND: number; + const HTTP_STATUS_SEE_OTHER: number; + const HTTP_STATUS_NOT_MODIFIED: number; + const HTTP_STATUS_USE_PROXY: number; + const HTTP_STATUS_TEMPORARY_REDIRECT: number; + const HTTP_STATUS_PERMANENT_REDIRECT: number; + const HTTP_STATUS_BAD_REQUEST: number; + const HTTP_STATUS_UNAUTHORIZED: number; + const HTTP_STATUS_PAYMENT_REQUIRED: number; + const HTTP_STATUS_FORBIDDEN: number; + const HTTP_STATUS_NOT_FOUND: number; + const HTTP_STATUS_METHOD_NOT_ALLOWED: number; + const HTTP_STATUS_NOT_ACCEPTABLE: number; + const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; + const HTTP_STATUS_REQUEST_TIMEOUT: number; + const HTTP_STATUS_CONFLICT: number; + const HTTP_STATUS_GONE: number; + const HTTP_STATUS_LENGTH_REQUIRED: number; + const HTTP_STATUS_PRECONDITION_FAILED: number; + const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; + const HTTP_STATUS_URI_TOO_LONG: number; + const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; + const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; + const HTTP_STATUS_EXPECTATION_FAILED: number; + const HTTP_STATUS_TEAPOT: number; + const HTTP_STATUS_MISDIRECTED_REQUEST: number; + const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; + const HTTP_STATUS_LOCKED: number; + const HTTP_STATUS_FAILED_DEPENDENCY: number; + const HTTP_STATUS_UNORDERED_COLLECTION: number; + const HTTP_STATUS_UPGRADE_REQUIRED: number; + const HTTP_STATUS_PRECONDITION_REQUIRED: number; + const HTTP_STATUS_TOO_MANY_REQUESTS: number; + const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; + const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; + const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; + const HTTP_STATUS_NOT_IMPLEMENTED: number; + const HTTP_STATUS_BAD_GATEWAY: number; + const HTTP_STATUS_SERVICE_UNAVAILABLE: number; + const HTTP_STATUS_GATEWAY_TIMEOUT: number; + const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; + const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; + const HTTP_STATUS_INSUFFICIENT_STORAGE: number; + const HTTP_STATUS_LOOP_DETECTED: number; + const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; + const HTTP_STATUS_NOT_EXTENDED: number; + const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; + } + /** + * This symbol can be set as a property on the HTTP/2 headers object with + * an array value in order to provide a list of headers considered sensitive. + */ + export const sensitiveHeaders: symbol; + /** + * Returns an object containing the default settings for an `Http2Session`instance. This method returns a new object instance every time it is called + * so instances returned may be safely modified for use. + * @since v8.4.0 + */ + export function getDefaultSettings(): Settings; + /** + * Returns a `Buffer` instance containing serialized representation of the given + * HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended + * for use with the `HTTP2-Settings` header field. + * + * ```js + * const http2 = require('node:http2'); + * + * const packed = http2.getPackedSettings({ enablePush: false }); + * + * console.log(packed.toString('base64')); + * // Prints: AAIAAAAA + * ``` + * @since v8.4.0 + */ + export function getPackedSettings(settings: Settings): Buffer; + /** + * Returns a `HTTP/2 Settings Object` containing the deserialized settings from + * the given `Buffer` as generated by `http2.getPackedSettings()`. + * @since v8.4.0 + * @param buf The packed settings. + */ + export function getUnpackedSettings(buf: Uint8Array): Settings; + /** + * Returns a `net.Server` instance that creates and manages `Http2Session`instances. + * + * Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when + * communicating + * with browser clients. + * + * ```js + * const http2 = require('node:http2'); + * + * // Create an unencrypted HTTP/2 server. + * // Since there are no browsers known that support + * // unencrypted HTTP/2, the use of `http2.createSecureServer()` + * // is necessary when communicating with browser clients. + * const server = http2.createServer(); + * + * server.on('stream', (stream, headers) => { + * stream.respond({ + * 'content-type': 'text/html; charset=utf-8', + * ':status': 200, + * }); + * stream.end('

Hello World

'); + * }); + * + * server.listen(8000); + * ``` + * @since v8.4.0 + * @param onRequestHandler See `Compatibility API` + */ + export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; + export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; + /** + * Returns a `tls.Server` instance that creates and manages `Http2Session`instances. + * + * ```js + * const http2 = require('node:http2'); + * const fs = require('node:fs'); + * + * const options = { + * key: fs.readFileSync('server-key.pem'), + * cert: fs.readFileSync('server-cert.pem'), + * }; + * + * // Create a secure HTTP/2 server + * const server = http2.createSecureServer(options); + * + * server.on('stream', (stream, headers) => { + * stream.respond({ + * 'content-type': 'text/html; charset=utf-8', + * ':status': 200, + * }); + * stream.end('

Hello World

'); + * }); + * + * server.listen(8443); + * ``` + * @since v8.4.0 + * @param onRequestHandler See `Compatibility API` + */ + export function createSecureServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; + export function createSecureServer(options: SecureServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; + /** + * Returns a `ClientHttp2Session` instance. + * + * ```js + * const http2 = require('node:http2'); + * const client = http2.connect('https://localhost:1234'); + * + * // Use the client + * + * client.close(); + * ``` + * @since v8.4.0 + * @param authority The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the `http://` or `https://` prefix, host name, and IP port (if a non-default port + * is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored. + * @param listener Will be registered as a one-time listener of the {@link 'connect'} event. + */ + export function connect(authority: string | url.URL, listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): ClientHttp2Session; + export function connect( + authority: string | url.URL, + options?: ClientSessionOptions | SecureClientSessionOptions, + listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void + ): ClientHttp2Session; +} +declare module 'node:http2' { + export * from 'http2'; +} diff --git a/node_modules/@types/node/ts4.8/https.d.ts b/node_modules/@types/node/ts4.8/https.d.ts new file mode 100755 index 0000000..76fca92 --- /dev/null +++ b/node_modules/@types/node/ts4.8/https.d.ts @@ -0,0 +1,441 @@ +/** + * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a + * separate module. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/https.js) + */ +declare module 'https' { + import { Duplex } from 'node:stream'; + import * as tls from 'node:tls'; + import * as http from 'node:http'; + import { URL } from 'node:url'; + type ServerOptions< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; + type RequestOptions = http.RequestOptions & + tls.SecureContextOptions & { + checkServerIdentity?: typeof tls.checkServerIdentity | undefined; + rejectUnauthorized?: boolean | undefined; // Defaults to true + servername?: string | undefined; // SNI TLS Extension + }; + interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { + rejectUnauthorized?: boolean | undefined; + maxCachedSessions?: number | undefined; + } + /** + * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information. + * @since v0.4.5 + */ + class Agent extends http.Agent { + constructor(options?: AgentOptions); + options: AgentOptions; + } + interface Server< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + > extends http.Server {} + /** + * See `http.Server` for more information. + * @since v0.3.4 + */ + class Server< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + > extends tls.Server { + constructor(requestListener?: http.RequestListener); + constructor( + options: ServerOptions, + requestListener?: http.RequestListener, + ); + /** + * Closes all connections connected to this server. + * @since v18.2.0 + */ + closeAllConnections(): void; + /** + * Closes all connections connected to this server which are not sending a request or waiting for a response. + * @since v18.2.0 + */ + closeIdleConnections(): void; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + addListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + addListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'connection', listener: (socket: Duplex) => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'listening', listener: () => void): this; + addListener(event: 'checkContinue', listener: http.RequestListener): this; + addListener(event: 'checkExpectation', listener: http.RequestListener): this; + addListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + addListener(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + addListener(event: 'request', listener: http.RequestListener): this; + addListener(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + emit(event: string, ...args: any[]): boolean; + emit(event: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean; + emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void): boolean; + emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; + emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; + emit(event: 'secureConnection', tlsSocket: tls.TLSSocket): boolean; + emit(event: 'tlsClientError', err: Error, tlsSocket: tls.TLSSocket): boolean; + emit(event: 'close'): boolean; + emit(event: 'connection', socket: Duplex): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'listening'): boolean; + emit( + event: 'checkContinue', + req: InstanceType, + res: InstanceType & { + req: InstanceType; + } + ): boolean; + emit( + event: 'checkExpectation', + req: InstanceType, + res: InstanceType & { + req: InstanceType; + } + ): boolean; + emit(event: 'clientError', err: Error, socket: Duplex): boolean; + emit(event: 'connect', req: InstanceType, socket: Duplex, head: Buffer): boolean; + emit( + event: 'request', + req: InstanceType, + res: InstanceType & { + req: InstanceType; + } + ): boolean; + emit(event: 'upgrade', req: InstanceType, socket: Duplex, head: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + on(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + on(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'connection', listener: (socket: Duplex) => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'listening', listener: () => void): this; + on(event: 'checkContinue', listener: http.RequestListener): this; + on(event: 'checkExpectation', listener: http.RequestListener): this; + on(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + on(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + on(event: 'request', listener: http.RequestListener): this; + on(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + once(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + once(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'connection', listener: (socket: Duplex) => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'listening', listener: () => void): this; + once(event: 'checkContinue', listener: http.RequestListener): this; + once(event: 'checkExpectation', listener: http.RequestListener): this; + once(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + once(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + once(event: 'request', listener: http.RequestListener): this; + once(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + prependListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'connection', listener: (socket: Duplex) => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'listening', listener: () => void): this; + prependListener(event: 'checkContinue', listener: http.RequestListener): this; + prependListener(event: 'checkExpectation', listener: http.RequestListener): this; + prependListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + prependListener(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependListener(event: 'request', listener: http.RequestListener): this; + prependListener(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void): this; + prependOnceListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + prependOnceListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; + prependOnceListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'connection', listener: (socket: Duplex) => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'listening', listener: () => void): this; + prependOnceListener(event: 'checkContinue', listener: http.RequestListener): this; + prependOnceListener(event: 'checkExpectation', listener: http.RequestListener): this; + prependOnceListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this; + prependOnceListener(event: 'connect', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + prependOnceListener(event: 'request', listener: http.RequestListener): this; + prependOnceListener(event: 'upgrade', listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; + } + /** + * ```js + * // curl -k https://localhost:8000/ + * const https = require('node:https'); + * const fs = require('node:fs'); + * + * const options = { + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * }; + * + * https.createServer(options, (req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * ``` + * + * Or + * + * ```js + * const https = require('node:https'); + * const fs = require('node:fs'); + * + * const options = { + * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'), + * passphrase: 'sample', + * }; + * + * https.createServer(options, (req, res) => { + * res.writeHead(200); + * res.end('hello world\n'); + * }).listen(8000); + * ``` + * @since v0.3.4 + * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`. + * @param requestListener A listener to be added to the `'request'` event. + */ + function createServer< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + >(requestListener?: http.RequestListener): Server; + function createServer< + Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, + Response extends typeof http.ServerResponse = typeof http.ServerResponse, + >( + options: ServerOptions, + requestListener?: http.RequestListener, + ): Server; + /** + * Makes a request to a secure web server. + * + * The following additional `options` from `tls.connect()` are also accepted:`ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`,`honorCipherOrder`, `key`, `passphrase`, + * `pfx`, `rejectUnauthorized`,`secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`,`highWaterMark`. + * + * `options` can be an object, a string, or a `URL` object. If `options` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to + * upload a file with a POST request, then write to the `ClientRequest` object. + * + * ```js + * const https = require('node:https'); + * + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * }; + * + * const req = https.request(options, (res) => { + * console.log('statusCode:', res.statusCode); + * console.log('headers:', res.headers); + * + * res.on('data', (d) => { + * process.stdout.write(d); + * }); + * }); + * + * req.on('error', (e) => { + * console.error(e); + * }); + * req.end(); + * ``` + * + * Example using options from `tls.connect()`: + * + * ```js + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * }; + * options.agent = new https.Agent(options); + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Alternatively, opt out of connection pooling by not using an `Agent`. + * + * ```js + * const options = { + * hostname: 'encrypted.google.com', + * port: 443, + * path: '/', + * method: 'GET', + * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), + * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), + * agent: false, + * }; + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Example using a `URL` as `options`: + * + * ```js + * const options = new URL('https://abc:xyz@example.com'); + * + * const req = https.request(options, (res) => { + * // ... + * }); + * ``` + * + * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`): + * + * ```js + * const tls = require('node:tls'); + * const https = require('node:https'); + * const crypto = require('node:crypto'); + * + * function sha256(s) { + * return crypto.createHash('sha256').update(s).digest('base64'); + * } + * const options = { + * hostname: 'github.com', + * port: 443, + * path: '/', + * method: 'GET', + * checkServerIdentity: function(host, cert) { + * // Make sure the certificate is issued to the host we are connected to + * const err = tls.checkServerIdentity(host, cert); + * if (err) { + * return err; + * } + * + * // Pin the public key, similar to HPKP pin-sha256 pinning + * const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU='; + * if (sha256(cert.pubkey) !== pubkey256) { + * const msg = 'Certificate verification error: ' + + * `The public key of '${cert.subject.CN}' ` + + * 'does not match our pinned fingerprint'; + * return new Error(msg); + * } + * + * // Pin the exact certificate, rather than the pub key + * const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' + + * 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16'; + * if (cert.fingerprint256 !== cert256) { + * const msg = 'Certificate verification error: ' + + * `The certificate of '${cert.subject.CN}' ` + + * 'does not match our pinned fingerprint'; + * return new Error(msg); + * } + * + * // This loop is informational only. + * // Print the certificate and public key fingerprints of all certs in the + * // chain. Its common to pin the public key of the issuer on the public + * // internet, while pinning the public key of the service in sensitive + * // environments. + * do { + * console.log('Subject Common Name:', cert.subject.CN); + * console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256); + * + * hash = crypto.createHash('sha256'); + * console.log(' Public key ping-sha256:', sha256(cert.pubkey)); + * + * lastprint256 = cert.fingerprint256; + * cert = cert.issuerCertificate; + * } while (cert.fingerprint256 !== lastprint256); + * + * }, + * }; + * + * options.agent = new https.Agent(options); + * const req = https.request(options, (res) => { + * console.log('All OK. Server matched our pinned cert or public key'); + * console.log('statusCode:', res.statusCode); + * // Print the HPKP values + * console.log('headers:', res.headers['public-key-pins']); + * + * res.on('data', (d) => {}); + * }); + * + * req.on('error', (e) => { + * console.error(e.message); + * }); + * req.end(); + * ``` + * + * Outputs for example: + * + * ```text + * Subject Common Name: github.com + * Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16 + * Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU= + * Subject Common Name: DigiCert SHA2 Extended Validation Server CA + * Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A + * Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho= + * Subject Common Name: DigiCert High Assurance EV Root CA + * Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF + * Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18= + * All OK. Server matched our pinned cert or public key + * statusCode: 200 + * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho="; + * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4="; + * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains + * ``` + * @since v0.3.6 + * @param options Accepts all `options` from `request`, with some differences in default values: + */ + function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + /** + * Like `http.get()` but for HTTPS. + * + * `options` can be an object, a string, or a `URL` object. If `options` is a + * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. + * + * ```js + * const https = require('node:https'); + * + * https.get('https://encrypted.google.com/', (res) => { + * console.log('statusCode:', res.statusCode); + * console.log('headers:', res.headers); + * + * res.on('data', (d) => { + * process.stdout.write(d); + * }); + * + * }).on('error', (e) => { + * console.error(e); + * }); + * ``` + * @since v0.3.6 + * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. + */ + function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + let globalAgent: Agent; +} +declare module 'node:https' { + export * from 'https'; +} diff --git a/node_modules/@types/node/ts4.8/index.d.ts b/node_modules/@types/node/ts4.8/index.d.ts new file mode 100755 index 0000000..7c8b38c --- /dev/null +++ b/node_modules/@types/node/ts4.8/index.d.ts @@ -0,0 +1,88 @@ +/** + * License for programmatically and manually incorporated + * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc + * + * Copyright Node.js contributors. All rights reserved. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +// NOTE: These definitions support NodeJS and TypeScript 4.8 and earlier. + +// Reference required types from the default lib: +/// +/// +/// +/// + +// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + +/// diff --git a/node_modules/@types/node/ts4.8/inspector.d.ts b/node_modules/@types/node/ts4.8/inspector.d.ts new file mode 100755 index 0000000..dbe0374 --- /dev/null +++ b/node_modules/@types/node/ts4.8/inspector.d.ts @@ -0,0 +1,2747 @@ +// eslint-disable-next-line @definitelytyped/dt-header +// Type definitions for inspector + +// These definitions are auto-generated. +// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330 +// for more information. + + +/** + * The `node:inspector` module provides an API for interacting with the V8 + * inspector. + * + * It can be accessed using: + * + * ```js + * import * as inspector from 'node:inspector/promises'; + * ``` + * + * or + * + * ```js + * import * as inspector from 'node:inspector'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/inspector.js) + */ +declare module 'inspector' { + import EventEmitter = require('node:events'); + interface InspectorNotification { + method: string; + params: T; + } + namespace Schema { + /** + * Description of the protocol domain. + */ + interface Domain { + /** + * Domain name. + */ + name: string; + /** + * Domain version. + */ + version: string; + } + interface GetDomainsReturnType { + /** + * List of supported domains. + */ + domains: Domain[]; + } + } + namespace Runtime { + /** + * Unique script identifier. + */ + type ScriptId = string; + /** + * Unique object identifier. + */ + type RemoteObjectId = string; + /** + * Primitive value which cannot be JSON-stringified. + */ + type UnserializableValue = string; + /** + * Mirror object referencing original JavaScript object. + */ + interface RemoteObject { + /** + * Object type. + */ + type: string; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + /** + * Object class (constructor) name. Specified for object type values only. + */ + className?: string | undefined; + /** + * Remote object value in case of primitive values or JSON values (if it was requested). + */ + value?: any; + /** + * Primitive value which can not be JSON-stringified does not have value, but gets this property. + */ + unserializableValue?: UnserializableValue | undefined; + /** + * String representation of the object. + */ + description?: string | undefined; + /** + * Unique object identifier (for non-primitive values). + */ + objectId?: RemoteObjectId | undefined; + /** + * Preview containing abbreviated property values. Specified for object type values only. + * @experimental + */ + preview?: ObjectPreview | undefined; + /** + * @experimental + */ + customPreview?: CustomPreview | undefined; + } + /** + * @experimental + */ + interface CustomPreview { + header: string; + hasBody: boolean; + formatterObjectId: RemoteObjectId; + bindRemoteObjectFunctionId: RemoteObjectId; + configObjectId?: RemoteObjectId | undefined; + } + /** + * Object containing abbreviated remote object value. + * @experimental + */ + interface ObjectPreview { + /** + * Object type. + */ + type: string; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + /** + * String representation of the object. + */ + description?: string | undefined; + /** + * True iff some of the properties or entries of the original object did not fit. + */ + overflow: boolean; + /** + * List of the properties. + */ + properties: PropertyPreview[]; + /** + * List of the entries. Specified for map and set subtype values only. + */ + entries?: EntryPreview[] | undefined; + } + /** + * @experimental + */ + interface PropertyPreview { + /** + * Property name. + */ + name: string; + /** + * Object type. Accessor means that the property itself is an accessor property. + */ + type: string; + /** + * User-friendly property value string. + */ + value?: string | undefined; + /** + * Nested value preview. + */ + valuePreview?: ObjectPreview | undefined; + /** + * Object subtype hint. Specified for object type values only. + */ + subtype?: string | undefined; + } + /** + * @experimental + */ + interface EntryPreview { + /** + * Preview of the key. Specified for map-like collection entries. + */ + key?: ObjectPreview | undefined; + /** + * Preview of the value. + */ + value: ObjectPreview; + } + /** + * Object property descriptor. + */ + interface PropertyDescriptor { + /** + * Property name or symbol description. + */ + name: string; + /** + * The value associated with the property. + */ + value?: RemoteObject | undefined; + /** + * True if the value associated with the property may be changed (data descriptors only). + */ + writable?: boolean | undefined; + /** + * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). + */ + get?: RemoteObject | undefined; + /** + * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). + */ + set?: RemoteObject | undefined; + /** + * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. + */ + configurable: boolean; + /** + * True if this property shows up during enumeration of the properties on the corresponding object. + */ + enumerable: boolean; + /** + * True if the result was thrown during the evaluation. + */ + wasThrown?: boolean | undefined; + /** + * True if the property is owned for the object. + */ + isOwn?: boolean | undefined; + /** + * Property symbol object, if the property is of the symbol type. + */ + symbol?: RemoteObject | undefined; + } + /** + * Object internal property descriptor. This property isn't normally visible in JavaScript code. + */ + interface InternalPropertyDescriptor { + /** + * Conventional property name. + */ + name: string; + /** + * The value associated with the property. + */ + value?: RemoteObject | undefined; + } + /** + * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. + */ + interface CallArgument { + /** + * Primitive value or serializable javascript object. + */ + value?: any; + /** + * Primitive value which can not be JSON-stringified. + */ + unserializableValue?: UnserializableValue | undefined; + /** + * Remote object handle. + */ + objectId?: RemoteObjectId | undefined; + } + /** + * Id of an execution context. + */ + type ExecutionContextId = number; + /** + * Description of an isolated world. + */ + interface ExecutionContextDescription { + /** + * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. + */ + id: ExecutionContextId; + /** + * Execution context origin. + */ + origin: string; + /** + * Human readable name describing given context. + */ + name: string; + /** + * Embedder-specific auxiliary data. + */ + auxData?: {} | undefined; + } + /** + * Detailed information about exception (or error) that was thrown during script compilation or execution. + */ + interface ExceptionDetails { + /** + * Exception id. + */ + exceptionId: number; + /** + * Exception text, which should be used together with exception object when available. + */ + text: string; + /** + * Line number of the exception location (0-based). + */ + lineNumber: number; + /** + * Column number of the exception location (0-based). + */ + columnNumber: number; + /** + * Script ID of the exception location. + */ + scriptId?: ScriptId | undefined; + /** + * URL of the exception location, to be used when the script was not reported. + */ + url?: string | undefined; + /** + * JavaScript stack trace if available. + */ + stackTrace?: StackTrace | undefined; + /** + * Exception object if available. + */ + exception?: RemoteObject | undefined; + /** + * Identifier of the context where exception happened. + */ + executionContextId?: ExecutionContextId | undefined; + } + /** + * Number of milliseconds since epoch. + */ + type Timestamp = number; + /** + * Stack entry for runtime errors and assertions. + */ + interface CallFrame { + /** + * JavaScript function name. + */ + functionName: string; + /** + * JavaScript script id. + */ + scriptId: ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * JavaScript script line number (0-based). + */ + lineNumber: number; + /** + * JavaScript script column number (0-based). + */ + columnNumber: number; + } + /** + * Call frames for assertions or error messages. + */ + interface StackTrace { + /** + * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. + */ + description?: string | undefined; + /** + * JavaScript function name. + */ + callFrames: CallFrame[]; + /** + * Asynchronous JavaScript stack trace that preceded this stack, if available. + */ + parent?: StackTrace | undefined; + /** + * Asynchronous JavaScript stack trace that preceded this stack, if available. + * @experimental + */ + parentId?: StackTraceId | undefined; + } + /** + * Unique identifier of current debugger. + * @experimental + */ + type UniqueDebuggerId = string; + /** + * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. + * @experimental + */ + interface StackTraceId { + id: string; + debuggerId?: UniqueDebuggerId | undefined; + } + interface EvaluateParameterType { + /** + * Expression to evaluate. + */ + expression: string; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + /** + * Determines whether Command Line API should be available during the evaluation. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + contextId?: ExecutionContextId | undefined; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should be treated as initiated by user in the UI. + */ + userGesture?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + } + interface AwaitPromiseParameterType { + /** + * Identifier of the promise. + */ + promiseObjectId: RemoteObjectId; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + */ + generatePreview?: boolean | undefined; + } + interface CallFunctionOnParameterType { + /** + * Declaration of the function to call. + */ + functionDeclaration: string; + /** + * Identifier of the object to call function on. Either objectId or executionContextId should be specified. + */ + objectId?: RemoteObjectId | undefined; + /** + * Call arguments. All call arguments must belong to the same JavaScript world as the target object. + */ + arguments?: CallArgument[] | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object which should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should be treated as initiated by user in the UI. + */ + userGesture?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + /** + * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. + */ + executionContextId?: ExecutionContextId | undefined; + /** + * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. + */ + objectGroup?: string | undefined; + } + interface GetPropertiesParameterType { + /** + * Identifier of the object to return properties for. + */ + objectId: RemoteObjectId; + /** + * If true, returns properties belonging only to the element itself, not to its prototype chain. + */ + ownProperties?: boolean | undefined; + /** + * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. + * @experimental + */ + accessorPropertiesOnly?: boolean | undefined; + /** + * Whether preview should be generated for the results. + * @experimental + */ + generatePreview?: boolean | undefined; + } + interface ReleaseObjectParameterType { + /** + * Identifier of the object to release. + */ + objectId: RemoteObjectId; + } + interface ReleaseObjectGroupParameterType { + /** + * Symbolic object group name. + */ + objectGroup: string; + } + interface SetCustomObjectFormatterEnabledParameterType { + enabled: boolean; + } + interface CompileScriptParameterType { + /** + * Expression to compile. + */ + expression: string; + /** + * Source url to be set for the script. + */ + sourceURL: string; + /** + * Specifies whether the compiled script should be persisted. + */ + persistScript: boolean; + /** + * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + executionContextId?: ExecutionContextId | undefined; + } + interface RunScriptParameterType { + /** + * Id of the script to run. + */ + scriptId: ScriptId; + /** + * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + */ + executionContextId?: ExecutionContextId | undefined; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Determines whether Command Line API should be available during the evaluation. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object which should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + */ + generatePreview?: boolean | undefined; + /** + * Whether execution should await for resulting value and return once awaited promise is resolved. + */ + awaitPromise?: boolean | undefined; + } + interface QueryObjectsParameterType { + /** + * Identifier of the prototype to return objects for. + */ + prototypeObjectId: RemoteObjectId; + } + interface GlobalLexicalScopeNamesParameterType { + /** + * Specifies in which execution context to lookup global scope variables. + */ + executionContextId?: ExecutionContextId | undefined; + } + interface EvaluateReturnType { + /** + * Evaluation result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface AwaitPromiseReturnType { + /** + * Promise result. Will contain rejected value if promise was rejected. + */ + result: RemoteObject; + /** + * Exception details if stack strace is available. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface CallFunctionOnReturnType { + /** + * Call result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface GetPropertiesReturnType { + /** + * Object properties. + */ + result: PropertyDescriptor[]; + /** + * Internal object properties (only of the element itself). + */ + internalProperties?: InternalPropertyDescriptor[] | undefined; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface CompileScriptReturnType { + /** + * Id of the script. + */ + scriptId?: ScriptId | undefined; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface RunScriptReturnType { + /** + * Run result. + */ + result: RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: ExceptionDetails | undefined; + } + interface QueryObjectsReturnType { + /** + * Array with objects. + */ + objects: RemoteObject; + } + interface GlobalLexicalScopeNamesReturnType { + names: string[]; + } + interface ExecutionContextCreatedEventDataType { + /** + * A newly created execution context. + */ + context: ExecutionContextDescription; + } + interface ExecutionContextDestroyedEventDataType { + /** + * Id of the destroyed context + */ + executionContextId: ExecutionContextId; + } + interface ExceptionThrownEventDataType { + /** + * Timestamp of the exception. + */ + timestamp: Timestamp; + exceptionDetails: ExceptionDetails; + } + interface ExceptionRevokedEventDataType { + /** + * Reason describing why exception was revoked. + */ + reason: string; + /** + * The id of revoked exception, as reported in exceptionThrown. + */ + exceptionId: number; + } + interface ConsoleAPICalledEventDataType { + /** + * Type of the call. + */ + type: string; + /** + * Call arguments. + */ + args: RemoteObject[]; + /** + * Identifier of the context where the call was made. + */ + executionContextId: ExecutionContextId; + /** + * Call timestamp. + */ + timestamp: Timestamp; + /** + * Stack trace captured when the call was made. + */ + stackTrace?: StackTrace | undefined; + /** + * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. + * @experimental + */ + context?: string | undefined; + } + interface InspectRequestedEventDataType { + object: RemoteObject; + hints: {}; + } + } + namespace Debugger { + /** + * Breakpoint identifier. + */ + type BreakpointId = string; + /** + * Call frame identifier. + */ + type CallFrameId = string; + /** + * Location in the source code. + */ + interface Location { + /** + * Script identifier as reported in the Debugger.scriptParsed. + */ + scriptId: Runtime.ScriptId; + /** + * Line number in the script (0-based). + */ + lineNumber: number; + /** + * Column number in the script (0-based). + */ + columnNumber?: number | undefined; + } + /** + * Location in the source code. + * @experimental + */ + interface ScriptPosition { + lineNumber: number; + columnNumber: number; + } + /** + * JavaScript call frame. Array of call frames form the call stack. + */ + interface CallFrame { + /** + * Call frame identifier. This identifier is only valid while the virtual machine is paused. + */ + callFrameId: CallFrameId; + /** + * Name of the JavaScript function called on this call frame. + */ + functionName: string; + /** + * Location in the source code. + */ + functionLocation?: Location | undefined; + /** + * Location in the source code. + */ + location: Location; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Scope chain for this call frame. + */ + scopeChain: Scope[]; + /** + * this object for this call frame. + */ + this: Runtime.RemoteObject; + /** + * The value being returned, if the function is at return point. + */ + returnValue?: Runtime.RemoteObject | undefined; + } + /** + * Scope description. + */ + interface Scope { + /** + * Scope type. + */ + type: string; + /** + * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. + */ + object: Runtime.RemoteObject; + name?: string | undefined; + /** + * Location in the source code where scope starts + */ + startLocation?: Location | undefined; + /** + * Location in the source code where scope ends + */ + endLocation?: Location | undefined; + } + /** + * Search match for resource. + */ + interface SearchMatch { + /** + * Line number in resource content. + */ + lineNumber: number; + /** + * Line with match content. + */ + lineContent: string; + } + interface BreakLocation { + /** + * Script identifier as reported in the Debugger.scriptParsed. + */ + scriptId: Runtime.ScriptId; + /** + * Line number in the script (0-based). + */ + lineNumber: number; + /** + * Column number in the script (0-based). + */ + columnNumber?: number | undefined; + type?: string | undefined; + } + interface SetBreakpointsActiveParameterType { + /** + * New value for breakpoints active state. + */ + active: boolean; + } + interface SetSkipAllPausesParameterType { + /** + * New value for skip pauses state. + */ + skip: boolean; + } + interface SetBreakpointByUrlParameterType { + /** + * Line number to set breakpoint at. + */ + lineNumber: number; + /** + * URL of the resources to set breakpoint on. + */ + url?: string | undefined; + /** + * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. + */ + urlRegex?: string | undefined; + /** + * Script hash of the resources to set breakpoint on. + */ + scriptHash?: string | undefined; + /** + * Offset in the line to set breakpoint at. + */ + columnNumber?: number | undefined; + /** + * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. + */ + condition?: string | undefined; + } + interface SetBreakpointParameterType { + /** + * Location to set breakpoint in. + */ + location: Location; + /** + * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. + */ + condition?: string | undefined; + } + interface RemoveBreakpointParameterType { + breakpointId: BreakpointId; + } + interface GetPossibleBreakpointsParameterType { + /** + * Start of range to search possible breakpoint locations in. + */ + start: Location; + /** + * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. + */ + end?: Location | undefined; + /** + * Only consider locations which are in the same (non-nested) function as start. + */ + restrictToFunction?: boolean | undefined; + } + interface ContinueToLocationParameterType { + /** + * Location to continue to. + */ + location: Location; + targetCallFrames?: string | undefined; + } + interface PauseOnAsyncCallParameterType { + /** + * Debugger will pause when async call with given stack trace is started. + */ + parentStackTraceId: Runtime.StackTraceId; + } + interface StepIntoParameterType { + /** + * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. + * @experimental + */ + breakOnAsyncCall?: boolean | undefined; + } + interface GetStackTraceParameterType { + stackTraceId: Runtime.StackTraceId; + } + interface SearchInContentParameterType { + /** + * Id of the script to search in. + */ + scriptId: Runtime.ScriptId; + /** + * String to search for. + */ + query: string; + /** + * If true, search is case sensitive. + */ + caseSensitive?: boolean | undefined; + /** + * If true, treats string parameter as regex. + */ + isRegex?: boolean | undefined; + } + interface SetScriptSourceParameterType { + /** + * Id of the script to edit. + */ + scriptId: Runtime.ScriptId; + /** + * New content of the script. + */ + scriptSource: string; + /** + * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. + */ + dryRun?: boolean | undefined; + } + interface RestartFrameParameterType { + /** + * Call frame identifier to evaluate on. + */ + callFrameId: CallFrameId; + } + interface GetScriptSourceParameterType { + /** + * Id of the script to get source for. + */ + scriptId: Runtime.ScriptId; + } + interface SetPauseOnExceptionsParameterType { + /** + * Pause on exceptions mode. + */ + state: string; + } + interface EvaluateOnCallFrameParameterType { + /** + * Call frame identifier to evaluate on. + */ + callFrameId: CallFrameId; + /** + * Expression to evaluate. + */ + expression: string; + /** + * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). + */ + objectGroup?: string | undefined; + /** + * Specifies whether command line API should be available to the evaluated expression, defaults to false. + */ + includeCommandLineAPI?: boolean | undefined; + /** + * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. + */ + silent?: boolean | undefined; + /** + * Whether the result is expected to be a JSON object that should be sent by value. + */ + returnByValue?: boolean | undefined; + /** + * Whether preview should be generated for the result. + * @experimental + */ + generatePreview?: boolean | undefined; + /** + * Whether to throw an exception if side effect cannot be ruled out during evaluation. + */ + throwOnSideEffect?: boolean | undefined; + } + interface SetVariableValueParameterType { + /** + * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. + */ + scopeNumber: number; + /** + * Variable name. + */ + variableName: string; + /** + * New variable value. + */ + newValue: Runtime.CallArgument; + /** + * Id of callframe that holds variable. + */ + callFrameId: CallFrameId; + } + interface SetReturnValueParameterType { + /** + * New return value. + */ + newValue: Runtime.CallArgument; + } + interface SetAsyncCallStackDepthParameterType { + /** + * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). + */ + maxDepth: number; + } + interface SetBlackboxPatternsParameterType { + /** + * Array of regexps that will be used to check script url for blackbox state. + */ + patterns: string[]; + } + interface SetBlackboxedRangesParameterType { + /** + * Id of the script. + */ + scriptId: Runtime.ScriptId; + positions: ScriptPosition[]; + } + interface EnableReturnType { + /** + * Unique identifier of the debugger. + * @experimental + */ + debuggerId: Runtime.UniqueDebuggerId; + } + interface SetBreakpointByUrlReturnType { + /** + * Id of the created breakpoint for further reference. + */ + breakpointId: BreakpointId; + /** + * List of the locations this breakpoint resolved into upon addition. + */ + locations: Location[]; + } + interface SetBreakpointReturnType { + /** + * Id of the created breakpoint for further reference. + */ + breakpointId: BreakpointId; + /** + * Location this breakpoint resolved into. + */ + actualLocation: Location; + } + interface GetPossibleBreakpointsReturnType { + /** + * List of the possible breakpoint locations. + */ + locations: BreakLocation[]; + } + interface GetStackTraceReturnType { + stackTrace: Runtime.StackTrace; + } + interface SearchInContentReturnType { + /** + * List of search matches. + */ + result: SearchMatch[]; + } + interface SetScriptSourceReturnType { + /** + * New stack trace in case editing has happened while VM was stopped. + */ + callFrames?: CallFrame[] | undefined; + /** + * Whether current call stack was modified after applying the changes. + */ + stackChanged?: boolean | undefined; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + /** + * Exception details if any. + */ + exceptionDetails?: Runtime.ExceptionDetails | undefined; + } + interface RestartFrameReturnType { + /** + * New stack trace. + */ + callFrames: CallFrame[]; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + } + interface GetScriptSourceReturnType { + /** + * Script source. + */ + scriptSource: string; + } + interface EvaluateOnCallFrameReturnType { + /** + * Object wrapper for the evaluation result. + */ + result: Runtime.RemoteObject; + /** + * Exception details. + */ + exceptionDetails?: Runtime.ExceptionDetails | undefined; + } + interface ScriptParsedEventDataType { + /** + * Identifier of the script parsed. + */ + scriptId: Runtime.ScriptId; + /** + * URL or name of the script parsed (if any). + */ + url: string; + /** + * Line offset of the script within the resource with given URL (for script tags). + */ + startLine: number; + /** + * Column offset of the script within the resource with given URL. + */ + startColumn: number; + /** + * Last line of the script. + */ + endLine: number; + /** + * Length of the last line of the script. + */ + endColumn: number; + /** + * Specifies script creation context. + */ + executionContextId: Runtime.ExecutionContextId; + /** + * Content hash of the script. + */ + hash: string; + /** + * Embedder-specific auxiliary data. + */ + executionContextAuxData?: {} | undefined; + /** + * True, if this script is generated as a result of the live edit operation. + * @experimental + */ + isLiveEdit?: boolean | undefined; + /** + * URL of source map associated with script (if any). + */ + sourceMapURL?: string | undefined; + /** + * True, if this script has sourceURL. + */ + hasSourceURL?: boolean | undefined; + /** + * True, if this script is ES6 module. + */ + isModule?: boolean | undefined; + /** + * This script length. + */ + length?: number | undefined; + /** + * JavaScript top stack frame of where the script parsed event was triggered if available. + * @experimental + */ + stackTrace?: Runtime.StackTrace | undefined; + } + interface ScriptFailedToParseEventDataType { + /** + * Identifier of the script parsed. + */ + scriptId: Runtime.ScriptId; + /** + * URL or name of the script parsed (if any). + */ + url: string; + /** + * Line offset of the script within the resource with given URL (for script tags). + */ + startLine: number; + /** + * Column offset of the script within the resource with given URL. + */ + startColumn: number; + /** + * Last line of the script. + */ + endLine: number; + /** + * Length of the last line of the script. + */ + endColumn: number; + /** + * Specifies script creation context. + */ + executionContextId: Runtime.ExecutionContextId; + /** + * Content hash of the script. + */ + hash: string; + /** + * Embedder-specific auxiliary data. + */ + executionContextAuxData?: {} | undefined; + /** + * URL of source map associated with script (if any). + */ + sourceMapURL?: string | undefined; + /** + * True, if this script has sourceURL. + */ + hasSourceURL?: boolean | undefined; + /** + * True, if this script is ES6 module. + */ + isModule?: boolean | undefined; + /** + * This script length. + */ + length?: number | undefined; + /** + * JavaScript top stack frame of where the script parsed event was triggered if available. + * @experimental + */ + stackTrace?: Runtime.StackTrace | undefined; + } + interface BreakpointResolvedEventDataType { + /** + * Breakpoint unique identifier. + */ + breakpointId: BreakpointId; + /** + * Actual breakpoint location. + */ + location: Location; + } + interface PausedEventDataType { + /** + * Call stack the virtual machine stopped on. + */ + callFrames: CallFrame[]; + /** + * Pause reason. + */ + reason: string; + /** + * Object containing break-specific auxiliary properties. + */ + data?: {} | undefined; + /** + * Hit breakpoints IDs + */ + hitBreakpoints?: string[] | undefined; + /** + * Async stack trace, if any. + */ + asyncStackTrace?: Runtime.StackTrace | undefined; + /** + * Async stack trace, if any. + * @experimental + */ + asyncStackTraceId?: Runtime.StackTraceId | undefined; + /** + * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. + * @experimental + */ + asyncCallStackTraceId?: Runtime.StackTraceId | undefined; + } + } + namespace Console { + /** + * Console message. + */ + interface ConsoleMessage { + /** + * Message source. + */ + source: string; + /** + * Message severity. + */ + level: string; + /** + * Message text. + */ + text: string; + /** + * URL of the message origin. + */ + url?: string | undefined; + /** + * Line number in the resource that generated this message (1-based). + */ + line?: number | undefined; + /** + * Column number in the resource that generated this message (1-based). + */ + column?: number | undefined; + } + interface MessageAddedEventDataType { + /** + * Console message that has been added. + */ + message: ConsoleMessage; + } + } + namespace Profiler { + /** + * Profile node. Holds callsite information, execution statistics and child nodes. + */ + interface ProfileNode { + /** + * Unique id of the node. + */ + id: number; + /** + * Function location. + */ + callFrame: Runtime.CallFrame; + /** + * Number of samples where this node was on top of the call stack. + */ + hitCount?: number | undefined; + /** + * Child node ids. + */ + children?: number[] | undefined; + /** + * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. + */ + deoptReason?: string | undefined; + /** + * An array of source position ticks. + */ + positionTicks?: PositionTickInfo[] | undefined; + } + /** + * Profile. + */ + interface Profile { + /** + * The list of profile nodes. First item is the root node. + */ + nodes: ProfileNode[]; + /** + * Profiling start timestamp in microseconds. + */ + startTime: number; + /** + * Profiling end timestamp in microseconds. + */ + endTime: number; + /** + * Ids of samples top nodes. + */ + samples?: number[] | undefined; + /** + * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. + */ + timeDeltas?: number[] | undefined; + } + /** + * Specifies a number of samples attributed to a certain source position. + */ + interface PositionTickInfo { + /** + * Source line number (1-based). + */ + line: number; + /** + * Number of samples attributed to the source line. + */ + ticks: number; + } + /** + * Coverage data for a source range. + */ + interface CoverageRange { + /** + * JavaScript script source offset for the range start. + */ + startOffset: number; + /** + * JavaScript script source offset for the range end. + */ + endOffset: number; + /** + * Collected execution count of the source range. + */ + count: number; + } + /** + * Coverage data for a JavaScript function. + */ + interface FunctionCoverage { + /** + * JavaScript function name. + */ + functionName: string; + /** + * Source ranges inside the function with coverage data. + */ + ranges: CoverageRange[]; + /** + * Whether coverage data for this function has block granularity. + */ + isBlockCoverage: boolean; + } + /** + * Coverage data for a JavaScript script. + */ + interface ScriptCoverage { + /** + * JavaScript script id. + */ + scriptId: Runtime.ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Functions contained in the script that has coverage data. + */ + functions: FunctionCoverage[]; + } + /** + * Describes a type collected during runtime. + * @experimental + */ + interface TypeObject { + /** + * Name of a type collected with type profiling. + */ + name: string; + } + /** + * Source offset and types for a parameter or return value. + * @experimental + */ + interface TypeProfileEntry { + /** + * Source offset of the parameter or end of function for return values. + */ + offset: number; + /** + * The types for this parameter or return value. + */ + types: TypeObject[]; + } + /** + * Type profile data collected during runtime for a JavaScript script. + * @experimental + */ + interface ScriptTypeProfile { + /** + * JavaScript script id. + */ + scriptId: Runtime.ScriptId; + /** + * JavaScript script name or url. + */ + url: string; + /** + * Type profile entries for parameters and return values of the functions in the script. + */ + entries: TypeProfileEntry[]; + } + interface SetSamplingIntervalParameterType { + /** + * New sampling interval in microseconds. + */ + interval: number; + } + interface StartPreciseCoverageParameterType { + /** + * Collect accurate call counts beyond simple 'covered' or 'not covered'. + */ + callCount?: boolean | undefined; + /** + * Collect block-based coverage. + */ + detailed?: boolean | undefined; + } + interface StopReturnType { + /** + * Recorded profile. + */ + profile: Profile; + } + interface TakePreciseCoverageReturnType { + /** + * Coverage data for the current isolate. + */ + result: ScriptCoverage[]; + } + interface GetBestEffortCoverageReturnType { + /** + * Coverage data for the current isolate. + */ + result: ScriptCoverage[]; + } + interface TakeTypeProfileReturnType { + /** + * Type profile for all scripts since startTypeProfile() was turned on. + */ + result: ScriptTypeProfile[]; + } + interface ConsoleProfileStartedEventDataType { + id: string; + /** + * Location of console.profile(). + */ + location: Debugger.Location; + /** + * Profile title passed as an argument to console.profile(). + */ + title?: string | undefined; + } + interface ConsoleProfileFinishedEventDataType { + id: string; + /** + * Location of console.profileEnd(). + */ + location: Debugger.Location; + profile: Profile; + /** + * Profile title passed as an argument to console.profile(). + */ + title?: string | undefined; + } + } + namespace HeapProfiler { + /** + * Heap snapshot object id. + */ + type HeapSnapshotObjectId = string; + /** + * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. + */ + interface SamplingHeapProfileNode { + /** + * Function location. + */ + callFrame: Runtime.CallFrame; + /** + * Allocations size in bytes for the node excluding children. + */ + selfSize: number; + /** + * Child nodes. + */ + children: SamplingHeapProfileNode[]; + } + /** + * Profile. + */ + interface SamplingHeapProfile { + head: SamplingHeapProfileNode; + } + interface StartTrackingHeapObjectsParameterType { + trackAllocations?: boolean | undefined; + } + interface StopTrackingHeapObjectsParameterType { + /** + * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. + */ + reportProgress?: boolean | undefined; + } + interface TakeHeapSnapshotParameterType { + /** + * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. + */ + reportProgress?: boolean | undefined; + } + interface GetObjectByHeapObjectIdParameterType { + objectId: HeapSnapshotObjectId; + /** + * Symbolic group name that can be used to release multiple objects. + */ + objectGroup?: string | undefined; + } + interface AddInspectedHeapObjectParameterType { + /** + * Heap snapshot object id to be accessible by means of $x command line API. + */ + heapObjectId: HeapSnapshotObjectId; + } + interface GetHeapObjectIdParameterType { + /** + * Identifier of the object to get heap object id for. + */ + objectId: Runtime.RemoteObjectId; + } + interface StartSamplingParameterType { + /** + * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. + */ + samplingInterval?: number | undefined; + } + interface GetObjectByHeapObjectIdReturnType { + /** + * Evaluation result. + */ + result: Runtime.RemoteObject; + } + interface GetHeapObjectIdReturnType { + /** + * Id of the heap snapshot object corresponding to the passed remote object id. + */ + heapSnapshotObjectId: HeapSnapshotObjectId; + } + interface StopSamplingReturnType { + /** + * Recorded sampling heap profile. + */ + profile: SamplingHeapProfile; + } + interface GetSamplingProfileReturnType { + /** + * Return the sampling profile being collected. + */ + profile: SamplingHeapProfile; + } + interface AddHeapSnapshotChunkEventDataType { + chunk: string; + } + interface ReportHeapSnapshotProgressEventDataType { + done: number; + total: number; + finished?: boolean | undefined; + } + interface LastSeenObjectIdEventDataType { + lastSeenObjectId: number; + timestamp: number; + } + interface HeapStatsUpdateEventDataType { + /** + * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. + */ + statsUpdate: number[]; + } + } + namespace NodeTracing { + interface TraceConfig { + /** + * Controls how the trace buffer stores data. + */ + recordMode?: string | undefined; + /** + * Included category filters. + */ + includedCategories: string[]; + } + interface StartParameterType { + traceConfig: TraceConfig; + } + interface GetCategoriesReturnType { + /** + * A list of supported tracing categories. + */ + categories: string[]; + } + interface DataCollectedEventDataType { + value: Array<{}>; + } + } + namespace NodeWorker { + type WorkerID = string; + /** + * Unique identifier of attached debugging session. + */ + type SessionID = string; + interface WorkerInfo { + workerId: WorkerID; + type: string; + title: string; + url: string; + } + interface SendMessageToWorkerParameterType { + message: string; + /** + * Identifier of the session. + */ + sessionId: SessionID; + } + interface EnableParameterType { + /** + * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` + * message to run them. + */ + waitForDebuggerOnStart: boolean; + } + interface DetachParameterType { + sessionId: SessionID; + } + interface AttachedToWorkerEventDataType { + /** + * Identifier assigned to the session used to send/receive messages. + */ + sessionId: SessionID; + workerInfo: WorkerInfo; + waitingForDebugger: boolean; + } + interface DetachedFromWorkerEventDataType { + /** + * Detached session identifier. + */ + sessionId: SessionID; + } + interface ReceivedMessageFromWorkerEventDataType { + /** + * Identifier of a session which sends a message. + */ + sessionId: SessionID; + message: string; + } + } + namespace NodeRuntime { + interface NotifyWhenWaitingForDisconnectParameterType { + enabled: boolean; + } + } + /** + * The `inspector.Session` is used for dispatching messages to the V8 inspector + * back-end and receiving message responses and notifications. + */ + class Session extends EventEmitter { + /** + * Create a new instance of the inspector.Session class. + * The inspector session needs to be connected through session.connect() before the messages can be dispatched to the inspector backend. + */ + constructor(); + /** + * Connects a session to the inspector back-end. + * @since v8.0.0 + */ + connect(): void; + /** + * Immediately close the session. All pending message callbacks will be called + * with an error. `session.connect()` will need to be called to be able to send + * messages again. Reconnected session will lose all inspector state, such as + * enabled agents or configured breakpoints. + * @since v8.0.0 + */ + disconnect(): void; + /** + * Posts a message to the inspector back-end. `callback` will be notified when + * a response is received. `callback` is a function that accepts two optional + * arguments: error and message-specific result. + * + * ```js + * session.post('Runtime.evaluate', { expression: '2 + 2' }, + * (error, { result }) => console.log(result)); + * // Output: { type: 'number', value: 4, description: '4' } + * ``` + * + * The latest version of the V8 inspector protocol is published on the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/). + * + * Node.js inspector supports all the Chrome DevTools Protocol domains declared + * by V8\. Chrome DevTools Protocol domain provides an interface for interacting + * with one of the runtime agents used to inspect the application state and listen + * to the run-time events. + * + * ## Example usage + * + * Apart from the debugger, various V8 Profilers are available through the DevTools + * protocol. + * @since v8.0.0 + */ + post(method: string, params?: {}, callback?: (err: Error | null, params?: {}) => void): void; + post(method: string, callback?: (err: Error | null, params?: {}) => void): void; + /** + * Returns supported domains. + */ + post(method: 'Schema.getDomains', callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; + /** + * Evaluates expression on global object. + */ + post(method: 'Runtime.evaluate', params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + post(method: 'Runtime.evaluate', callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; + /** + * Add handler to promise with given promise object id. + */ + post(method: 'Runtime.awaitPromise', params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; + post(method: 'Runtime.awaitPromise', callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; + /** + * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. + */ + post(method: 'Runtime.callFunctionOn', params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; + post(method: 'Runtime.callFunctionOn', callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; + /** + * Returns properties of a given object. Object group of the result is inherited from the target object. + */ + post(method: 'Runtime.getProperties', params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; + post(method: 'Runtime.getProperties', callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; + /** + * Releases remote object with given id. + */ + post(method: 'Runtime.releaseObject', params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.releaseObject', callback?: (err: Error | null) => void): void; + /** + * Releases all remote objects that belong to a given group. + */ + post(method: 'Runtime.releaseObjectGroup', params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.releaseObjectGroup', callback?: (err: Error | null) => void): void; + /** + * Tells inspected instance to run if it was waiting for debugger to attach. + */ + post(method: 'Runtime.runIfWaitingForDebugger', callback?: (err: Error | null) => void): void; + /** + * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. + */ + post(method: 'Runtime.enable', callback?: (err: Error | null) => void): void; + /** + * Disables reporting of execution contexts creation. + */ + post(method: 'Runtime.disable', callback?: (err: Error | null) => void): void; + /** + * Discards collected exceptions and console API calls. + */ + post(method: 'Runtime.discardConsoleEntries', callback?: (err: Error | null) => void): void; + /** + * @experimental + */ + post(method: 'Runtime.setCustomObjectFormatterEnabled', params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Runtime.setCustomObjectFormatterEnabled', callback?: (err: Error | null) => void): void; + /** + * Compiles expression. + */ + post(method: 'Runtime.compileScript', params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; + post(method: 'Runtime.compileScript', callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; + /** + * Runs script with given id in a given context. + */ + post(method: 'Runtime.runScript', params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + post(method: 'Runtime.runScript', callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; + post(method: 'Runtime.queryObjects', params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + post(method: 'Runtime.queryObjects', callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; + /** + * Returns all let, const and class variables from global scope. + */ + post( + method: 'Runtime.globalLexicalScopeNames', + params?: Runtime.GlobalLexicalScopeNamesParameterType, + callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void + ): void; + post(method: 'Runtime.globalLexicalScopeNames', callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; + /** + * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. + */ + post(method: 'Debugger.enable', callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; + /** + * Disables debugger for given page. + */ + post(method: 'Debugger.disable', callback?: (err: Error | null) => void): void; + /** + * Activates / deactivates all breakpoints on the page. + */ + post(method: 'Debugger.setBreakpointsActive', params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBreakpointsActive', callback?: (err: Error | null) => void): void; + /** + * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). + */ + post(method: 'Debugger.setSkipAllPauses', params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setSkipAllPauses', callback?: (err: Error | null) => void): void; + /** + * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. + */ + post(method: 'Debugger.setBreakpointByUrl', params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; + post(method: 'Debugger.setBreakpointByUrl', callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; + /** + * Sets JavaScript breakpoint at a given location. + */ + post(method: 'Debugger.setBreakpoint', params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; + post(method: 'Debugger.setBreakpoint', callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; + /** + * Removes JavaScript breakpoint. + */ + post(method: 'Debugger.removeBreakpoint', params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.removeBreakpoint', callback?: (err: Error | null) => void): void; + /** + * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. + */ + post( + method: 'Debugger.getPossibleBreakpoints', + params?: Debugger.GetPossibleBreakpointsParameterType, + callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void + ): void; + post(method: 'Debugger.getPossibleBreakpoints', callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; + /** + * Continues execution until specific location is reached. + */ + post(method: 'Debugger.continueToLocation', params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.continueToLocation', callback?: (err: Error | null) => void): void; + /** + * @experimental + */ + post(method: 'Debugger.pauseOnAsyncCall', params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.pauseOnAsyncCall', callback?: (err: Error | null) => void): void; + /** + * Steps over the statement. + */ + post(method: 'Debugger.stepOver', callback?: (err: Error | null) => void): void; + /** + * Steps into the function call. + */ + post(method: 'Debugger.stepInto', params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.stepInto', callback?: (err: Error | null) => void): void; + /** + * Steps out of the function call. + */ + post(method: 'Debugger.stepOut', callback?: (err: Error | null) => void): void; + /** + * Stops on the next JavaScript statement. + */ + post(method: 'Debugger.pause', callback?: (err: Error | null) => void): void; + /** + * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. + * @experimental + */ + post(method: 'Debugger.scheduleStepIntoAsync', callback?: (err: Error | null) => void): void; + /** + * Resumes JavaScript execution. + */ + post(method: 'Debugger.resume', callback?: (err: Error | null) => void): void; + /** + * Returns stack trace with given stackTraceId. + * @experimental + */ + post(method: 'Debugger.getStackTrace', params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; + post(method: 'Debugger.getStackTrace', callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; + /** + * Searches for given string in script content. + */ + post(method: 'Debugger.searchInContent', params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; + post(method: 'Debugger.searchInContent', callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; + /** + * Edits JavaScript source live. + */ + post(method: 'Debugger.setScriptSource', params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; + post(method: 'Debugger.setScriptSource', callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; + /** + * Restarts particular call frame from the beginning. + */ + post(method: 'Debugger.restartFrame', params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; + post(method: 'Debugger.restartFrame', callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; + /** + * Returns source for the script with given id. + */ + post(method: 'Debugger.getScriptSource', params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; + post(method: 'Debugger.getScriptSource', callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; + /** + * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. + */ + post(method: 'Debugger.setPauseOnExceptions', params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setPauseOnExceptions', callback?: (err: Error | null) => void): void; + /** + * Evaluates expression on a given call frame. + */ + post(method: 'Debugger.evaluateOnCallFrame', params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; + post(method: 'Debugger.evaluateOnCallFrame', callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; + /** + * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. + */ + post(method: 'Debugger.setVariableValue', params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setVariableValue', callback?: (err: Error | null) => void): void; + /** + * Changes return value in top frame. Available only at return break position. + * @experimental + */ + post(method: 'Debugger.setReturnValue', params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setReturnValue', callback?: (err: Error | null) => void): void; + /** + * Enables or disables async call stacks tracking. + */ + post(method: 'Debugger.setAsyncCallStackDepth', params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setAsyncCallStackDepth', callback?: (err: Error | null) => void): void; + /** + * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. + * @experimental + */ + post(method: 'Debugger.setBlackboxPatterns', params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBlackboxPatterns', callback?: (err: Error | null) => void): void; + /** + * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. + * @experimental + */ + post(method: 'Debugger.setBlackboxedRanges', params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Debugger.setBlackboxedRanges', callback?: (err: Error | null) => void): void; + /** + * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. + */ + post(method: 'Console.enable', callback?: (err: Error | null) => void): void; + /** + * Disables console domain, prevents further console messages from being reported to the client. + */ + post(method: 'Console.disable', callback?: (err: Error | null) => void): void; + /** + * Does nothing. + */ + post(method: 'Console.clearMessages', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.enable', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.disable', callback?: (err: Error | null) => void): void; + /** + * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. + */ + post(method: 'Profiler.setSamplingInterval', params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Profiler.setSamplingInterval', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.start', callback?: (err: Error | null) => void): void; + post(method: 'Profiler.stop', callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; + /** + * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. + */ + post(method: 'Profiler.startPreciseCoverage', params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; + post(method: 'Profiler.startPreciseCoverage', callback?: (err: Error | null) => void): void; + /** + * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. + */ + post(method: 'Profiler.stopPreciseCoverage', callback?: (err: Error | null) => void): void; + /** + * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. + */ + post(method: 'Profiler.takePreciseCoverage', callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; + /** + * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. + */ + post(method: 'Profiler.getBestEffortCoverage', callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; + /** + * Enable type profile. + * @experimental + */ + post(method: 'Profiler.startTypeProfile', callback?: (err: Error | null) => void): void; + /** + * Disable type profile. Disabling releases type profile data collected so far. + * @experimental + */ + post(method: 'Profiler.stopTypeProfile', callback?: (err: Error | null) => void): void; + /** + * Collect type profile. + * @experimental + */ + post(method: 'Profiler.takeTypeProfile', callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void; + post(method: 'HeapProfiler.enable', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.disable', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startTrackingHeapObjects', params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startTrackingHeapObjects', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopTrackingHeapObjects', params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopTrackingHeapObjects', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.takeHeapSnapshot', params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.takeHeapSnapshot', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.collectGarbage', callback?: (err: Error | null) => void): void; + post( + method: 'HeapProfiler.getObjectByHeapObjectId', + params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, + callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void + ): void; + post(method: 'HeapProfiler.getObjectByHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; + /** + * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). + */ + post(method: 'HeapProfiler.addInspectedHeapObject', params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.addInspectedHeapObject', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.getHeapObjectId', params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; + post(method: 'HeapProfiler.getHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; + post(method: 'HeapProfiler.startSampling', params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.startSampling', callback?: (err: Error | null) => void): void; + post(method: 'HeapProfiler.stopSampling', callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; + post(method: 'HeapProfiler.getSamplingProfile', callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; + /** + * Gets supported tracing categories. + */ + post(method: 'NodeTracing.getCategories', callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; + /** + * Start trace events collection. + */ + post(method: 'NodeTracing.start', params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeTracing.start', callback?: (err: Error | null) => void): void; + /** + * Stop trace events collection. Remaining collected events will be sent as a sequence of + * dataCollected events followed by tracingComplete event. + */ + post(method: 'NodeTracing.stop', callback?: (err: Error | null) => void): void; + /** + * Sends protocol message over session with given id. + */ + post(method: 'NodeWorker.sendMessageToWorker', params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.sendMessageToWorker', callback?: (err: Error | null) => void): void; + /** + * Instructs the inspector to attach to running workers. Will also attach to new workers + * as they start + */ + post(method: 'NodeWorker.enable', params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.enable', callback?: (err: Error | null) => void): void; + /** + * Detaches from all running workers and disables attaching to new workers as they are started. + */ + post(method: 'NodeWorker.disable', callback?: (err: Error | null) => void): void; + /** + * Detached from the worker with given sessionId. + */ + post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeWorker.detach', callback?: (err: Error | null) => void): void; + /** + * Enable the `NodeRuntime.waitingForDisconnect`. + */ + post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; + post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', callback?: (err: Error | null) => void): void; + // Events + addListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + addListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + addListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + addListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + addListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + addListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + addListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + addListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + addListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + addListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + addListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + addListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + addListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + addListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + addListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + addListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + addListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + addListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + addListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + addListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + addListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + addListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + addListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + addListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + addListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + addListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + addListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'inspectorNotification', message: InspectorNotification<{}>): boolean; + emit(event: 'Runtime.executionContextCreated', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextDestroyed', message: InspectorNotification): boolean; + emit(event: 'Runtime.executionContextsCleared'): boolean; + emit(event: 'Runtime.exceptionThrown', message: InspectorNotification): boolean; + emit(event: 'Runtime.exceptionRevoked', message: InspectorNotification): boolean; + emit(event: 'Runtime.consoleAPICalled', message: InspectorNotification): boolean; + emit(event: 'Runtime.inspectRequested', message: InspectorNotification): boolean; + emit(event: 'Debugger.scriptParsed', message: InspectorNotification): boolean; + emit(event: 'Debugger.scriptFailedToParse', message: InspectorNotification): boolean; + emit(event: 'Debugger.breakpointResolved', message: InspectorNotification): boolean; + emit(event: 'Debugger.paused', message: InspectorNotification): boolean; + emit(event: 'Debugger.resumed'): boolean; + emit(event: 'Console.messageAdded', message: InspectorNotification): boolean; + emit(event: 'Profiler.consoleProfileStarted', message: InspectorNotification): boolean; + emit(event: 'Profiler.consoleProfileFinished', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.addHeapSnapshotChunk', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.resetProfiles'): boolean; + emit(event: 'HeapProfiler.reportHeapSnapshotProgress', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.lastSeenObjectId', message: InspectorNotification): boolean; + emit(event: 'HeapProfiler.heapStatsUpdate', message: InspectorNotification): boolean; + emit(event: 'NodeTracing.dataCollected', message: InspectorNotification): boolean; + emit(event: 'NodeTracing.tracingComplete'): boolean; + emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification): boolean; + emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification): boolean; + emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification): boolean; + emit(event: 'NodeRuntime.waitingForDisconnect'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + on(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + on(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + on(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + on(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + on(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + on(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + on(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + on(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + on(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + on(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + on(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + on(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + on(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + on(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + on(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + on(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + on(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + on(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + on(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + on(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + on(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + on(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + on(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + on(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + on(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + on(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + once(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + once(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + once(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + once(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + once(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + once(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + once(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + once(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + once(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + once(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + once(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + once(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + once(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + once(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + once(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + once(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + once(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + once(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + once(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + once(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + once(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + once(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + once(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + once(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + once(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + once(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + prependListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + prependListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + prependListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + prependListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + prependListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + prependListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + prependListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + prependListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + prependListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + prependListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + prependListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + prependListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + prependListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + prependListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + prependListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + prependListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + prependListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + prependOnceListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; + /** + * Issued when new execution context is created. + */ + prependOnceListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + prependOnceListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + prependOnceListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; + /** + * Issued when exception was thrown and unhandled. + */ + prependOnceListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; + /** + * Issued when unhandled exception was revoked. + */ + prependOnceListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; + /** + * Issued when console API was called. + */ + prependOnceListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; + /** + * Issued when object should be inspected (for example, as a result of inspect() command line API call). + */ + prependOnceListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. + */ + prependOnceListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; + /** + * Fired when virtual machine fails to parse the script. + */ + prependOnceListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; + /** + * Fired when breakpoint is resolved to an actual script and location. + */ + prependOnceListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. + */ + prependOnceListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; + /** + * Fired when the virtual machine resumed execution. + */ + prependOnceListener(event: 'Debugger.resumed', listener: () => void): this; + /** + * Issued when new console message is added. + */ + prependOnceListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; + /** + * Sent when new profile recording is started using console.profile() call. + */ + prependOnceListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; + prependOnceListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; + prependOnceListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. + */ + prependOnceListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; + /** + * If heap objects tracking has been started then backend may send update for one or more fragments + */ + prependOnceListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependOnceListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependOnceListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependOnceListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependOnceListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; + /** + * This event is fired instead of `Runtime.executionContextDestroyed` when + * enabled. + * It is fired when the Node process finished all code execution and is + * waiting for all frontends to disconnect. + */ + prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; + } + /** + * Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has + * started. + * + * If wait is `true`, will block until a client has connected to the inspect port + * and flow control has been passed to the debugger client. + * + * See the `security warning` regarding the `host`parameter usage. + * @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional. + * @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional. + * @param [wait=false] Block until a client has connected. Optional. + */ + function open(port?: number, host?: string, wait?: boolean): void; + /** + * Deactivate the inspector. Blocks until there are no active connections. + */ + function close(): void; + /** + * Return the URL of the active inspector, or `undefined` if there is none. + * + * ```console + * $ node --inspect -p 'inspector.url()' + * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 + * For help, see: https://nodejs.org/en/docs/inspector + * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 + * + * $ node --inspect=localhost:3000 -p 'inspector.url()' + * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a + * For help, see: https://nodejs.org/en/docs/inspector + * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a + * + * $ node -p 'inspector.url()' + * undefined + * ``` + */ + function url(): string | undefined; + /** + * Blocks until a client (existing or connected later) has sent`Runtime.runIfWaitingForDebugger` command. + * + * An exception will be thrown if there is no active inspector. + * @since v12.7.0 + */ + function waitForDebugger(): void; +} +/** + * The inspector module provides an API for interacting with the V8 inspector. + */ +declare module 'node:inspector' { + import inspector = require('inspector'); + export = inspector; +} diff --git a/node_modules/@types/node/ts4.8/module.d.ts b/node_modules/@types/node/ts4.8/module.d.ts new file mode 100755 index 0000000..58847a8 --- /dev/null +++ b/node_modules/@types/node/ts4.8/module.d.ts @@ -0,0 +1,232 @@ +/** + * @since v0.3.7 + */ +declare module 'module' { + import { URL } from 'node:url'; + import { MessagePort } from 'node:worker_threads'; + namespace Module { + /** + * The `module.syncBuiltinESMExports()` method updates all the live bindings for + * builtin `ES Modules` to match the properties of the `CommonJS` exports. It + * does not add or remove exported names from the `ES Modules`. + * + * ```js + * const fs = require('node:fs'); + * const assert = require('node:assert'); + * const { syncBuiltinESMExports } = require('node:module'); + * + * fs.readFile = newAPI; + * + * delete fs.readFileSync; + * + * function newAPI() { + * // ... + * } + * + * fs.newAPI = newAPI; + * + * syncBuiltinESMExports(); + * + * import('node:fs').then((esmFS) => { + * // It syncs the existing readFile property with the new value + * assert.strictEqual(esmFS.readFile, newAPI); + * // readFileSync has been deleted from the required fs + * assert.strictEqual('readFileSync' in fs, false); + * // syncBuiltinESMExports() does not remove readFileSync from esmFS + * assert.strictEqual('readFileSync' in esmFS, true); + * // syncBuiltinESMExports() does not add names + * assert.strictEqual(esmFS.newAPI, undefined); + * }); + * ``` + * @since v12.12.0 + */ + function syncBuiltinESMExports(): void; + /** + * `path` is the resolved path for the file for which a corresponding source map + * should be fetched. + * @since v13.7.0, v12.17.0 + * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise. + */ + function findSourceMap(path: string, error?: Error): SourceMap; + interface SourceMapPayload { + file: string; + version: number; + sources: string[]; + sourcesContent: string[]; + names: string[]; + mappings: string; + sourceRoot: string; + } + interface SourceMapping { + generatedLine: number; + generatedColumn: number; + originalSource: string; + originalLine: number; + originalColumn: number; + } + /** + * @since v13.7.0, v12.17.0 + */ + class SourceMap { + /** + * Getter for the payload used to construct the `SourceMap` instance. + */ + readonly payload: SourceMapPayload; + constructor(payload: SourceMapPayload); + /** + * Given a line offset and column offset in the generated source + * file, returns an object representing the SourceMap range in the + * original file if found, or an empty object if not. + * + * The object returned contains the following keys: + * + * The returned value represents the raw range as it appears in the + * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and + * column numbers as they appear in Error messages and CallSite + * objects. + * + * To get the corresponding 1-indexed line and column numbers from a + * lineNumber and columnNumber as they are reported by Error stacks + * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)` + * @param lineOffset The zero-indexed line number offset in the generated source + * @param columnOffset The zero-indexed column number offset in the generated source + */ + findEntry(lineOffset: number, columnOffset: number): SourceMapping; + } + interface ImportAssertions extends NodeJS.Dict { + type?: string | undefined; + } + type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm'; + type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray; + interface GlobalPreloadContext { + port: MessagePort; + } + /** + * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in. + * This hook allows the return of a string that is run as a sloppy-mode script on startup. + * + * @param context Information to assist the preload code + * @return Code to run before application startup + */ + type GlobalPreloadHook = (context: GlobalPreloadContext) => string; + interface ResolveHookContext { + /** + * Export conditions of the relevant `package.json` + */ + conditions: string[]; + /** + * An object whose key-value pairs represent the assertions for the module to import + */ + importAssertions: ImportAssertions; + /** + * The module importing this one, or undefined if this is the Node.js entry point + */ + parentURL: string | undefined; + } + interface ResolveFnOutput { + /** + * A hint to the load hook (it might be ignored) + */ + format?: ModuleFormat | null | undefined; + /** + * The import assertions to use when caching the module (optional; if excluded the input will be used) + */ + importAssertions?: ImportAssertions | undefined; + /** + * A signal that this hook intends to terminate the chain of `resolve` hooks. + * @default false + */ + shortCircuit?: boolean | undefined; + /** + * The absolute URL to which this input resolves + */ + url: string; + } + /** + * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook. + * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`); + * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook. + * + * @param specifier The specified URL path of the module to be resolved + * @param context + * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook + */ + type ResolveHook = ( + specifier: string, + context: ResolveHookContext, + nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput | Promise + ) => ResolveFnOutput | Promise; + interface LoadHookContext { + /** + * Export conditions of the relevant `package.json` + */ + conditions: string[]; + /** + * The format optionally supplied by the `resolve` hook chain + */ + format: ModuleFormat; + /** + * An object whose key-value pairs represent the assertions for the module to import + */ + importAssertions: ImportAssertions; + } + interface LoadFnOutput { + format: ModuleFormat; + /** + * A signal that this hook intends to terminate the chain of `resolve` hooks. + * @default false + */ + shortCircuit?: boolean | undefined; + /** + * The source for Node.js to evaluate + */ + source?: ModuleSource; + } + /** + * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed. + * It is also in charge of validating the import assertion. + * + * @param url The URL/path of the module to be loaded + * @param context Metadata about the module + * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook + */ + type LoadHook = ( + url: string, + context: LoadHookContext, + nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise + ) => LoadFnOutput | Promise; + } + interface Module extends NodeModule {} + class Module { + static runMain(): void; + static wrap(code: string): string; + static createRequire(path: string | URL): NodeRequire; + static builtinModules: string[]; + static isBuiltin(moduleName: string): boolean; + static Module: typeof Module; + constructor(id: string, parent?: Module); + } + global { + interface ImportMeta { + url: string; + /** + * @experimental + * This feature is only available with the `--experimental-import-meta-resolve` + * command flag enabled. + * + * Provides a module-relative resolution function scoped to each module, returning + * the URL string. + * + * @param specified The module specifier to resolve relative to `parent`. + * @param parent The absolute parent module URL to resolve from. If none + * is specified, the value of `import.meta.url` is used as the default. + */ + resolve?(specified: string, parent?: string | URL): Promise; + } + } + export = Module; +} +declare module 'node:module' { + import module = require('module'); + export = module; +} diff --git a/node_modules/@types/node/ts4.8/net.d.ts b/node_modules/@types/node/ts4.8/net.d.ts new file mode 100755 index 0000000..92190b6 --- /dev/null +++ b/node_modules/@types/node/ts4.8/net.d.ts @@ -0,0 +1,893 @@ +/** + * > Stability: 2 - Stable + * + * The `node:net` module provides an asynchronous network API for creating stream-based + * TCP or `IPC` servers ({@link createServer}) and clients + * ({@link createConnection}). + * + * It can be accessed using: + * + * ```js + * const net = require('node:net'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/net.js) + */ +declare module 'net' { + import * as stream from 'node:stream'; + import { Abortable, EventEmitter } from 'node:events'; + import * as dns from 'node:dns'; + type LookupFunction = (hostname: string, options: dns.LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => void) => void; + interface AddressInfo { + address: string; + family: string; + port: number; + } + interface SocketConstructorOpts { + fd?: number | undefined; + allowHalfOpen?: boolean | undefined; + readable?: boolean | undefined; + writable?: boolean | undefined; + signal?: AbortSignal; + } + interface OnReadOpts { + buffer: Uint8Array | (() => Uint8Array); + /** + * This function is called for every chunk of incoming data. + * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer. + * Return false from this function to implicitly pause() the socket. + */ + callback(bytesWritten: number, buf: Uint8Array): boolean; + } + interface ConnectOpts { + /** + * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket. + * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will + * still be emitted as normal and methods like pause() and resume() will also behave as expected. + */ + onread?: OnReadOpts | undefined; + } + interface TcpSocketConnectOpts extends ConnectOpts { + port: number; + host?: string | undefined; + localAddress?: string | undefined; + localPort?: number | undefined; + hints?: number | undefined; + family?: number | undefined; + lookup?: LookupFunction | undefined; + noDelay?: boolean | undefined; + keepAlive?: boolean | undefined; + keepAliveInitialDelay?: number | undefined; + /** + * @since v18.13.0 + */ + autoSelectFamily?: boolean | undefined; + /** + * @since v18.13.0 + */ + autoSelectFamilyAttemptTimeout?: number | undefined; + } + interface IpcSocketConnectOpts extends ConnectOpts { + path: string; + } + type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; + type SocketReadyState = 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed'; + /** + * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint + * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also + * an `EventEmitter`. + * + * A `net.Socket` can be created by the user and used directly to interact with + * a server. For example, it is returned by {@link createConnection}, + * so the user can use it to talk to the server. + * + * It can also be created by Node.js and passed to the user when a connection + * is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use + * it to interact with the client. + * @since v0.3.4 + */ + class Socket extends stream.Duplex { + constructor(options?: SocketConstructorOpts); + /** + * Sends data on the socket. The second parameter specifies the encoding in the + * case of a string. It defaults to UTF8 encoding. + * + * Returns `true` if the entire data was flushed successfully to the kernel + * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free. + * + * The optional `callback` parameter will be executed when the data is finally + * written out, which may not be immediately. + * + * See `Writable` stream `write()` method for more + * information. + * @since v0.1.90 + * @param [encoding='utf8'] Only used when data is `string`. + */ + write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean; + write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean; + /** + * Initiate a connection on a given socket. + * + * Possible signatures: + * + * * `socket.connect(options[, connectListener])` + * * `socket.connect(path[, connectListener])` for `IPC` connections. + * * `socket.connect(port[, host][, connectListener])` for TCP connections. + * * Returns: `net.Socket` The socket itself. + * + * This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting, + * instead of a `'connect'` event, an `'error'` event will be emitted with + * the error passed to the `'error'` listener. + * The last parameter `connectListener`, if supplied, will be added as a listener + * for the `'connect'` event **once**. + * + * This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined + * behavior. + */ + connect(options: SocketConnectOpts, connectionListener?: () => void): this; + connect(port: number, host: string, connectionListener?: () => void): this; + connect(port: number, connectionListener?: () => void): this; + connect(path: string, connectionListener?: () => void): this; + /** + * Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information. + * @since v0.1.90 + * @return The socket itself. + */ + setEncoding(encoding?: BufferEncoding): this; + /** + * Pauses the reading of data. That is, `'data'` events will not be emitted. + * Useful to throttle back an upload. + * @return The socket itself. + */ + pause(): this; + /** + * Close the TCP connection by sending an RST packet and destroy the stream. + * If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected. + * Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. + * If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error. + * @since v18.3.0, v16.17.0 + */ + resetAndDestroy(): this; + /** + * Resumes reading after a call to `socket.pause()`. + * @return The socket itself. + */ + resume(): this; + /** + * Sets the socket to timeout after `timeout` milliseconds of inactivity on + * the socket. By default `net.Socket` do not have a timeout. + * + * When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to + * end the connection. + * + * ```js + * socket.setTimeout(3000); + * socket.on('timeout', () => { + * console.log('socket timeout'); + * socket.end(); + * }); + * ``` + * + * If `timeout` is 0, then the existing idle timeout is disabled. + * + * The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event. + * @since v0.1.90 + * @return The socket itself. + */ + setTimeout(timeout: number, callback?: () => void): this; + /** + * Enable/disable the use of Nagle's algorithm. + * + * When a TCP connection is created, it will have Nagle's algorithm enabled. + * + * Nagle's algorithm delays data before it is sent via the network. It attempts + * to optimize throughput at the expense of latency. + * + * Passing `true` for `noDelay` or not passing an argument will disable Nagle's + * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's + * algorithm. + * @since v0.1.90 + * @param [noDelay=true] + * @return The socket itself. + */ + setNoDelay(noDelay?: boolean): this; + /** + * Enable/disable keep-alive functionality, and optionally set the initial + * delay before the first keepalive probe is sent on an idle socket. + * + * Set `initialDelay` (in milliseconds) to set the delay between the last + * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default + * (or previous) setting. + * + * Enabling the keep-alive functionality will set the following socket options: + * + * * `SO_KEEPALIVE=1` + * * `TCP_KEEPIDLE=initialDelay` + * * `TCP_KEEPCNT=10` + * * `TCP_KEEPINTVL=1` + * @since v0.1.92 + * @param [enable=false] + * @param [initialDelay=0] + * @return The socket itself. + */ + setKeepAlive(enable?: boolean, initialDelay?: number): this; + /** + * Returns the bound `address`, the address `family` name and `port` of the + * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + * @since v0.1.90 + */ + address(): AddressInfo | {}; + /** + * Calling `unref()` on a socket will allow the program to exit if this is the only + * active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect. + * @since v0.9.1 + * @return The socket itself. + */ + unref(): this; + /** + * Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior). + * If the socket is `ref`ed calling `ref` again will have no effect. + * @since v0.9.1 + * @return The socket itself. + */ + ref(): this; + /** + * This property shows the number of characters buffered for writing. The buffer + * may contain strings whose length after encoding is not yet known. So this number + * is only an approximation of the number of bytes in the buffer. + * + * `net.Socket` has the property that `socket.write()` always works. This is to + * help users get up and running quickly. The computer cannot always keep up + * with the amount of data that is written to a socket. The network connection + * simply might be too slow. Node.js will internally queue up the data written to a + * socket and send it out over the wire when it is possible. + * + * The consequence of this internal buffering is that memory may grow. + * Users who experience large or growing `bufferSize` should attempt to + * "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`. + * @since v0.3.8 + * @deprecated Since v14.6.0 - Use `writableLength` instead. + */ + readonly bufferSize: number; + /** + * The amount of received bytes. + * @since v0.5.3 + */ + readonly bytesRead: number; + /** + * The amount of bytes sent. + * @since v0.5.3 + */ + readonly bytesWritten: number; + /** + * If `true`,`socket.connect(options[, connectListener])` was + * called and has not yet finished. It will stay `true` until the socket becomes + * connected, then it is set to `false` and the `'connect'` event is emitted. Note + * that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event. + * @since v6.1.0 + */ + readonly connecting: boolean; + /** + * This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting + * (see `socket.connecting`). + * @since v11.2.0, v10.16.0 + */ + readonly pending: boolean; + /** + * See `writable.destroyed` for further details. + */ + readonly destroyed: boolean; + /** + * The string representation of the local IP address the remote client is + * connecting on. For example, in a server listening on `'0.0.0.0'`, if a client + * connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`. + * @since v0.9.6 + */ + readonly localAddress?: string; + /** + * The numeric representation of the local port. For example, `80` or `21`. + * @since v0.9.6 + */ + readonly localPort?: number; + /** + * The string representation of the local IP family. `'IPv4'` or `'IPv6'`. + * @since v18.8.0, v16.18.0 + */ + readonly localFamily?: string; + /** + * This property represents the state of the connection as a string. + * + * * If the stream is connecting `socket.readyState` is `opening`. + * * If the stream is readable and writable, it is `open`. + * * If the stream is readable and not writable, it is `readOnly`. + * * If the stream is not readable and writable, it is `writeOnly`. + * @since v0.5.0 + */ + readonly readyState: SocketReadyState; + /** + * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.5.10 + */ + readonly remoteAddress?: string | undefined; + /** + * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.11.14 + */ + readonly remoteFamily?: string | undefined; + /** + * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). + * @since v0.5.10 + */ + readonly remotePort?: number | undefined; + /** + * The socket timeout in milliseconds as set by `socket.setTimeout()`. + * It is `undefined` if a timeout has not been set. + * @since v10.7.0 + */ + readonly timeout?: number | undefined; + /** + * Half-closes the socket. i.e., it sends a FIN packet. It is possible the + * server will still send some data. + * + * See `writable.end()` for further details. + * @since v0.1.90 + * @param [encoding='utf8'] Only used when data is `string`. + * @param callback Optional callback for when the socket is finished. + * @return The socket itself. + */ + end(callback?: () => void): this; + end(buffer: Uint8Array | string, callback?: () => void): this; + end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this; + /** + * events.EventEmitter + * 1. close + * 2. connect + * 3. data + * 4. drain + * 5. end + * 6. error + * 7. lookup + * 8. ready + * 9. timeout + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: (hadError: boolean) => void): this; + addListener(event: 'connect', listener: () => void): this; + addListener(event: 'data', listener: (data: Buffer) => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + addListener(event: 'ready', listener: () => void): this; + addListener(event: 'timeout', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close', hadError: boolean): boolean; + emit(event: 'connect'): boolean; + emit(event: 'data', data: Buffer): boolean; + emit(event: 'drain'): boolean; + emit(event: 'end'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'lookup', err: Error, address: string, family: string | number, host: string): boolean; + emit(event: 'ready'): boolean; + emit(event: 'timeout'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: (hadError: boolean) => void): this; + on(event: 'connect', listener: () => void): this; + on(event: 'data', listener: (data: Buffer) => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + on(event: 'ready', listener: () => void): this; + on(event: 'timeout', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: (hadError: boolean) => void): this; + once(event: 'connect', listener: () => void): this; + once(event: 'data', listener: (data: Buffer) => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + once(event: 'ready', listener: () => void): this; + once(event: 'timeout', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: (hadError: boolean) => void): this; + prependListener(event: 'connect', listener: () => void): this; + prependListener(event: 'data', listener: (data: Buffer) => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + prependListener(event: 'ready', listener: () => void): this; + prependListener(event: 'timeout', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: (hadError: boolean) => void): this; + prependOnceListener(event: 'connect', listener: () => void): this; + prependOnceListener(event: 'data', listener: (data: Buffer) => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; + prependOnceListener(event: 'ready', listener: () => void): this; + prependOnceListener(event: 'timeout', listener: () => void): this; + } + interface ListenOptions extends Abortable { + port?: number | undefined; + host?: string | undefined; + backlog?: number | undefined; + path?: string | undefined; + exclusive?: boolean | undefined; + readableAll?: boolean | undefined; + writableAll?: boolean | undefined; + /** + * @default false + */ + ipv6Only?: boolean | undefined; + } + interface ServerOpts { + /** + * Indicates whether half-opened TCP connections are allowed. + * @default false + */ + allowHalfOpen?: boolean | undefined; + /** + * Indicates whether the socket should be paused on incoming connections. + * @default false + */ + pauseOnConnect?: boolean | undefined; + /** + * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. + * @default false + * @since v16.5.0 + */ + noDelay?: boolean | undefined; + /** + * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, + * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. + * @default false + * @since v16.5.0 + */ + keepAlive?: boolean | undefined; + /** + * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. + * @default 0 + * @since v16.5.0 + */ + keepAliveInitialDelay?: number | undefined; + } + interface DropArgument { + localAddress?: string; + localPort?: number; + localFamily?: string; + remoteAddress?: string; + remotePort?: number; + remoteFamily?: string; + } + /** + * This class is used to create a TCP or `IPC` server. + * @since v0.1.90 + */ + class Server extends EventEmitter { + constructor(connectionListener?: (socket: Socket) => void); + constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void); + /** + * Start a server listening for connections. A `net.Server` can be a TCP or + * an `IPC` server depending on what it listens to. + * + * Possible signatures: + * + * * `server.listen(handle[, backlog][, callback])` + * * `server.listen(options[, callback])` + * * `server.listen(path[, backlog][, callback])` for `IPC` servers + * * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers + * + * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'` + * event. + * + * All `listen()` methods can take a `backlog` parameter to specify the maximum + * length of the queue of pending connections. The actual length will be determined + * by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn`on Linux. The default value of this parameter is 511 (not 512). + * + * All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for + * details). + * + * The `server.listen()` method can be called again if and only if there was an + * error during the first `server.listen()` call or `server.close()` has been + * called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. + * + * One of the most common errors raised when listening is `EADDRINUSE`. + * This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry + * after a certain amount of time: + * + * ```js + * server.on('error', (e) => { + * if (e.code === 'EADDRINUSE') { + * console.error('Address in use, retrying...'); + * setTimeout(() => { + * server.close(); + * server.listen(PORT, HOST); + * }, 1000); + * } + * }); + * ``` + */ + listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; + listen(port?: number, hostname?: string, listeningListener?: () => void): this; + listen(port?: number, backlog?: number, listeningListener?: () => void): this; + listen(port?: number, listeningListener?: () => void): this; + listen(path: string, backlog?: number, listeningListener?: () => void): this; + listen(path: string, listeningListener?: () => void): this; + listen(options: ListenOptions, listeningListener?: () => void): this; + listen(handle: any, backlog?: number, listeningListener?: () => void): this; + listen(handle: any, listeningListener?: () => void): this; + /** + * Stops the server from accepting new connections and keeps existing + * connections. This function is asynchronous, the server is finally closed + * when all connections are ended and the server emits a `'close'` event. + * The optional `callback` will be called once the `'close'` event occurs. Unlike + * that event, it will be called with an `Error` as its only argument if the server + * was not open when it was closed. + * @since v0.1.90 + * @param callback Called when the server is closed. + */ + close(callback?: (err?: Error) => void): this; + /** + * Returns the bound `address`, the address `family` name, and `port` of the server + * as reported by the operating system if listening on an IP socket + * (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. + * + * For a server listening on a pipe or Unix domain socket, the name is returned + * as a string. + * + * ```js + * const server = net.createServer((socket) => { + * socket.end('goodbye\n'); + * }).on('error', (err) => { + * // Handle errors here. + * throw err; + * }); + * + * // Grab an arbitrary unused port. + * server.listen(() => { + * console.log('opened server on', server.address()); + * }); + * ``` + * + * `server.address()` returns `null` before the `'listening'` event has been + * emitted or after calling `server.close()`. + * @since v0.1.90 + */ + address(): AddressInfo | string | null; + /** + * Asynchronously get the number of concurrent connections on the server. Works + * when sockets were sent to forks. + * + * Callback should take two arguments `err` and `count`. + * @since v0.9.7 + */ + getConnections(cb: (error: Error | null, count: number) => void): void; + /** + * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior). + * If the server is `ref`ed calling `ref()` again will have no effect. + * @since v0.9.1 + */ + ref(): this; + /** + * Calling `unref()` on a server will allow the program to exit if this is the only + * active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect. + * @since v0.9.1 + */ + unref(): this; + /** + * Set this property to reject connections when the server's connection count gets + * high. + * + * It is not recommended to use this option once a socket has been sent to a child + * with `child_process.fork()`. + * @since v0.2.0 + */ + maxConnections: number; + connections: number; + /** + * Indicates whether or not the server is listening for connections. + * @since v5.7.0 + */ + listening: boolean; + /** + * events.EventEmitter + * 1. close + * 2. connection + * 3. error + * 4. listening + * 5. drop + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'connection', listener: (socket: Socket) => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'listening', listener: () => void): this; + addListener(event: 'drop', listener: (data?: DropArgument) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'connection', socket: Socket): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'listening'): boolean; + emit(event: 'drop', data?: DropArgument): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'connection', listener: (socket: Socket) => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'listening', listener: () => void): this; + on(event: 'drop', listener: (data?: DropArgument) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'connection', listener: (socket: Socket) => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'listening', listener: () => void): this; + once(event: 'drop', listener: (data?: DropArgument) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'connection', listener: (socket: Socket) => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'listening', listener: () => void): this; + prependListener(event: 'drop', listener: (data?: DropArgument) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'listening', listener: () => void): this; + prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this; + /** + * Calls {@link Server.close()} and returns a promise that fulfills when the server has closed. + * @since v20.5.0 + */ + [Symbol.asyncDispose](): Promise; + } + type IPVersion = 'ipv4' | 'ipv6'; + /** + * The `BlockList` object can be used with some network APIs to specify rules for + * disabling inbound or outbound access to specific IP addresses, IP ranges, or + * IP subnets. + * @since v15.0.0, v14.18.0 + */ + class BlockList { + /** + * Adds a rule to block the given IP address. + * @since v15.0.0, v14.18.0 + * @param address An IPv4 or IPv6 address. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addAddress(address: string, type?: IPVersion): void; + addAddress(address: SocketAddress): void; + /** + * Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive). + * @since v15.0.0, v14.18.0 + * @param start The starting IPv4 or IPv6 address in the range. + * @param end The ending IPv4 or IPv6 address in the range. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addRange(start: string, end: string, type?: IPVersion): void; + addRange(start: SocketAddress, end: SocketAddress): void; + /** + * Adds a rule to block a range of IP addresses specified as a subnet mask. + * @since v15.0.0, v14.18.0 + * @param net The network IPv4 or IPv6 address. + * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`. + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + addSubnet(net: SocketAddress, prefix: number): void; + addSubnet(net: string, prefix: number, type?: IPVersion): void; + /** + * Returns `true` if the given IP address matches any of the rules added to the`BlockList`. + * + * ```js + * const blockList = new net.BlockList(); + * blockList.addAddress('123.123.123.123'); + * blockList.addRange('10.0.0.1', '10.0.0.10'); + * blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6'); + * + * console.log(blockList.check('123.123.123.123')); // Prints: true + * console.log(blockList.check('10.0.0.3')); // Prints: true + * console.log(blockList.check('222.111.111.222')); // Prints: false + * + * // IPv6 notation for IPv4 addresses works: + * console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true + * console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true + * ``` + * @since v15.0.0, v14.18.0 + * @param address The IP address to check + * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. + */ + check(address: SocketAddress): boolean; + check(address: string, type?: IPVersion): boolean; + } + interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { + timeout?: number | undefined; + } + interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { + timeout?: number | undefined; + } + type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; + /** + * Creates a new TCP or `IPC` server. + * + * If `allowHalfOpen` is set to `true`, when the other end of the socket + * signals the end of transmission, the server will only send back the end of + * transmission when `socket.end()` is explicitly called. For example, in the + * context of TCP, when a FIN packed is received, a FIN packed is sent + * back only when `socket.end()` is explicitly called. Until then the + * connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information. + * + * If `pauseOnConnect` is set to `true`, then the socket associated with each + * incoming connection will be paused, and no data will be read from its handle. + * This allows connections to be passed between processes without any data being + * read by the original process. To begin reading data from a paused socket, call `socket.resume()`. + * + * The server can be a TCP server or an `IPC` server, depending on what it `listen()` to. + * + * Here is an example of a TCP echo server which listens for connections + * on port 8124: + * + * ```js + * const net = require('node:net'); + * const server = net.createServer((c) => { + * // 'connection' listener. + * console.log('client connected'); + * c.on('end', () => { + * console.log('client disconnected'); + * }); + * c.write('hello\r\n'); + * c.pipe(c); + * }); + * server.on('error', (err) => { + * throw err; + * }); + * server.listen(8124, () => { + * console.log('server bound'); + * }); + * ``` + * + * Test this by using `telnet`: + * + * ```bash + * telnet localhost 8124 + * ``` + * + * To listen on the socket `/tmp/echo.sock`: + * + * ```js + * server.listen('/tmp/echo.sock', () => { + * console.log('server bound'); + * }); + * ``` + * + * Use `nc` to connect to a Unix domain socket server: + * + * ```bash + * nc -U /tmp/echo.sock + * ``` + * @since v0.5.0 + * @param connectionListener Automatically set as a listener for the {@link 'connection'} event. + */ + function createServer(connectionListener?: (socket: Socket) => void): Server; + function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server; + /** + * Aliases to {@link createConnection}. + * + * Possible signatures: + * + * * {@link connect} + * * {@link connect} for `IPC` connections. + * * {@link connect} for TCP connections. + */ + function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; + function connect(port: number, host?: string, connectionListener?: () => void): Socket; + function connect(path: string, connectionListener?: () => void): Socket; + /** + * A factory function, which creates a new {@link Socket}, + * immediately initiates connection with `socket.connect()`, + * then returns the `net.Socket` that starts the connection. + * + * When the connection is established, a `'connect'` event will be emitted + * on the returned socket. The last parameter `connectListener`, if supplied, + * will be added as a listener for the `'connect'` event **once**. + * + * Possible signatures: + * + * * {@link createConnection} + * * {@link createConnection} for `IPC` connections. + * * {@link createConnection} for TCP connections. + * + * The {@link connect} function is an alias to this function. + */ + function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; + function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; + function createConnection(path: string, connectionListener?: () => void): Socket; + /** + * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4 + * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`. + * + * ```js + * net.isIP('::1'); // returns 6 + * net.isIP('127.0.0.1'); // returns 4 + * net.isIP('127.000.000.001'); // returns 0 + * net.isIP('127.0.0.1/24'); // returns 0 + * net.isIP('fhqwhgads'); // returns 0 + * ``` + * @since v0.3.0 + */ + function isIP(input: string): number; + /** + * Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no + * leading zeroes. Otherwise, returns `false`. + * + * ```js + * net.isIPv4('127.0.0.1'); // returns true + * net.isIPv4('127.000.000.001'); // returns false + * net.isIPv4('127.0.0.1/24'); // returns false + * net.isIPv4('fhqwhgads'); // returns false + * ``` + * @since v0.3.0 + */ + function isIPv4(input: string): boolean; + /** + * Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`. + * + * ```js + * net.isIPv6('::1'); // returns true + * net.isIPv6('fhqwhgads'); // returns false + * ``` + * @since v0.3.0 + */ + function isIPv6(input: string): boolean; + interface SocketAddressInitOptions { + /** + * The network address as either an IPv4 or IPv6 string. + * @default 127.0.0.1 + */ + address?: string | undefined; + /** + * @default `'ipv4'` + */ + family?: IPVersion | undefined; + /** + * An IPv6 flow-label used only if `family` is `'ipv6'`. + * @default 0 + */ + flowlabel?: number | undefined; + /** + * An IP port. + * @default 0 + */ + port?: number | undefined; + } + /** + * @since v15.14.0, v14.18.0 + */ + class SocketAddress { + constructor(options: SocketAddressInitOptions); + /** + * Either \`'ipv4'\` or \`'ipv6'\`. + * @since v15.14.0, v14.18.0 + */ + readonly address: string; + /** + * Either \`'ipv4'\` or \`'ipv6'\`. + * @since v15.14.0, v14.18.0 + */ + readonly family: IPVersion; + /** + * @since v15.14.0, v14.18.0 + */ + readonly port: number; + /** + * @since v15.14.0, v14.18.0 + */ + readonly flowlabel: number; + } +} +declare module 'node:net' { + export * from 'net'; +} diff --git a/node_modules/@types/node/ts4.8/os.d.ts b/node_modules/@types/node/ts4.8/os.d.ts new file mode 100755 index 0000000..3d20864 --- /dev/null +++ b/node_modules/@types/node/ts4.8/os.d.ts @@ -0,0 +1,477 @@ +/** + * The `node:os` module provides operating system-related utility methods and + * properties. It can be accessed using: + * + * ```js + * const os = require('node:os'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/os.js) + */ +declare module 'os' { + interface CpuInfo { + model: string; + speed: number; + times: { + user: number; + nice: number; + sys: number; + idle: number; + irq: number; + }; + } + interface NetworkInterfaceBase { + address: string; + netmask: string; + mac: string; + internal: boolean; + cidr: string | null; + } + interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { + family: 'IPv4'; + scopeid?: undefined; + } + interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { + family: 'IPv6'; + scopeid: number; + } + interface UserInfo { + username: T; + uid: number; + gid: number; + shell: T; + homedir: T; + } + type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; + /** + * Returns the host name of the operating system as a string. + * @since v0.3.3 + */ + function hostname(): string; + /** + * Returns an array containing the 1, 5, and 15 minute load averages. + * + * The load average is a measure of system activity calculated by the operating + * system and expressed as a fractional number. + * + * The load average is a Unix-specific concept. On Windows, the return value is + * always `[0, 0, 0]`. + * @since v0.3.3 + */ + function loadavg(): number[]; + /** + * Returns the system uptime in number of seconds. + * @since v0.3.3 + */ + function uptime(): number; + /** + * Returns the amount of free system memory in bytes as an integer. + * @since v0.3.3 + */ + function freemem(): number; + /** + * Returns the total amount of system memory in bytes as an integer. + * @since v0.3.3 + */ + function totalmem(): number; + /** + * Returns an array of objects containing information about each logical CPU core. + * The array will be empty if no CPU information is available, such as if the`/proc` file system is unavailable. + * + * The properties included on each object include: + * + * ```js + * [ + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 252020, + * nice: 0, + * sys: 30340, + * idle: 1070356870, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 306960, + * nice: 0, + * sys: 26980, + * idle: 1071569080, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 248450, + * nice: 0, + * sys: 21750, + * idle: 1070919370, + * irq: 0, + * }, + * }, + * { + * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + * speed: 2926, + * times: { + * user: 256880, + * nice: 0, + * sys: 19430, + * idle: 1070905480, + * irq: 20, + * }, + * }, + * ] + * ``` + * + * `nice` values are POSIX-only. On Windows, the `nice` values of all processors + * are always 0. + * + * `os.cpus().length` should not be used to calculate the amount of parallelism + * available to an application. Use {@link availableParallelism} for this purpose. + * @since v0.3.3 + */ + function cpus(): CpuInfo[]; + /** + * Returns an estimate of the default amount of parallelism a program should use. + * Always returns a value greater than zero. + * + * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism). + * @since v19.4.0, v18.14.0 + */ + function availableParallelism(): number; + /** + * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it + * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows. + * + * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information + * about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems. + * @since v0.3.3 + */ + function type(): string; + /** + * Returns the operating system as a string. + * + * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See + * [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v0.3.3 + */ + function release(): string; + /** + * Returns an object containing network interfaces that have been assigned a + * network address. + * + * Each key on the returned object identifies a network interface. The associated + * value is an array of objects that each describe an assigned network address. + * + * The properties available on the assigned network address object include: + * + * ```js + * { + * lo: [ + * { + * address: '127.0.0.1', + * netmask: '255.0.0.0', + * family: 'IPv4', + * mac: '00:00:00:00:00:00', + * internal: true, + * cidr: '127.0.0.1/8' + * }, + * { + * address: '::1', + * netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', + * family: 'IPv6', + * mac: '00:00:00:00:00:00', + * scopeid: 0, + * internal: true, + * cidr: '::1/128' + * } + * ], + * eth0: [ + * { + * address: '192.168.1.108', + * netmask: '255.255.255.0', + * family: 'IPv4', + * mac: '01:02:03:0a:0b:0c', + * internal: false, + * cidr: '192.168.1.108/24' + * }, + * { + * address: 'fe80::a00:27ff:fe4e:66a1', + * netmask: 'ffff:ffff:ffff:ffff::', + * family: 'IPv6', + * mac: '01:02:03:0a:0b:0c', + * scopeid: 1, + * internal: false, + * cidr: 'fe80::a00:27ff:fe4e:66a1/64' + * } + * ] + * } + * ``` + * @since v0.6.0 + */ + function networkInterfaces(): NodeJS.Dict; + /** + * Returns the string path of the current user's home directory. + * + * On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it + * uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory. + * + * On Windows, it uses the `USERPROFILE` environment variable if defined. + * Otherwise it uses the path to the profile directory of the current user. + * @since v2.3.0 + */ + function homedir(): string; + /** + * Returns information about the currently effective user. On POSIX platforms, + * this is typically a subset of the password file. The returned object includes + * the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and`gid` fields are `-1`, and `shell` is `null`. + * + * The value of `homedir` returned by `os.userInfo()` is provided by the operating + * system. This differs from the result of `os.homedir()`, which queries + * environment variables for the home directory before falling back to the + * operating system response. + * + * Throws a `SystemError` if a user has no `username` or `homedir`. + * @since v6.0.0 + */ + function userInfo(options: { encoding: 'buffer' }): UserInfo; + function userInfo(options?: { encoding: BufferEncoding }): UserInfo; + type SignalConstants = { + [key in NodeJS.Signals]: number; + }; + namespace constants { + const UV_UDP_REUSEADDR: number; + namespace signals {} + const signals: SignalConstants; + namespace errno { + const E2BIG: number; + const EACCES: number; + const EADDRINUSE: number; + const EADDRNOTAVAIL: number; + const EAFNOSUPPORT: number; + const EAGAIN: number; + const EALREADY: number; + const EBADF: number; + const EBADMSG: number; + const EBUSY: number; + const ECANCELED: number; + const ECHILD: number; + const ECONNABORTED: number; + const ECONNREFUSED: number; + const ECONNRESET: number; + const EDEADLK: number; + const EDESTADDRREQ: number; + const EDOM: number; + const EDQUOT: number; + const EEXIST: number; + const EFAULT: number; + const EFBIG: number; + const EHOSTUNREACH: number; + const EIDRM: number; + const EILSEQ: number; + const EINPROGRESS: number; + const EINTR: number; + const EINVAL: number; + const EIO: number; + const EISCONN: number; + const EISDIR: number; + const ELOOP: number; + const EMFILE: number; + const EMLINK: number; + const EMSGSIZE: number; + const EMULTIHOP: number; + const ENAMETOOLONG: number; + const ENETDOWN: number; + const ENETRESET: number; + const ENETUNREACH: number; + const ENFILE: number; + const ENOBUFS: number; + const ENODATA: number; + const ENODEV: number; + const ENOENT: number; + const ENOEXEC: number; + const ENOLCK: number; + const ENOLINK: number; + const ENOMEM: number; + const ENOMSG: number; + const ENOPROTOOPT: number; + const ENOSPC: number; + const ENOSR: number; + const ENOSTR: number; + const ENOSYS: number; + const ENOTCONN: number; + const ENOTDIR: number; + const ENOTEMPTY: number; + const ENOTSOCK: number; + const ENOTSUP: number; + const ENOTTY: number; + const ENXIO: number; + const EOPNOTSUPP: number; + const EOVERFLOW: number; + const EPERM: number; + const EPIPE: number; + const EPROTO: number; + const EPROTONOSUPPORT: number; + const EPROTOTYPE: number; + const ERANGE: number; + const EROFS: number; + const ESPIPE: number; + const ESRCH: number; + const ESTALE: number; + const ETIME: number; + const ETIMEDOUT: number; + const ETXTBSY: number; + const EWOULDBLOCK: number; + const EXDEV: number; + const WSAEINTR: number; + const WSAEBADF: number; + const WSAEACCES: number; + const WSAEFAULT: number; + const WSAEINVAL: number; + const WSAEMFILE: number; + const WSAEWOULDBLOCK: number; + const WSAEINPROGRESS: number; + const WSAEALREADY: number; + const WSAENOTSOCK: number; + const WSAEDESTADDRREQ: number; + const WSAEMSGSIZE: number; + const WSAEPROTOTYPE: number; + const WSAENOPROTOOPT: number; + const WSAEPROTONOSUPPORT: number; + const WSAESOCKTNOSUPPORT: number; + const WSAEOPNOTSUPP: number; + const WSAEPFNOSUPPORT: number; + const WSAEAFNOSUPPORT: number; + const WSAEADDRINUSE: number; + const WSAEADDRNOTAVAIL: number; + const WSAENETDOWN: number; + const WSAENETUNREACH: number; + const WSAENETRESET: number; + const WSAECONNABORTED: number; + const WSAECONNRESET: number; + const WSAENOBUFS: number; + const WSAEISCONN: number; + const WSAENOTCONN: number; + const WSAESHUTDOWN: number; + const WSAETOOMANYREFS: number; + const WSAETIMEDOUT: number; + const WSAECONNREFUSED: number; + const WSAELOOP: number; + const WSAENAMETOOLONG: number; + const WSAEHOSTDOWN: number; + const WSAEHOSTUNREACH: number; + const WSAENOTEMPTY: number; + const WSAEPROCLIM: number; + const WSAEUSERS: number; + const WSAEDQUOT: number; + const WSAESTALE: number; + const WSAEREMOTE: number; + const WSASYSNOTREADY: number; + const WSAVERNOTSUPPORTED: number; + const WSANOTINITIALISED: number; + const WSAEDISCON: number; + const WSAENOMORE: number; + const WSAECANCELLED: number; + const WSAEINVALIDPROCTABLE: number; + const WSAEINVALIDPROVIDER: number; + const WSAEPROVIDERFAILEDINIT: number; + const WSASYSCALLFAILURE: number; + const WSASERVICE_NOT_FOUND: number; + const WSATYPE_NOT_FOUND: number; + const WSA_E_NO_MORE: number; + const WSA_E_CANCELLED: number; + const WSAEREFUSED: number; + } + namespace priority { + const PRIORITY_LOW: number; + const PRIORITY_BELOW_NORMAL: number; + const PRIORITY_NORMAL: number; + const PRIORITY_ABOVE_NORMAL: number; + const PRIORITY_HIGH: number; + const PRIORITY_HIGHEST: number; + } + } + const devNull: string; + const EOL: string; + /** + * Returns the operating system CPU architecture for which the Node.js binary was + * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`. + * + * The return value is equivalent to `process.arch`. + * @since v0.5.0 + */ + function arch(): string; + /** + * Returns a string identifying the kernel version. + * + * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not + * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v13.11.0, v12.17.0 + */ + function version(): string; + /** + * Returns a string identifying the operating system platform for which + * the Node.js binary was compiled. The value is set at compile time. + * Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`,`'openbsd'`, `'sunos'`, and `'win32'`. + * + * The return value is equivalent to `process.platform`. + * + * The value `'android'` may also be returned if Node.js is built on the Android + * operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). + * @since v0.5.0 + */ + function platform(): NodeJS.Platform; + /** + * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`,`mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`. + * + * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not + * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. + * @since v18.9.0, v16.18.0 + */ + function machine(): string; + /** + * Returns the operating system's default directory for temporary files as a + * string. + * @since v0.9.9 + */ + function tmpdir(): string; + /** + * Returns a string identifying the endianness of the CPU for which the Node.js + * binary was compiled. + * + * Possible values are `'BE'` for big endian and `'LE'` for little endian. + * @since v0.9.4 + */ + function endianness(): 'BE' | 'LE'; + /** + * Returns the scheduling priority for the process specified by `pid`. If `pid` is + * not provided or is `0`, the priority of the current process is returned. + * @since v10.10.0 + * @param [pid=0] The process ID to retrieve scheduling priority for. + */ + function getPriority(pid?: number): number; + /** + * Attempts to set the scheduling priority for the process specified by `pid`. If`pid` is not provided or is `0`, the process ID of the current process is used. + * + * The `priority` input must be an integer between `-20` (high priority) and `19`(low priority). Due to differences between Unix priority levels and Windows + * priority classes, `priority` is mapped to one of six priority constants in`os.constants.priority`. When retrieving a process priority level, this range + * mapping may cause the return value to be slightly different on Windows. To avoid + * confusion, set `priority` to one of the priority constants. + * + * On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user + * privileges. Otherwise the set priority will be silently reduced to`PRIORITY_HIGH`. + * @since v10.10.0 + * @param [pid=0] The process ID to set scheduling priority for. + * @param priority The scheduling priority to assign to the process. + */ + function setPriority(priority: number): void; + function setPriority(pid: number, priority: number): void; +} +declare module 'node:os' { + export * from 'os'; +} diff --git a/node_modules/@types/node/ts4.8/path.d.ts b/node_modules/@types/node/ts4.8/path.d.ts new file mode 100755 index 0000000..723d5da --- /dev/null +++ b/node_modules/@types/node/ts4.8/path.d.ts @@ -0,0 +1,191 @@ +declare module 'path/posix' { + import path = require('path'); + export = path; +} +declare module 'path/win32' { + import path = require('path'); + export = path; +} +/** + * The `node:path` module provides utilities for working with file and directory + * paths. It can be accessed using: + * + * ```js + * const path = require('node:path'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/path.js) + */ +declare module 'path' { + namespace path { + /** + * A parsed path object generated by path.parse() or consumed by path.format(). + */ + interface ParsedPath { + /** + * The root of the path such as '/' or 'c:\' + */ + root: string; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir: string; + /** + * The file name including extension (if any) such as 'index.html' + */ + base: string; + /** + * The file extension (if any) such as '.html' + */ + ext: string; + /** + * The file name without extension (if any) such as 'index' + */ + name: string; + } + interface FormatInputPathObject { + /** + * The root of the path such as '/' or 'c:\' + */ + root?: string | undefined; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir?: string | undefined; + /** + * The file name including extension (if any) such as 'index.html' + */ + base?: string | undefined; + /** + * The file extension (if any) such as '.html' + */ + ext?: string | undefined; + /** + * The file name without extension (if any) such as 'index' + */ + name?: string | undefined; + } + interface PlatformPath { + /** + * Normalize a string path, reducing '..' and '.' parts. + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + * + * @param path string path to normalize. + * @throws {TypeError} if `path` is not a string. + */ + normalize(path: string): string; + /** + * Join all arguments together and normalize the resulting path. + * + * @param paths paths to join. + * @throws {TypeError} if any of the path segments is not a string. + */ + join(...paths: string[]): string; + /** + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + * + * Starting from leftmost {from} parameter, resolves {to} to an absolute path. + * + * If {to} isn't already absolute, {from} arguments are prepended in right to left order, + * until an absolute path is found. If after using all {from} paths still no absolute path is found, + * the current working directory is used as well. The resulting path is normalized, + * and trailing slashes are removed unless the path gets resolved to the root directory. + * + * @param paths A sequence of paths or path segments. + * @throws {TypeError} if any of the arguments is not a string. + */ + resolve(...paths: string[]): string; + /** + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + * + * If the given {path} is a zero-length string, `false` will be returned. + * + * @param path path to test. + * @throws {TypeError} if `path` is not a string. + */ + isAbsolute(path: string): boolean; + /** + * Solve the relative path from {from} to {to} based on the current working directory. + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. + * + * @throws {TypeError} if either `from` or `to` is not a string. + */ + relative(from: string, to: string): string; + /** + * Return the directory name of a path. Similar to the Unix dirname command. + * + * @param path the path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + dirname(path: string): string; + /** + * Return the last portion of a path. Similar to the Unix basename command. + * Often used to extract the file name from a fully qualified path. + * + * @param path the path to evaluate. + * @param suffix optionally, an extension to remove from the result. + * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string. + */ + basename(path: string, suffix?: string): string; + /** + * Return the extension of the path, from the last '.' to end of string in the last portion of the path. + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. + * + * @param path the path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + extname(path: string): string; + /** + * The platform-specific file separator. '\\' or '/'. + */ + readonly sep: '\\' | '/'; + /** + * The platform-specific file delimiter. ';' or ':'. + */ + readonly delimiter: ';' | ':'; + /** + * Returns an object from a path string - the opposite of format(). + * + * @param path path to evaluate. + * @throws {TypeError} if `path` is not a string. + */ + parse(path: string): ParsedPath; + /** + * Returns a path string from an object - the opposite of parse(). + * + * @param pathObject path to evaluate. + */ + format(pathObject: FormatInputPathObject): string; + /** + * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. + * If path is not a string, path will be returned without modifications. + * This method is meaningful only on Windows system. + * On POSIX systems, the method is non-operational and always returns path without modifications. + */ + toNamespacedPath(path: string): string; + /** + * Posix specific pathing. + * Same as parent object on posix. + */ + readonly posix: PlatformPath; + /** + * Windows specific pathing. + * Same as parent object on windows + */ + readonly win32: PlatformPath; + } + } + const path: path.PlatformPath; + export = path; +} +declare module 'node:path' { + import path = require('path'); + export = path; +} +declare module 'node:path/posix' { + import path = require('path/posix'); + export = path; +} +declare module 'node:path/win32' { + import path = require('path/win32'); + export = path; +} diff --git a/node_modules/@types/node/ts4.8/perf_hooks.d.ts b/node_modules/@types/node/ts4.8/perf_hooks.d.ts new file mode 100755 index 0000000..c090e1d --- /dev/null +++ b/node_modules/@types/node/ts4.8/perf_hooks.d.ts @@ -0,0 +1,638 @@ +/** + * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for + * Node.js-specific performance measurements. + * + * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/): + * + * * [High Resolution Time](https://www.w3.org/TR/hr-time-2) + * * [Performance Timeline](https://w3c.github.io/performance-timeline/) + * * [User Timing](https://www.w3.org/TR/user-timing/) + * * [Resource Timing](https://www.w3.org/TR/resource-timing-2/) + * + * ```js + * const { PerformanceObserver, performance } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((items) => { + * console.log(items.getEntries()[0].duration); + * performance.clearMarks(); + * }); + * obs.observe({ type: 'measure' }); + * performance.measure('Start to Now'); + * + * performance.mark('A'); + * doSomeLongRunningProcess(() => { + * performance.measure('A to Now', 'A'); + * + * performance.mark('B'); + * performance.measure('A to B', 'A', 'B'); + * }); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/perf_hooks.js) + */ +declare module 'perf_hooks' { + import { AsyncResource } from 'node:async_hooks'; + type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http'; + interface NodeGCPerformanceDetail { + /** + * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies + * the type of garbage collection operation that occurred. + * See perf_hooks.constants for valid values. + */ + readonly kind?: number | undefined; + /** + * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags` + * property contains additional information about garbage collection operation. + * See perf_hooks.constants for valid values. + */ + readonly flags?: number | undefined; + } + /** + * The constructor of this class is not exposed to users directly. + * @since v8.5.0 + */ + class PerformanceEntry { + protected constructor(); + /** + * The total number of milliseconds elapsed for this entry. This value will not + * be meaningful for all Performance Entry types. + * @since v8.5.0 + */ + readonly duration: number; + /** + * The name of the performance entry. + * @since v8.5.0 + */ + readonly name: string; + /** + * The high resolution millisecond timestamp marking the starting time of the + * Performance Entry. + * @since v8.5.0 + */ + readonly startTime: number; + /** + * The type of the performance entry. It may be one of: + * + * * `'node'` (Node.js only) + * * `'mark'` (available on the Web) + * * `'measure'` (available on the Web) + * * `'gc'` (Node.js only) + * * `'function'` (Node.js only) + * * `'http2'` (Node.js only) + * * `'http'` (Node.js only) + * @since v8.5.0 + */ + readonly entryType: EntryType; + /** + * Additional detail specific to the `entryType`. + * @since v16.0.0 + */ + readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type. + toJSON(): any; + } + /** + * Exposes marks created via the `Performance.mark()` method. + * @since v18.2.0, v16.17.0 + */ + class PerformanceMark extends PerformanceEntry { + readonly duration: 0; + readonly entryType: 'mark'; + } + /** + * Exposes measures created via the `Performance.measure()` method. + * + * The constructor of this class is not exposed to users directly. + * @since v18.2.0, v16.17.0 + */ + class PerformanceMeasure extends PerformanceEntry { + readonly entryType: 'measure'; + } + /** + * _This property is an extension by Node.js. It is not available in Web browsers._ + * + * Provides timing details for Node.js itself. The constructor of this class + * is not exposed to users. + * @since v8.5.0 + */ + class PerformanceNodeTiming extends PerformanceEntry { + /** + * The high resolution millisecond timestamp at which the Node.js process + * completed bootstrapping. If bootstrapping has not yet finished, the property + * has the value of -1. + * @since v8.5.0 + */ + readonly bootstrapComplete: number; + /** + * The high resolution millisecond timestamp at which the Node.js environment was + * initialized. + * @since v8.5.0 + */ + readonly environment: number; + /** + * The high resolution millisecond timestamp of the amount of time the event loop + * has been idle within the event loop's event provider (e.g. `epoll_wait`). This + * does not take CPU usage into consideration. If the event loop has not yet + * started (e.g., in the first tick of the main script), the property has the + * value of 0. + * @since v14.10.0, v12.19.0 + */ + readonly idleTime: number; + /** + * The high resolution millisecond timestamp at which the Node.js event loop + * exited. If the event loop has not yet exited, the property has the value of -1\. + * It can only have a value of not -1 in a handler of the `'exit'` event. + * @since v8.5.0 + */ + readonly loopExit: number; + /** + * The high resolution millisecond timestamp at which the Node.js event loop + * started. If the event loop has not yet started (e.g., in the first tick of the + * main script), the property has the value of -1. + * @since v8.5.0 + */ + readonly loopStart: number; + /** + * The high resolution millisecond timestamp at which the V8 platform was + * initialized. + * @since v8.5.0 + */ + readonly v8Start: number; + } + interface EventLoopUtilization { + idle: number; + active: number; + utilization: number; + } + /** + * @param util1 The result of a previous call to eventLoopUtilization() + * @param util2 The result of a previous call to eventLoopUtilization() prior to util1 + */ + type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization; + interface MarkOptions { + /** + * Additional optional detail to include with the mark. + */ + detail?: unknown | undefined; + /** + * An optional timestamp to be used as the mark time. + * @default `performance.now()`. + */ + startTime?: number | undefined; + } + interface MeasureOptions { + /** + * Additional optional detail to include with the mark. + */ + detail?: unknown | undefined; + /** + * Duration between start and end times. + */ + duration?: number | undefined; + /** + * Timestamp to be used as the end time, or a string identifying a previously recorded mark. + */ + end?: number | string | undefined; + /** + * Timestamp to be used as the start time, or a string identifying a previously recorded mark. + */ + start?: number | string | undefined; + } + interface TimerifyOptions { + /** + * A histogram object created using + * `perf_hooks.createHistogram()` that will record runtime durations in + * nanoseconds. + */ + histogram?: RecordableHistogram | undefined; + } + interface Performance { + /** + * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. + * If name is provided, removes only the named mark. + * @param name + */ + clearMarks(name?: string): void; + /** + * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline. + * If name is provided, removes only the named measure. + * @param name + * @since v16.7.0 + */ + clearMeasures(name?: string): void; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`. + * If you are only interested in performance entries of certain types or that have certain names, see + * `performance.getEntriesByType()` and `performance.getEntriesByName()`. + * @since v16.7.0 + */ + getEntries(): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` + * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`. + * @param name + * @param type + * @since v16.7.0 + */ + getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` + * whose `performanceEntry.entryType` is equal to `type`. + * @param type + * @since v16.7.0 + */ + getEntriesByType(type: EntryType): PerformanceEntry[]; + /** + * Creates a new PerformanceMark entry in the Performance Timeline. + * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', + * and whose performanceEntry.duration is always 0. + * Performance marks are used to mark specific significant moments in the Performance Timeline. + * @param name + * @return The PerformanceMark entry that was created + */ + mark(name?: string, options?: MarkOptions): PerformanceMark; + /** + * Creates a new PerformanceMeasure entry in the Performance Timeline. + * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', + * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. + * + * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify + * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, + * then startMark is set to timeOrigin by default. + * + * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp + * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. + * @param name + * @param startMark + * @param endMark + * @return The PerformanceMeasure entry that was created + */ + measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure; + measure(name: string, options: MeasureOptions): PerformanceMeasure; + /** + * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. + */ + readonly nodeTiming: PerformanceNodeTiming; + /** + * @return the current high resolution millisecond timestamp + */ + now(): number; + /** + * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. + */ + readonly timeOrigin: number; + /** + * Wraps a function within a new function that measures the running time of the wrapped function. + * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. + * @param fn + */ + timerify any>(fn: T, options?: TimerifyOptions): T; + /** + * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time. + * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait). + * No other CPU idle time is taken into consideration. + */ + eventLoopUtilization: EventLoopUtilityFunction; + } + interface PerformanceObserverEntryList { + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime`. + * + * ```js + * const { + * performance, + * PerformanceObserver, + * } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntries()); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 81.465639, + * * duration: 0 + * * }, + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 81.860064, + * * duration: 0 + * * } + * * ] + * + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ type: 'mark' }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntries(): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is + * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`. + * + * ```js + * const { + * performance, + * PerformanceObserver, + * } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntriesByName('meow')); + * + * * [ + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 98.545991, + * * duration: 0 + * * } + * * ] + * + * console.log(perfObserverList.getEntriesByName('nope')); // [] + * + * console.log(perfObserverList.getEntriesByName('test', 'mark')); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 63.518931, + * * duration: 0 + * * } + * * ] + * + * console.log(perfObserverList.getEntriesByName('test', 'measure')); // [] + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ entryTypes: ['mark', 'measure'] }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; + /** + * Returns a list of `PerformanceEntry` objects in chronological order + * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`. + * + * ```js + * const { + * performance, + * PerformanceObserver, + * } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((perfObserverList, observer) => { + * console.log(perfObserverList.getEntriesByType('mark')); + * + * * [ + * * PerformanceEntry { + * * name: 'test', + * * entryType: 'mark', + * * startTime: 55.897834, + * * duration: 0 + * * }, + * * PerformanceEntry { + * * name: 'meow', + * * entryType: 'mark', + * * startTime: 56.350146, + * * duration: 0 + * * } + * * ] + * + * performance.clearMarks(); + * performance.clearMeasures(); + * observer.disconnect(); + * }); + * obs.observe({ type: 'mark' }); + * + * performance.mark('test'); + * performance.mark('meow'); + * ``` + * @since v8.5.0 + */ + getEntriesByType(type: EntryType): PerformanceEntry[]; + } + type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; + /** + * @since v8.5.0 + */ + class PerformanceObserver extends AsyncResource { + constructor(callback: PerformanceObserverCallback); + /** + * Disconnects the `PerformanceObserver` instance from all notifications. + * @since v8.5.0 + */ + disconnect(): void; + /** + * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`: + * + * ```js + * const { + * performance, + * PerformanceObserver, + * } = require('node:perf_hooks'); + * + * const obs = new PerformanceObserver((list, observer) => { + * // Called once asynchronously. `list` contains three items. + * }); + * obs.observe({ type: 'mark' }); + * + * for (let n = 0; n < 3; n++) + * performance.mark(`test${n}`); + * ``` + * @since v8.5.0 + */ + observe( + options: + | { + entryTypes: ReadonlyArray; + buffered?: boolean | undefined; + } + | { + type: EntryType; + buffered?: boolean | undefined; + } + ): void; + } + namespace constants { + const NODE_PERFORMANCE_GC_MAJOR: number; + const NODE_PERFORMANCE_GC_MINOR: number; + const NODE_PERFORMANCE_GC_INCREMENTAL: number; + const NODE_PERFORMANCE_GC_WEAKCB: number; + const NODE_PERFORMANCE_GC_FLAGS_NO: number; + const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number; + const NODE_PERFORMANCE_GC_FLAGS_FORCED: number; + const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number; + const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number; + const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number; + const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number; + } + const performance: Performance; + interface EventLoopMonitorOptions { + /** + * The sampling rate in milliseconds. + * Must be greater than zero. + * @default 10 + */ + resolution?: number | undefined; + } + interface Histogram { + /** + * Returns a `Map` object detailing the accumulated percentile distribution. + * @since v11.10.0 + */ + readonly percentiles: Map; + /** + * The number of times the event loop delay exceeded the maximum 1 hour event + * loop delay threshold. + * @since v11.10.0 + */ + readonly exceeds: number; + /** + * The minimum recorded event loop delay. + * @since v11.10.0 + */ + readonly min: number; + /** + * The maximum recorded event loop delay. + * @since v11.10.0 + */ + readonly max: number; + /** + * The mean of the recorded event loop delays. + * @since v11.10.0 + */ + readonly mean: number; + /** + * The standard deviation of the recorded event loop delays. + * @since v11.10.0 + */ + readonly stddev: number; + /** + * Resets the collected histogram data. + * @since v11.10.0 + */ + reset(): void; + /** + * Returns the value at the given percentile. + * @since v11.10.0 + * @param percentile A percentile value in the range (0, 100]. + */ + percentile(percentile: number): number; + } + interface IntervalHistogram extends Histogram { + /** + * Enables the update interval timer. Returns `true` if the timer was + * started, `false` if it was already started. + * @since v11.10.0 + */ + enable(): boolean; + /** + * Disables the update interval timer. Returns `true` if the timer was + * stopped, `false` if it was already stopped. + * @since v11.10.0 + */ + disable(): boolean; + } + interface RecordableHistogram extends Histogram { + /** + * @since v15.9.0, v14.18.0 + * @param val The amount to record in the histogram. + */ + record(val: number | bigint): void; + /** + * Calculates the amount of time (in nanoseconds) that has passed since the + * previous call to `recordDelta()` and records that amount in the histogram. + * + * ## Examples + * @since v15.9.0, v14.18.0 + */ + recordDelta(): void; + /** + * Adds the values from `other` to this histogram. + * @since v17.4.0, v16.14.0 + */ + add(other: RecordableHistogram): void; + } + /** + * _This property is an extension by Node.js. It is not available in Web browsers._ + * + * Creates an `IntervalHistogram` object that samples and reports the event loop + * delay over time. The delays will be reported in nanoseconds. + * + * Using a timer to detect approximate event loop delay works because the + * execution of timers is tied specifically to the lifecycle of the libuv + * event loop. That is, a delay in the loop will cause a delay in the execution + * of the timer, and those delays are specifically what this API is intended to + * detect. + * + * ```js + * const { monitorEventLoopDelay } = require('node:perf_hooks'); + * const h = monitorEventLoopDelay({ resolution: 20 }); + * h.enable(); + * // Do something. + * h.disable(); + * console.log(h.min); + * console.log(h.max); + * console.log(h.mean); + * console.log(h.stddev); + * console.log(h.percentiles); + * console.log(h.percentile(50)); + * console.log(h.percentile(99)); + * ``` + * @since v11.10.0 + */ + function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram; + interface CreateHistogramOptions { + /** + * The minimum recordable value. Must be an integer value greater than 0. + * @default 1 + */ + min?: number | bigint | undefined; + /** + * The maximum recordable value. Must be an integer value greater than min. + * @default Number.MAX_SAFE_INTEGER + */ + max?: number | bigint | undefined; + /** + * The number of accuracy digits. Must be a number between 1 and 5. + * @default 3 + */ + figures?: number | undefined; + } + /** + * Returns a `RecordableHistogram`. + * @since v15.9.0, v14.18.0 + */ + function createHistogram(options?: CreateHistogramOptions): RecordableHistogram; + import { performance as _performance } from 'perf_hooks'; + global { + /** + * `performance` is a global reference for `require('perf_hooks').performance` + * https://nodejs.org/api/globals.html#performance + * @since v16.0.0 + */ + var performance: typeof globalThis extends { + onmessage: any; + performance: infer T; + } + ? T + : typeof _performance; + } +} +declare module 'node:perf_hooks' { + export * from 'perf_hooks'; +} diff --git a/node_modules/@types/node/ts4.8/process.d.ts b/node_modules/@types/node/ts4.8/process.d.ts new file mode 100755 index 0000000..f122546 --- /dev/null +++ b/node_modules/@types/node/ts4.8/process.d.ts @@ -0,0 +1,1494 @@ +declare module 'process' { + import * as tty from 'node:tty'; + import { Worker } from 'node:worker_threads'; + global { + var process: NodeJS.Process; + namespace NodeJS { + // this namespace merge is here because these are specifically used + // as the type for process.stdin, process.stdout, and process.stderr. + // they can't live in tty.d.ts because we need to disambiguate the imported name. + interface ReadStream extends tty.ReadStream {} + interface WriteStream extends tty.WriteStream {} + interface MemoryUsageFn { + /** + * The `process.memoryUsage()` method iterate over each page to gather informations about memory + * usage which can be slow depending on the program memory allocations. + */ + (): MemoryUsage; + /** + * method returns an integer representing the Resident Set Size (RSS) in bytes. + */ + rss(): number; + } + interface MemoryUsage { + rss: number; + heapTotal: number; + heapUsed: number; + external: number; + arrayBuffers: number; + } + interface CpuUsage { + user: number; + system: number; + } + interface ProcessRelease { + name: string; + sourceUrl?: string | undefined; + headersUrl?: string | undefined; + libUrl?: string | undefined; + lts?: string | undefined; + } + interface ProcessVersions extends Dict { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + modules: string; + openssl: string; + } + type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd'; + type Architecture = 'arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x64'; + type Signals = + | 'SIGABRT' + | 'SIGALRM' + | 'SIGBUS' + | 'SIGCHLD' + | 'SIGCONT' + | 'SIGFPE' + | 'SIGHUP' + | 'SIGILL' + | 'SIGINT' + | 'SIGIO' + | 'SIGIOT' + | 'SIGKILL' + | 'SIGPIPE' + | 'SIGPOLL' + | 'SIGPROF' + | 'SIGPWR' + | 'SIGQUIT' + | 'SIGSEGV' + | 'SIGSTKFLT' + | 'SIGSTOP' + | 'SIGSYS' + | 'SIGTERM' + | 'SIGTRAP' + | 'SIGTSTP' + | 'SIGTTIN' + | 'SIGTTOU' + | 'SIGUNUSED' + | 'SIGURG' + | 'SIGUSR1' + | 'SIGUSR2' + | 'SIGVTALRM' + | 'SIGWINCH' + | 'SIGXCPU' + | 'SIGXFSZ' + | 'SIGBREAK' + | 'SIGLOST' + | 'SIGINFO'; + type UncaughtExceptionOrigin = 'uncaughtException' | 'unhandledRejection'; + type MultipleResolveType = 'resolve' | 'reject'; + type BeforeExitListener = (code: number) => void; + type DisconnectListener = () => void; + type ExitListener = (code: number) => void; + type RejectionHandledListener = (promise: Promise) => void; + type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void; + /** + * Most of the time the unhandledRejection will be an Error, but this should not be relied upon + * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error. + */ + type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; + type WarningListener = (warning: Error) => void; + type MessageListener = (message: unknown, sendHandle: unknown) => void; + type SignalsListener = (signal: Signals) => void; + type MultipleResolveListener = (type: MultipleResolveType, promise: Promise, value: unknown) => void; + type WorkerListener = (worker: Worker) => void; + interface Socket extends ReadWriteStream { + isTTY?: true | undefined; + } + // Alias for compatibility + interface ProcessEnv extends Dict { + /** + * Can be used to change the default timezone at runtime + */ + TZ?: string; + } + interface HRTime { + (time?: [number, number]): [number, number]; + bigint(): bigint; + } + interface ProcessReport { + /** + * Directory where the report is written. + * working directory of the Node.js process. + * @default '' indicating that reports are written to the current + */ + directory: string; + /** + * Filename where the report is written. + * The default value is the empty string. + * @default '' the output filename will be comprised of a timestamp, + * PID, and sequence number. + */ + filename: string; + /** + * Returns a JSON-formatted diagnostic report for the running process. + * The report's JavaScript stack trace is taken from err, if present. + */ + getReport(err?: Error): string; + /** + * If true, a diagnostic report is generated on fatal errors, + * such as out of memory errors or failed C++ assertions. + * @default false + */ + reportOnFatalError: boolean; + /** + * If true, a diagnostic report is generated when the process + * receives the signal specified by process.report.signal. + * @default false + */ + reportOnSignal: boolean; + /** + * If true, a diagnostic report is generated on uncaught exception. + * @default false + */ + reportOnUncaughtException: boolean; + /** + * The signal used to trigger the creation of a diagnostic report. + * @default 'SIGUSR2' + */ + signal: Signals; + /** + * Writes a diagnostic report to a file. If filename is not provided, the default filename + * includes the date, time, PID, and a sequence number. + * The report's JavaScript stack trace is taken from err, if present. + * + * @param fileName Name of the file where the report is written. + * This should be a relative path, that will be appended to the directory specified in + * `process.report.directory`, or the current working directory of the Node.js process, + * if unspecified. + * @param error A custom error used for reporting the JavaScript stack. + * @return Filename of the generated report. + */ + writeReport(fileName?: string): string; + writeReport(error?: Error): string; + writeReport(fileName?: string, err?: Error): string; + } + interface ResourceUsage { + fsRead: number; + fsWrite: number; + involuntaryContextSwitches: number; + ipcReceived: number; + ipcSent: number; + majorPageFault: number; + maxRSS: number; + minorPageFault: number; + sharedMemorySize: number; + signalsCount: number; + swappedOut: number; + systemCPUTime: number; + unsharedDataSize: number; + unsharedStackSize: number; + userCPUTime: number; + voluntaryContextSwitches: number; + } + interface EmitWarningOptions { + /** + * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. + * + * @default 'Warning' + */ + type?: string | undefined; + /** + * A unique identifier for the warning instance being emitted. + */ + code?: string | undefined; + /** + * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. + * + * @default process.emitWarning + */ + ctor?: Function | undefined; + /** + * Additional text to include with the error. + */ + detail?: string | undefined; + } + interface ProcessConfig { + readonly target_defaults: { + readonly cflags: any[]; + readonly default_configuration: string; + readonly defines: string[]; + readonly include_dirs: string[]; + readonly libraries: string[]; + }; + readonly variables: { + readonly clang: number; + readonly host_arch: string; + readonly node_install_npm: boolean; + readonly node_install_waf: boolean; + readonly node_prefix: string; + readonly node_shared_openssl: boolean; + readonly node_shared_v8: boolean; + readonly node_shared_zlib: boolean; + readonly node_use_dtrace: boolean; + readonly node_use_etw: boolean; + readonly node_use_openssl: boolean; + readonly target_arch: string; + readonly v8_no_strict_aliasing: number; + readonly v8_use_snapshot: boolean; + readonly visibility: string; + }; + } + interface Process extends EventEmitter { + /** + * The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is + * a `Writable` stream. + * + * For example, to copy `process.stdin` to `process.stdout`: + * + * ```js + * import { stdin, stdout } from 'node:process'; + * + * stdin.pipe(stdout); + * ``` + * + * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information. + */ + stdout: WriteStream & { + fd: 1; + }; + /** + * The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is + * a `Writable` stream. + * + * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information. + */ + stderr: WriteStream & { + fd: 2; + }; + /** + * The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is + * a `Readable` stream. + * + * For details of how to read from `stdin` see `readable.read()`. + * + * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that + * is compatible with scripts written for Node.js prior to v0.10\. + * For more information see `Stream compatibility`. + * + * In "old" streams mode the `stdin` stream is paused by default, so one + * must call `process.stdin.resume()` to read from it. Note also that calling`process.stdin.resume()` itself would switch stream to "old" mode. + */ + stdin: ReadStream & { + fd: 0; + }; + openStdin(): Socket; + /** + * The `process.argv` property returns an array containing the command-line + * arguments passed when the Node.js process was launched. The first element will + * be {@link execPath}. See `process.argv0` if access to the original value + * of `argv[0]` is needed. The second element will be the path to the JavaScript + * file being executed. The remaining elements will be any additional command-line + * arguments. + * + * For example, assuming the following script for `process-args.js`: + * + * ```js + * import { argv } from 'node:process'; + * + * // print process.argv + * argv.forEach((val, index) => { + * console.log(`${index}: ${val}`); + * }); + * ``` + * + * Launching the Node.js process as: + * + * ```bash + * node process-args.js one two=three four + * ``` + * + * Would generate the output: + * + * ```text + * 0: /usr/local/bin/node + * 1: /Users/mjr/work/node/process-args.js + * 2: one + * 3: two=three + * 4: four + * ``` + * @since v0.1.27 + */ + argv: string[]; + /** + * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts. + * + * ```console + * $ bash -c 'exec -a customArgv0 ./node' + * > process.argv[0] + * '/Volumes/code/external/node/out/Release/node' + * > process.argv0 + * 'customArgv0' + * ``` + * @since v6.4.0 + */ + argv0: string; + /** + * The `process.execArgv` property returns the set of Node.js-specific command-line + * options passed when the Node.js process was launched. These options do not + * appear in the array returned by the {@link argv} property, and do not + * include the Node.js executable, the name of the script, or any options following + * the script name. These options are useful in order to spawn child processes with + * the same execution environment as the parent. + * + * ```bash + * node --harmony script.js --version + * ``` + * + * Results in `process.execArgv`: + * + * ```js + * ['--harmony'] + * ``` + * + * And `process.argv`: + * + * ```js + * ['/usr/local/bin/node', 'script.js', '--version'] + * ``` + * + * Refer to `Worker constructor` for the detailed behavior of worker + * threads with this property. + * @since v0.7.7 + */ + execArgv: string[]; + /** + * The `process.execPath` property returns the absolute pathname of the executable + * that started the Node.js process. Symbolic links, if any, are resolved. + * + * ```js + * '/usr/local/bin/node' + * ``` + * @since v0.1.100 + */ + execPath: string; + /** + * The `process.abort()` method causes the Node.js process to exit immediately and + * generate a core file. + * + * This feature is not available in `Worker` threads. + * @since v0.7.0 + */ + abort(): never; + /** + * The `process.chdir()` method changes the current working directory of the + * Node.js process or throws an exception if doing so fails (for instance, if + * the specified `directory` does not exist). + * + * ```js + * import { chdir, cwd } from 'node:process'; + * + * console.log(`Starting directory: ${cwd()}`); + * try { + * chdir('/tmp'); + * console.log(`New directory: ${cwd()}`); + * } catch (err) { + * console.error(`chdir: ${err}`); + * } + * ``` + * + * This feature is not available in `Worker` threads. + * @since v0.1.17 + */ + chdir(directory: string): void; + /** + * The `process.cwd()` method returns the current working directory of the Node.js + * process. + * + * ```js + * import { cwd } from 'node:process'; + * + * console.log(`Current directory: ${cwd()}`); + * ``` + * @since v0.1.8 + */ + cwd(): string; + /** + * The port used by the Node.js debugger when enabled. + * + * ```js + * import process from 'node:process'; + * + * process.debugPort = 5858; + * ``` + * @since v0.7.2 + */ + debugPort: number; + /** + * The `process.emitWarning()` method can be used to emit custom or application + * specific process warnings. These can be listened for by adding a handler to the `'warning'` event. + * + * ```js + * import { emitWarning } from 'node:process'; + * + * // Emit a warning with a code and additional detail. + * emitWarning('Something happened!', { + * code: 'MY_WARNING', + * detail: 'This is some additional information', + * }); + * // Emits: + * // (node:56338) [MY_WARNING] Warning: Something happened! + * // This is some additional information + * ``` + * + * In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler. + * + * ```js + * import process from 'node:process'; + * + * process.on('warning', (warning) => { + * console.warn(warning.name); // 'Warning' + * console.warn(warning.message); // 'Something happened!' + * console.warn(warning.code); // 'MY_WARNING' + * console.warn(warning.stack); // Stack trace + * console.warn(warning.detail); // 'This is some additional information' + * }); + * ``` + * + * If `warning` is passed as an `Error` object, the `options` argument is ignored. + * @since v8.0.0 + * @param warning The warning to emit. + */ + emitWarning(warning: string | Error, ctor?: Function): void; + emitWarning(warning: string | Error, type?: string, ctor?: Function): void; + emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void; + emitWarning(warning: string | Error, options?: EmitWarningOptions): void; + /** + * The `process.env` property returns an object containing the user environment. + * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html). + * + * An example of this object looks like: + * + * ```js + * { + * TERM: 'xterm-256color', + * SHELL: '/usr/local/bin/bash', + * USER: 'maciej', + * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', + * PWD: '/Users/maciej', + * EDITOR: 'vim', + * SHLVL: '1', + * HOME: '/Users/maciej', + * LOGNAME: 'maciej', + * _: '/usr/local/bin/node' + * } + * ``` + * + * It is possible to modify this object, but such modifications will not be + * reflected outside the Node.js process, or (unless explicitly requested) + * to other `Worker` threads. + * In other words, the following example would not work: + * + * ```bash + * node -e 'process.env.foo = "bar"' && echo $foo + * ``` + * + * While the following will: + * + * ```js + * import { env } from 'node:process'; + * + * env.foo = 'bar'; + * console.log(env.foo); + * ``` + * + * Assigning a property on `process.env` will implicitly convert the value + * to a string. **This behavior is deprecated.** Future versions of Node.js may + * throw an error when the value is not a string, number, or boolean. + * + * ```js + * import { env } from 'node:process'; + * + * env.test = null; + * console.log(env.test); + * // => 'null' + * env.test = undefined; + * console.log(env.test); + * // => 'undefined' + * ``` + * + * Use `delete` to delete a property from `process.env`. + * + * ```js + * import { env } from 'node:process'; + * + * env.TEST = 1; + * delete env.TEST; + * console.log(env.TEST); + * // => undefined + * ``` + * + * On Windows operating systems, environment variables are case-insensitive. + * + * ```js + * import { env } from 'node:process'; + * + * env.TEST = 1; + * console.log(env.test); + * // => 1 + * ``` + * + * Unless explicitly specified when creating a `Worker` instance, + * each `Worker` thread has its own copy of `process.env`, based on its + * parent thread's `process.env`, or whatever was specified as the `env` option + * to the `Worker` constructor. Changes to `process.env` will not be visible + * across `Worker` threads, and only the main thread can make changes that + * are visible to the operating system or to native add-ons. + * @since v0.1.27 + */ + env: ProcessEnv; + /** + * The `process.exit()` method instructs Node.js to terminate the process + * synchronously with an exit status of `code`. If `code` is omitted, exit uses + * either the 'success' code `0` or the value of `process.exitCode` if it has been + * set. Node.js will not terminate until all the `'exit'` event listeners are + * called. + * + * To exit with a 'failure' code: + * + * ```js + * import { exit } from 'node:process'; + * + * exit(1); + * ``` + * + * The shell that executed Node.js should see the exit code as `1`. + * + * Calling `process.exit()` will force the process to exit as quickly as possible + * even if there are still asynchronous operations pending that have not yet + * completed fully, including I/O operations to `process.stdout` and`process.stderr`. + * + * In most situations, it is not actually necessary to call `process.exit()`explicitly. The Node.js process will exit on its own _if there is no additional_ + * _work pending_ in the event loop. The `process.exitCode` property can be set to + * tell the process which exit code to use when the process exits gracefully. + * + * For instance, the following example illustrates a _misuse_ of the`process.exit()` method that could lead to data printed to stdout being + * truncated and lost: + * + * ```js + * import { exit } from 'node:process'; + * + * // This is an example of what *not* to do: + * if (someConditionNotMet()) { + * printUsageToStdout(); + * exit(1); + * } + * ``` + * + * The reason this is problematic is because writes to `process.stdout` in Node.js + * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js + * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed. + * + * Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding + * scheduling any additional work for the event loop: + * + * ```js + * import process from 'node:process'; + * + * // How to properly set the exit code while letting + * // the process exit gracefully. + * if (someConditionNotMet()) { + * printUsageToStdout(); + * process.exitCode = 1; + * } + * ``` + * + * If it is necessary to terminate the Node.js process due to an error condition, + * throwing an _uncaught_ error and allowing the process to terminate accordingly + * is safer than calling `process.exit()`. + * + * In `Worker` threads, this function stops the current thread rather + * than the current process. + * @since v0.1.13 + * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed. + */ + exit(code?: number): never; + /** + * A number which will be the process exit code, when the process either + * exits gracefully, or is exited via {@link exit} without specifying + * a code. + * + * Specifying a code to {@link exit} will override any + * previous setting of `process.exitCode`. + * @since v0.11.8 + */ + exitCode?: number | undefined; + /** + * The `process.getgid()` method returns the numerical group identity of the + * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).) + * + * ```js + * import process from 'process'; + * + * if (process.getgid) { + * console.log(`Current gid: ${process.getgid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.1.31 + */ + getgid?: () => number; + /** + * The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a + * numeric ID or a group name + * string. If a group name is specified, this method blocks while resolving the + * associated numeric ID. + * + * ```js + * import process from 'process'; + * + * if (process.getgid && process.setgid) { + * console.log(`Current gid: ${process.getgid()}`); + * try { + * process.setgid(501); + * console.log(`New gid: ${process.getgid()}`); + * } catch (err) { + * console.log(`Failed to set gid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.1.31 + * @param id The group name or ID + */ + setgid?: (id: number | string) => void; + /** + * The `process.getuid()` method returns the numeric user identity of the process. + * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).) + * + * ```js + * import process from 'process'; + * + * if (process.getuid) { + * console.log(`Current uid: ${process.getuid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.1.28 + */ + getuid?: () => number; + /** + * The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a + * numeric ID or a username string. + * If a username is specified, the method blocks while resolving the associated + * numeric ID. + * + * ```js + * import process from 'process'; + * + * if (process.getuid && process.setuid) { + * console.log(`Current uid: ${process.getuid()}`); + * try { + * process.setuid(501); + * console.log(`New uid: ${process.getuid()}`); + * } catch (err) { + * console.log(`Failed to set uid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.1.28 + */ + setuid?: (id: number | string) => void; + /** + * The `process.geteuid()` method returns the numerical effective user identity of + * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).) + * + * ```js + * import process from 'process'; + * + * if (process.geteuid) { + * console.log(`Current uid: ${process.geteuid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v2.0.0 + */ + geteuid?: () => number; + /** + * The `process.seteuid()` method sets the effective user identity of the process. + * (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username + * string. If a username is specified, the method blocks while resolving the + * associated numeric ID. + * + * ```js + * import process from 'process'; + * + * if (process.geteuid && process.seteuid) { + * console.log(`Current uid: ${process.geteuid()}`); + * try { + * process.seteuid(501); + * console.log(`New uid: ${process.geteuid()}`); + * } catch (err) { + * console.log(`Failed to set uid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v2.0.0 + * @param id A user name or ID + */ + seteuid?: (id: number | string) => void; + /** + * The `process.getegid()` method returns the numerical effective group identity + * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).) + * + * ```js + * import process from 'process'; + * + * if (process.getegid) { + * console.log(`Current gid: ${process.getegid()}`); + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v2.0.0 + */ + getegid?: () => number; + /** + * The `process.setegid()` method sets the effective group identity of the process. + * (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group + * name string. If a group name is specified, this method blocks while resolving + * the associated a numeric ID. + * + * ```js + * import process from 'process'; + * + * if (process.getegid && process.setegid) { + * console.log(`Current gid: ${process.getegid()}`); + * try { + * process.setegid(501); + * console.log(`New gid: ${process.getegid()}`); + * } catch (err) { + * console.log(`Failed to set gid: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v2.0.0 + * @param id A group name or ID + */ + setegid?: (id: number | string) => void; + /** + * The `process.getgroups()` method returns an array with the supplementary group + * IDs. POSIX leaves it unspecified if the effective group ID is included but + * Node.js ensures it always is. + * + * ```js + * import process from 'process'; + * + * if (process.getgroups) { + * console.log(process.getgroups()); // [ 16, 21, 297 ] + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * @since v0.9.4 + */ + getgroups?: () => number[]; + /** + * The `process.setgroups()` method sets the supplementary group IDs for the + * Node.js process. This is a privileged operation that requires the Node.js + * process to have `root` or the `CAP_SETGID` capability. + * + * The `groups` array can contain numeric group IDs, group names, or both. + * + * ```js + * import process from 'process'; + * + * if (process.getgroups && process.setgroups) { + * try { + * process.setgroups([501]); + * console.log(process.getgroups()); // new groups + * } catch (err) { + * console.log(`Failed to set groups: ${err}`); + * } + * } + * ``` + * + * This function is only available on POSIX platforms (i.e. not Windows or + * Android). + * This feature is not available in `Worker` threads. + * @since v0.9.4 + */ + setgroups?: (groups: ReadonlyArray) => void; + /** + * The `process.setUncaughtExceptionCaptureCallback()` function sets a function + * that will be invoked when an uncaught exception occurs, which will receive the + * exception value itself as its first argument. + * + * If such a function is set, the `'uncaughtException'` event will + * not be emitted. If `--abort-on-uncaught-exception` was passed from the + * command line or set through `v8.setFlagsFromString()`, the process will + * not abort. Actions configured to take place on exceptions such as report + * generations will be affected too + * + * To unset the capture function,`process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this + * method with a non-`null` argument while another capture function is set will + * throw an error. + * + * Using this function is mutually exclusive with using the deprecated `domain` built-in module. + * @since v9.3.0 + */ + setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; + /** + * Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}. + * @since v9.3.0 + */ + hasUncaughtExceptionCaptureCallback(): boolean; + /** + * The `process.version` property contains the Node.js version string. + * + * ```js + * import { version } from 'node:process'; + * + * console.log(`Version: ${version}`); + * // Version: v14.8.0 + * ``` + * + * To get the version string without the prepended _v_, use`process.versions.node`. + * @since v0.1.3 + */ + readonly version: string; + /** + * The `process.versions` property returns an object listing the version strings of + * Node.js and its dependencies. `process.versions.modules` indicates the current + * ABI version, which is increased whenever a C++ API changes. Node.js will refuse + * to load modules that were compiled against a different module ABI version. + * + * ```js + * import { versions } from 'node:process'; + * + * console.log(versions); + * ``` + * + * Will generate an object similar to: + * + * ```console + * { node: '20.2.0', + * acorn: '8.8.2', + * ada: '2.4.0', + * ares: '1.19.0', + * base64: '0.5.0', + * brotli: '1.0.9', + * cjs_module_lexer: '1.2.2', + * cldr: '43.0', + * icu: '73.1', + * llhttp: '8.1.0', + * modules: '115', + * napi: '8', + * nghttp2: '1.52.0', + * nghttp3: '0.7.0', + * ngtcp2: '0.8.1', + * openssl: '3.0.8+quic', + * simdutf: '3.2.9', + * tz: '2023c', + * undici: '5.22.0', + * unicode: '15.0', + * uv: '1.44.2', + * uvwasi: '0.0.16', + * v8: '11.3.244.8-node.9', + * zlib: '1.2.13' } + * ``` + * @since v0.2.0 + */ + readonly versions: ProcessVersions; + /** + * The `process.config` property returns a frozen `Object` containing the + * JavaScript representation of the configure options used to compile the current + * Node.js executable. This is the same as the `config.gypi` file that was produced + * when running the `./configure` script. + * + * An example of the possible output looks like: + * + * ```js + * { + * target_defaults: + * { cflags: [], + * default_configuration: 'Release', + * defines: [], + * include_dirs: [], + * libraries: [] }, + * variables: + * { + * host_arch: 'x64', + * napi_build_version: 5, + * node_install_npm: 'true', + * node_prefix: '', + * node_shared_cares: 'false', + * node_shared_http_parser: 'false', + * node_shared_libuv: 'false', + * node_shared_zlib: 'false', + * node_use_openssl: 'true', + * node_shared_openssl: 'false', + * strict_aliasing: 'true', + * target_arch: 'x64', + * v8_use_snapshot: 1 + * } + * } + * ``` + * @since v0.7.7 + */ + readonly config: ProcessConfig; + /** + * The `process.kill()` method sends the `signal` to the process identified by`pid`. + * + * Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information. + * + * This method will throw an error if the target `pid` does not exist. As a special + * case, a signal of `0` can be used to test for the existence of a process. + * Windows platforms will throw an error if the `pid` is used to kill a process + * group. + * + * Even though the name of this function is `process.kill()`, it is really just a + * signal sender, like the `kill` system call. The signal sent may do something + * other than kill the target process. + * + * ```js + * import process, { kill } from 'node:process'; + * + * process.on('SIGHUP', () => { + * console.log('Got SIGHUP signal.'); + * }); + * + * setTimeout(() => { + * console.log('Exiting.'); + * process.exit(0); + * }, 100); + * + * kill(process.pid, 'SIGHUP'); + * ``` + * + * When `SIGUSR1` is received by a Node.js process, Node.js will start the + * debugger. See `Signal Events`. + * @since v0.0.6 + * @param pid A process ID + * @param [signal='SIGTERM'] The signal to send, either as a string or number. + */ + kill(pid: number, signal?: string | number): true; + /** + * The `process.pid` property returns the PID of the process. + * + * ```js + * import { pid } from 'node:process'; + * + * console.log(`This process is pid ${pid}`); + * ``` + * @since v0.1.15 + */ + readonly pid: number; + /** + * The `process.ppid` property returns the PID of the parent of the + * current process. + * + * ```js + * import { ppid } from 'node:process'; + * + * console.log(`The parent process is pid ${ppid}`); + * ``` + * @since v9.2.0, v8.10.0, v6.13.0 + */ + readonly ppid: number; + /** + * The `process.title` property returns the current process title (i.e. returns + * the current value of `ps`). Assigning a new value to `process.title` modifies + * the current value of `ps`. + * + * When a new value is assigned, different platforms will impose different maximum + * length restrictions on the title. Usually such restrictions are quite limited. + * For instance, on Linux and macOS, `process.title` is limited to the size of the + * binary name plus the length of the command-line arguments because setting the`process.title` overwrites the `argv` memory of the process. Node.js v0.8 + * allowed for longer process title strings by also overwriting the `environ`memory but that was potentially insecure and confusing in some (rather obscure) + * cases. + * + * Assigning a value to `process.title` might not result in an accurate label + * within process manager applications such as macOS Activity Monitor or Windows + * Services Manager. + * @since v0.1.104 + */ + title: string; + /** + * The operating system CPU architecture for which the Node.js binary was compiled. + * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`. + * + * ```js + * import { arch } from 'node:process'; + * + * console.log(`This processor architecture is ${arch}`); + * ``` + * @since v0.5.0 + */ + readonly arch: Architecture; + /** + * The `process.platform` property returns a string identifying the operating + * system platform for which the Node.js binary was compiled. + * + * Currently possible values are: + * + * * `'aix'` + * * `'darwin'` + * * `'freebsd'` + * * `'linux'` + * * `'openbsd'` + * * `'sunos'` + * * `'win32'` + * + * ```js + * import { platform } from 'node:process'; + * + * console.log(`This platform is ${platform}`); + * ``` + * + * The value `'android'` may also be returned if the Node.js is built on the + * Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). + * @since v0.1.16 + */ + readonly platform: Platform; + /** + * The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at + * runtime, `require.main` may still refer to the original main module in + * modules that were required before the change occurred. Generally, it's + * safe to assume that the two refer to the same module. + * + * As with `require.main`, `process.mainModule` will be `undefined` if there + * is no entry script. + * @since v0.1.17 + * @deprecated Since v14.0.0 - Use `main` instead. + */ + mainModule?: Module | undefined; + memoryUsage: MemoryUsageFn; + /** + * Gets the amount of memory available to the process (in bytes) based on + * limits imposed by the OS. If there is no such constraint, or the constraint + * is unknown, `undefined` is returned. + * + * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more + * information. + * @since v19.6.0, v18.15.0 + * @experimental + */ + constrainedMemory(): number | undefined; + /** + * The `process.cpuUsage()` method returns the user and system CPU time usage of + * the current process, in an object with properties `user` and `system`, whose + * values are microsecond values (millionth of a second). These values measure time + * spent in user and system code respectively, and may end up being greater than + * actual elapsed time if multiple CPU cores are performing work for this process. + * + * The result of a previous call to `process.cpuUsage()` can be passed as the + * argument to the function, to get a diff reading. + * + * ```js + * import { cpuUsage } from 'node:process'; + * + * const startUsage = cpuUsage(); + * // { user: 38579, system: 6986 } + * + * // spin the CPU for 500 milliseconds + * const now = Date.now(); + * while (Date.now() - now < 500); + * + * console.log(cpuUsage(startUsage)); + * // { user: 514883, system: 11226 } + * ``` + * @since v6.1.0 + * @param previousValue A previous return value from calling `process.cpuUsage()` + */ + cpuUsage(previousValue?: CpuUsage): CpuUsage; + /** + * `process.nextTick()` adds `callback` to the "next tick queue". This queue is + * fully drained after the current operation on the JavaScript stack runs to + * completion and before the event loop is allowed to continue. It's possible to + * create an infinite loop if one were to recursively call `process.nextTick()`. + * See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background. + * + * ```js + * import { nextTick } from 'node:process'; + * + * console.log('start'); + * nextTick(() => { + * console.log('nextTick callback'); + * }); + * console.log('scheduled'); + * // Output: + * // start + * // scheduled + * // nextTick callback + * ``` + * + * This is important when developing APIs in order to give users the opportunity + * to assign event handlers _after_ an object has been constructed but before any + * I/O has occurred: + * + * ```js + * import { nextTick } from 'node:process'; + * + * function MyThing(options) { + * this.setupOptions(options); + * + * nextTick(() => { + * this.startDoingStuff(); + * }); + * } + * + * const thing = new MyThing(); + * thing.getReadyForStuff(); + * + * // thing.startDoingStuff() gets called now, not before. + * ``` + * + * It is very important for APIs to be either 100% synchronous or 100% + * asynchronous. Consider this example: + * + * ```js + * // WARNING! DO NOT USE! BAD UNSAFE HAZARD! + * function maybeSync(arg, cb) { + * if (arg) { + * cb(); + * return; + * } + * + * fs.stat('file', cb); + * } + * ``` + * + * This API is hazardous because in the following case: + * + * ```js + * const maybeTrue = Math.random() > 0.5; + * + * maybeSync(maybeTrue, () => { + * foo(); + * }); + * + * bar(); + * ``` + * + * It is not clear whether `foo()` or `bar()` will be called first. + * + * The following approach is much better: + * + * ```js + * import { nextTick } from 'node:process'; + * + * function definitelyAsync(arg, cb) { + * if (arg) { + * nextTick(cb); + * return; + * } + * + * fs.stat('file', cb); + * } + * ``` + * @since v0.1.26 + * @param args Additional arguments to pass when invoking the `callback` + */ + nextTick(callback: Function, ...args: any[]): void; + /** + * The `process.release` property returns an `Object` containing metadata related + * to the current release, including URLs for the source tarball and headers-only + * tarball. + * + * `process.release` contains the following properties: + * + * ```js + * { + * name: 'node', + * lts: 'Hydrogen', + * sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz', + * headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz', + * libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib' + * } + * ``` + * + * In custom builds from non-release versions of the source tree, only the`name` property may be present. The additional properties should not be + * relied upon to exist. + * @since v3.0.0 + */ + readonly release: ProcessRelease; + features: { + inspector: boolean; + debug: boolean; + uv: boolean; + ipv6: boolean; + tls_alpn: boolean; + tls_sni: boolean; + tls_ocsp: boolean; + tls: boolean; + }; + /** + * `process.umask()` returns the Node.js process's file mode creation mask. Child + * processes inherit the mask from the parent process. + * @since v0.1.19 + * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential * + * security vulnerability. There is no safe, cross-platform alternative API. + */ + umask(): number; + /** + * Can only be set if not in worker thread. + */ + umask(mask: string | number): number; + /** + * The `process.uptime()` method returns the number of seconds the current Node.js + * process has been running. + * + * The return value includes fractions of a second. Use `Math.floor()` to get whole + * seconds. + * @since v0.5.0 + */ + uptime(): number; + hrtime: HRTime; + /** + * If Node.js is spawned with an IPC channel, the `process.send()` method can be + * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object. + * + * If Node.js was not spawned with an IPC channel, `process.send` will be`undefined`. + * + * The message goes through serialization and parsing. The resulting message might + * not be the same as what is originally sent. + * @since v0.5.9 + * @param options used to parameterize the sending of certain types of handles.`options` supports the following properties: + */ + send?( + message: any, + sendHandle?: any, + options?: { + swallowErrors?: boolean | undefined; + }, + callback?: (error: Error | null) => void + ): boolean; + /** + * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the + * IPC channel to the parent process, allowing the child process to exit gracefully + * once there are no other connections keeping it alive. + * + * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process. + * + * If the Node.js process was not spawned with an IPC channel,`process.disconnect()` will be `undefined`. + * @since v0.7.2 + */ + disconnect(): void; + /** + * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return`true` so long as the IPC + * channel is connected and will return `false` after`process.disconnect()` is called. + * + * Once `process.connected` is `false`, it is no longer possible to send messages + * over the IPC channel using `process.send()`. + * @since v0.7.2 + */ + connected: boolean; + /** + * The `process.allowedNodeEnvironmentFlags` property is a special, + * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable. + * + * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides`Set.prototype.has` to recognize several different possible flag + * representations. `process.allowedNodeEnvironmentFlags.has()` will + * return `true` in the following cases: + * + * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g.,`inspect-brk` for `--inspect-brk`, or `r` for `-r`. + * * Flags passed through to V8 (as listed in `--v8-options`) may replace + * one or more _non-leading_ dashes for an underscore, or vice-versa; + * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`, + * etc. + * * Flags may contain one or more equals (`=`) characters; all + * characters after and including the first equals will be ignored; + * e.g., `--stack-trace-limit=100`. + * * Flags _must_ be allowable within `NODE_OPTIONS`. + * + * When iterating over `process.allowedNodeEnvironmentFlags`, flags will + * appear only _once_; each will begin with one or more dashes. Flags + * passed through to V8 will contain underscores instead of non-leading + * dashes: + * + * ```js + * import { allowedNodeEnvironmentFlags } from 'node:process'; + * + * allowedNodeEnvironmentFlags.forEach((flag) => { + * // -r + * // --inspect-brk + * // --abort_on_uncaught_exception + * // ... + * }); + * ``` + * + * The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail + * silently. + * + * If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will + * contain what _would have_ been allowable. + * @since v10.10.0 + */ + allowedNodeEnvironmentFlags: ReadonlySet; + /** + * `process.report` is an object whose methods are used to generate diagnostic + * reports for the current process. Additional documentation is available in the `report documentation`. + * @since v11.8.0 + */ + report?: ProcessReport | undefined; + /** + * ```js + * import { resourceUsage } from 'node:process'; + * + * console.log(resourceUsage()); + * /* + * Will output: + * { + * userCPUTime: 82872, + * systemCPUTime: 4143, + * maxRSS: 33164, + * sharedMemorySize: 0, + * unsharedDataSize: 0, + * unsharedStackSize: 0, + * minorPageFault: 2469, + * majorPageFault: 0, + * swappedOut: 0, + * fsRead: 0, + * fsWrite: 8, + * ipcSent: 0, + * ipcReceived: 0, + * signalsCount: 0, + * voluntaryContextSwitches: 79, + * involuntaryContextSwitches: 1 + * } + * + * ``` + * @since v12.6.0 + * @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t]. + */ + resourceUsage(): ResourceUsage; + /** + * The `process.traceDeprecation` property indicates whether the`--trace-deprecation` flag is set on the current Node.js process. See the + * documentation for the `'warning' event` and the `emitWarning() method` for more information about this + * flag's behavior. + * @since v0.8.0 + */ + traceDeprecation: boolean; + /* EventEmitter */ + addListener(event: 'beforeExit', listener: BeforeExitListener): this; + addListener(event: 'disconnect', listener: DisconnectListener): this; + addListener(event: 'exit', listener: ExitListener): this; + addListener(event: 'rejectionHandled', listener: RejectionHandledListener): this; + addListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + addListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + addListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + addListener(event: 'warning', listener: WarningListener): this; + addListener(event: 'message', listener: MessageListener): this; + addListener(event: Signals, listener: SignalsListener): this; + addListener(event: 'multipleResolves', listener: MultipleResolveListener): this; + addListener(event: 'worker', listener: WorkerListener): this; + emit(event: 'beforeExit', code: number): boolean; + emit(event: 'disconnect'): boolean; + emit(event: 'exit', code: number): boolean; + emit(event: 'rejectionHandled', promise: Promise): boolean; + emit(event: 'uncaughtException', error: Error): boolean; + emit(event: 'uncaughtExceptionMonitor', error: Error): boolean; + emit(event: 'unhandledRejection', reason: unknown, promise: Promise): boolean; + emit(event: 'warning', warning: Error): boolean; + emit(event: 'message', message: unknown, sendHandle: unknown): this; + emit(event: Signals, signal?: Signals): boolean; + emit(event: 'multipleResolves', type: MultipleResolveType, promise: Promise, value: unknown): this; + emit(event: 'worker', listener: WorkerListener): this; + on(event: 'beforeExit', listener: BeforeExitListener): this; + on(event: 'disconnect', listener: DisconnectListener): this; + on(event: 'exit', listener: ExitListener): this; + on(event: 'rejectionHandled', listener: RejectionHandledListener): this; + on(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + on(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + on(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + on(event: 'warning', listener: WarningListener): this; + on(event: 'message', listener: MessageListener): this; + on(event: Signals, listener: SignalsListener): this; + on(event: 'multipleResolves', listener: MultipleResolveListener): this; + on(event: 'worker', listener: WorkerListener): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'beforeExit', listener: BeforeExitListener): this; + once(event: 'disconnect', listener: DisconnectListener): this; + once(event: 'exit', listener: ExitListener): this; + once(event: 'rejectionHandled', listener: RejectionHandledListener): this; + once(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + once(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + once(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + once(event: 'warning', listener: WarningListener): this; + once(event: 'message', listener: MessageListener): this; + once(event: Signals, listener: SignalsListener): this; + once(event: 'multipleResolves', listener: MultipleResolveListener): this; + once(event: 'worker', listener: WorkerListener): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'beforeExit', listener: BeforeExitListener): this; + prependListener(event: 'disconnect', listener: DisconnectListener): this; + prependListener(event: 'exit', listener: ExitListener): this; + prependListener(event: 'rejectionHandled', listener: RejectionHandledListener): this; + prependListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + prependListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + prependListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + prependListener(event: 'warning', listener: WarningListener): this; + prependListener(event: 'message', listener: MessageListener): this; + prependListener(event: Signals, listener: SignalsListener): this; + prependListener(event: 'multipleResolves', listener: MultipleResolveListener): this; + prependListener(event: 'worker', listener: WorkerListener): this; + prependOnceListener(event: 'beforeExit', listener: BeforeExitListener): this; + prependOnceListener(event: 'disconnect', listener: DisconnectListener): this; + prependOnceListener(event: 'exit', listener: ExitListener): this; + prependOnceListener(event: 'rejectionHandled', listener: RejectionHandledListener): this; + prependOnceListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this; + prependOnceListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this; + prependOnceListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this; + prependOnceListener(event: 'warning', listener: WarningListener): this; + prependOnceListener(event: 'message', listener: MessageListener): this; + prependOnceListener(event: Signals, listener: SignalsListener): this; + prependOnceListener(event: 'multipleResolves', listener: MultipleResolveListener): this; + prependOnceListener(event: 'worker', listener: WorkerListener): this; + listeners(event: 'beforeExit'): BeforeExitListener[]; + listeners(event: 'disconnect'): DisconnectListener[]; + listeners(event: 'exit'): ExitListener[]; + listeners(event: 'rejectionHandled'): RejectionHandledListener[]; + listeners(event: 'uncaughtException'): UncaughtExceptionListener[]; + listeners(event: 'uncaughtExceptionMonitor'): UncaughtExceptionListener[]; + listeners(event: 'unhandledRejection'): UnhandledRejectionListener[]; + listeners(event: 'warning'): WarningListener[]; + listeners(event: 'message'): MessageListener[]; + listeners(event: Signals): SignalsListener[]; + listeners(event: 'multipleResolves'): MultipleResolveListener[]; + listeners(event: 'worker'): WorkerListener[]; + } + } + } + export = process; +} +declare module 'node:process' { + import process = require('process'); + export = process; +} diff --git a/node_modules/@types/node/ts4.8/punycode.d.ts b/node_modules/@types/node/ts4.8/punycode.d.ts new file mode 100755 index 0000000..8927207 --- /dev/null +++ b/node_modules/@types/node/ts4.8/punycode.d.ts @@ -0,0 +1,117 @@ +/** + * **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users + * currently depending on the `punycode` module should switch to using the + * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL + * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`. + * + * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It + * can be accessed using: + * + * ```js + * const punycode = require('punycode'); + * ``` + * + * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is + * primarily intended for use in Internationalized Domain Names. Because host + * names in URLs are limited to ASCII characters only, Domain Names that contain + * non-ASCII characters must be converted into ASCII using the Punycode scheme. + * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent + * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`. + * + * The `punycode` module provides a simple implementation of the Punycode standard. + * + * The `punycode` module is a third-party dependency used by Node.js and + * made available to developers as a convenience. Fixes or other modifications to + * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project. + * @deprecated Since v7.0.0 - Deprecated + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/punycode.js) + */ +declare module 'punycode' { + /** + * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only + * characters to the equivalent string of Unicode codepoints. + * + * ```js + * punycode.decode('maana-pta'); // 'mañana' + * punycode.decode('--dqo34k'); // '☃-⌘' + * ``` + * @since v0.5.1 + */ + function decode(string: string): string; + /** + * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters. + * + * ```js + * punycode.encode('mañana'); // 'maana-pta' + * punycode.encode('☃-⌘'); // '--dqo34k' + * ``` + * @since v0.5.1 + */ + function encode(string: string): string; + /** + * The `punycode.toUnicode()` method converts a string representing a domain name + * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be + * converted. + * + * ```js + * // decode domain names + * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com' + * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com' + * punycode.toUnicode('example.com'); // 'example.com' + * ``` + * @since v0.6.1 + */ + function toUnicode(domain: string): string; + /** + * The `punycode.toASCII()` method converts a Unicode string representing an + * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the + * domain name will be converted. Calling `punycode.toASCII()` on a string that + * already only contains ASCII characters will have no effect. + * + * ```js + * // encode domain names + * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com' + * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com' + * punycode.toASCII('example.com'); // 'example.com' + * ``` + * @since v0.6.1 + */ + function toASCII(domain: string): string; + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + const ucs2: ucs2; + interface ucs2 { + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + decode(string: string): number[]; + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + encode(codePoints: ReadonlyArray): string; + } + /** + * @deprecated since v7.0.0 + * The version of the punycode module bundled in Node.js is being deprecated. + * In a future major version of Node.js this module will be removed. + * Users currently depending on the punycode module should switch to using + * the userland-provided Punycode.js module instead. + */ + const version: string; +} +declare module 'node:punycode' { + export * from 'punycode'; +} diff --git a/node_modules/@types/node/ts4.8/querystring.d.ts b/node_modules/@types/node/ts4.8/querystring.d.ts new file mode 100755 index 0000000..e9d087c --- /dev/null +++ b/node_modules/@types/node/ts4.8/querystring.d.ts @@ -0,0 +1,131 @@ +/** + * The `node:querystring` module provides utilities for parsing and formatting URL + * query strings. It can be accessed using: + * + * ```js + * const querystring = require('node:querystring'); + * ``` + * + * `querystring` is more performant than `URLSearchParams` but is not a + * standardized API. Use `URLSearchParams` when performance is not critical or + * when compatibility with browser code is desirable. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/querystring.js) + */ +declare module 'querystring' { + interface StringifyOptions { + encodeURIComponent?: ((str: string) => string) | undefined; + } + interface ParseOptions { + maxKeys?: number | undefined; + decodeURIComponent?: ((str: string) => string) | undefined; + } + interface ParsedUrlQuery extends NodeJS.Dict {} + interface ParsedUrlQueryInput extends NodeJS.Dict | ReadonlyArray | ReadonlyArray | null> {} + /** + * The `querystring.stringify()` method produces a URL query string from a + * given `obj` by iterating through the object's "own properties". + * + * It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | + * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | + * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | + * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | + * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | + * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | + * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | + * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to + * empty strings. + * + * ```js + * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); + * // Returns 'foo=bar&baz=qux&baz=quux&corge=' + * + * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); + * // Returns 'foo:bar;baz:qux' + * ``` + * + * By default, characters requiring percent-encoding within the query string will + * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified: + * + * ```js + * // Assuming gbkEncodeURIComponent function already exists, + * + * querystring.stringify({ w: '中文', foo: 'bar' }, null, null, + * { encodeURIComponent: gbkEncodeURIComponent }); + * ``` + * @since v0.1.25 + * @param obj The object to serialize into a URL query string + * @param [sep='&'] The substring used to delimit key and value pairs in the query string. + * @param [eq='='] . The substring used to delimit keys and values in the query string. + */ + function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; + /** + * The `querystring.parse()` method parses a URL query string (`str`) into a + * collection of key and value pairs. + * + * For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into: + * + * ```js + * { + * foo: 'bar', + * abc: ['xyz', '123'] + * } + * ``` + * + * The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`, + * `obj.hasOwnProperty()`, and others + * are not defined and _will not work_. + * + * By default, percent-encoded characters within the query string will be assumed + * to use UTF-8 encoding. If an alternative character encoding is used, then an + * alternative `decodeURIComponent` option will need to be specified: + * + * ```js + * // Assuming gbkDecodeURIComponent function already exists... + * + * querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null, + * { decodeURIComponent: gbkDecodeURIComponent }); + * ``` + * @since v0.1.25 + * @param str The URL query string to parse + * @param [sep='&'] The substring used to delimit key and value pairs in the query string. + * @param [eq='='] . The substring used to delimit keys and values in the query string. + */ + function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; + /** + * The querystring.encode() function is an alias for querystring.stringify(). + */ + const encode: typeof stringify; + /** + * The querystring.decode() function is an alias for querystring.parse(). + */ + const decode: typeof parse; + /** + * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL + * query strings. + * + * The `querystring.escape()` method is used by `querystring.stringify()` and is + * generally not expected to be used directly. It is exported primarily to allow + * application code to provide a replacement percent-encoding implementation if + * necessary by assigning `querystring.escape` to an alternative function. + * @since v0.1.25 + */ + function escape(str: string): string; + /** + * The `querystring.unescape()` method performs decoding of URL percent-encoded + * characters on the given `str`. + * + * The `querystring.unescape()` method is used by `querystring.parse()` and is + * generally not expected to be used directly. It is exported primarily to allow + * application code to provide a replacement decoding implementation if + * necessary by assigning `querystring.unescape` to an alternative function. + * + * By default, the `querystring.unescape()` method will attempt to use the + * JavaScript built-in `decodeURIComponent()` method to decode. If that fails, + * a safer equivalent that does not throw on malformed URLs will be used. + * @since v0.1.25 + */ + function unescape(str: string): string; +} +declare module 'node:querystring' { + export * from 'querystring'; +} diff --git a/node_modules/@types/node/ts4.8/readline.d.ts b/node_modules/@types/node/ts4.8/readline.d.ts new file mode 100755 index 0000000..e6f7b0a --- /dev/null +++ b/node_modules/@types/node/ts4.8/readline.d.ts @@ -0,0 +1,526 @@ +/** + * The `node:readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time. + * + * To use the promise-based APIs: + * + * ```js + * import * as readline from 'node:readline/promises'; + * ``` + * + * To use the callback and sync APIs: + * + * ```js + * import * as readline from 'node:readline'; + * ``` + * + * The following simple example illustrates the basic use of the `node:readline`module. + * + * ```js + * import * as readline from 'node:readline/promises'; + * import { stdin as input, stdout as output } from 'node:process'; + * + * const rl = readline.createInterface({ input, output }); + * + * const answer = await rl.question('What do you think of Node.js? '); + * + * console.log(`Thank you for your valuable feedback: ${answer}`); + * + * rl.close(); + * ``` + * + * Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be + * received on the `input` stream. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js) + */ +declare module 'readline' { + import { Abortable, EventEmitter } from 'node:events'; + import * as promises from 'node:readline/promises'; + export { promises }; + export interface Key { + sequence?: string | undefined; + name?: string | undefined; + ctrl?: boolean | undefined; + meta?: boolean | undefined; + shift?: boolean | undefined; + } + /** + * Instances of the `readline.Interface` class are constructed using the`readline.createInterface()` method. Every instance is associated with a + * single `input` `Readable` stream and a single `output` `Writable` stream. + * The `output` stream is used to print prompts for user input that arrives on, + * and is read from, the `input` stream. + * @since v0.1.104 + */ + export class Interface extends EventEmitter { + readonly terminal: boolean; + /** + * The current input data being processed by node. + * + * This can be used when collecting input from a TTY stream to retrieve the + * current value that has been processed thus far, prior to the `line` event + * being emitted. Once the `line` event has been emitted, this property will + * be an empty string. + * + * Be aware that modifying the value during the instance runtime may have + * unintended consequences if `rl.cursor` is not also controlled. + * + * **If not using a TTY stream for input, use the `'line'` event.** + * + * One possible use case would be as follows: + * + * ```js + * const values = ['lorem ipsum', 'dolor sit amet']; + * const rl = readline.createInterface(process.stdin); + * const showResults = debounce(() => { + * console.log( + * '\n', + * values.filter((val) => val.startsWith(rl.line)).join(' '), + * ); + * }, 300); + * process.stdin.on('keypress', (c, k) => { + * showResults(); + * }); + * ``` + * @since v0.1.98 + */ + readonly line: string; + /** + * The cursor position relative to `rl.line`. + * + * This will track where the current cursor lands in the input string, when + * reading input from a TTY stream. The position of cursor determines the + * portion of the input string that will be modified as input is processed, + * as well as the column where the terminal caret will be rendered. + * @since v0.1.98 + */ + readonly cursor: number; + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor + */ + protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean); + /** + * NOTE: According to the documentation: + * + * > Instances of the `readline.Interface` class are constructed using the + * > `readline.createInterface()` method. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor + */ + protected constructor(options: ReadLineOptions); + /** + * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`. + * @since v15.3.0, v14.17.0 + * @return the current prompt string + */ + getPrompt(): string; + /** + * The `rl.setPrompt()` method sets the prompt that will be written to `output`whenever `rl.prompt()` is called. + * @since v0.1.98 + */ + setPrompt(prompt: string): void; + /** + * The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new + * location at which to provide input. + * + * When called, `rl.prompt()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written. + * @since v0.1.98 + * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`. + */ + prompt(preserveCursor?: boolean): void; + /** + * The `rl.question()` method displays the `query` by writing it to the `output`, + * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument. + * + * When called, `rl.question()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written. + * + * The `callback` function passed to `rl.question()` does not follow the typical + * pattern of accepting an `Error` object or `null` as the first argument. + * The `callback` is called with the provided answer as the only argument. + * + * An error will be thrown if calling `rl.question()` after `rl.close()`. + * + * Example usage: + * + * ```js + * rl.question('What is your favorite food? ', (answer) => { + * console.log(`Oh, so your favorite food is ${answer}`); + * }); + * ``` + * + * Using an `AbortController` to cancel a question. + * + * ```js + * const ac = new AbortController(); + * const signal = ac.signal; + * + * rl.question('What is your favorite food? ', { signal }, (answer) => { + * console.log(`Oh, so your favorite food is ${answer}`); + * }); + * + * signal.addEventListener('abort', () => { + * console.log('The food question timed out'); + * }, { once: true }); + * + * setTimeout(() => ac.abort(), 10000); + * ``` + * @since v0.3.3 + * @param query A statement or query to write to `output`, prepended to the prompt. + * @param callback A callback function that is invoked with the user's input in response to the `query`. + */ + question(query: string, callback: (answer: string) => void): void; + question(query: string, options: Abortable, callback: (answer: string) => void): void; + /** + * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed + * later if necessary. + * + * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance. + * @since v0.3.4 + */ + pause(): this; + /** + * The `rl.resume()` method resumes the `input` stream if it has been paused. + * @since v0.3.4 + */ + resume(): this; + /** + * The `rl.close()` method closes the `Interface` instance and + * relinquishes control over the `input` and `output` streams. When called, + * the `'close'` event will be emitted. + * + * Calling `rl.close()` does not immediately stop other events (including `'line'`) + * from being emitted by the `Interface` instance. + * @since v0.1.98 + */ + close(): void; + /** + * The `rl.write()` method will write either `data` or a key sequence identified + * by `key` to the `output`. The `key` argument is supported only if `output` is + * a `TTY` text terminal. See `TTY keybindings` for a list of key + * combinations. + * + * If `key` is specified, `data` is ignored. + * + * When called, `rl.write()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written. + * + * ```js + * rl.write('Delete this!'); + * // Simulate Ctrl+U to delete the line written previously + * rl.write(null, { ctrl: true, name: 'u' }); + * ``` + * + * The `rl.write()` method will write the data to the `readline` `Interface`'s`input`_as if it were provided by the user_. + * @since v0.1.98 + */ + write(data: string | Buffer, key?: Key): void; + write(data: undefined | null | string | Buffer, key: Key): void; + /** + * Returns the real position of the cursor in relation to the input + * prompt + string. Long input (wrapping) strings, as well as multiple + * line prompts are included in the calculations. + * @since v13.5.0, v12.16.0 + */ + getCursorPos(): CursorPos; + /** + * events.EventEmitter + * 1. close + * 2. line + * 3. pause + * 4. resume + * 5. SIGCONT + * 6. SIGINT + * 7. SIGTSTP + * 8. history + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'line', listener: (input: string) => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: 'SIGCONT', listener: () => void): this; + addListener(event: 'SIGINT', listener: () => void): this; + addListener(event: 'SIGTSTP', listener: () => void): this; + addListener(event: 'history', listener: (history: string[]) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'line', input: string): boolean; + emit(event: 'pause'): boolean; + emit(event: 'resume'): boolean; + emit(event: 'SIGCONT'): boolean; + emit(event: 'SIGINT'): boolean; + emit(event: 'SIGTSTP'): boolean; + emit(event: 'history', history: string[]): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'line', listener: (input: string) => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: 'SIGCONT', listener: () => void): this; + on(event: 'SIGINT', listener: () => void): this; + on(event: 'SIGTSTP', listener: () => void): this; + on(event: 'history', listener: (history: string[]) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'line', listener: (input: string) => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: 'SIGCONT', listener: () => void): this; + once(event: 'SIGINT', listener: () => void): this; + once(event: 'SIGTSTP', listener: () => void): this; + once(event: 'history', listener: (history: string[]) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'line', listener: (input: string) => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: 'SIGCONT', listener: () => void): this; + prependListener(event: 'SIGINT', listener: () => void): this; + prependListener(event: 'SIGTSTP', listener: () => void): this; + prependListener(event: 'history', listener: (history: string[]) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'line', listener: (input: string) => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: 'SIGCONT', listener: () => void): this; + prependOnceListener(event: 'SIGINT', listener: () => void): this; + prependOnceListener(event: 'SIGTSTP', listener: () => void): this; + prependOnceListener(event: 'history', listener: (history: string[]) => void): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + export type ReadLine = Interface; // type forwarded for backwards compatibility + export type Completer = (line: string) => CompleterResult; + export type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void; + export type CompleterResult = [string[], string]; + export interface ReadLineOptions { + input: NodeJS.ReadableStream; + output?: NodeJS.WritableStream | undefined; + completer?: Completer | AsyncCompleter | undefined; + terminal?: boolean | undefined; + /** + * Initial list of history lines. This option makes sense + * only if `terminal` is set to `true` by the user or by an internal `output` + * check, otherwise the history caching mechanism is not initialized at all. + * @default [] + */ + history?: string[] | undefined; + historySize?: number | undefined; + prompt?: string | undefined; + crlfDelay?: number | undefined; + /** + * If `true`, when a new input line added + * to the history list duplicates an older one, this removes the older line + * from the list. + * @default false + */ + removeHistoryDuplicates?: boolean | undefined; + escapeCodeTimeout?: number | undefined; + tabSize?: number | undefined; + } + /** + * The `readline.createInterface()` method creates a new `readline.Interface`instance. + * + * ```js + * const readline = require('node:readline'); + * const rl = readline.createInterface({ + * input: process.stdin, + * output: process.stdout, + * }); + * ``` + * + * Once the `readline.Interface` instance is created, the most common case is to + * listen for the `'line'` event: + * + * ```js + * rl.on('line', (line) => { + * console.log(`Received: ${line}`); + * }); + * ``` + * + * If `terminal` is `true` for this instance then the `output` stream will get + * the best compatibility if it defines an `output.columns` property and emits + * a `'resize'` event on the `output` if or when the columns ever change + * (`process.stdout` does this automatically when it is a TTY). + * + * When creating a `readline.Interface` using `stdin` as input, the program + * will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without + * waiting for user input, call `process.stdin.unref()`. + * @since v0.1.98 + */ + export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; + export function createInterface(options: ReadLineOptions): Interface; + /** + * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input. + * + * Optionally, `interface` specifies a `readline.Interface` instance for which + * autocompletion is disabled when copy-pasted input is detected. + * + * If the `stream` is a `TTY`, then it must be in raw mode. + * + * This is automatically called by any readline instance on its `input` if the`input` is a terminal. Closing the `readline` instance does not stop + * the `input` from emitting `'keypress'` events. + * + * ```js + * readline.emitKeypressEvents(process.stdin); + * if (process.stdin.isTTY) + * process.stdin.setRawMode(true); + * ``` + * + * ## Example: Tiny CLI + * + * The following example illustrates the use of `readline.Interface` class to + * implement a small command-line interface: + * + * ```js + * const readline = require('node:readline'); + * const rl = readline.createInterface({ + * input: process.stdin, + * output: process.stdout, + * prompt: 'OHAI> ', + * }); + * + * rl.prompt(); + * + * rl.on('line', (line) => { + * switch (line.trim()) { + * case 'hello': + * console.log('world!'); + * break; + * default: + * console.log(`Say what? I might have heard '${line.trim()}'`); + * break; + * } + * rl.prompt(); + * }).on('close', () => { + * console.log('Have a great day!'); + * process.exit(0); + * }); + * ``` + * + * ## Example: Read file stream line-by-Line + * + * A common use case for `readline` is to consume an input file one line at a + * time. The easiest way to do so is leveraging the `fs.ReadStream` API as + * well as a `for await...of` loop: + * + * ```js + * const fs = require('node:fs'); + * const readline = require('node:readline'); + * + * async function processLineByLine() { + * const fileStream = fs.createReadStream('input.txt'); + * + * const rl = readline.createInterface({ + * input: fileStream, + * crlfDelay: Infinity, + * }); + * // Note: we use the crlfDelay option to recognize all instances of CR LF + * // ('\r\n') in input.txt as a single line break. + * + * for await (const line of rl) { + * // Each line in input.txt will be successively available here as `line`. + * console.log(`Line from file: ${line}`); + * } + * } + * + * processLineByLine(); + * ``` + * + * Alternatively, one could use the `'line'` event: + * + * ```js + * const fs = require('node:fs'); + * const readline = require('node:readline'); + * + * const rl = readline.createInterface({ + * input: fs.createReadStream('sample.txt'), + * crlfDelay: Infinity, + * }); + * + * rl.on('line', (line) => { + * console.log(`Line from file: ${line}`); + * }); + * ``` + * + * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied: + * + * ```js + * const { once } = require('node:events'); + * const { createReadStream } = require('node:fs'); + * const { createInterface } = require('node:readline'); + * + * (async function processLineByLine() { + * try { + * const rl = createInterface({ + * input: createReadStream('big-file.txt'), + * crlfDelay: Infinity, + * }); + * + * rl.on('line', (line) => { + * // Process the line. + * }); + * + * await once(rl, 'close'); + * + * console.log('File processed.'); + * } catch (err) { + * console.error(err); + * } + * })(); + * ``` + * @since v0.7.7 + */ + export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; + export type Direction = -1 | 0 | 1; + export interface CursorPos { + rows: number; + cols: number; + } + /** + * The `readline.clearLine()` method clears current line of given `TTY` stream + * in a specified direction identified by `dir`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; + /** + * The `readline.clearScreenDown()` method clears the given `TTY` stream from + * the current position of the cursor down. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; + /** + * The `readline.cursorTo()` method moves cursor to the specified position in a + * given `TTY` `stream`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; + /** + * The `readline.moveCursor()` method moves the cursor _relative_ to its current + * position in a given `TTY` `stream`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; +} +declare module 'node:readline' { + export * from 'readline'; +} diff --git a/node_modules/@types/node/ts4.8/readline/promises.d.ts b/node_modules/@types/node/ts4.8/readline/promises.d.ts new file mode 100755 index 0000000..079fbdf --- /dev/null +++ b/node_modules/@types/node/ts4.8/readline/promises.d.ts @@ -0,0 +1,145 @@ +/** + * @since v17.0.0 + * @experimental + */ +declare module 'readline/promises' { + import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline'; + import { Abortable } from 'node:events'; + /** + * Instances of the `readlinePromises.Interface` class are constructed using the`readlinePromises.createInterface()` method. Every instance is associated with a + * single `input` `Readable` stream and a single `output` `Writable` stream. + * The `output` stream is used to print prompts for user input that arrives on, + * and is read from, the `input` stream. + * @since v17.0.0 + */ + class Interface extends _Interface { + /** + * The `rl.question()` method displays the `query` by writing it to the `output`, + * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument. + * + * When called, `rl.question()` will resume the `input` stream if it has been + * paused. + * + * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written. + * + * If the question is called after `rl.close()`, it returns a rejected promise. + * + * Example usage: + * + * ```js + * const answer = await rl.question('What is your favorite food? '); + * console.log(`Oh, so your favorite food is ${answer}`); + * ``` + * + * Using an `AbortSignal` to cancel a question. + * + * ```js + * const signal = AbortSignal.timeout(10_000); + * + * signal.addEventListener('abort', () => { + * console.log('The food question timed out'); + * }, { once: true }); + * + * const answer = await rl.question('What is your favorite food? ', { signal }); + * console.log(`Oh, so your favorite food is ${answer}`); + * ``` + * @since v17.0.0 + * @param query A statement or query to write to `output`, prepended to the prompt. + * @return A promise that is fulfilled with the user's input in response to the `query`. + */ + question(query: string): Promise; + question(query: string, options: Abortable): Promise; + } + /** + * @since v17.0.0 + */ + class Readline { + /** + * @param stream A TTY stream. + */ + constructor( + stream: NodeJS.WritableStream, + options?: { + autoCommit?: boolean; + } + ); + /** + * The `rl.clearLine()` method adds to the internal list of pending action an + * action that clears current line of the associated `stream` in a specified + * direction identified by `dir`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. + * @since v17.0.0 + * @return this + */ + clearLine(dir: Direction): this; + /** + * The `rl.clearScreenDown()` method adds to the internal list of pending action an + * action that clears the associated stream from the current position of the + * cursor down. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. + * @since v17.0.0 + * @return this + */ + clearScreenDown(): this; + /** + * The `rl.commit()` method sends all the pending actions to the associated`stream` and clears the internal list of pending actions. + * @since v17.0.0 + */ + commit(): Promise; + /** + * The `rl.cursorTo()` method adds to the internal list of pending action an action + * that moves cursor to the specified position in the associated `stream`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. + * @since v17.0.0 + * @return this + */ + cursorTo(x: number, y?: number): this; + /** + * The `rl.moveCursor()` method adds to the internal list of pending action an + * action that moves the cursor _relative_ to its current position in the + * associated `stream`. + * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. + * @since v17.0.0 + * @return this + */ + moveCursor(dx: number, dy: number): this; + /** + * The `rl.rollback` methods clears the internal list of pending actions without + * sending it to the associated `stream`. + * @since v17.0.0 + * @return this + */ + rollback(): this; + } + /** + * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface`instance. + * + * ```js + * const readlinePromises = require('node:readline/promises'); + * const rl = readlinePromises.createInterface({ + * input: process.stdin, + * output: process.stdout, + * }); + * ``` + * + * Once the `readlinePromises.Interface` instance is created, the most common case + * is to listen for the `'line'` event: + * + * ```js + * rl.on('line', (line) => { + * console.log(`Received: ${line}`); + * }); + * ``` + * + * If `terminal` is `true` for this instance then the `output` stream will get + * the best compatibility if it defines an `output.columns` property and emits + * a `'resize'` event on the `output` if or when the columns ever change + * (`process.stdout` does this automatically when it is a TTY). + * @since v17.0.0 + */ + function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; + function createInterface(options: ReadLineOptions): Interface; +} +declare module 'node:readline/promises' { + export * from 'readline/promises'; +} diff --git a/node_modules/@types/node/ts4.8/repl.d.ts b/node_modules/@types/node/ts4.8/repl.d.ts new file mode 100755 index 0000000..c8147ed --- /dev/null +++ b/node_modules/@types/node/ts4.8/repl.d.ts @@ -0,0 +1,424 @@ +/** + * The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation + * that is available both as a standalone program or includible in other + * applications. It can be accessed using: + * + * ```js + * const repl = require('node:repl'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/repl.js) + */ +declare module 'repl' { + import { Interface, Completer, AsyncCompleter } from 'node:readline'; + import { Context } from 'node:vm'; + import { InspectOptions } from 'node:util'; + interface ReplOptions { + /** + * The input prompt to display. + * @default "> " + */ + prompt?: string | undefined; + /** + * The `Readable` stream from which REPL input will be read. + * @default process.stdin + */ + input?: NodeJS.ReadableStream | undefined; + /** + * The `Writable` stream to which REPL output will be written. + * @default process.stdout + */ + output?: NodeJS.WritableStream | undefined; + /** + * If `true`, specifies that the output should be treated as a TTY terminal, and have + * ANSI/VT100 escape codes written to it. + * Default: checking the value of the `isTTY` property on the output stream upon + * instantiation. + */ + terminal?: boolean | undefined; + /** + * The function to be used when evaluating each given line of input. + * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can + * error with `repl.Recoverable` to indicate the input was incomplete and prompt for + * additional lines. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_default_evaluation + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_custom_evaluation_functions + */ + eval?: REPLEval | undefined; + /** + * Defines if the repl prints output previews or not. + * @default `true` Always `false` in case `terminal` is falsy. + */ + preview?: boolean | undefined; + /** + * If `true`, specifies that the default `writer` function should include ANSI color + * styling to REPL output. If a custom `writer` function is provided then this has no + * effect. + * Default: the REPL instance's `terminal` value. + */ + useColors?: boolean | undefined; + /** + * If `true`, specifies that the default evaluation function will use the JavaScript + * `global` as the context as opposed to creating a new separate context for the REPL + * instance. The node CLI REPL sets this value to `true`. + * Default: `false`. + */ + useGlobal?: boolean | undefined; + /** + * If `true`, specifies that the default writer will not output the return value of a + * command if it evaluates to `undefined`. + * Default: `false`. + */ + ignoreUndefined?: boolean | undefined; + /** + * The function to invoke to format the output of each command before writing to `output`. + * Default: a wrapper for `util.inspect`. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output + */ + writer?: REPLWriter | undefined; + /** + * An optional function used for custom Tab auto completion. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function + */ + completer?: Completer | AsyncCompleter | undefined; + /** + * A flag that specifies whether the default evaluator executes all JavaScript commands in + * strict mode or default (sloppy) mode. + * Accepted values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined; + /** + * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is + * pressed. This cannot be used together with a custom `eval` function. + * Default: `false`. + */ + breakEvalOnSigint?: boolean | undefined; + } + type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void; + type REPLWriter = (this: REPLServer, obj: any) => string; + /** + * This is the default "writer" value, if none is passed in the REPL options, + * and it can be overridden by custom print functions. + */ + const writer: REPLWriter & { + options: InspectOptions; + }; + type REPLCommandAction = (this: REPLServer, text: string) => void; + interface REPLCommand { + /** + * Help text to be displayed when `.help` is entered. + */ + help?: string | undefined; + /** + * The function to execute, optionally accepting a single string argument. + */ + action: REPLCommandAction; + } + /** + * Instances of `repl.REPLServer` are created using the {@link start} method + * or directly using the JavaScript `new` keyword. + * + * ```js + * const repl = require('node:repl'); + * + * const options = { useColors: true }; + * + * const firstInstance = repl.start(options); + * const secondInstance = new repl.REPLServer(options); + * ``` + * @since v0.1.91 + */ + class REPLServer extends Interface { + /** + * The `vm.Context` provided to the `eval` function to be used for JavaScript + * evaluation. + */ + readonly context: Context; + /** + * @deprecated since v14.3.0 - Use `input` instead. + */ + readonly inputStream: NodeJS.ReadableStream; + /** + * @deprecated since v14.3.0 - Use `output` instead. + */ + readonly outputStream: NodeJS.WritableStream; + /** + * The `Readable` stream from which REPL input will be read. + */ + readonly input: NodeJS.ReadableStream; + /** + * The `Writable` stream to which REPL output will be written. + */ + readonly output: NodeJS.WritableStream; + /** + * The commands registered via `replServer.defineCommand()`. + */ + readonly commands: NodeJS.ReadOnlyDict; + /** + * A value indicating whether the REPL is currently in "editor mode". + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys + */ + readonly editorMode: boolean; + /** + * A value indicating whether the `_` variable has been assigned. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreAssigned: boolean; + /** + * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly last: any; + /** + * A value indicating whether the `_error` variable has been assigned. + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly underscoreErrAssigned: boolean; + /** + * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). + * + * @since v9.8.0 + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable + */ + readonly lastError: any; + /** + * Specified in the REPL options, this is the function to be used when evaluating each + * given line of input. If not specified in the REPL options, this is an async wrapper + * for the JavaScript `eval()` function. + */ + readonly eval: REPLEval; + /** + * Specified in the REPL options, this is a value indicating whether the default + * `writer` function should include ANSI color styling to REPL output. + */ + readonly useColors: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `eval` + * function will use the JavaScript `global` as the context as opposed to creating a new + * separate context for the REPL instance. + */ + readonly useGlobal: boolean; + /** + * Specified in the REPL options, this is a value indicating whether the default `writer` + * function should output the result of a command if it evaluates to `undefined`. + */ + readonly ignoreUndefined: boolean; + /** + * Specified in the REPL options, this is the function to invoke to format the output of + * each command before writing to `outputStream`. If not specified in the REPL options, + * this will be a wrapper for `util.inspect`. + */ + readonly writer: REPLWriter; + /** + * Specified in the REPL options, this is the function to use for custom Tab auto-completion. + */ + readonly completer: Completer | AsyncCompleter; + /** + * Specified in the REPL options, this is a flag that specifies whether the default `eval` + * function should execute all JavaScript commands in strict mode or default (sloppy) mode. + * Possible values are: + * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. + * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to + * prefacing every repl statement with `'use strict'`. + */ + readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; + /** + * NOTE: According to the documentation: + * + * > Instances of `repl.REPLServer` are created using the `repl.start()` method and + * > _should not_ be created directly using the JavaScript `new` keyword. + * + * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver + */ + private constructor(); + /** + * The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands + * to the REPL instance. Such commands are invoked by typing a `.` followed by the`keyword`. The `cmd` is either a `Function` or an `Object` with the following + * properties: + * + * The following example shows two new commands added to the REPL instance: + * + * ```js + * const repl = require('node:repl'); + * + * const replServer = repl.start({ prompt: '> ' }); + * replServer.defineCommand('sayhello', { + * help: 'Say hello', + * action(name) { + * this.clearBufferedCommand(); + * console.log(`Hello, ${name}!`); + * this.displayPrompt(); + * }, + * }); + * replServer.defineCommand('saybye', function saybye() { + * console.log('Goodbye!'); + * this.close(); + * }); + * ``` + * + * The new commands can then be used from within the REPL instance: + * + * ```console + * > .sayhello Node.js User + * Hello, Node.js User! + * > .saybye + * Goodbye! + * ``` + * @since v0.3.0 + * @param keyword The command keyword (_without_ a leading `.` character). + * @param cmd The function to invoke when the command is processed. + */ + defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; + /** + * The `replServer.displayPrompt()` method readies the REPL instance for input + * from the user, printing the configured `prompt` to a new line in the `output`and resuming the `input` to accept new input. + * + * When multi-line input is being entered, an ellipsis is printed rather than the + * 'prompt'. + * + * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`. + * + * The `replServer.displayPrompt` method is primarily intended to be called from + * within the action function for commands registered using the`replServer.defineCommand()` method. + * @since v0.1.91 + */ + displayPrompt(preserveCursor?: boolean): void; + /** + * The `replServer.clearBufferedCommand()` method clears any command that has been + * buffered but not yet executed. This method is primarily intended to be + * called from within the action function for commands registered using the`replServer.defineCommand()` method. + * @since v9.0.0 + */ + clearBufferedCommand(): void; + /** + * Initializes a history log file for the REPL instance. When executing the + * Node.js binary and using the command-line REPL, a history file is initialized + * by default. However, this is not the case when creating a REPL + * programmatically. Use this method to initialize a history log file when working + * with REPL instances programmatically. + * @since v11.10.0 + * @param historyPath the path to the history file + * @param callback called when history writes are ready or upon error + */ + setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void; + /** + * events.EventEmitter + * 1. close - inherited from `readline.Interface` + * 2. line - inherited from `readline.Interface` + * 3. pause - inherited from `readline.Interface` + * 4. resume - inherited from `readline.Interface` + * 5. SIGCONT - inherited from `readline.Interface` + * 6. SIGINT - inherited from `readline.Interface` + * 7. SIGTSTP - inherited from `readline.Interface` + * 8. exit + * 9. reset + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'close', listener: () => void): this; + addListener(event: 'line', listener: (input: string) => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: 'SIGCONT', listener: () => void): this; + addListener(event: 'SIGINT', listener: () => void): this; + addListener(event: 'SIGTSTP', listener: () => void): this; + addListener(event: 'exit', listener: () => void): this; + addListener(event: 'reset', listener: (context: Context) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'close'): boolean; + emit(event: 'line', input: string): boolean; + emit(event: 'pause'): boolean; + emit(event: 'resume'): boolean; + emit(event: 'SIGCONT'): boolean; + emit(event: 'SIGINT'): boolean; + emit(event: 'SIGTSTP'): boolean; + emit(event: 'exit'): boolean; + emit(event: 'reset', context: Context): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'close', listener: () => void): this; + on(event: 'line', listener: (input: string) => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: 'SIGCONT', listener: () => void): this; + on(event: 'SIGINT', listener: () => void): this; + on(event: 'SIGTSTP', listener: () => void): this; + on(event: 'exit', listener: () => void): this; + on(event: 'reset', listener: (context: Context) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'line', listener: (input: string) => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: 'SIGCONT', listener: () => void): this; + once(event: 'SIGINT', listener: () => void): this; + once(event: 'SIGTSTP', listener: () => void): this; + once(event: 'exit', listener: () => void): this; + once(event: 'reset', listener: (context: Context) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'line', listener: (input: string) => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: 'SIGCONT', listener: () => void): this; + prependListener(event: 'SIGINT', listener: () => void): this; + prependListener(event: 'SIGTSTP', listener: () => void): this; + prependListener(event: 'exit', listener: () => void): this; + prependListener(event: 'reset', listener: (context: Context) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'line', listener: (input: string) => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: 'SIGCONT', listener: () => void): this; + prependOnceListener(event: 'SIGINT', listener: () => void): this; + prependOnceListener(event: 'SIGTSTP', listener: () => void): this; + prependOnceListener(event: 'exit', listener: () => void): this; + prependOnceListener(event: 'reset', listener: (context: Context) => void): this; + } + /** + * A flag passed in the REPL options. Evaluates expressions in sloppy mode. + */ + const REPL_MODE_SLOPPY: unique symbol; + /** + * A flag passed in the REPL options. Evaluates expressions in strict mode. + * This is equivalent to prefacing every repl statement with `'use strict'`. + */ + const REPL_MODE_STRICT: unique symbol; + /** + * The `repl.start()` method creates and starts a {@link REPLServer} instance. + * + * If `options` is a string, then it specifies the input prompt: + * + * ```js + * const repl = require('node:repl'); + * + * // a Unix style prompt + * repl.start('$ '); + * ``` + * @since v0.1.91 + */ + function start(options?: string | ReplOptions): REPLServer; + /** + * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. + * + * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors + */ + class Recoverable extends SyntaxError { + err: Error; + constructor(err: Error); + } +} +declare module 'node:repl' { + export * from 'repl'; +} diff --git a/node_modules/@types/node/ts4.8/stream.d.ts b/node_modules/@types/node/ts4.8/stream.d.ts new file mode 100755 index 0000000..98866eb --- /dev/null +++ b/node_modules/@types/node/ts4.8/stream.d.ts @@ -0,0 +1,1430 @@ +/** + * A stream is an abstract interface for working with streaming data in Node.js. + * The `node:stream` module provides an API for implementing the stream interface. + * + * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances. + * + * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`. + * + * To access the `node:stream` module: + * + * ```js + * const stream = require('node:stream'); + * ``` + * + * The `node:stream` module is useful for creating new types of stream instances. + * It is usually not necessary to use the `node:stream` module to consume streams. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/stream.js) + */ +declare module 'stream' { + import { EventEmitter, Abortable } from 'node:events'; + import { Blob as NodeBlob } from 'node:buffer'; + import * as streamPromises from 'node:stream/promises'; + import * as streamConsumers from 'node:stream/consumers'; + import * as streamWeb from 'node:stream/web'; + + type ComposeFnParam = (source: any) => void; + + class internal extends EventEmitter { + pipe( + destination: T, + options?: { + end?: boolean | undefined; + } + ): T; + compose(stream: T | ComposeFnParam | Iterable | AsyncIterable, options?: { signal: AbortSignal }): T; + } + import Stream = internal.Stream; + import Readable = internal.Readable; + import ReadableOptions = internal.ReadableOptions; + class ReadableBase extends Stream implements NodeJS.ReadableStream { + /** + * A utility method for creating Readable Streams out of iterators. + */ + static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; + /** + * Returns whether the stream has been read from or cancelled. + * @since v16.8.0 + */ + static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean; + /** + * Returns whether the stream was destroyed or errored before emitting `'end'`. + * @since v16.8.0 + * @experimental + */ + readonly readableAborted: boolean; + /** + * Is `true` if it is safe to call `readable.read()`, which means + * the stream has not been destroyed or emitted `'error'` or `'end'`. + * @since v11.4.0 + */ + readable: boolean; + /** + * Returns whether `'data'` has been emitted. + * @since v16.7.0, v14.18.0 + * @experimental + */ + readonly readableDidRead: boolean; + /** + * Getter for the property `encoding` of a given `Readable` stream. The `encoding`property can be set using the `readable.setEncoding()` method. + * @since v12.7.0 + */ + readonly readableEncoding: BufferEncoding | null; + /** + * Becomes `true` when `'end'` event is emitted. + * @since v12.9.0 + */ + readonly readableEnded: boolean; + /** + * This property reflects the current state of a `Readable` stream as described + * in the `Three states` section. + * @since v9.4.0 + */ + readonly readableFlowing: boolean | null; + /** + * Returns the value of `highWaterMark` passed when creating this `Readable`. + * @since v9.3.0 + */ + readonly readableHighWaterMark: number; + /** + * This property contains the number of bytes (or objects) in the queue + * ready to be read. The value provides introspection data regarding + * the status of the `highWaterMark`. + * @since v9.4.0 + */ + readonly readableLength: number; + /** + * Getter for the property `objectMode` of a given `Readable` stream. + * @since v12.3.0 + */ + readonly readableObjectMode: boolean; + /** + * Is `true` after `readable.destroy()` has been called. + * @since v8.0.0 + */ + destroyed: boolean; + /** + * Is `true` after `'close'` has been emitted. + * @since v18.0.0 + */ + readonly closed: boolean; + /** + * Returns error if the stream has been destroyed with an error. + * @since v18.0.0 + */ + readonly errored: Error | null; + constructor(opts?: ReadableOptions); + _construct?(callback: (error?: Error | null) => void): void; + _read(size: number): void; + /** + * The `readable.read()` method reads data out of the internal buffer and + * returns it. If no data is available to be read, `null` is returned. By default, + * the data is returned as a `Buffer` object unless an encoding has been + * specified using the `readable.setEncoding()` method or the stream is operating + * in object mode. + * + * The optional `size` argument specifies a specific number of bytes to read. If`size` bytes are not available to be read, `null` will be returned _unless_the stream has ended, in which + * case all of the data remaining in the internal + * buffer will be returned. + * + * If the `size` argument is not specified, all of the data contained in the + * internal buffer will be returned. + * + * The `size` argument must be less than or equal to 1 GiB. + * + * The `readable.read()` method should only be called on `Readable` streams + * operating in paused mode. In flowing mode, `readable.read()` is called + * automatically until the internal buffer is fully drained. + * + * ```js + * const readable = getReadableStreamSomehow(); + * + * // 'readable' may be triggered multiple times as data is buffered in + * readable.on('readable', () => { + * let chunk; + * console.log('Stream is readable (new data received in buffer)'); + * // Use a loop to make sure we read all currently available data + * while (null !== (chunk = readable.read())) { + * console.log(`Read ${chunk.length} bytes of data...`); + * } + * }); + * + * // 'end' will be triggered once when there is no more data available + * readable.on('end', () => { + * console.log('Reached end of stream.'); + * }); + * ``` + * + * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks + * are not concatenated. A `while` loop is necessary to consume all data + * currently in the buffer. When reading a large file `.read()` may return `null`, + * having consumed all buffered content so far, but there is still more data to + * come not yet buffered. In this case a new `'readable'` event will be emitted + * when there is more data in the buffer. Finally the `'end'` event will be + * emitted when there is no more data to come. + * + * Therefore to read a file's whole contents from a `readable`, it is necessary + * to collect chunks across multiple `'readable'` events: + * + * ```js + * const chunks = []; + * + * readable.on('readable', () => { + * let chunk; + * while (null !== (chunk = readable.read())) { + * chunks.push(chunk); + * } + * }); + * + * readable.on('end', () => { + * const content = chunks.join(''); + * }); + * ``` + * + * A `Readable` stream in object mode will always return a single item from + * a call to `readable.read(size)`, regardless of the value of the`size` argument. + * + * If the `readable.read()` method returns a chunk of data, a `'data'` event will + * also be emitted. + * + * Calling {@link read} after the `'end'` event has + * been emitted will return `null`. No runtime error will be raised. + * @since v0.9.4 + * @param size Optional argument to specify how much data to read. + */ + read(size?: number): any; + /** + * The `readable.setEncoding()` method sets the character encoding for + * data read from the `Readable` stream. + * + * By default, no encoding is assigned and stream data will be returned as`Buffer` objects. Setting an encoding causes the stream data + * to be returned as strings of the specified encoding rather than as `Buffer`objects. For instance, calling `readable.setEncoding('utf8')` will cause the + * output data to be interpreted as UTF-8 data, and passed as strings. Calling`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal + * string format. + * + * The `Readable` stream will properly handle multi-byte characters delivered + * through the stream that would otherwise become improperly decoded if simply + * pulled from the stream as `Buffer` objects. + * + * ```js + * const readable = getReadableStreamSomehow(); + * readable.setEncoding('utf8'); + * readable.on('data', (chunk) => { + * assert.equal(typeof chunk, 'string'); + * console.log('Got %d characters of string data:', chunk.length); + * }); + * ``` + * @since v0.9.4 + * @param encoding The encoding to use. + */ + setEncoding(encoding: BufferEncoding): this; + /** + * The `readable.pause()` method will cause a stream in flowing mode to stop + * emitting `'data'` events, switching out of flowing mode. Any data that + * becomes available will remain in the internal buffer. + * + * ```js + * const readable = getReadableStreamSomehow(); + * readable.on('data', (chunk) => { + * console.log(`Received ${chunk.length} bytes of data.`); + * readable.pause(); + * console.log('There will be no additional data for 1 second.'); + * setTimeout(() => { + * console.log('Now data will start flowing again.'); + * readable.resume(); + * }, 1000); + * }); + * ``` + * + * The `readable.pause()` method has no effect if there is a `'readable'`event listener. + * @since v0.9.4 + */ + pause(): this; + /** + * The `readable.resume()` method causes an explicitly paused `Readable` stream to + * resume emitting `'data'` events, switching the stream into flowing mode. + * + * The `readable.resume()` method can be used to fully consume the data from a + * stream without actually processing any of that data: + * + * ```js + * getReadableStreamSomehow() + * .resume() + * .on('end', () => { + * console.log('Reached the end, but did not read anything.'); + * }); + * ``` + * + * The `readable.resume()` method has no effect if there is a `'readable'`event listener. + * @since v0.9.4 + */ + resume(): this; + /** + * The `readable.isPaused()` method returns the current operating state of the`Readable`. This is used primarily by the mechanism that underlies the`readable.pipe()` method. In most + * typical cases, there will be no reason to + * use this method directly. + * + * ```js + * const readable = new stream.Readable(); + * + * readable.isPaused(); // === false + * readable.pause(); + * readable.isPaused(); // === true + * readable.resume(); + * readable.isPaused(); // === false + * ``` + * @since v0.11.14 + */ + isPaused(): boolean; + /** + * The `readable.unpipe()` method detaches a `Writable` stream previously attached + * using the {@link pipe} method. + * + * If the `destination` is not specified, then _all_ pipes are detached. + * + * If the `destination` is specified, but no pipe is set up for it, then + * the method does nothing. + * + * ```js + * const fs = require('node:fs'); + * const readable = getReadableStreamSomehow(); + * const writable = fs.createWriteStream('file.txt'); + * // All the data from readable goes into 'file.txt', + * // but only for the first second. + * readable.pipe(writable); + * setTimeout(() => { + * console.log('Stop writing to file.txt.'); + * readable.unpipe(writable); + * console.log('Manually close the file stream.'); + * writable.end(); + * }, 1000); + * ``` + * @since v0.9.4 + * @param destination Optional specific stream to unpipe + */ + unpipe(destination?: NodeJS.WritableStream): this; + /** + * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the + * same as `readable.push(null)`, after which no more data can be written. The EOF + * signal is put at the end of the buffer and any buffered data will still be + * flushed. + * + * The `readable.unshift()` method pushes a chunk of data back into the internal + * buffer. This is useful in certain situations where a stream is being consumed by + * code that needs to "un-consume" some amount of data that it has optimistically + * pulled out of the source, so that the data can be passed on to some other party. + * + * The `stream.unshift(chunk)` method cannot be called after the `'end'` event + * has been emitted or a runtime error will be thrown. + * + * Developers using `stream.unshift()` often should consider switching to + * use of a `Transform` stream instead. See the `API for stream implementers` section for more information. + * + * ```js + * // Pull off a header delimited by \n\n. + * // Use unshift() if we get too much. + * // Call the callback with (error, header, stream). + * const { StringDecoder } = require('node:string_decoder'); + * function parseHeader(stream, callback) { + * stream.on('error', callback); + * stream.on('readable', onReadable); + * const decoder = new StringDecoder('utf8'); + * let header = ''; + * function onReadable() { + * let chunk; + * while (null !== (chunk = stream.read())) { + * const str = decoder.write(chunk); + * if (str.includes('\n\n')) { + * // Found the header boundary. + * const split = str.split(/\n\n/); + * header += split.shift(); + * const remaining = split.join('\n\n'); + * const buf = Buffer.from(remaining, 'utf8'); + * stream.removeListener('error', callback); + * // Remove the 'readable' listener before unshifting. + * stream.removeListener('readable', onReadable); + * if (buf.length) + * stream.unshift(buf); + * // Now the body of the message can be read from the stream. + * callback(null, header, stream); + * return; + * } + * // Still reading the header. + * header += str; + * } + * } + * } + * ``` + * + * Unlike {@link push}, `stream.unshift(chunk)` will not + * end the reading process by resetting the internal reading state of the stream. + * This can cause unexpected results if `readable.unshift()` is called during a + * read (i.e. from within a {@link _read} implementation on a + * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately, + * however it is best to simply avoid calling `readable.unshift()` while in the + * process of performing a read. + * @since v0.9.11 + * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must be a string, `Buffer`, `Uint8Array`, or `null`. For object mode + * streams, `chunk` may be any JavaScript value. + * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. + */ + unshift(chunk: any, encoding?: BufferEncoding): void; + /** + * Prior to Node.js 0.10, streams did not implement the entire `node:stream`module API as it is currently defined. (See `Compatibility` for more + * information.) + * + * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the`readable.wrap()` method can be used to create a `Readable` + * stream that uses + * the old stream as its data source. + * + * It will rarely be necessary to use `readable.wrap()` but the method has been + * provided as a convenience for interacting with older Node.js applications and + * libraries. + * + * ```js + * const { OldReader } = require('./old-api-module.js'); + * const { Readable } = require('node:stream'); + * const oreader = new OldReader(); + * const myReader = new Readable().wrap(oreader); + * + * myReader.on('readable', () => { + * myReader.read(); // etc. + * }); + * ``` + * @since v0.9.4 + * @param stream An "old style" readable stream + */ + wrap(stream: NodeJS.ReadableStream): this; + push(chunk: any, encoding?: BufferEncoding): boolean; + _destroy(error: Error | null, callback: (error?: Error | null) => void): void; + /** + * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable + * stream will release any internal resources and subsequent calls to `push()`will be ignored. + * + * Once `destroy()` has been called any further calls will be a no-op and no + * further errors except from `_destroy()` may be emitted as `'error'`. + * + * Implementors should not override this method, but instead implement `readable._destroy()`. + * @since v8.0.0 + * @param error Error which will be passed as payload in `'error'` event + */ + destroy(error?: Error): this; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. data + * 3. end + * 4. error + * 5. pause + * 6. readable + * 7. resume + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: any) => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'readable', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'data', chunk: any): boolean; + emit(event: 'end'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'pause'): boolean; + emit(event: 'readable'): boolean; + emit(event: 'resume'): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: any) => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'readable', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: any) => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'readable', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: any) => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'readable', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: any) => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'readable', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: 'close', listener: () => void): this; + removeListener(event: 'data', listener: (chunk: any) => void): this; + removeListener(event: 'end', listener: () => void): this; + removeListener(event: 'error', listener: (err: Error) => void): this; + removeListener(event: 'pause', listener: () => void): this; + removeListener(event: 'readable', listener: () => void): this; + removeListener(event: 'resume', listener: () => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + [Symbol.asyncIterator](): AsyncIterableIterator; + /** + * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished. + * @since v20.4.0 + */ + [Symbol.asyncDispose](): Promise; + } + import WritableOptions = internal.WritableOptions; + class WritableBase extends Stream implements NodeJS.WritableStream { + /** + * Is `true` if it is safe to call `writable.write()`, which means + * the stream has not been destroyed, errored, or ended. + * @since v11.4.0 + */ + readonly writable: boolean; + /** + * Is `true` after `writable.end()` has been called. This property + * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead. + * @since v12.9.0 + */ + readonly writableEnded: boolean; + /** + * Is set to `true` immediately before the `'finish'` event is emitted. + * @since v12.6.0 + */ + readonly writableFinished: boolean; + /** + * Return the value of `highWaterMark` passed when creating this `Writable`. + * @since v9.3.0 + */ + readonly writableHighWaterMark: number; + /** + * This property contains the number of bytes (or objects) in the queue + * ready to be written. The value provides introspection data regarding + * the status of the `highWaterMark`. + * @since v9.4.0 + */ + readonly writableLength: number; + /** + * Getter for the property `objectMode` of a given `Writable` stream. + * @since v12.3.0 + */ + readonly writableObjectMode: boolean; + /** + * Number of times `writable.uncork()` needs to be + * called in order to fully uncork the stream. + * @since v13.2.0, v12.16.0 + */ + readonly writableCorked: number; + /** + * Is `true` after `writable.destroy()` has been called. + * @since v8.0.0 + */ + destroyed: boolean; + /** + * Is `true` after `'close'` has been emitted. + * @since v18.0.0 + */ + readonly closed: boolean; + /** + * Returns error if the stream has been destroyed with an error. + * @since v18.0.0 + */ + readonly errored: Error | null; + /** + * Is `true` if the stream's buffer has been full and stream will emit `'drain'`. + * @since v15.2.0, v14.17.0 + */ + readonly writableNeedDrain: boolean; + constructor(opts?: WritableOptions); + _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + _writev?( + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + _construct?(callback: (error?: Error | null) => void): void; + _destroy(error: Error | null, callback: (error?: Error | null) => void): void; + _final(callback: (error?: Error | null) => void): void; + /** + * The `writable.write()` method writes some data to the stream, and calls the + * supplied `callback` once the data has been fully handled. If an error + * occurs, the `callback` will be called with the error as its + * first argument. The `callback` is called asynchronously and before `'error'` is + * emitted. + * + * The return value is `true` if the internal buffer is less than the`highWaterMark` configured when the stream was created after admitting `chunk`. + * If `false` is returned, further attempts to write data to the stream should + * stop until the `'drain'` event is emitted. + * + * While a stream is not draining, calls to `write()` will buffer `chunk`, and + * return false. Once all currently buffered chunks are drained (accepted for + * delivery by the operating system), the `'drain'` event will be emitted. + * Once `write()` returns false, do not write more chunks + * until the `'drain'` event is emitted. While calling `write()` on a stream that + * is not draining is allowed, Node.js will buffer all written chunks until + * maximum memory usage occurs, at which point it will abort unconditionally. + * Even before it aborts, high memory usage will cause poor garbage collector + * performance and high RSS (which is not typically released back to the system, + * even after the memory is no longer required). Since TCP sockets may never + * drain if the remote peer does not read the data, writing a socket that is + * not draining may lead to a remotely exploitable vulnerability. + * + * Writing data while the stream is not draining is particularly + * problematic for a `Transform`, because the `Transform` streams are paused + * by default until they are piped or a `'data'` or `'readable'` event handler + * is added. + * + * If the data to be written can be generated or fetched on demand, it is + * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is + * possible to respect backpressure and avoid memory issues using the `'drain'` event: + * + * ```js + * function write(data, cb) { + * if (!stream.write(data)) { + * stream.once('drain', cb); + * } else { + * process.nextTick(cb); + * } + * } + * + * // Wait for cb to be called before doing any other write. + * write('hello', () => { + * console.log('Write completed, do more writes now.'); + * }); + * ``` + * + * A `Writable` stream in object mode will always ignore the `encoding` argument. + * @since v0.9.4 + * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any + * JavaScript value other than `null`. + * @param [encoding='utf8'] The encoding, if `chunk` is a string. + * @param callback Callback for when this chunk of data is flushed. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean; + write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean; + /** + * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream. + * @since v0.11.15 + * @param encoding The new default encoding + */ + setDefaultEncoding(encoding: BufferEncoding): this; + /** + * Calling the `writable.end()` method signals that no more data will be written + * to the `Writable`. The optional `chunk` and `encoding` arguments allow one + * final additional chunk of data to be written immediately before closing the + * stream. + * + * Calling the {@link write} method after calling {@link end} will raise an error. + * + * ```js + * // Write 'hello, ' and then end with 'world!'. + * const fs = require('node:fs'); + * const file = fs.createWriteStream('example.txt'); + * file.write('hello, '); + * file.end('world!'); + * // Writing more now is not allowed! + * ``` + * @since v0.9.4 + * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any + * JavaScript value other than `null`. + * @param encoding The encoding if `chunk` is a string + * @param callback Callback for when the stream is finished. + */ + end(cb?: () => void): this; + end(chunk: any, cb?: () => void): this; + end(chunk: any, encoding: BufferEncoding, cb?: () => void): this; + /** + * The `writable.cork()` method forces all written data to be buffered in memory. + * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called. + * + * The primary intent of `writable.cork()` is to accommodate a situation in which + * several small chunks are written to the stream in rapid succession. Instead of + * immediately forwarding them to the underlying destination, `writable.cork()`buffers all the chunks until `writable.uncork()` is called, which will pass them + * all to `writable._writev()`, if present. This prevents a head-of-line blocking + * situation where data is being buffered while waiting for the first small chunk + * to be processed. However, use of `writable.cork()` without implementing`writable._writev()` may have an adverse effect on throughput. + * + * See also: `writable.uncork()`, `writable._writev()`. + * @since v0.11.2 + */ + cork(): void; + /** + * The `writable.uncork()` method flushes all data buffered since {@link cork} was called. + * + * When using `writable.cork()` and `writable.uncork()` to manage the buffering + * of writes to a stream, defer calls to `writable.uncork()` using`process.nextTick()`. Doing so allows batching of all`writable.write()` calls that occur within a given Node.js event + * loop phase. + * + * ```js + * stream.cork(); + * stream.write('some '); + * stream.write('data '); + * process.nextTick(() => stream.uncork()); + * ``` + * + * If the `writable.cork()` method is called multiple times on a stream, the + * same number of calls to `writable.uncork()` must be called to flush the buffered + * data. + * + * ```js + * stream.cork(); + * stream.write('some '); + * stream.cork(); + * stream.write('data '); + * process.nextTick(() => { + * stream.uncork(); + * // The data will not be flushed until uncork() is called a second time. + * stream.uncork(); + * }); + * ``` + * + * See also: `writable.cork()`. + * @since v0.11.2 + */ + uncork(): void; + /** + * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the writable + * stream has ended and subsequent calls to `write()` or `end()` will result in + * an `ERR_STREAM_DESTROYED` error. + * This is a destructive and immediate way to destroy a stream. Previous calls to`write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error. + * Use `end()` instead of destroy if data should flush before close, or wait for + * the `'drain'` event before destroying the stream. + * + * Once `destroy()` has been called any further calls will be a no-op and no + * further errors except from `_destroy()` may be emitted as `'error'`. + * + * Implementors should not override this method, + * but instead implement `writable._destroy()`. + * @since v8.0.0 + * @param error Optional, an error to emit with `'error'` event. + */ + destroy(error?: Error): this; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. drain + * 3. error + * 4. finish + * 5. pipe + * 6. unpipe + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'pipe', listener: (src: Readable) => void): this; + addListener(event: 'unpipe', listener: (src: Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'drain'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'finish'): boolean; + emit(event: 'pipe', src: Readable): boolean; + emit(event: 'unpipe', src: Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'pipe', listener: (src: Readable) => void): this; + on(event: 'unpipe', listener: (src: Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'pipe', listener: (src: Readable) => void): this; + once(event: 'unpipe', listener: (src: Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'pipe', listener: (src: Readable) => void): this; + prependListener(event: 'unpipe', listener: (src: Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'pipe', listener: (src: Readable) => void): this; + prependOnceListener(event: 'unpipe', listener: (src: Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: 'close', listener: () => void): this; + removeListener(event: 'drain', listener: () => void): this; + removeListener(event: 'error', listener: (err: Error) => void): this; + removeListener(event: 'finish', listener: () => void): this; + removeListener(event: 'pipe', listener: (src: Readable) => void): this; + removeListener(event: 'unpipe', listener: (src: Readable) => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + namespace internal { + class Stream extends internal { + constructor(opts?: ReadableOptions); + } + interface StreamOptions extends Abortable { + emitClose?: boolean | undefined; + highWaterMark?: number | undefined; + objectMode?: boolean | undefined; + construct?(this: T, callback: (error?: Error | null) => void): void; + destroy?(this: T, error: Error | null, callback: (error: Error | null) => void): void; + autoDestroy?: boolean | undefined; + } + interface ReadableOptions extends StreamOptions { + encoding?: BufferEncoding | undefined; + read?(this: Readable, size: number): void; + } + /** + * @since v0.9.4 + */ + class Readable extends ReadableBase { + /** + * A utility method for creating a `Readable` from a web `ReadableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb(readableStream: streamWeb.ReadableStream, options?: Pick): Readable; + /** + * A utility method for creating a web `ReadableStream` from a `Readable`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamReadable: Readable): streamWeb.ReadableStream; + } + interface WritableOptions extends StreamOptions { + decodeStrings?: boolean | undefined; + defaultEncoding?: BufferEncoding | undefined; + write?(this: Writable, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + writev?( + this: Writable, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + final?(this: Writable, callback: (error?: Error | null) => void): void; + } + /** + * @since v0.9.4 + */ + class Writable extends WritableBase { + /** + * A utility method for creating a `Writable` from a web `WritableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb(writableStream: streamWeb.WritableStream, options?: Pick): Writable; + /** + * A utility method for creating a web `WritableStream` from a `Writable`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamWritable: Writable): streamWeb.WritableStream; + } + interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean | undefined; + readableObjectMode?: boolean | undefined; + writableObjectMode?: boolean | undefined; + readableHighWaterMark?: number | undefined; + writableHighWaterMark?: number | undefined; + writableCorked?: number | undefined; + construct?(this: Duplex, callback: (error?: Error | null) => void): void; + read?(this: Duplex, size: number): void; + write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + writev?( + this: Duplex, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + final?(this: Duplex, callback: (error?: Error | null) => void): void; + destroy?(this: Duplex, error: Error | null, callback: (error: Error | null) => void): void; + } + /** + * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces. + * + * Examples of `Duplex` streams include: + * + * * `TCP sockets` + * * `zlib streams` + * * `crypto streams` + * @since v0.9.4 + */ + class Duplex extends ReadableBase implements WritableBase { + readonly writable: boolean; + readonly writableEnded: boolean; + readonly writableFinished: boolean; + readonly writableHighWaterMark: number; + readonly writableLength: number; + readonly writableObjectMode: boolean; + readonly writableCorked: number; + readonly writableNeedDrain: boolean; + readonly closed: boolean; + readonly errored: Error | null; + /** + * If `false` then the stream will automatically end the writable side when the + * readable side ends. Set initially by the `allowHalfOpen` constructor option, + * which defaults to `true`. + * + * This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is + * emitted. + * @since v0.9.4 + */ + allowHalfOpen: boolean; + constructor(opts?: DuplexOptions); + /** + * A utility method for creating duplex streams. + * + * - `Stream` converts writable stream into writable `Duplex` and readable stream + * to `Duplex`. + * - `Blob` converts into readable `Duplex`. + * - `string` converts into readable `Duplex`. + * - `ArrayBuffer` converts into readable `Duplex`. + * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`. + * - `AsyncGeneratorFunction` converts into a readable/writable transform + * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield + * `null`. + * - `AsyncFunction` converts into a writable `Duplex`. Must return + * either `null` or `undefined` + * - `Object ({ writable, readable })` converts `readable` and + * `writable` into `Stream` and then combines them into `Duplex` where the + * `Duplex` will write to the `writable` and read from the `readable`. + * - `Promise` converts into readable `Duplex`. Value `null` is ignored. + * + * @since v16.8.0 + */ + static from(src: Stream | NodeBlob | ArrayBuffer | string | Iterable | AsyncIterable | AsyncGeneratorFunction | Promise | Object): Duplex; + _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + _writev?( + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + _destroy(error: Error | null, callback: (error: Error | null) => void): void; + _final(callback: (error?: Error | null) => void): void; + write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean; + write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; + setDefaultEncoding(encoding: BufferEncoding): this; + end(cb?: () => void): this; + end(chunk: any, cb?: () => void): this; + end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this; + cork(): void; + uncork(): void; + /** + * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`. + * @since v17.0.0 + * @experimental + */ + static toWeb(streamDuplex: Duplex): { + readable: streamWeb.ReadableStream; + writable: streamWeb.WritableStream; + }; + /** + * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`. + * @since v17.0.0 + * @experimental + */ + static fromWeb( + duplexStream: { + readable: streamWeb.ReadableStream; + writable: streamWeb.WritableStream; + }, + options?: Pick + ): Duplex; + /** + * Event emitter + * The defined events on documents including: + * 1. close + * 2. data + * 3. drain + * 4. end + * 5. error + * 6. finish + * 7. pause + * 8. pipe + * 9. readable + * 10. resume + * 11. unpipe + */ + addListener(event: 'close', listener: () => void): this; + addListener(event: 'data', listener: (chunk: any) => void): this; + addListener(event: 'drain', listener: () => void): this; + addListener(event: 'end', listener: () => void): this; + addListener(event: 'error', listener: (err: Error) => void): this; + addListener(event: 'finish', listener: () => void): this; + addListener(event: 'pause', listener: () => void): this; + addListener(event: 'pipe', listener: (src: Readable) => void): this; + addListener(event: 'readable', listener: () => void): this; + addListener(event: 'resume', listener: () => void): this; + addListener(event: 'unpipe', listener: (src: Readable) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + emit(event: 'close'): boolean; + emit(event: 'data', chunk: any): boolean; + emit(event: 'drain'): boolean; + emit(event: 'end'): boolean; + emit(event: 'error', err: Error): boolean; + emit(event: 'finish'): boolean; + emit(event: 'pause'): boolean; + emit(event: 'pipe', src: Readable): boolean; + emit(event: 'readable'): boolean; + emit(event: 'resume'): boolean; + emit(event: 'unpipe', src: Readable): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'close', listener: () => void): this; + on(event: 'data', listener: (chunk: any) => void): this; + on(event: 'drain', listener: () => void): this; + on(event: 'end', listener: () => void): this; + on(event: 'error', listener: (err: Error) => void): this; + on(event: 'finish', listener: () => void): this; + on(event: 'pause', listener: () => void): this; + on(event: 'pipe', listener: (src: Readable) => void): this; + on(event: 'readable', listener: () => void): this; + on(event: 'resume', listener: () => void): this; + on(event: 'unpipe', listener: (src: Readable) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + once(event: 'close', listener: () => void): this; + once(event: 'data', listener: (chunk: any) => void): this; + once(event: 'drain', listener: () => void): this; + once(event: 'end', listener: () => void): this; + once(event: 'error', listener: (err: Error) => void): this; + once(event: 'finish', listener: () => void): this; + once(event: 'pause', listener: () => void): this; + once(event: 'pipe', listener: (src: Readable) => void): this; + once(event: 'readable', listener: () => void): this; + once(event: 'resume', listener: () => void): this; + once(event: 'unpipe', listener: (src: Readable) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + prependListener(event: 'close', listener: () => void): this; + prependListener(event: 'data', listener: (chunk: any) => void): this; + prependListener(event: 'drain', listener: () => void): this; + prependListener(event: 'end', listener: () => void): this; + prependListener(event: 'error', listener: (err: Error) => void): this; + prependListener(event: 'finish', listener: () => void): this; + prependListener(event: 'pause', listener: () => void): this; + prependListener(event: 'pipe', listener: (src: Readable) => void): this; + prependListener(event: 'readable', listener: () => void): this; + prependListener(event: 'resume', listener: () => void): this; + prependListener(event: 'unpipe', listener: (src: Readable) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'close', listener: () => void): this; + prependOnceListener(event: 'data', listener: (chunk: any) => void): this; + prependOnceListener(event: 'drain', listener: () => void): this; + prependOnceListener(event: 'end', listener: () => void): this; + prependOnceListener(event: 'error', listener: (err: Error) => void): this; + prependOnceListener(event: 'finish', listener: () => void): this; + prependOnceListener(event: 'pause', listener: () => void): this; + prependOnceListener(event: 'pipe', listener: (src: Readable) => void): this; + prependOnceListener(event: 'readable', listener: () => void): this; + prependOnceListener(event: 'resume', listener: () => void): this; + prependOnceListener(event: 'unpipe', listener: (src: Readable) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + removeListener(event: 'close', listener: () => void): this; + removeListener(event: 'data', listener: (chunk: any) => void): this; + removeListener(event: 'drain', listener: () => void): this; + removeListener(event: 'end', listener: () => void): this; + removeListener(event: 'error', listener: (err: Error) => void): this; + removeListener(event: 'finish', listener: () => void): this; + removeListener(event: 'pause', listener: () => void): this; + removeListener(event: 'pipe', listener: (src: Readable) => void): this; + removeListener(event: 'readable', listener: () => void): this; + removeListener(event: 'resume', listener: () => void): this; + removeListener(event: 'unpipe', listener: (src: Readable) => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + } + type TransformCallback = (error?: Error | null, data?: any) => void; + interface TransformOptions extends DuplexOptions { + construct?(this: Transform, callback: (error?: Error | null) => void): void; + read?(this: Transform, size: number): void; + write?(this: Transform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; + writev?( + this: Transform, + chunks: Array<{ + chunk: any; + encoding: BufferEncoding; + }>, + callback: (error?: Error | null) => void + ): void; + final?(this: Transform, callback: (error?: Error | null) => void): void; + destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void; + transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; + flush?(this: Transform, callback: TransformCallback): void; + } + /** + * Transform streams are `Duplex` streams where the output is in some way + * related to the input. Like all `Duplex` streams, `Transform` streams + * implement both the `Readable` and `Writable` interfaces. + * + * Examples of `Transform` streams include: + * + * * `zlib streams` + * * `crypto streams` + * @since v0.9.4 + */ + class Transform extends Duplex { + constructor(opts?: TransformOptions); + _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; + _flush(callback: TransformCallback): void; + } + /** + * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is + * primarily for examples and testing, but there are some use cases where`stream.PassThrough` is useful as a building block for novel sorts of streams. + */ + class PassThrough extends Transform {} + /** + * A stream to attach a signal to. + * + * Attaches an AbortSignal to a readable or writeable stream. This lets code + * control stream destruction using an `AbortController`. + * + * Calling `abort` on the `AbortController` corresponding to the passed`AbortSignal` will behave the same way as calling `.destroy(new AbortError())`on the stream, and `controller.error(new + * AbortError())` for webstreams. + * + * ```js + * const fs = require('node:fs'); + * + * const controller = new AbortController(); + * const read = addAbortSignal( + * controller.signal, + * fs.createReadStream(('object.json')), + * ); + * // Later, abort the operation closing the stream + * controller.abort(); + * ``` + * + * Or using an `AbortSignal` with a readable stream as an async iterable: + * + * ```js + * const controller = new AbortController(); + * setTimeout(() => controller.abort(), 10_000); // set a timeout + * const stream = addAbortSignal( + * controller.signal, + * fs.createReadStream(('object.json')), + * ); + * (async () => { + * try { + * for await (const chunk of stream) { + * await process(chunk); + * } + * } catch (e) { + * if (e.name === 'AbortError') { + * // The operation was cancelled + * } else { + * throw e; + * } + * } + * })(); + * ``` + * + * Or using an `AbortSignal` with a ReadableStream: + * + * ```js + * const controller = new AbortController(); + * const rs = new ReadableStream({ + * start(controller) { + * controller.enqueue('hello'); + * controller.enqueue('world'); + * controller.close(); + * }, + * }); + * + * addAbortSignal(controller.signal, rs); + * + * finished(rs, (err) => { + * if (err) { + * if (err.name === 'AbortError') { + * // The operation was cancelled + * } + * } + * }); + * + * const reader = rs.getReader(); + * + * reader.read().then(({ value, done }) => { + * console.log(value); // hello + * console.log(done); // false + * controller.abort(); + * }); + * ``` + * @since v15.4.0 + * @param signal A signal representing possible cancellation + * @param stream a stream to attach a signal to + */ + function addAbortSignal(signal: AbortSignal, stream: T): T; + /** + * Returns the default highWaterMark used by streams. + * Defaults to `16384` (16 KiB), or `16` for `objectMode`. + * @since v19.9.0 + * @param objectMode + */ + function getDefaultHighWaterMark(objectMode: boolean): number; + /** + * Sets the default highWaterMark used by streams. + * @since v19.9.0 + * @param objectMode + * @param value highWaterMark value + */ + function setDefaultHighWaterMark(objectMode: boolean, value: number): void; + interface FinishedOptions extends Abortable { + error?: boolean | undefined; + readable?: boolean | undefined; + writable?: boolean | undefined; + } + /** + * A readable and/or writable stream/webstream. + * + * A function to get notified when a stream is no longer readable, writable + * or has experienced an error or a premature close event. + * + * ```js + * const { finished } = require('node:stream'); + * const fs = require('node:fs'); + * + * const rs = fs.createReadStream('archive.tar'); + * + * finished(rs, (err) => { + * if (err) { + * console.error('Stream failed.', err); + * } else { + * console.log('Stream is done reading.'); + * } + * }); + * + * rs.resume(); // Drain the stream. + * ``` + * + * Especially useful in error handling scenarios where a stream is destroyed + * prematurely (like an aborted HTTP request), and will not emit `'end'`or `'finish'`. + * + * The `finished` API provides `promise version`. + * + * `stream.finished()` leaves dangling event listeners (in particular`'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been + * invoked. The reason for this is so that unexpected `'error'` events (due to + * incorrect stream implementations) do not cause unexpected crashes. + * If this is unwanted behavior then the returned cleanup function needs to be + * invoked in the callback: + * + * ```js + * const cleanup = finished(rs, (err) => { + * cleanup(); + * // ... + * }); + * ``` + * @since v10.0.0 + * @param stream A readable and/or writable stream. + * @param callback A callback function that takes an optional error argument. + * @return A cleanup function which removes all registered listeners. + */ + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options: FinishedOptions, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void; + namespace finished { + function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise; + } + type PipelineSourceFunction = () => Iterable | AsyncIterable; + type PipelineSource = Iterable | AsyncIterable | NodeJS.ReadableStream | PipelineSourceFunction; + type PipelineTransform, U> = + | NodeJS.ReadWriteStream + | ((source: S extends (...args: any[]) => Iterable | AsyncIterable ? AsyncIterable : S) => AsyncIterable); + type PipelineTransformSource = PipelineSource | PipelineTransform; + type PipelineDestinationIterableFunction = (source: AsyncIterable) => AsyncIterable; + type PipelineDestinationPromiseFunction = (source: AsyncIterable) => Promise

; + type PipelineDestination, P> = S extends PipelineTransformSource + ? NodeJS.WritableStream | PipelineDestinationIterableFunction | PipelineDestinationPromiseFunction + : never; + type PipelineCallback> = S extends PipelineDestinationPromiseFunction + ? (err: NodeJS.ErrnoException | null, value: P) => void + : (err: NodeJS.ErrnoException | null) => void; + type PipelinePromise> = S extends PipelineDestinationPromiseFunction ? Promise

: Promise; + interface PipelineOptions { + signal?: AbortSignal | undefined; + end?: boolean | undefined; + } + /** + * A module method to pipe between streams and generators forwarding errors and + * properly cleaning up and provide a callback when the pipeline is complete. + * + * ```js + * const { pipeline } = require('node:stream'); + * const fs = require('node:fs'); + * const zlib = require('node:zlib'); + * + * // Use the pipeline API to easily pipe a series of streams + * // together and get notified when the pipeline is fully done. + * + * // A pipeline to gzip a potentially huge tar file efficiently: + * + * pipeline( + * fs.createReadStream('archive.tar'), + * zlib.createGzip(), + * fs.createWriteStream('archive.tar.gz'), + * (err) => { + * if (err) { + * console.error('Pipeline failed.', err); + * } else { + * console.log('Pipeline succeeded.'); + * } + * }, + * ); + * ``` + * + * The `pipeline` API provides a `promise version`. + * + * `stream.pipeline()` will call `stream.destroy(err)` on all streams except: + * + * * `Readable` streams which have emitted `'end'` or `'close'`. + * * `Writable` streams which have emitted `'finish'` or `'close'`. + * + * `stream.pipeline()` leaves dangling event listeners on the streams + * after the `callback` has been invoked. In the case of reuse of streams after + * failure, this can cause event listener leaks and swallowed errors. If the last + * stream is readable, dangling event listeners will be removed so that the last + * stream can be consumed later. + * + * `stream.pipeline()` closes all the streams when an error is raised. + * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior + * once it would destroy the socket without sending the expected response. + * See the example below: + * + * ```js + * const fs = require('node:fs'); + * const http = require('node:http'); + * const { pipeline } = require('node:stream'); + * + * const server = http.createServer((req, res) => { + * const fileStream = fs.createReadStream('./fileNotExist.txt'); + * pipeline(fileStream, res, (err) => { + * if (err) { + * console.log(err); // No such file + * // this message can't be sent once `pipeline` already destroyed the socket + * return res.end('error!!!'); + * } + * }); + * }); + * ``` + * @since v10.0.0 + * @param callback Called when the pipeline is fully done. + */ + function pipeline, B extends PipelineDestination>( + source: A, + destination: B, + callback?: PipelineCallback + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline, T1 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + destination: B, + callback?: PipelineCallback + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline, T1 extends PipelineTransform, T2 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + transform2: T2, + destination: B, + callback?: PipelineCallback + ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, callback?: PipelineCallback): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, callback?: PipelineCallback): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; + function pipeline( + streams: ReadonlyArray, + callback?: (err: NodeJS.ErrnoException | null) => void + ): NodeJS.WritableStream; + function pipeline( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array void)> + ): NodeJS.WritableStream; + namespace pipeline { + function __promisify__, B extends PipelineDestination>(source: A, destination: B, options?: PipelineOptions): PipelinePromise; + function __promisify__, T1 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + destination: B, + options?: PipelineOptions + ): PipelinePromise; + function __promisify__, T1 extends PipelineTransform, T2 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + transform2: T2, + destination: B, + options?: PipelineOptions + ): PipelinePromise; + function __promisify__< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise; + function __promisify__< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise; + function __promisify__(streams: ReadonlyArray, options?: PipelineOptions): Promise; + function __promisify__( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array + ): Promise; + } + interface Pipe { + close(): void; + hasRef(): boolean; + ref(): void; + unref(): void; + } + /** + * Returns whether the stream has encountered an error. + * @since v17.3.0, v16.14.0 + * @experimental + */ + function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean; + /** + * Returns whether the stream is readable. + * @since v17.4.0, v16.14.0 + * @experimental + */ + function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; + const promises: typeof streamPromises; + const consumers: typeof streamConsumers; + } + export = internal; +} +declare module 'node:stream' { + import stream = require('stream'); + export = stream; +} diff --git a/node_modules/@types/node/ts4.8/stream/consumers.d.ts b/node_modules/@types/node/ts4.8/stream/consumers.d.ts new file mode 100755 index 0000000..2fd9424 --- /dev/null +++ b/node_modules/@types/node/ts4.8/stream/consumers.d.ts @@ -0,0 +1,12 @@ +declare module 'stream/consumers' { + import { Blob as NodeBlob } from 'node:buffer'; + import { Readable } from 'node:stream'; + function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; + function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; + function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; + function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; + function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator): Promise; +} +declare module 'node:stream/consumers' { + export * from 'stream/consumers'; +} diff --git a/node_modules/@types/node/ts4.8/stream/promises.d.ts b/node_modules/@types/node/ts4.8/stream/promises.d.ts new file mode 100755 index 0000000..b427073 --- /dev/null +++ b/node_modules/@types/node/ts4.8/stream/promises.d.ts @@ -0,0 +1,42 @@ +declare module 'stream/promises' { + import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream'; + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise; + function pipeline, B extends PipelineDestination>(source: A, destination: B, options?: PipelineOptions): PipelinePromise; + function pipeline, T1 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + destination: B, + options?: PipelineOptions + ): PipelinePromise; + function pipeline, T1 extends PipelineTransform, T2 extends PipelineTransform, B extends PipelineDestination>( + source: A, + transform1: T1, + transform2: T2, + destination: B, + options?: PipelineOptions + ): PipelinePromise; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise; + function pipeline< + A extends PipelineSource, + T1 extends PipelineTransform, + T2 extends PipelineTransform, + T3 extends PipelineTransform, + T4 extends PipelineTransform, + B extends PipelineDestination + >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise; + function pipeline(streams: ReadonlyArray, options?: PipelineOptions): Promise; + function pipeline( + stream1: NodeJS.ReadableStream, + stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, + ...streams: Array + ): Promise; +} +declare module 'node:stream/promises' { + export * from 'stream/promises'; +} diff --git a/node_modules/@types/node/ts4.8/stream/web.d.ts b/node_modules/@types/node/ts4.8/stream/web.d.ts new file mode 100755 index 0000000..f9ef057 --- /dev/null +++ b/node_modules/@types/node/ts4.8/stream/web.d.ts @@ -0,0 +1,330 @@ +declare module 'stream/web' { + // stub module, pending copy&paste from .d.ts or manual impl + // copy from lib.dom.d.ts + interface ReadableWritablePair { + readable: ReadableStream; + /** + * Provides a convenient, chainable way of piping this readable stream + * through a transform stream (or any other { writable, readable } + * pair). It simply pipes the stream into the writable side of the + * supplied pair, and returns the readable side for further use. + * + * Piping a stream will lock it for the duration of the pipe, preventing + * any other consumer from acquiring a reader. + */ + writable: WritableStream; + } + interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + /** + * Pipes this readable stream to a given writable stream destination. + * The way in which the piping process behaves under various error + * conditions can be customized with a number of passed options. It + * returns a promise that fulfills when the piping process completes + * successfully, or rejects if any errors were encountered. + * + * Piping a stream will lock it for the duration of the pipe, preventing + * any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate + * as follows: + * + * An error in this source readable stream will abort destination, + * unless preventAbort is truthy. The returned promise will be rejected + * with the source's error, or with any error that occurs during + * aborting the destination. + * + * An error in destination will cancel this source readable stream, + * unless preventCancel is truthy. The returned promise will be rejected + * with the destination's error, or with any error that occurs during + * canceling the source. + * + * When this source readable stream closes, destination will be closed, + * unless preventClose is truthy. The returned promise will be fulfilled + * once this process completes, unless an error is encountered while + * closing the destination, in which case it will be rejected with that + * error. + * + * If destination starts out closed or closing, this source readable + * stream will be canceled, unless preventCancel is true. The returned + * promise will be rejected with an error indicating piping to a closed + * stream failed, or with any error that occurs during canceling the + * source. + * + * The signal option can be set to an AbortSignal to allow aborting an + * ongoing pipe operation via the corresponding AbortController. In this + * case, this source readable stream will be canceled, and destination + * aborted, unless the respective options preventCancel or preventAbort + * are set. + */ + preventClose?: boolean; + signal?: AbortSignal; + } + interface ReadableStreamGenericReader { + readonly closed: Promise; + cancel(reason?: any): Promise; + } + interface ReadableStreamDefaultReadValueResult { + done: false; + value: T; + } + interface ReadableStreamDefaultReadDoneResult { + done: true; + value?: undefined; + } + type ReadableStreamController = ReadableStreamDefaultController; + type ReadableStreamDefaultReadResult = ReadableStreamDefaultReadValueResult | ReadableStreamDefaultReadDoneResult; + interface ReadableByteStreamControllerCallback { + (controller: ReadableByteStreamController): void | PromiseLike; + } + interface UnderlyingSinkAbortCallback { + (reason?: any): void | PromiseLike; + } + interface UnderlyingSinkCloseCallback { + (): void | PromiseLike; + } + interface UnderlyingSinkStartCallback { + (controller: WritableStreamDefaultController): any; + } + interface UnderlyingSinkWriteCallback { + (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike; + } + interface UnderlyingSourceCancelCallback { + (reason?: any): void | PromiseLike; + } + interface UnderlyingSourcePullCallback { + (controller: ReadableStreamController): void | PromiseLike; + } + interface UnderlyingSourceStartCallback { + (controller: ReadableStreamController): any; + } + interface TransformerFlushCallback { + (controller: TransformStreamDefaultController): void | PromiseLike; + } + interface TransformerStartCallback { + (controller: TransformStreamDefaultController): any; + } + interface TransformerTransformCallback { + (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; + } + interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: ReadableStreamErrorCallback; + pull?: ReadableByteStreamControllerCallback; + start?: ReadableByteStreamControllerCallback; + type: 'bytes'; + } + interface UnderlyingSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback; + start?: UnderlyingSourceStartCallback; + type?: undefined; + } + interface UnderlyingSink { + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; + type?: undefined; + write?: UnderlyingSinkWriteCallback; + } + interface ReadableStreamErrorCallback { + (reason: any): void | PromiseLike; + } + /** This Streams API interface represents a readable stream of byte data. */ + interface ReadableStream { + readonly locked: boolean; + cancel(reason?: any): Promise; + getReader(): ReadableStreamDefaultReader; + pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; + pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; + tee(): [ReadableStream, ReadableStream]; + values(options?: { preventCancel?: boolean }): AsyncIterableIterator; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + const ReadableStream: { + prototype: ReadableStream; + new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy): ReadableStream; + new (underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; + }; + interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { + read(): Promise>; + releaseLock(): void; + } + const ReadableStreamDefaultReader: { + prototype: ReadableStreamDefaultReader; + new (stream: ReadableStream): ReadableStreamDefaultReader; + }; + const ReadableStreamBYOBReader: any; + const ReadableStreamBYOBRequest: any; + interface ReadableByteStreamController { + readonly byobRequest: undefined; + readonly desiredSize: number | null; + close(): void; + enqueue(chunk: ArrayBufferView): void; + error(error?: any): void; + } + const ReadableByteStreamController: { + prototype: ReadableByteStreamController; + new (): ReadableByteStreamController; + }; + interface ReadableStreamDefaultController { + readonly desiredSize: number | null; + close(): void; + enqueue(chunk?: R): void; + error(e?: any): void; + } + const ReadableStreamDefaultController: { + prototype: ReadableStreamDefaultController; + new (): ReadableStreamDefaultController; + }; + interface Transformer { + flush?: TransformerFlushCallback; + readableType?: undefined; + start?: TransformerStartCallback; + transform?: TransformerTransformCallback; + writableType?: undefined; + } + interface TransformStream { + readonly readable: ReadableStream; + readonly writable: WritableStream; + } + const TransformStream: { + prototype: TransformStream; + new (transformer?: Transformer, writableStrategy?: QueuingStrategy, readableStrategy?: QueuingStrategy): TransformStream; + }; + interface TransformStreamDefaultController { + readonly desiredSize: number | null; + enqueue(chunk?: O): void; + error(reason?: any): void; + terminate(): void; + } + const TransformStreamDefaultController: { + prototype: TransformStreamDefaultController; + new (): TransformStreamDefaultController; + }; + /** + * This Streams API interface provides a standard abstraction for writing + * streaming data to a destination, known as a sink. This object comes with + * built-in back pressure and queuing. + */ + interface WritableStream { + readonly locked: boolean; + abort(reason?: any): Promise; + close(): Promise; + getWriter(): WritableStreamDefaultWriter; + } + const WritableStream: { + prototype: WritableStream; + new (underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy): WritableStream; + }; + /** + * This Streams API interface is the object returned by + * WritableStream.getWriter() and once created locks the < writer to the + * WritableStream ensuring that no other streams can write to the underlying + * sink. + */ + interface WritableStreamDefaultWriter { + readonly closed: Promise; + readonly desiredSize: number | null; + readonly ready: Promise; + abort(reason?: any): Promise; + close(): Promise; + releaseLock(): void; + write(chunk?: W): Promise; + } + const WritableStreamDefaultWriter: { + prototype: WritableStreamDefaultWriter; + new (stream: WritableStream): WritableStreamDefaultWriter; + }; + /** + * This Streams API interface represents a controller allowing control of a + * WritableStream's state. When constructing a WritableStream, the + * underlying sink is given a corresponding WritableStreamDefaultController + * instance to manipulate. + */ + interface WritableStreamDefaultController { + error(e?: any): void; + } + const WritableStreamDefaultController: { + prototype: WritableStreamDefaultController; + new (): WritableStreamDefaultController; + }; + interface QueuingStrategy { + highWaterMark?: number; + size?: QueuingStrategySize; + } + interface QueuingStrategySize { + (chunk?: T): number; + } + interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water + * mark. + * + * Note that the provided high water mark will not be validated ahead of + * time. Instead, if it is negative, NaN, or not a number, the resulting + * ByteLengthQueuingStrategy will cause the corresponding stream + * constructor to throw. + */ + highWaterMark: number; + } + /** + * This Streams API interface provides a built-in byte length queuing + * strategy that can be used when constructing streams. + */ + interface ByteLengthQueuingStrategy extends QueuingStrategy { + readonly highWaterMark: number; + readonly size: QueuingStrategySize; + } + const ByteLengthQueuingStrategy: { + prototype: ByteLengthQueuingStrategy; + new (init: QueuingStrategyInit): ByteLengthQueuingStrategy; + }; + /** + * This Streams API interface provides a built-in byte length queuing + * strategy that can be used when constructing streams. + */ + interface CountQueuingStrategy extends QueuingStrategy { + readonly highWaterMark: number; + readonly size: QueuingStrategySize; + } + const CountQueuingStrategy: { + prototype: CountQueuingStrategy; + new (init: QueuingStrategyInit): CountQueuingStrategy; + }; + interface TextEncoderStream { + /** Returns "utf-8". */ + readonly encoding: 'utf-8'; + readonly readable: ReadableStream; + readonly writable: WritableStream; + readonly [Symbol.toStringTag]: string; + } + const TextEncoderStream: { + prototype: TextEncoderStream; + new (): TextEncoderStream; + }; + interface TextDecoderOptions { + fatal?: boolean; + ignoreBOM?: boolean; + } + type BufferSource = ArrayBufferView | ArrayBuffer; + interface TextDecoderStream { + /** Returns encoding's name, lower cased. */ + readonly encoding: string; + /** Returns `true` if error mode is "fatal", and `false` otherwise. */ + readonly fatal: boolean; + /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ + readonly ignoreBOM: boolean; + readonly readable: ReadableStream; + readonly writable: WritableStream; + readonly [Symbol.toStringTag]: string; + } + const TextDecoderStream: { + prototype: TextDecoderStream; + new (label?: string, options?: TextDecoderOptions): TextDecoderStream; + }; +} +declare module 'node:stream/web' { + export * from 'stream/web'; +} diff --git a/node_modules/@types/node/ts4.8/string_decoder.d.ts b/node_modules/@types/node/ts4.8/string_decoder.d.ts new file mode 100755 index 0000000..a069bb8 --- /dev/null +++ b/node_modules/@types/node/ts4.8/string_decoder.d.ts @@ -0,0 +1,67 @@ +/** + * The `node:string_decoder` module provides an API for decoding `Buffer` objects + * into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 + * characters. It can be accessed using: + * + * ```js + * const { StringDecoder } = require('node:string_decoder'); + * ``` + * + * The following example shows the basic use of the `StringDecoder` class. + * + * ```js + * const { StringDecoder } = require('node:string_decoder'); + * const decoder = new StringDecoder('utf8'); + * + * const cent = Buffer.from([0xC2, 0xA2]); + * console.log(decoder.write(cent)); + * + * const euro = Buffer.from([0xE2, 0x82, 0xAC]); + * console.log(decoder.write(euro)); + * ``` + * + * When a `Buffer` instance is written to the `StringDecoder` instance, an + * internal buffer is used to ensure that the decoded string does not contain + * any incomplete multibyte characters. These are held in the buffer until the + * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called. + * + * In the following example, the three UTF-8 encoded bytes of the European Euro + * symbol (`€`) are written over three separate operations: + * + * ```js + * const { StringDecoder } = require('node:string_decoder'); + * const decoder = new StringDecoder('utf8'); + * + * decoder.write(Buffer.from([0xE2])); + * decoder.write(Buffer.from([0x82])); + * console.log(decoder.end(Buffer.from([0xAC]))); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/string_decoder.js) + */ +declare module 'string_decoder' { + class StringDecoder { + constructor(encoding?: BufferEncoding); + /** + * Returns a decoded string, ensuring that any incomplete multibyte characters at + * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the + * returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`. + * @since v0.1.99 + * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode. + */ + write(buffer: Buffer): string; + /** + * Returns any remaining input stored in the internal buffer as a string. Bytes + * representing incomplete UTF-8 and UTF-16 characters will be replaced with + * substitution characters appropriate for the character encoding. + * + * If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input. + * After `end()` is called, the `stringDecoder` object can be reused for new input. + * @since v0.9.3 + * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode. + */ + end(buffer?: Buffer): string; + } +} +declare module 'node:string_decoder' { + export * from 'string_decoder'; +} diff --git a/node_modules/@types/node/ts4.8/test.d.ts b/node_modules/@types/node/ts4.8/test.d.ts new file mode 100755 index 0000000..6d8c91f --- /dev/null +++ b/node_modules/@types/node/ts4.8/test.d.ts @@ -0,0 +1,1461 @@ +/** + * The `node:test` module facilitates the creation of JavaScript tests. + * To access it: + * + * ```js + * import test from 'node:test'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import test from 'test'; + * ``` + * + * Tests created via the `test` module consist of a single function that is + * processed in one of three ways: + * + * 1. A synchronous function that is considered failing if it throws an exception, + * and is considered passing otherwise. + * 2. A function that returns a `Promise` that is considered failing if the`Promise` rejects, and is considered passing if the `Promise` resolves. + * 3. A function that receives a callback function. If the callback receives any + * truthy value as its first argument, the test is considered failing. If a + * falsy value is passed as the first argument to the callback, the test is + * considered passing. If the test function receives a callback function and + * also returns a `Promise`, the test will fail. + * + * The following example illustrates how tests are written using the`test` module. + * + * ```js + * test('synchronous passing test', (t) => { + * // This test passes because it does not throw an exception. + * assert.strictEqual(1, 1); + * }); + * + * test('synchronous failing test', (t) => { + * // This test fails because it throws an exception. + * assert.strictEqual(1, 2); + * }); + * + * test('asynchronous passing test', async (t) => { + * // This test passes because the Promise returned by the async + * // function is not rejected. + * assert.strictEqual(1, 1); + * }); + * + * test('asynchronous failing test', async (t) => { + * // This test fails because the Promise returned by the async + * // function is rejected. + * assert.strictEqual(1, 2); + * }); + * + * test('failing test using Promises', (t) => { + * // Promises can be used directly as well. + * return new Promise((resolve, reject) => { + * setImmediate(() => { + * reject(new Error('this will cause the test to fail')); + * }); + * }); + * }); + * + * test('callback passing test', (t, done) => { + * // done() is the callback function. When the setImmediate() runs, it invokes + * // done() with no arguments. + * setImmediate(done); + * }); + * + * test('callback failing test', (t, done) => { + * // When the setImmediate() runs, done() is invoked with an Error object and + * // the test fails. + * setImmediate(() => { + * done(new Error('callback failure')); + * }); + * }); + * ``` + * + * If any tests fail, the process exit code is set to `1`. + * @since v18.0.0, v16.17.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test.js) + */ +declare module 'node:test' { + import { Readable } from 'node:stream'; + import { AsyncResource } from 'node:async_hooks'; + /** + * ```js + * import { tap } from 'node:test/reporters'; + * import process from 'node:process'; + * + * run({ files: [path.resolve('./tests/test.js')] }) + * .compose(tap) + * .pipe(process.stdout); + * ``` + * @since v18.9.0, v16.19.0 + * @param options Configuration options for running tests. The following properties are supported: + */ + function run(options?: RunOptions): TestsStream; + /** + * The `test()` function is the value imported from the `test` module. Each + * invocation of this function results in reporting the test to the `TestsStream`. + * + * The `TestContext` object passed to the `fn` argument can be used to perform + * actions related to the current test. Examples include skipping the test, adding + * additional diagnostic information, or creating subtests. + * + * `test()` returns a `Promise` that resolves once the test completes. + * if `test()` is called within a `describe()` block, it resolve immediately. + * The return value can usually be discarded for top level tests. + * However, the return value from subtests should be used to prevent the parent + * test from finishing first and cancelling the subtest + * as shown in the following example. + * + * ```js + * test('top level test', async (t) => { + * // The setTimeout() in the following subtest would cause it to outlive its + * // parent test if 'await' is removed on the next line. Once the parent test + * // completes, it will cancel any outstanding subtests. + * await t.test('longer running subtest', async (t) => { + * return new Promise((resolve, reject) => { + * setTimeout(resolve, 1000); + * }); + * }); + * }); + * ``` + * + * The `timeout` option can be used to fail the test if it takes longer than`timeout` milliseconds to complete. However, it is not a reliable mechanism for + * canceling tests because a running test might block the application thread and + * thus prevent the scheduled cancellation. + * @since v18.0.0, v16.17.0 + * @param [name='The name'] The name of the test, which is displayed when reporting test results. + * @param options Configuration options for the test. The following properties are supported: + * @param [fn='A no-op function'] The function under test. The first argument to this function is a {@link TestContext} object. If the test uses callbacks, the callback function is passed as the + * second argument. + * @return Resolved with `undefined` once the test completes, or immediately if the test runs within {@link describe}. + */ + function test(name?: string, fn?: TestFn): Promise; + function test(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function test(options?: TestOptions, fn?: TestFn): Promise; + function test(fn?: TestFn): Promise; + namespace test { + export { + after, + afterEach, + before, + beforeEach, + describe, + it, + run, + mock, + test, + skip, + todo, + only + }; + } + /** + * The `describe()` function imported from the `node:test` module. Each + * invocation of this function results in the creation of a Subtest. + * After invocation of top level `describe` functions, + * all top level tests and suites will execute. + * @param [name='The name'] The name of the suite, which is displayed when reporting test results. + * @param options Configuration options for the suite. supports the same options as `test([name][, options][, fn])`. + * @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object. + * @return Immediately fulfilled with `undefined`. + */ + function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function describe(name?: string, fn?: SuiteFn): Promise; + function describe(options?: TestOptions, fn?: SuiteFn): Promise; + function describe(fn?: SuiteFn): Promise; + namespace describe { + /** + * Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`. + */ + function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function skip(name?: string, fn?: SuiteFn): Promise; + function skip(options?: TestOptions, fn?: SuiteFn): Promise; + function skip(fn?: SuiteFn): Promise; + /** + * Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`. + */ + function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function todo(name?: string, fn?: SuiteFn): Promise; + function todo(options?: TestOptions, fn?: SuiteFn): Promise; + function todo(fn?: SuiteFn): Promise; + /** + * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`. + * @since v18.15.0 + */ + function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function only(name?: string, fn?: SuiteFn): Promise; + function only(options?: TestOptions, fn?: SuiteFn): Promise; + function only(fn?: SuiteFn): Promise; + } + /** + * Shorthand for `test()`. + * + * The `it()` function is imported from the `node:test` module. + * @since v18.6.0, v16.17.0 + */ + function it(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function it(name?: string, fn?: TestFn): Promise; + function it(options?: TestOptions, fn?: TestFn): Promise; + function it(fn?: TestFn): Promise; + namespace it { + /** + * Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`. + */ + function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function skip(name?: string, fn?: TestFn): Promise; + function skip(options?: TestOptions, fn?: TestFn): Promise; + function skip(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`. + */ + function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function todo(name?: string, fn?: TestFn): Promise; + function todo(options?: TestOptions, fn?: TestFn): Promise; + function todo(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`. + * @since v18.15.0 + */ + function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function only(name?: string, fn?: TestFn): Promise; + function only(options?: TestOptions, fn?: TestFn): Promise; + function only(fn?: TestFn): Promise; + } + /** + * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`. + * @since v20.2.0 + */ + function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function skip(name?: string, fn?: TestFn): Promise; + function skip(options?: TestOptions, fn?: TestFn): Promise; + function skip(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`. + * @since v20.2.0 + */ + function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function todo(name?: string, fn?: TestFn): Promise; + function todo(options?: TestOptions, fn?: TestFn): Promise; + function todo(fn?: TestFn): Promise; + /** + * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`. + * @since v20.2.0 + */ + function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function only(name?: string, fn?: TestFn): Promise; + function only(options?: TestOptions, fn?: TestFn): Promise; + function only(fn?: TestFn): Promise; + /** + * The type of a function under test. The first argument to this function is a + * {@link TestContext} object. If the test uses callbacks, the callback function is passed as + * the second argument. + */ + type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise; + /** + * The type of a function under Suite. + */ + type SuiteFn = (s: SuiteContext) => void | Promise; + interface TestShard { + /** + * A positive integer between 1 and `` that specifies the index of the shard to run. + */ + index: number; + /** + * A positive integer that specifies the total number of shards to split the test files to. + */ + total: number; + } + interface RunOptions { + /** + * If a number is provided, then that many files would run in parallel. + * If truthy, it would run (number of cpu cores - 1) files in parallel. + * If falsy, it would only run one file at a time. + * If unspecified, subtests inherit this value from their parent. + * @default true + */ + concurrency?: number | boolean | undefined; + /** + * An array containing the list of files to run. + * If unspecified, the test runner execution model will be used. + */ + files?: readonly string[] | undefined; + /** + * Allows aborting an in-progress test execution. + * @default undefined + */ + signal?: AbortSignal | undefined; + /** + * A number of milliseconds the test will fail after. + * If unspecified, subtests inherit this value from their parent. + * @default Infinity + */ + timeout?: number | undefined; + /** + * Sets inspector port of test child process. + * If a nullish value is provided, each process gets its own port, + * incremented from the primary's `process.debugPort`. + */ + inspectPort?: number | (() => number) | undefined; + /** + * That can be used to only run tests whose name matches the provided pattern. + * Test name patterns are interpreted as JavaScript regular expressions. + * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run. + */ + testNamePatterns?: string | RegExp | string[] | RegExp[]; + /** + * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run. + */ + setup?: (root: unknown) => void | Promise; + /** + * Whether to run in watch mode or not. + * @default false + */ + watch?: boolean | undefined; + /** + * Running tests in a specific shard. + * @default undefined + */ + shard?: TestShard | undefined; + } + class Test extends AsyncResource { + concurrency: number; + nesting: number; + only: boolean; + reporter: TestsStream; + runOnlySubtests: boolean; + testNumber: number; + timeout: number | null; + } + /** + * A successful call to `run()` method will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.`TestsStream` will emit events, in the + * order of the tests definition + * @since v18.9.0, v16.19.0 + */ + class TestsStream extends Readable implements NodeJS.ReadableStream { + addListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + addListener(event: 'test:fail', listener: (data: TestFail) => void): this; + addListener(event: 'test:pass', listener: (data: TestPass) => void): this; + addListener(event: 'test:plan', listener: (data: TestPlan) => void): this; + addListener(event: 'test:start', listener: (data: TestStart) => void): this; + addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; + addListener(event: string, listener: (...args: any[]) => void): this; + emit(event: 'test:diagnostic', data: DiagnosticData): boolean; + emit(event: 'test:fail', data: TestFail): boolean; + emit(event: 'test:pass', data: TestPass): boolean; + emit(event: 'test:plan', data: TestPlan): boolean; + emit(event: 'test:start', data: TestStart): boolean; + emit(event: 'test:stderr', data: TestStderr): boolean; + emit(event: 'test:stdout', data: TestStdout): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + on(event: 'test:fail', listener: (data: TestFail) => void): this; + on(event: 'test:pass', listener: (data: TestPass) => void): this; + on(event: 'test:plan', listener: (data: TestPlan) => void): this; + on(event: 'test:start', listener: (data: TestStart) => void): this; + on(event: 'test:stderr', listener: (data: TestStderr) => void): this; + on(event: 'test:stdout', listener: (data: TestStdout) => void): this; + on(event: string, listener: (...args: any[]) => void): this; + once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + once(event: 'test:fail', listener: (data: TestFail) => void): this; + once(event: 'test:pass', listener: (data: TestPass) => void): this; + once(event: 'test:plan', listener: (data: TestPlan) => void): this; + once(event: 'test:start', listener: (data: TestStart) => void): this; + once(event: 'test:stderr', listener: (data: TestStderr) => void): this; + once(event: 'test:stdout', listener: (data: TestStdout) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + prependListener(event: 'test:fail', listener: (data: TestFail) => void): this; + prependListener(event: 'test:pass', listener: (data: TestPass) => void): this; + prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this; + prependListener(event: 'test:start', listener: (data: TestStart) => void): this; + prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; + prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this; + prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this; + prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this; + prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this; + prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + } + /** + * An instance of `TestContext` is passed to each test function in order to + * interact with the test runner. However, the `TestContext` constructor is not + * exposed as part of the API. + * @since v18.0.0, v16.17.0 + */ + class TestContext { + /** + * This function is used to create a hook running before subtest of the current test. + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as + * the second argument. Default: A no-op function. + * @param options Configuration options for the hook. + * @since v20.1.0 + */ + before: typeof before; + /** + * This function is used to create a hook running before each subtest of the current test. + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as + * the second argument. Default: A no-op function. + * @param options Configuration options for the hook. + * @since v18.8.0 + */ + beforeEach: typeof beforeEach; + /** + * This function is used to create a hook that runs after the current test finishes. + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as + * the second argument. Default: A no-op function. + * @param options Configuration options for the hook. + * @since v18.13.0 + */ + after: typeof after; + /** + * This function is used to create a hook running after each subtest of the current test. + * @param fn The hook function. If the hook uses callbacks, the callback function is passed as + * the second argument. Default: A no-op function. + * @param options Configuration options for the hook. + * @since v18.8.0 + */ + afterEach: typeof afterEach; + /** + * This function is used to write diagnostics to the output. Any diagnostic + * information is included at the end of the test's results. This function does + * not return a value. + * + * ```js + * test('top level test', (t) => { + * t.diagnostic('A diagnostic message'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Message to be reported. + */ + diagnostic(message: string): void; + /** + * The name of the test. + * @since v18.8.0, v16.18.0 + */ + readonly name: string; + /** + * If `shouldRunOnlyTests` is truthy, the test context will only run tests that + * have the `only` option set. Otherwise, all tests are run. If Node.js was not + * started with the `--test-only` command-line option, this function is a + * no-op. + * + * ```js + * test('top level test', (t) => { + * // The test context can be set to run subtests with the 'only' option. + * t.runOnly(true); + * return Promise.all([ + * t.test('this subtest is now skipped'), + * t.test('this subtest is run', { only: true }), + * ]); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param shouldRunOnlyTests Whether or not to run `only` tests. + */ + runOnly(shouldRunOnlyTests: boolean): void; + /** + * ```js + * test('top level test', async (t) => { + * await fetch('some/uri', { signal: t.signal }); + * }); + * ``` + * @since v18.7.0, v16.17.0 + */ + readonly signal: AbortSignal; + /** + * This function causes the test's output to indicate the test as skipped. If`message` is provided, it is included in the output. Calling `skip()` does + * not terminate execution of the test function. This function does not return a + * value. + * + * ```js + * test('top level test', (t) => { + * // Make sure to return here as well if the test contains additional logic. + * t.skip('this is skipped'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Optional skip message. + */ + skip(message?: string): void; + /** + * This function adds a `TODO` directive to the test's output. If `message` is + * provided, it is included in the output. Calling `todo()` does not terminate + * execution of the test function. This function does not return a value. + * + * ```js + * test('top level test', (t) => { + * // This test is marked as `TODO` + * t.todo('this is a todo'); + * }); + * ``` + * @since v18.0.0, v16.17.0 + * @param message Optional `TODO` message. + */ + todo(message?: string): void; + /** + * This function is used to create subtests under the current test. This function behaves in + * the same fashion as the top level {@link test} function. + * @since v18.0.0 + * @param name The name of the test, which is displayed when reporting test results. + * Default: The `name` property of fn, or `''` if `fn` does not have a name. + * @param options Configuration options for the test + * @param fn The function under test. This first argument to this function is a + * {@link TestContext} object. If the test uses callbacks, the callback function is + * passed as the second argument. Default: A no-op function. + * @returns A {@link Promise} resolved with `undefined` once the test completes. + */ + test: typeof test; + /** + * Each test provides its own MockTracker instance. + */ + readonly mock: MockTracker; + } + /** + * An instance of `SuiteContext` is passed to each suite function in order to + * interact with the test runner. However, the `SuiteContext` constructor is not + * exposed as part of the API. + * @since v18.7.0, v16.17.0 + */ + class SuiteContext { + /** + * The name of the suite. + * @since v18.8.0, v16.18.0 + */ + readonly name: string; + /** + * Can be used to abort test subtasks when the test has been aborted. + * @since v18.7.0, v16.17.0 + */ + readonly signal: AbortSignal; + } + interface TestOptions { + /** + * If a number is provided, then that many tests would run in parallel. + * If truthy, it would run (number of cpu cores - 1) tests in parallel. + * For subtests, it will be `Infinity` tests in parallel. + * If falsy, it would only run one test at a time. + * If unspecified, subtests inherit this value from their parent. + * @default false + */ + concurrency?: number | boolean | undefined; + /** + * If truthy, and the test context is configured to run `only` tests, then this test will be + * run. Otherwise, the test is skipped. + * @default false + */ + only?: boolean | undefined; + /** + * Allows aborting an in-progress test. + * @since v18.8.0 + */ + signal?: AbortSignal | undefined; + /** + * If truthy, the test is skipped. If a string is provided, that string is displayed in the + * test results as the reason for skipping the test. + * @default false + */ + skip?: boolean | string | undefined; + /** + * A number of milliseconds the test will fail after. If unspecified, subtests inherit this + * value from their parent. + * @default Infinity + * @since v18.7.0 + */ + timeout?: number | undefined; + /** + * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in + * the test results as the reason why the test is `TODO`. + * @default false + */ + todo?: boolean | string | undefined; + } + /** + * This function is used to create a hook running before running a suite. + * + * ```js + * describe('tests', async () => { + * before(() => console.log('about to run some test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. The following properties are supported: + */ + function before(fn?: HookFn, options?: HookOptions): void; + /** + * This function is used to create a hook running after running a suite. + * + * ```js + * describe('tests', async () => { + * after(() => console.log('finished running tests')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. The following properties are supported: + */ + function after(fn?: HookFn, options?: HookOptions): void; + /** + * This function is used to create a hook running + * before each subtest of the current suite. + * + * ```js + * describe('tests', async () => { + * beforeEach(() => console.log('about to run a test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. The following properties are supported: + */ + function beforeEach(fn?: HookFn, options?: HookOptions): void; + /** + * This function is used to create a hook running + * after each subtest of the current test. + * + * ```js + * describe('tests', async () => { + * afterEach(() => console.log('finished running a test')); + * it('is a subtest', () => { + * assert.ok('some relevant assertion here'); + * }); + * }); + * ``` + * @since v18.8.0, v16.18.0 + * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. + * @param options Configuration options for the hook. The following properties are supported: + */ + function afterEach(fn?: HookFn, options?: HookOptions): void; + /** + * The hook function. If the hook uses callbacks, the callback function is passed as the + * second argument. + */ + type HookFn = (s: SuiteContext, done: (result?: any) => void) => any; + /** + * Configuration options for hooks. + * @since v18.8.0 + */ + interface HookOptions { + /** + * Allows aborting an in-progress hook. + */ + signal?: AbortSignal | undefined; + /** + * A number of milliseconds the hook will fail after. If unspecified, subtests inherit this + * value from their parent. + * @default Infinity + */ + timeout?: number | undefined; + } + interface MockFunctionOptions { + /** + * The number of times that the mock will use the behavior of `implementation`. + * Once the mock function has been called `times` times, + * it will automatically restore the behavior of `original`. + * This value must be an integer greater than zero. + * @default Infinity + */ + times?: number | undefined; + } + interface MockMethodOptions extends MockFunctionOptions { + /** + * If `true`, `object[methodName]` is treated as a getter. + * This option cannot be used with the `setter` option. + */ + getter?: boolean | undefined; + /** + * If `true`, `object[methodName]` is treated as a setter. + * This option cannot be used with the `getter` option. + */ + setter?: boolean | undefined; + } + type Mock = F & { + mock: MockFunctionContext; + }; + type NoOpFunction = (...args: any[]) => undefined; + type FunctionPropertyNames = { + [K in keyof T]: T[K] extends Function ? K : never; + }[keyof T]; + /** + * The `MockTracker` class is used to manage mocking functionality. The test runner + * module provides a top level `mock` export which is a `MockTracker` instance. + * Each test also provides its own `MockTracker` instance via the test context's`mock` property. + * @since v19.1.0, v18.13.0 + */ + class MockTracker { + /** + * This function is used to create a mock function. + * + * The following example creates a mock function that increments a counter by one + * on each invocation. The `times` option is used to modify the mock behavior such + * that the first two invocations add two to the counter instead of one. + * + * ```js + * test('mocks a counting function', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne, addTwo, { times: 2 }); + * + * assert.strictEqual(fn(), 2); + * assert.strictEqual(fn(), 4); + * assert.strictEqual(fn(), 5); + * assert.strictEqual(fn(), 6); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param [original='A no-op function'] An optional function to create a mock on. + * @param implementation An optional function used as the mock implementation for `original`. This is useful for creating mocks that exhibit one behavior for a specified number of calls and + * then restore the behavior of `original`. + * @param options Optional configuration options for the mock function. The following properties are supported: + * @return The mocked function. The mocked function contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the + * behavior of the mocked function. + */ + fn(original?: F, options?: MockFunctionOptions): Mock; + fn(original?: F, implementation?: Implementation, options?: MockFunctionOptions): Mock; + /** + * This function is used to create a mock on an existing object method. The + * following example demonstrates how a mock is created on an existing object + * method. + * + * ```js + * test('spies on an object method', (t) => { + * const number = { + * value: 5, + * subtract(a) { + * return this.value - a; + * }, + * }; + * + * t.mock.method(number, 'subtract'); + * assert.strictEqual(number.subtract.mock.calls.length, 0); + * assert.strictEqual(number.subtract(3), 2); + * assert.strictEqual(number.subtract.mock.calls.length, 1); + * + * const call = number.subtract.mock.calls[0]; + * + * assert.deepStrictEqual(call.arguments, [3]); + * assert.strictEqual(call.result, 2); + * assert.strictEqual(call.error, undefined); + * assert.strictEqual(call.target, undefined); + * assert.strictEqual(call.this, number); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param object The object whose method is being mocked. + * @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown. + * @param implementation An optional function used as the mock implementation for `object[methodName]`. + * @param options Optional configuration options for the mock method. The following properties are supported: + * @return The mocked method. The mocked method contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the + * behavior of the mocked method. + */ + method< + MockedObject extends object, + MethodName extends FunctionPropertyNames, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function + ? Mock + : never; + method< + MockedObject extends object, + MethodName extends FunctionPropertyNames, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation: Implementation, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function + ? Mock + : never; + method( + object: MockedObject, + methodName: keyof MockedObject, + options: MockMethodOptions, + ): Mock; + method( + object: MockedObject, + methodName: keyof MockedObject, + implementation: Function, + options: MockMethodOptions, + ): Mock; + + /** + * This function is syntax sugar for `MockTracker.method` with `options.getter`set to `true`. + * @since v19.3.0, v18.13.0 + */ + getter< + MockedObject extends object, + MethodName extends keyof MockedObject, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): Mock<() => MockedObject[MethodName]>; + getter< + MockedObject extends object, + MethodName extends keyof MockedObject, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation?: Implementation, + options?: MockFunctionOptions, + ): Mock<(() => MockedObject[MethodName]) | Implementation>; + /** + * This function is syntax sugar for `MockTracker.method` with `options.setter`set to `true`. + * @since v19.3.0, v18.13.0 + */ + setter< + MockedObject extends object, + MethodName extends keyof MockedObject, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): Mock<(value: MockedObject[MethodName]) => void>; + setter< + MockedObject extends object, + MethodName extends keyof MockedObject, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation?: Implementation, + options?: MockFunctionOptions, + ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTracker` and disassociates the mocks from the`MockTracker` instance. Once disassociated, the mocks can still be used, but the`MockTracker` instance can no longer be + * used to reset their behavior or + * otherwise interact with them. + * + * After each test completes, this function is called on the test context's`MockTracker`. If the global `MockTracker` is used extensively, calling this + * function manually is recommended. + * @since v19.1.0, v18.13.0 + */ + reset(): void; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTracker`. Unlike `mock.reset()`, `mock.restoreAll()` does + * not disassociate the mocks from the `MockTracker` instance. + * @since v19.1.0, v18.13.0 + */ + restoreAll(): void; + timers: MockTimers; + } + const mock: MockTracker; + interface MockFunctionCall< + F extends Function, + ReturnType = F extends (...args: any) => infer T + ? T + : F extends abstract new (...args: any) => infer T + ? T + : unknown, + Args = F extends (...args: infer Y) => any + ? Y + : F extends abstract new (...args: infer Y) => any + ? Y + : unknown[], + > { + /** + * An array of the arguments passed to the mock function. + */ + arguments: Args; + /** + * If the mocked function threw then this property contains the thrown value. + */ + error: unknown | undefined; + /** + * The value returned by the mocked function. + * + * If the mocked function threw, it will be `undefined`. + */ + result: ReturnType | undefined; + /** + * An `Error` object whose stack can be used to determine the callsite of the mocked function invocation. + */ + stack: Error; + /** + * If the mocked function is a constructor, this field contains the class being constructed. + * Otherwise this will be `undefined`. + */ + target: F extends abstract new (...args: any) => any ? F : undefined; + /** + * The mocked function's `this` value. + */ + this: unknown; + } + /** + * The `MockFunctionContext` class is used to inspect or manipulate the behavior of + * mocks created via the `MockTracker` APIs. + * @since v19.1.0, v18.13.0 + */ + class MockFunctionContext { + /** + * A getter that returns a copy of the internal array used to track calls to the + * mock. Each entry in the array is an object with the following properties. + * @since v19.1.0, v18.13.0 + */ + readonly calls: Array>; + /** + * This function returns the number of times that this mock has been invoked. This + * function is more efficient than checking `ctx.calls.length` because `ctx.calls`is a getter that creates a copy of the internal call tracking array. + * @since v19.1.0, v18.13.0 + * @return The number of times that this mock has been invoked. + */ + callCount(): number; + /** + * This function is used to change the behavior of an existing mock. + * + * The following example creates a mock function using `t.mock.fn()`, calls the + * mock function, and then changes the mock implementation to a different function. + * + * ```js + * test('changes a mock behavior', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne); + * + * assert.strictEqual(fn(), 1); + * fn.mock.mockImplementation(addTwo); + * assert.strictEqual(fn(), 3); + * assert.strictEqual(fn(), 5); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param implementation The function to be used as the mock's new implementation. + */ + mockImplementation(implementation: Function): void; + /** + * This function is used to change the behavior of an existing mock for a single + * invocation. Once invocation `onCall` has occurred, the mock will revert to + * whatever behavior it would have used had `mockImplementationOnce()` not been + * called. + * + * The following example creates a mock function using `t.mock.fn()`, calls the + * mock function, changes the mock implementation to a different function for the + * next invocation, and then resumes its previous behavior. + * + * ```js + * test('changes a mock behavior once', (t) => { + * let cnt = 0; + * + * function addOne() { + * cnt++; + * return cnt; + * } + * + * function addTwo() { + * cnt += 2; + * return cnt; + * } + * + * const fn = t.mock.fn(addOne); + * + * assert.strictEqual(fn(), 1); + * fn.mock.mockImplementationOnce(addTwo); + * assert.strictEqual(fn(), 3); + * assert.strictEqual(fn(), 4); + * }); + * ``` + * @since v19.1.0, v18.13.0 + * @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`. + * @param onCall The invocation number that will use `implementation`. If the specified invocation has already occurred then an exception is thrown. + */ + mockImplementationOnce(implementation: Function, onCall?: number): void; + /** + * Resets the call history of the mock function. + * @since v19.3.0, v18.13.0 + */ + resetCalls(): void; + /** + * Resets the implementation of the mock function to its original behavior. The + * mock can still be used after calling this function. + * @since v19.1.0, v18.13.0 + */ + restore(): void; + } + type Timer = 'setInterval' | 'clearInterval' | 'setTimeout' | 'clearTimeout'; + /** + * Mocking timers is a technique commonly used in software testing to simulate and + * control the behavior of timers, such as `setInterval` and `setTimeout`, + * without actually waiting for the specified time intervals. + * + * The `MockTracker` provides a top-level `timers` export + * which is a `MockTimers` instance. + * @since v20.4.0 + * @experimental + */ + class MockTimers { + /** + * Enables timer mocking for the specified timers. + * + * **Note:** When you enable mocking for a specific timer, its associated + * clear function will also be implicitly mocked. + * + * Example usage: + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.enable(['setInterval']); + * ``` + * + * ```js + * const { mock } = require('node:test'); + * mock.timers.enable(['setInterval']); + * ``` + * + * The above example enables mocking for the `setInterval` timer and + * implicitly mocks the `clearInterval` function. Only the `setInterval`and `clearInterval` functions from `node:timers`,`node:timers/promises`, and`globalThis` will be mocked. + * + * Alternatively, if you call `mock.timers.enable()` without any parameters: + * + * All timers (`'setInterval'`, `'clearInterval'`, `'setTimeout'`, and `'clearTimeout'`) + * will be mocked. The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout`functions from `node:timers`, `node:timers/promises`, + * and `globalThis` will be mocked. + * @since v20.4.0 + */ + enable(timers?: Timer[]): void; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTimers` instance and disassociates the mocks + * from the `MockTracker` instance. + * + * **Note:** After each test completes, this function is called on + * the test context's `MockTracker`. + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.reset(); + * ``` + * + * ```js + * const { mock } = require('node:test'); + * mock.timers.reset(); + * ``` + * @since v20.4.0 + */ + reset(): void; + /** + * Advances time for all mocked timers. + * + * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts + * only positive numbers. In Node.js, `setTimeout` with negative numbers is + * only supported for web compatibility reasons. + * + * The following example mocks a `setTimeout` function and + * by using `.tick` advances in + * time triggering all pending timers. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * + * context.mock.timers.enable(['setTimeout']); + * + * setTimeout(fn, 9999); + * + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * + * setTimeout(fn, 9999); + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * Alternativelly, the `.tick` function can be called many times + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * @since v20.4.0 + */ + tick(milliseconds: number): void; + /** + * Triggers all pending mocked timers immediately. + * + * The example below triggers all pending timers immediately, + * causing them to execute without any delay. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable(['setTimeout']); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * + * assert.deepStrictEqual(results, [3, 2, 1]); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable(['setTimeout']); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * + * assert.deepStrictEqual(results, [3, 2, 1]); + * }); + * ``` + * + * **Note:** The `runAll()` function is specifically designed for + * triggering timers in the context of timer mocking. + * It does not have any effect on real-time system + * clocks or actual timers outside of the mocking environment. + * @since v20.4.0 + */ + runAll(): void; + /** + * Calls {@link MockTimers.reset()}. + */ + [Symbol.dispose](): void; + } + export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo }; +} + +interface DiagnosticData { + /** + * The diagnostic message. + */ + message: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestFail { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration_ms: number; + /** + * The error thrown by the test. + */ + error: Error; + /** + * The type of the test, used to denote whether this is a suite. + * @since 20.0.0, 19.9.0, 18.17.0 + */ + type?: 'suite'; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestPass { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration_ms: number; + /** + * The type of the test, used to denote whether this is a suite. + * @since 20.0.0, 19.9.0, 18.17.0 + */ + type?: 'suite'; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestPlan { + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The number of subtests that have ran. + */ + count: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestStart { + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestStderr { + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The message written to `stderr` + */ + message: string; +} +interface TestStdout { + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The message written to `stdout` + */ + message: string; +} +interface TestEnqueue { + /** + * The test name + */ + name: string; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The nesting level of the test. + */ + nesting: number; +} +interface TestDequeue { + /** + * The test name + */ + name: string; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The nesting level of the test. + */ + nesting: number; +} + +/** + * The `node:test/reporters` module exposes the builtin-reporters for `node:test`. + * To access it: + * + * ```js + * import test from 'node:test/reporters'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import test from 'test/reporters'; + * ``` + * @since v19.9.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js) + */ +declare module 'node:test/reporters' { + import { Transform } from 'node:stream'; + + type TestEvent = + | { type: 'test:diagnostic', data: DiagnosticData } + | { type: 'test:fail', data: TestFail } + | { type: 'test:pass', data: TestPass } + | { type: 'test:plan', data: TestPlan } + | { type: 'test:start', data: TestStart } + | { type: 'test:stderr', data: TestStderr } + | { type: 'test:stdout', data: TestStdout } + | { type: 'test:enqueue', data: TestEnqueue } + | { type: 'test:dequeue', data: TestDequeue } + | { type: 'test:watch:drained' }; + type TestEventGenerator = AsyncGenerator; + + /** + * The `dot` reporter outputs the test results in a compact format, + * where each passing test is represented by a `.`, + * and each failing test is represented by a `X`. + */ + function dot(source: TestEventGenerator): AsyncGenerator<'\n' | '.' | 'X', void>; + /** + * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. + */ + function tap(source: TestEventGenerator): AsyncGenerator; + /** + * The `spec` reporter outputs the test results in a human-readable format. + */ + class Spec extends Transform { + constructor(); + } + export { dot, tap, Spec as spec, TestEvent }; +} diff --git a/node_modules/@types/node/ts4.8/timers.d.ts b/node_modules/@types/node/ts4.8/timers.d.ts new file mode 100755 index 0000000..51acc4e --- /dev/null +++ b/node_modules/@types/node/ts4.8/timers.d.ts @@ -0,0 +1,225 @@ +/** + * The `timer` module exposes a global API for scheduling functions to + * be called at some future period of time. Because the timer functions are + * globals, there is no need to call `require('node:timers')` to use the API. + * + * The timer functions within Node.js implement a similar API as the timers API + * provided by Web Browsers but use a different internal implementation that is + * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout). + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/timers.js) + */ +declare module 'timers' { + import { Abortable } from 'node:events'; + import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises'; + interface TimerOptions extends Abortable { + /** + * Set to `false` to indicate that the scheduled `Timeout` + * should not require the Node.js event loop to remain active. + * @default true + */ + ref?: boolean | undefined; + } + let setTimeout: typeof global.setTimeout; + let clearTimeout: typeof global.clearTimeout; + let setInterval: typeof global.setInterval; + let clearInterval: typeof global.clearInterval; + let setImmediate: typeof global.setImmediate; + let clearImmediate: typeof global.clearImmediate; + global { + namespace NodeJS { + // compatibility with older typings + interface Timer extends RefCounted { + hasRef(): boolean; + refresh(): this; + [Symbol.toPrimitive](): number; + } + /** + * This object is created internally and is returned from `setImmediate()`. It + * can be passed to `clearImmediate()` in order to cancel the scheduled + * actions. + * + * By default, when an immediate is scheduled, the Node.js event loop will continue + * running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`functions that can be used to + * control this default behavior. + */ + class Immediate implements RefCounted { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the`Immediate` is active. Calling `immediate.ref()` multiple times will have no + * effect. + * + * By default, all `Immediate` objects are "ref'ed", making it normally unnecessary + * to call `immediate.ref()` unless `immediate.unref()` had been called previously. + * @since v9.7.0 + * @return a reference to `immediate` + */ + ref(): this; + /** + * When called, the active `Immediate` object will not require the Node.js event + * loop to remain active. If there is no other activity keeping the event loop + * running, the process may exit before the `Immediate` object's callback is + * invoked. Calling `immediate.unref()` multiple times will have no effect. + * @since v9.7.0 + * @return a reference to `immediate` + */ + unref(): this; + /** + * If true, the `Immediate` object will keep the Node.js event loop active. + * @since v11.0.0 + */ + hasRef(): boolean; + _onImmediate: Function; // to distinguish it from the Timeout class + /** + * Cancels the immediate. This is similar to calling `clearImmediate()`. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + } + /** + * This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the + * scheduled actions. + * + * By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the + * timer is active. Each of the `Timeout` objects returned by these functions + * export both `timeout.ref()` and `timeout.unref()` functions that can be used to + * control this default behavior. + */ + class Timeout implements Timer { + /** + * When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect. + * + * By default, all `Timeout` objects are "ref'ed", making it normally unnecessary + * to call `timeout.ref()` unless `timeout.unref()` had been called previously. + * @since v0.9.1 + * @return a reference to `timeout` + */ + ref(): this; + /** + * When called, the active `Timeout` object will not require the Node.js event loop + * to remain active. If there is no other activity keeping the event loop running, + * the process may exit before the `Timeout` object's callback is invoked. Calling`timeout.unref()` multiple times will have no effect. + * @since v0.9.1 + * @return a reference to `timeout` + */ + unref(): this; + /** + * If true, the `Timeout` object will keep the Node.js event loop active. + * @since v11.0.0 + */ + hasRef(): boolean; + /** + * Sets the timer's start time to the current time, and reschedules the timer to + * call its callback at the previously specified duration adjusted to the current + * time. This is useful for refreshing a timer without allocating a new + * JavaScript object. + * + * Using this on a timer that has already called its callback will reactivate the + * timer. + * @since v10.2.0 + * @return a reference to `timeout` + */ + refresh(): this; + [Symbol.toPrimitive](): number; + /** + * Cancels the timeout. + * @since v20.5.0 + */ + [Symbol.dispose](): void; + } + } + /** + * Schedules execution of a one-time `callback` after `delay` milliseconds. + * + * The `callback` will likely not be invoked in precisely `delay` milliseconds. + * Node.js makes no guarantees about the exact timing of when callbacks will fire, + * nor of their ordering. The callback will be called as close as possible to the + * time specified. + * + * When `delay` is larger than `2147483647` or less than `1`, the `delay`will be set to `1`. Non-integer delays are truncated to an integer. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setTimeout()`. + * @since v0.0.1 + * @param callback The function to call when the timer elapses. + * @param [delay=1] The number of milliseconds to wait before calling the `callback`. + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearTimeout} + */ + function setTimeout(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout; + // util.promisify no rest args compability + // tslint:disable-next-line void-return + function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout; + namespace setTimeout { + const __promisify__: typeof setTimeoutPromise; + } + /** + * Cancels a `Timeout` object created by `setTimeout()`. + * @since v0.0.1 + * @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number. + */ + function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void; + /** + * Schedules repeated execution of `callback` every `delay` milliseconds. + * + * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be + * set to `1`. Non-integer delays are truncated to an integer. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setInterval()`. + * @since v0.0.1 + * @param callback The function to call when the timer elapses. + * @param [delay=1] The number of milliseconds to wait before calling the `callback`. + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearInterval} + */ + function setInterval(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout; + // util.promisify no rest args compability + // tslint:disable-next-line void-return + function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout; + namespace setInterval { + const __promisify__: typeof setIntervalPromise; + } + /** + * Cancels a `Timeout` object created by `setInterval()`. + * @since v0.0.1 + * @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number. + */ + function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void; + /** + * Schedules the "immediate" execution of the `callback` after I/O events' + * callbacks. + * + * When multiple calls to `setImmediate()` are made, the `callback` functions are + * queued for execution in the order in which they are created. The entire callback + * queue is processed every event loop iteration. If an immediate timer is queued + * from inside an executing callback, that timer will not be triggered until the + * next event loop iteration. + * + * If `callback` is not a function, a `TypeError` will be thrown. + * + * This method has a custom variant for promises that is available using `timersPromises.setImmediate()`. + * @since v0.9.1 + * @param callback The function to call at the end of this turn of the Node.js `Event Loop` + * @param args Optional arguments to pass when the `callback` is called. + * @return for use with {@link clearImmediate} + */ + function setImmediate(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate; + // util.promisify no rest args compability + // tslint:disable-next-line void-return + function setImmediate(callback: (args: void) => void): NodeJS.Immediate; + namespace setImmediate { + const __promisify__: typeof setImmediatePromise; + } + /** + * Cancels an `Immediate` object created by `setImmediate()`. + * @since v0.9.1 + * @param immediate An `Immediate` object as returned by {@link setImmediate}. + */ + function clearImmediate(immediateId: NodeJS.Immediate | undefined): void; + function queueMicrotask(callback: () => void): void; + } +} +declare module 'node:timers' { + export * from 'timers'; +} diff --git a/node_modules/@types/node/ts4.8/timers/promises.d.ts b/node_modules/@types/node/ts4.8/timers/promises.d.ts new file mode 100755 index 0000000..299a355 --- /dev/null +++ b/node_modules/@types/node/ts4.8/timers/promises.d.ts @@ -0,0 +1,93 @@ +/** + * The `timers/promises` API provides an alternative set of timer functions + * that return `Promise` objects. The API is accessible via`require('node:timers/promises')`. + * + * ```js + * import { + * setTimeout, + * setImmediate, + * setInterval, + * } from 'timers/promises'; + * ``` + * @since v15.0.0 + */ +declare module 'timers/promises' { + import { TimerOptions } from 'node:timers'; + /** + * ```js + * import { + * setTimeout, + * } from 'timers/promises'; + * + * const res = await setTimeout(100, 'result'); + * + * console.log(res); // Prints 'result' + * ``` + * @since v15.0.0 + * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. + * @param value A value with which the promise is fulfilled. + */ + function setTimeout(delay?: number, value?: T, options?: TimerOptions): Promise; + /** + * ```js + * import { + * setImmediate, + * } from 'timers/promises'; + * + * const res = await setImmediate('result'); + * + * console.log(res); // Prints 'result' + * ``` + * @since v15.0.0 + * @param value A value with which the promise is fulfilled. + */ + function setImmediate(value?: T, options?: TimerOptions): Promise; + /** + * Returns an async iterator that generates values in an interval of `delay` ms. + * If `ref` is `true`, you need to call `next()` of async iterator explicitly + * or implicitly to keep the event loop alive. + * + * ```js + * import { + * setInterval, + * } from 'timers/promises'; + * + * const interval = 100; + * for await (const startTime of setInterval(interval, Date.now())) { + * const now = Date.now(); + * console.log(now); + * if ((now - startTime) > 1000) + * break; + * } + * console.log(Date.now()); + * ``` + * @since v15.9.0 + */ + function setInterval(delay?: number, value?: T, options?: TimerOptions): AsyncIterable; + interface Scheduler { + /** + * ```js + * import { scheduler } from 'node:timers/promises'; + * + * await scheduler.wait(1000); // Wait one second before continuing + * ``` + * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API. + * Calling timersPromises.scheduler.wait(delay, options) is roughly equivalent to calling timersPromises.setTimeout(delay, undefined, options) except that the ref option is not supported. + * @since v16.14.0 + * @experimental + * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. + */ + wait: (delay?: number, options?: TimerOptions) => Promise; + /** + * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API. + * Calling timersPromises.scheduler.yield() is equivalent to calling timersPromises.setImmediate() with no arguments. + * @since v16.14.0 + * @experimental + */ + yield: () => Promise; + } + const scheduler: Scheduler; +} +declare module 'node:timers/promises' { + export * from 'timers/promises'; +} diff --git a/node_modules/@types/node/ts4.8/tls.d.ts b/node_modules/@types/node/ts4.8/tls.d.ts new file mode 100755 index 0000000..4992b24 --- /dev/null +++ b/node_modules/@types/node/ts4.8/tls.d.ts @@ -0,0 +1,1130 @@ +/** + * The `node:tls` module provides an implementation of the Transport Layer Security + * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. + * The module can be accessed using: + * + * ```js + * const tls = require('node:tls'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js) + */ +declare module 'tls' { + import { X509Certificate } from 'node:crypto'; + import * as net from 'node:net'; + import * as stream from 'stream'; + const CLIENT_RENEG_LIMIT: number; + const CLIENT_RENEG_WINDOW: number; + interface Certificate { + /** + * Country code. + */ + C: string; + /** + * Street. + */ + ST: string; + /** + * Locality. + */ + L: string; + /** + * Organization. + */ + O: string; + /** + * Organizational unit. + */ + OU: string; + /** + * Common name. + */ + CN: string; + } + interface PeerCertificate { + /** + * `true` if a Certificate Authority (CA), `false` otherwise. + * @since v18.13.0 + */ + ca: boolean; + /** + * The DER encoded X.509 certificate data. + */ + raw: Buffer; + /** + * The certificate subject. + */ + subject: Certificate; + /** + * The certificate issuer, described in the same terms as the `subject`. + */ + issuer: Certificate; + /** + * The date-time the certificate is valid from. + */ + valid_from: string; + /** + * The date-time the certificate is valid to. + */ + valid_to: string; + /** + * The certificate serial number, as a hex string. + */ + serialNumber: string; + /** + * The SHA-1 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint: string; + /** + * The SHA-256 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint256: string; + /** + * The SHA-512 digest of the DER encoded certificate. + * It is returned as a `:` separated hexadecimal string. + */ + fingerprint512: string; + /** + * The extended key usage, a set of OIDs. + */ + ext_key_usage?: string[]; + /** + * A string containing concatenated names for the subject, + * an alternative to the `subject` names. + */ + subjectaltname?: string; + /** + * An array describing the AuthorityInfoAccess, used with OCSP. + */ + infoAccess?: NodeJS.Dict; + /** + * For RSA keys: The RSA bit size. + * + * For EC keys: The key size in bits. + */ + bits?: number; + /** + * The RSA exponent, as a string in hexadecimal number notation. + */ + exponent?: string; + /** + * The RSA modulus, as a hexadecimal string. + */ + modulus?: string; + /** + * The public key. + */ + pubkey?: Buffer; + /** + * The ASN.1 name of the OID of the elliptic curve. + * Well-known curves are identified by an OID. + * While it is unusual, it is possible that the curve + * is identified by its mathematical properties, + * in which case it will not have an OID. + */ + asn1Curve?: string; + /** + * The NIST name for the elliptic curve,if it has one + * (not all well-known curves have been assigned names by NIST). + */ + nistCurve?: string; + } + interface DetailedPeerCertificate extends PeerCertificate { + /** + * The issuer certificate object. + * For self-signed certificates, this may be a circular reference. + */ + issuerCertificate: DetailedPeerCertificate; + } + interface CipherNameAndProtocol { + /** + * The cipher name. + */ + name: string; + /** + * SSL/TLS protocol version. + */ + version: string; + /** + * IETF name for the cipher suite. + */ + standardName: string; + } + interface EphemeralKeyInfo { + /** + * The supported types are 'DH' and 'ECDH'. + */ + type: string; + /** + * The name property is available only when type is 'ECDH'. + */ + name?: string | undefined; + /** + * The size of parameter of an ephemeral key exchange. + */ + size: number; + } + interface KeyObject { + /** + * Private keys in PEM format. + */ + pem: string | Buffer; + /** + * Optional passphrase. + */ + passphrase?: string | undefined; + } + interface PxfObject { + /** + * PFX or PKCS12 encoded private key and certificate chain. + */ + buf: string | Buffer; + /** + * Optional passphrase. + */ + passphrase?: string | undefined; + } + interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { + /** + * If true the TLS socket will be instantiated in server-mode. + * Defaults to false. + */ + isServer?: boolean | undefined; + /** + * An optional net.Server instance. + */ + server?: net.Server | undefined; + /** + * An optional Buffer instance containing a TLS session. + */ + session?: Buffer | undefined; + /** + * If true, specifies that the OCSP status request extension will be + * added to the client hello and an 'OCSPResponse' event will be + * emitted on the socket before establishing a secure communication + */ + requestOCSP?: boolean | undefined; + } + /** + * Performs transparent encryption of written data and all required TLS + * negotiation. + * + * Instances of `tls.TLSSocket` implement the duplex `Stream` interface. + * + * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the + * connection is open. + * @since v0.11.4 + */ + class TLSSocket extends net.Socket { + /** + * Construct a new tls.TLSSocket object from an existing TCP socket. + */ + constructor(socket: net.Socket, options?: TLSSocketOptions); + /** + * This property is `true` if the peer certificate was signed by one of the CAs + * specified when creating the `tls.TLSSocket` instance, otherwise `false`. + * @since v0.11.4 + */ + authorized: boolean; + /** + * Returns the reason why the peer's certificate was not been verified. This + * property is set only when `tlsSocket.authorized === false`. + * @since v0.11.4 + */ + authorizationError: Error; + /** + * Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances. + * @since v0.11.4 + */ + encrypted: true; + /** + * String containing the selected ALPN protocol. + * Before a handshake has completed, this value is always null. + * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false. + */ + alpnProtocol: string | false | null; + /** + * Returns an object representing the local certificate. The returned object has + * some properties corresponding to the fields of the certificate. + * + * See {@link TLSSocket.getPeerCertificate} for an example of the certificate + * structure. + * + * If there is no local certificate, an empty object will be returned. If the + * socket has been destroyed, `null` will be returned. + * @since v11.2.0 + */ + getCertificate(): PeerCertificate | object | null; + /** + * Returns an object containing information on the negotiated cipher suite. + * + * For example, a TLSv1.2 protocol with AES256-SHA cipher: + * + * ```json + * { + * "name": "AES256-SHA", + * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA", + * "version": "SSLv3" + * } + * ``` + * + * See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information. + * @since v0.11.4 + */ + getCipher(): CipherNameAndProtocol; + /** + * Returns an object representing the type, name, and size of parameter of + * an ephemeral key exchange in `perfect forward secrecy` on a client + * connection. It returns an empty object when the key exchange is not + * ephemeral. As this is only supported on a client socket; `null` is returned + * if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The`name` property is available only when type is `'ECDH'`. + * + * For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`. + * @since v5.0.0 + */ + getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; + /** + * As the `Finished` messages are message digests of the complete handshake + * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can + * be used for external authentication procedures when the authentication + * provided by SSL/TLS is not desired or is not enough. + * + * Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used + * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + * @since v9.9.0 + * @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet. + */ + getFinished(): Buffer | undefined; + /** + * Returns an object representing the peer's certificate. If the peer does not + * provide a certificate, an empty object will be returned. If the socket has been + * destroyed, `null` will be returned. + * + * If the full certificate chain was requested, each certificate will include an`issuerCertificate` property containing an object representing its issuer's + * certificate. + * @since v0.11.4 + * @param detailed Include the full certificate chain if `true`, otherwise include just the peer's certificate. + * @return A certificate object. + */ + getPeerCertificate(detailed: true): DetailedPeerCertificate; + getPeerCertificate(detailed?: false): PeerCertificate; + getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; + /** + * As the `Finished` messages are message digests of the complete handshake + * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can + * be used for external authentication procedures when the authentication + * provided by SSL/TLS is not desired or is not enough. + * + * Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used + * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + * @since v9.9.0 + * @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so + * far. + */ + getPeerFinished(): Buffer | undefined; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the + * current connection. The value `'unknown'` will be returned for connected + * sockets that have not completed the handshaking process. The value `null` will + * be returned for server sockets or disconnected client sockets. + * + * Protocol versions are: + * + * * `'SSLv3'` + * * `'TLSv1'` + * * `'TLSv1.1'` + * * `'TLSv1.2'` + * * `'TLSv1.3'` + * + * See the OpenSSL [`SSL_get_version`](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html) documentation for more information. + * @since v5.7.0 + */ + getProtocol(): string | null; + /** + * Returns the TLS session data or `undefined` if no session was + * negotiated. On the client, the data can be provided to the `session` option of {@link connect} to resume the connection. On the server, it may be useful + * for debugging. + * + * See `Session Resumption` for more information. + * + * Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications + * must use the `'session'` event (it also works for TLSv1.2 and below). + * @since v0.11.4 + */ + getSession(): Buffer | undefined; + /** + * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information. + * @since v12.11.0 + * @return List of signature algorithms shared between the server and the client in the order of decreasing preference. + */ + getSharedSigalgs(): string[]; + /** + * For a client, returns the TLS session ticket if one is available, or`undefined`. For a server, always returns `undefined`. + * + * It may be useful for debugging. + * + * See `Session Resumption` for more information. + * @since v0.11.4 + */ + getTLSTicket(): Buffer | undefined; + /** + * See `Session Resumption` for more information. + * @since v0.5.6 + * @return `true` if the session was reused, `false` otherwise. + */ + isSessionReused(): boolean; + /** + * The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. + * Upon completion, the `callback` function will be passed a single argument + * that is either an `Error` (if the request failed) or `null`. + * + * This method can be used to request a peer's certificate after the secure + * connection has been established. + * + * When running as the server, the socket will be destroyed with an error after`handshakeTimeout` timeout. + * + * For TLSv1.3, renegotiation cannot be initiated, it is not supported by the + * protocol. + * @since v0.11.8 + * @param callback If `renegotiate()` returned `true`, callback is attached once to the `'secure'` event. If `renegotiate()` returned `false`, `callback` will be called in the next tick with + * an error, unless the `tlsSocket` has been destroyed, in which case `callback` will not be called at all. + * @return `true` if renegotiation was initiated, `false` otherwise. + */ + renegotiate( + options: { + rejectUnauthorized?: boolean | undefined; + requestCert?: boolean | undefined; + }, + callback: (err: Error | null) => void + ): undefined | boolean; + /** + * The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. + * Returns `true` if setting the limit succeeded; `false` otherwise. + * + * Smaller fragment sizes decrease the buffering latency on the client: larger + * fragments are buffered by the TLS layer until the entire fragment is received + * and its integrity is verified; large fragments can span multiple roundtrips + * and their processing can be delayed due to packet loss or reordering. However, + * smaller fragments add extra TLS framing bytes and CPU overhead, which may + * decrease overall server throughput. + * @since v0.11.11 + * @param [size=16384] The maximum TLS fragment size. The maximum value is `16384`. + */ + setMaxSendFragment(size: number): boolean; + /** + * Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts + * to renegotiate will trigger an `'error'` event on the `TLSSocket`. + * @since v8.4.0 + */ + disableRenegotiation(): void; + /** + * When enabled, TLS packet trace information is written to `stderr`. This can be + * used to debug TLS connection problems. + * + * The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by + * OpenSSL's `SSL_trace()` function, the format is undocumented, can change + * without notice, and should not be relied on. + * @since v12.2.0 + */ + enableTrace(): void; + /** + * Returns the peer certificate as an `X509Certificate` object. + * + * If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned. + * @since v15.9.0 + */ + getPeerX509Certificate(): X509Certificate | undefined; + /** + * Returns the local certificate as an `X509Certificate` object. + * + * If there is no local certificate, or the socket has been destroyed,`undefined` will be returned. + * @since v15.9.0 + */ + getX509Certificate(): X509Certificate | undefined; + /** + * Keying material is used for validations to prevent different kind of attacks in + * network protocols, for example in the specifications of IEEE 802.1X. + * + * Example + * + * ```js + * const keyingMaterial = tlsSocket.exportKeyingMaterial( + * 128, + * 'client finished'); + * + * /* + * Example return value of keyingMaterial: + * + * + * ``` + * + * See the OpenSSL [`SSL_export_keying_material`](https://www.openssl.org/docs/man1.1.1/man3/SSL_export_keying_material.html) documentation for more + * information. + * @since v13.10.0, v12.17.0 + * @param length number of bytes to retrieve from keying material + * @param label an application specific label, typically this will be a value from the [IANA Exporter Label + * Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). + * @param context Optionally provide a context. + * @return requested bytes of the keying material + */ + exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer; + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + addListener(event: 'secureConnect', listener: () => void): this; + addListener(event: 'session', listener: (session: Buffer) => void): this; + addListener(event: 'keylog', listener: (line: Buffer) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'OCSPResponse', response: Buffer): boolean; + emit(event: 'secureConnect'): boolean; + emit(event: 'session', session: Buffer): boolean; + emit(event: 'keylog', line: Buffer): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + on(event: 'secureConnect', listener: () => void): this; + on(event: 'session', listener: (session: Buffer) => void): this; + on(event: 'keylog', listener: (line: Buffer) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + once(event: 'secureConnect', listener: () => void): this; + once(event: 'session', listener: (session: Buffer) => void): this; + once(event: 'keylog', listener: (line: Buffer) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + prependListener(event: 'secureConnect', listener: () => void): this; + prependListener(event: 'session', listener: (session: Buffer) => void): this; + prependListener(event: 'keylog', listener: (line: Buffer) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'OCSPResponse', listener: (response: Buffer) => void): this; + prependOnceListener(event: 'secureConnect', listener: () => void): this; + prependOnceListener(event: 'session', listener: (session: Buffer) => void): this; + prependOnceListener(event: 'keylog', listener: (line: Buffer) => void): this; + } + interface CommonConnectionOptions { + /** + * An optional TLS context object from tls.createSecureContext() + */ + secureContext?: SecureContext | undefined; + /** + * When enabled, TLS packet trace information is written to `stderr`. This can be + * used to debug TLS connection problems. + * @default false + */ + enableTrace?: boolean | undefined; + /** + * If true the server will request a certificate from clients that + * connect and attempt to verify that certificate. Defaults to + * false. + */ + requestCert?: boolean | undefined; + /** + * An array of strings or a Buffer naming possible ALPN protocols. + * (Protocols should be ordered by their priority.) + */ + ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined; + /** + * SNICallback(servername, cb) A function that will be + * called if the client supports SNI TLS extension. Two arguments + * will be passed when called: servername and cb. SNICallback should + * invoke cb(null, ctx), where ctx is a SecureContext instance. + * (tls.createSecureContext(...) can be used to get a proper + * SecureContext.) If SNICallback wasn't provided the default callback + * with high-level API will be used (see below). + */ + SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined; + /** + * If true the server will reject any connection which is not + * authorized with the list of supplied CAs. This option only has an + * effect if requestCert is true. + * @default true + */ + rejectUnauthorized?: boolean | undefined; + } + interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { + /** + * Abort the connection if the SSL/TLS handshake does not finish in the + * specified number of milliseconds. A 'tlsClientError' is emitted on + * the tls.Server object whenever a handshake times out. Default: + * 120000 (120 seconds). + */ + handshakeTimeout?: number | undefined; + /** + * The number of seconds after which a TLS session created by the + * server will no longer be resumable. See Session Resumption for more + * information. Default: 300. + */ + sessionTimeout?: number | undefined; + /** + * 48-bytes of cryptographically strong pseudo-random data. + */ + ticketKeys?: Buffer | undefined; + /** + * + * @param socket + * @param identity identity parameter sent from the client. + * @return pre-shared key that must either be + * a buffer or `null` to stop the negotiation process. Returned PSK must be + * compatible with the selected cipher's digest. + * + * When negotiating TLS-PSK (pre-shared keys), this function is called + * with the identity provided by the client. + * If the return value is `null` the negotiation process will stop and an + * "unknown_psk_identity" alert message will be sent to the other party. + * If the server wishes to hide the fact that the PSK identity was not known, + * the callback must provide some random data as `psk` to make the connection + * fail with "decrypt_error" before negotiation is finished. + * PSK ciphers are disabled by default, and using TLS-PSK thus + * requires explicitly specifying a cipher suite with the `ciphers` option. + * More information can be found in the RFC 4279. + */ + pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null; + /** + * hint to send to a client to help + * with selecting the identity during TLS-PSK negotiation. Will be ignored + * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be + * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. + */ + pskIdentityHint?: string | undefined; + } + interface PSKCallbackNegotation { + psk: DataView | NodeJS.TypedArray; + identity: string; + } + interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { + host?: string | undefined; + port?: number | undefined; + path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. + socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket + checkServerIdentity?: typeof checkServerIdentity | undefined; + servername?: string | undefined; // SNI TLS Extension + session?: Buffer | undefined; + minDHSize?: number | undefined; + lookup?: net.LookupFunction | undefined; + timeout?: number | undefined; + /** + * When negotiating TLS-PSK (pre-shared keys), this function is called + * with optional identity `hint` provided by the server or `null` + * in case of TLS 1.3 where `hint` was removed. + * It will be necessary to provide a custom `tls.checkServerIdentity()` + * for the connection as the default one will try to check hostname/IP + * of the server against the certificate but that's not applicable for PSK + * because there won't be a certificate present. + * More information can be found in the RFC 4279. + * + * @param hint message sent from the server to help client + * decide which identity to use during negotiation. + * Always `null` if TLS 1.3 is used. + * @returns Return `null` to stop the negotiation process. `psk` must be + * compatible with the selected cipher's digest. + * `identity` must use UTF-8 encoding. + */ + pskCallback?(hint: string | null): PSKCallbackNegotation | null; + } + /** + * Accepts encrypted connections using TLS or SSL. + * @since v0.3.2 + */ + class Server extends net.Server { + constructor(secureConnectionListener?: (socket: TLSSocket) => void); + constructor(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void); + /** + * The `server.addContext()` method adds a secure context that will be used if + * the client request's SNI name matches the supplied `hostname` (or wildcard). + * + * When there are multiple matching contexts, the most recently added one is + * used. + * @since v0.5.3 + * @param hostname A SNI host name or wildcard (e.g. `'*'`) + * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created + * with {@link createSecureContext} itself. + */ + addContext(hostname: string, context: SecureContextOptions): void; + /** + * Returns the session ticket keys. + * + * See `Session Resumption` for more information. + * @since v3.0.0 + * @return A 48-byte buffer containing the session ticket keys. + */ + getTicketKeys(): Buffer; + /** + * The `server.setSecureContext()` method replaces the secure context of an + * existing server. Existing connections to the server are not interrupted. + * @since v11.0.0 + * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). + */ + setSecureContext(options: SecureContextOptions): void; + /** + * Sets the session ticket keys. + * + * Changes to the ticket keys are effective only for future server connections. + * Existing or currently pending server connections will use the previous keys. + * + * See `Session Resumption` for more information. + * @since v3.0.0 + * @param keys A 48-byte buffer containing the session ticket keys. + */ + setTicketKeys(keys: Buffer): void; + /** + * events.EventEmitter + * 1. tlsClientError + * 2. newSession + * 3. OCSPRequest + * 4. resumeSession + * 5. secureConnection + * 6. keylog + */ + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + addListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + addListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'tlsClientError', err: Error, tlsSocket: TLSSocket): boolean; + emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean; + emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; + emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void): boolean; + emit(event: 'secureConnection', tlsSocket: TLSSocket): boolean; + emit(event: 'keylog', line: Buffer, tlsSocket: TLSSocket): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + on(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + on(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + once(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + once(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + prependListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; + prependOnceListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; + prependOnceListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this; + prependOnceListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; + } + /** + * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. + */ + interface SecurePair { + encrypted: TLSSocket; + cleartext: TLSSocket; + } + type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; + interface SecureContextOptions { + /** + * If set, this will be called when a client opens a connection using the ALPN extension. + * One argument will be passed to the callback: an object containing `servername` and `protocols` fields, + * respectively containing the server name from the SNI extension (if any) and an array of + * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, + * which will be returned to the client as the selected ALPN protocol, or `undefined`, + * to reject the connection with a fatal alert. If a string is returned that does not match one of + * the client's ALPN protocols, an error will be thrown. + * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error. + */ + ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined; + /** + * Optionally override the trusted CA certificates. Default is to trust + * the well-known CAs curated by Mozilla. Mozilla's CAs are completely + * replaced when CAs are explicitly specified using this option. + */ + ca?: string | Buffer | Array | undefined; + /** + * Cert chains in PEM format. One cert chain should be provided per + * private key. Each cert chain should consist of the PEM formatted + * certificate for a provided private key, followed by the PEM + * formatted intermediate certificates (if any), in order, and not + * including the root CA (the root CA must be pre-known to the peer, + * see ca). When providing multiple cert chains, they do not have to + * be in the same order as their private keys in key. If the + * intermediate certificates are not provided, the peer will not be + * able to validate the certificate, and the handshake will fail. + */ + cert?: string | Buffer | Array | undefined; + /** + * Colon-separated list of supported signature algorithms. The list + * can contain digest algorithms (SHA256, MD5 etc.), public key + * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g + * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). + */ + sigalgs?: string | undefined; + /** + * Cipher suite specification, replacing the default. For more + * information, see modifying the default cipher suite. Permitted + * ciphers can be obtained via tls.getCiphers(). Cipher names must be + * uppercased in order for OpenSSL to accept them. + */ + ciphers?: string | undefined; + /** + * Name of an OpenSSL engine which can provide the client certificate. + */ + clientCertEngine?: string | undefined; + /** + * PEM formatted CRLs (Certificate Revocation Lists). + */ + crl?: string | Buffer | Array | undefined; + /** + * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy. + * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available. + * ECDHE-based perfect forward secrecy will still be available. + */ + dhparam?: string | Buffer | undefined; + /** + * A string describing a named curve or a colon separated list of curve + * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key + * agreement. Set to auto to select the curve automatically. Use + * crypto.getCurves() to obtain a list of available curve names. On + * recent releases, openssl ecparam -list_curves will also display the + * name and description of each available elliptic curve. Default: + * tls.DEFAULT_ECDH_CURVE. + */ + ecdhCurve?: string | undefined; + /** + * Attempt to use the server's cipher suite preferences instead of the + * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be + * set in secureOptions + */ + honorCipherOrder?: boolean | undefined; + /** + * Private keys in PEM format. PEM allows the option of private keys + * being encrypted. Encrypted keys will be decrypted with + * options.passphrase. Multiple keys using different algorithms can be + * provided either as an array of unencrypted key strings or buffers, + * or an array of objects in the form {pem: [, + * passphrase: ]}. The object form can only occur in an array. + * object.passphrase is optional. Encrypted keys will be decrypted with + * object.passphrase if provided, or options.passphrase if it is not. + */ + key?: string | Buffer | Array | undefined; + /** + * Name of an OpenSSL engine to get private key from. Should be used + * together with privateKeyIdentifier. + */ + privateKeyEngine?: string | undefined; + /** + * Identifier of a private key managed by an OpenSSL engine. Should be + * used together with privateKeyEngine. Should not be set together with + * key, because both options define a private key in different ways. + */ + privateKeyIdentifier?: string | undefined; + /** + * Optionally set the maximum TLS version to allow. One + * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the + * `secureProtocol` option, use one or the other. + * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using + * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to + * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. + */ + maxVersion?: SecureVersion | undefined; + /** + * Optionally set the minimum TLS version to allow. One + * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the + * `secureProtocol` option, use one or the other. It is not recommended to use + * less than TLSv1.2, but it may be required for interoperability. + * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using + * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to + * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to + * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. + */ + minVersion?: SecureVersion | undefined; + /** + * Shared passphrase used for a single private key and/or a PFX. + */ + passphrase?: string | undefined; + /** + * PFX or PKCS12 encoded private key and certificate chain. pfx is an + * alternative to providing key and cert individually. PFX is usually + * encrypted, if it is, passphrase will be used to decrypt it. Multiple + * PFX can be provided either as an array of unencrypted PFX buffers, + * or an array of objects in the form {buf: [, + * passphrase: ]}. The object form can only occur in an array. + * object.passphrase is optional. Encrypted PFX will be decrypted with + * object.passphrase if provided, or options.passphrase if it is not. + */ + pfx?: string | Buffer | Array | undefined; + /** + * Optionally affect the OpenSSL protocol behavior, which is not + * usually necessary. This should be used carefully if at all! Value is + * a numeric bitmask of the SSL_OP_* options from OpenSSL Options + */ + secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options + /** + * Legacy mechanism to select the TLS protocol version to use, it does + * not support independent control of the minimum and maximum version, + * and does not support limiting the protocol to TLSv1.3. Use + * minVersion and maxVersion instead. The possible values are listed as + * SSL_METHODS, use the function names as strings. For example, use + * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow + * any TLS protocol version up to TLSv1.3. It is not recommended to use + * TLS versions less than 1.2, but it may be required for + * interoperability. Default: none, see minVersion. + */ + secureProtocol?: string | undefined; + /** + * Opaque identifier used by servers to ensure session state is not + * shared between applications. Unused by clients. + */ + sessionIdContext?: string | undefined; + /** + * 48-bytes of cryptographically strong pseudo-random data. + * See Session Resumption for more information. + */ + ticketKeys?: Buffer | undefined; + /** + * The number of seconds after which a TLS session created by the + * server will no longer be resumable. See Session Resumption for more + * information. Default: 300. + */ + sessionTimeout?: number | undefined; + } + interface SecureContext { + context: any; + } + /** + * Verifies the certificate `cert` is issued to `hostname`. + * + * Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on + * failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). + * + * This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as + * such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead. + * + * This function can be overwritten by providing an alternative function as the`options.checkServerIdentity` option that is passed to `tls.connect()`. The + * overwriting function can call `tls.checkServerIdentity()` of course, to augment + * the checks done with additional verification. + * + * This function is only called if the certificate passed all other checks, such as + * being issued by trusted CA (`options.ca`). + * + * Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name + * was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use + * a custom`options.checkServerIdentity` function that implements the desired behavior. + * @since v0.8.4 + * @param hostname The host name or IP address to verify the certificate against. + * @param cert A `certificate object` representing the peer's certificate. + */ + function checkServerIdentity(hostname: string, cert: PeerCertificate): Error | undefined; + /** + * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is + * automatically set as a listener for the `'secureConnection'` event. + * + * The `ticketKeys` options is automatically shared between `node:cluster` module + * workers. + * + * The following illustrates a simple echo server: + * + * ```js + * const tls = require('node:tls'); + * const fs = require('node:fs'); + * + * const options = { + * key: fs.readFileSync('server-key.pem'), + * cert: fs.readFileSync('server-cert.pem'), + * + * // This is necessary only if using client certificate authentication. + * requestCert: true, + * + * // This is necessary only if the client uses a self-signed certificate. + * ca: [ fs.readFileSync('client-cert.pem') ], + * }; + * + * const server = tls.createServer(options, (socket) => { + * console.log('server connected', + * socket.authorized ? 'authorized' : 'unauthorized'); + * socket.write('welcome!\n'); + * socket.setEncoding('utf8'); + * socket.pipe(socket); + * }); + * server.listen(8000, () => { + * console.log('server bound'); + * }); + * ``` + * + * The server can be tested by connecting to it using the example client from {@link connect}. + * @since v0.3.2 + */ + function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; + function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; + /** + * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event. + * + * `tls.connect()` returns a {@link TLSSocket} object. + * + * Unlike the `https` API, `tls.connect()` does not enable the + * SNI (Server Name Indication) extension by default, which may cause some + * servers to return an incorrect certificate or reject the connection + * altogether. To enable SNI, set the `servername` option in addition + * to `host`. + * + * The following illustrates a client for the echo server example from {@link createServer}: + * + * ```js + * // Assumes an echo server that is listening on port 8000. + * const tls = require('node:tls'); + * const fs = require('node:fs'); + * + * const options = { + * // Necessary only if the server requires client certificate authentication. + * key: fs.readFileSync('client-key.pem'), + * cert: fs.readFileSync('client-cert.pem'), + * + * // Necessary only if the server uses a self-signed certificate. + * ca: [ fs.readFileSync('server-cert.pem') ], + * + * // Necessary only if the server's cert isn't for "localhost". + * checkServerIdentity: () => { return null; }, + * }; + * + * const socket = tls.connect(8000, options, () => { + * console.log('client connected', + * socket.authorized ? 'authorized' : 'unauthorized'); + * process.stdin.pipe(socket); + * process.stdin.resume(); + * }); + * socket.setEncoding('utf8'); + * socket.on('data', (data) => { + * console.log(data); + * }); + * socket.on('end', () => { + * console.log('server ends connection'); + * }); + * ``` + * @since v0.11.3 + */ + function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; + /** + * Creates a new secure pair object with two streams, one of which reads and writes + * the encrypted data and the other of which reads and writes the cleartext data. + * Generally, the encrypted stream is piped to/from an incoming encrypted data + * stream and the cleartext one is used as a replacement for the initial encrypted + * stream. + * + * `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and`encrypted` stream properties. + * + * Using `cleartext` has the same API as {@link TLSSocket}. + * + * The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code: + * + * ```js + * pair = tls.createSecurePair(// ... ); + * pair.encrypted.pipe(socket); + * socket.pipe(pair.encrypted); + * ``` + * + * can be replaced by: + * + * ```js + * secureSocket = tls.TLSSocket(socket, options); + * ``` + * + * where `secureSocket` has the same API as `pair.cleartext`. + * @since v0.3.2 + * @deprecated Since v0.11.3 - Use {@link TLSSocket} instead. + * @param context A secure context object as returned by `tls.createSecureContext()` + * @param isServer `true` to specify that this TLS connection should be opened as a server. + * @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`. + * @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`. + */ + function createSecurePair(context?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; + /** + * {@link createServer} sets the default value of the `honorCipherOrder` option + * to `true`, other APIs that create secure contexts leave it unset. + * + * {@link createServer} uses a 128 bit truncated SHA1 hash value generated + * from `process.argv` as the default value of the `sessionIdContext` option, other + * APIs that create secure contexts have no default value. + * + * The `tls.createSecureContext()` method creates a `SecureContext` object. It is + * usable as an argument to several `tls` APIs, such as `server.addContext()`, + * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option. + * + * A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it. + * + * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of + * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt). + * + * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength + * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can + * be used to create custom parameters. The key length must be greater than or + * equal to 1024 bits or else an error will be thrown. Although 1024 bits is + * permissible, use 2048 bits or larger for stronger security. + * @since v0.11.13 + */ + function createSecureContext(options?: SecureContextOptions): SecureContext; + /** + * Returns an array with the names of the supported TLS ciphers. The names are + * lower-case for historical reasons, but must be uppercased to be used in + * the `ciphers` option of {@link createSecureContext}. + * + * Not all supported ciphers are enabled by default. See `Modifying the default TLS cipher suite`. + * + * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for + * TLSv1.2 and below. + * + * ```js + * console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...] + * ``` + * @since v0.10.2 + */ + function getCiphers(): string[]; + /** + * The default curve name to use for ECDH key agreement in a tls server. + * The default value is 'auto'. See tls.createSecureContext() for further + * information. + */ + let DEFAULT_ECDH_CURVE: string; + /** + * The default value of the maxVersion option of + * tls.createSecureContext(). It can be assigned any of the supported TLS + * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: + * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets + * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to + * 'TLSv1.3'. If multiple of the options are provided, the highest maximum + * is used. + */ + let DEFAULT_MAX_VERSION: SecureVersion; + /** + * The default value of the minVersion option of tls.createSecureContext(). + * It can be assigned any of the supported TLS protocol versions, + * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless + * changed using CLI options. Using --tls-min-v1.0 sets the default to + * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using + * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options + * are provided, the lowest minimum is used. + */ + let DEFAULT_MIN_VERSION: SecureVersion; + /** + * The default value of the ciphers option of tls.createSecureContext(). + * It can be assigned any of the supported OpenSSL ciphers. + * Defaults to the content of crypto.constants.defaultCoreCipherList, unless + * changed using CLI options using --tls-default-ciphers. + */ + let DEFAULT_CIPHERS: string; + /** + * An immutable array of strings representing the root certificates (in PEM + * format) used for verifying peer certificates. This is the default value + * of the ca option to tls.createSecureContext(). + */ + const rootCertificates: ReadonlyArray; +} +declare module 'node:tls' { + export * from 'tls'; +} diff --git a/node_modules/@types/node/ts4.8/trace_events.d.ts b/node_modules/@types/node/ts4.8/trace_events.d.ts new file mode 100755 index 0000000..ca8baed --- /dev/null +++ b/node_modules/@types/node/ts4.8/trace_events.d.ts @@ -0,0 +1,182 @@ +/** + * The `node:trace_events` module provides a mechanism to centralize tracing + * information generated by V8, Node.js core, and userspace code. + * + * Tracing can be enabled with the `--trace-event-categories` command-line flag + * or by using the `node:trace_events` module. The `--trace-event-categories` flag + * accepts a list of comma-separated category names. + * + * The available categories are: + * + * * `node`: An empty placeholder. + * * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data. + * The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. + * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones. + * * `node.console`: Enables capture of `console.time()` and `console.count()`output. + * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool + * synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. + * * `node.threadpoolwork.async`: Enables capture of trace data for threadpool + * asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. + * * `node.dns.native`: Enables capture of trace data for DNS queries. + * * `node.net.native`: Enables capture of trace data for network. + * * `node.environment`: Enables capture of Node.js Environment milestones. + * * `node.fs.sync`: Enables capture of trace data for file system sync methods. + * * `node.fs_dir.sync`: Enables capture of trace data for file system sync + * directory methods. + * * `node.fs.async`: Enables capture of trace data for file system async methods. + * * `node.fs_dir.async`: Enables capture of trace data for file system async + * directory methods. + * * `node.perf`: Enables capture of `Performance API` measurements. + * * `node.perf.usertiming`: Enables capture of only Performance API User Timing + * measures and marks. + * * `node.perf.timerify`: Enables capture of only Performance API timerify + * measurements. + * * `node.promises.rejections`: Enables capture of trace data tracking the number + * of unhandled Promise rejections and handled-after-rejections. + * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. + * * `v8`: The `V8` events are GC, compiling, and execution related. + * * `node.http`: Enables capture of trace data for http request / response. + * + * By default the `node`, `node.async_hooks`, and `v8` categories are enabled. + * + * ```bash + * node --trace-event-categories v8,node,node.async_hooks server.js + * ``` + * + * Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be + * used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default. + * + * ```bash + * node --trace-events-enabled + * + * # is equivalent to + * + * node --trace-event-categories v8,node,node.async_hooks + * ``` + * + * Alternatively, trace events may be enabled using the `node:trace_events` module: + * + * ```js + * const trace_events = require('node:trace_events'); + * const tracing = trace_events.createTracing({ categories: ['node.perf'] }); + * tracing.enable(); // Enable trace event capture for the 'node.perf' category + * + * // do work + * + * tracing.disable(); // Disable trace event capture for the 'node.perf' category + * ``` + * + * Running Node.js with tracing enabled will produce log files that can be opened + * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome. + * + * The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can + * be specified with `--trace-event-file-pattern` that accepts a template + * string that supports `${rotation}` and `${pid}`: + * + * ```bash + * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js + * ``` + * + * To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers + * in your code, such as: + * + * ```js + * process.on('SIGINT', function onSigint() { + * console.info('Received SIGINT.'); + * process.exit(130); // Or applicable exit code depending on OS and signal + * }); + * ``` + * + * The tracing system uses the same time source + * as the one used by `process.hrtime()`. + * However the trace-event timestamps are expressed in microseconds, + * unlike `process.hrtime()` which returns nanoseconds. + * + * The features from this module are not available in `Worker` threads. + * @experimental + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/trace_events.js) + */ +declare module 'trace_events' { + /** + * The `Tracing` object is used to enable or disable tracing for sets of + * categories. Instances are created using the + * `trace_events.createTracing()` method. + * + * When created, the `Tracing` object is disabled. Calling the + * `tracing.enable()` method adds the categories to the set of enabled trace + * event categories. Calling `tracing.disable()` will remove the categories + * from the set of enabled trace event categories. + */ + interface Tracing { + /** + * A comma-separated list of the trace event categories covered by this + * `Tracing` object. + */ + readonly categories: string; + /** + * Disables this `Tracing` object. + * + * Only trace event categories _not_ covered by other enabled `Tracing` + * objects and _not_ specified by the `--trace-event-categories` flag + * will be disabled. + */ + disable(): void; + /** + * Enables this `Tracing` object for the set of categories covered by + * the `Tracing` object. + */ + enable(): void; + /** + * `true` only if the `Tracing` object has been enabled. + */ + readonly enabled: boolean; + } + interface CreateTracingOptions { + /** + * An array of trace category names. Values included in the array are + * coerced to a string when possible. An error will be thrown if the + * value cannot be coerced. + */ + categories: string[]; + } + /** + * Creates and returns a `Tracing` object for the given set of `categories`. + * + * ```js + * const trace_events = require('node:trace_events'); + * const categories = ['node.perf', 'node.async_hooks']; + * const tracing = trace_events.createTracing({ categories }); + * tracing.enable(); + * // do stuff + * tracing.disable(); + * ``` + * @since v10.0.0 + * @return . + */ + function createTracing(options: CreateTracingOptions): Tracing; + /** + * Returns a comma-separated list of all currently-enabled trace event + * categories. The current set of enabled trace event categories is determined + * by the _union_ of all currently-enabled `Tracing` objects and any categories + * enabled using the `--trace-event-categories` flag. + * + * Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console. + * + * ```js + * const trace_events = require('node:trace_events'); + * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] }); + * const t2 = trace_events.createTracing({ categories: ['node.perf'] }); + * const t3 = trace_events.createTracing({ categories: ['v8'] }); + * + * t1.enable(); + * t2.enable(); + * + * console.log(trace_events.getEnabledCategories()); + * ``` + * @since v10.0.0 + */ + function getEnabledCategories(): string | undefined; +} +declare module 'node:trace_events' { + export * from 'trace_events'; +} diff --git a/node_modules/@types/node/ts4.8/tty.d.ts b/node_modules/@types/node/ts4.8/tty.d.ts new file mode 100755 index 0000000..7653bf8 --- /dev/null +++ b/node_modules/@types/node/ts4.8/tty.d.ts @@ -0,0 +1,208 @@ +/** + * The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream`classes. In most cases, it will not be necessary or possible to use this module + * directly. However, it can be accessed using: + * + * ```js + * const tty = require('node:tty'); + * ``` + * + * When Node.js detects that it is being run with a text terminal ("TTY") + * attached, `process.stdin` will, by default, be initialized as an instance of`tty.ReadStream` and both `process.stdout` and `process.stderr` will, by + * default, be instances of `tty.WriteStream`. The preferred method of determining + * whether Node.js is being run within a TTY context is to check that the value of + * the `process.stdout.isTTY` property is `true`: + * + * ```console + * $ node -p -e "Boolean(process.stdout.isTTY)" + * true + * $ node -p -e "Boolean(process.stdout.isTTY)" | cat + * false + * ``` + * + * In most cases, there should be little to no reason for an application to + * manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes. + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tty.js) + */ +declare module 'tty' { + import * as net from 'node:net'; + /** + * The `tty.isatty()` method returns `true` if the given `fd` is associated with + * a TTY and `false` if it is not, including whenever `fd` is not a non-negative + * integer. + * @since v0.5.8 + * @param fd A numeric file descriptor + */ + function isatty(fd: number): boolean; + /** + * Represents the readable side of a TTY. In normal circumstances `process.stdin` will be the only `tty.ReadStream` instance in a Node.js + * process and there should be no reason to create additional instances. + * @since v0.5.8 + */ + class ReadStream extends net.Socket { + constructor(fd: number, options?: net.SocketConstructorOpts); + /** + * A `boolean` that is `true` if the TTY is currently configured to operate as a + * raw device. + * + * This flag is always `false` when a process starts, even if the terminal is + * operating in raw mode. Its value will change with subsequent calls to`setRawMode`. + * @since v0.7.7 + */ + isRaw: boolean; + /** + * Allows configuration of `tty.ReadStream` so that it operates as a raw device. + * + * When in raw mode, input is always available character-by-character, not + * including modifiers. Additionally, all special processing of characters by the + * terminal is disabled, including echoing input + * characters. Ctrl+C will no longer cause a `SIGINT` when + * in this mode. + * @since v0.7.7 + * @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw` + * property will be set to the resulting mode. + * @return The read stream instance. + */ + setRawMode(mode: boolean): this; + /** + * A `boolean` that is always `true` for `tty.ReadStream` instances. + * @since v0.5.8 + */ + isTTY: boolean; + } + /** + * -1 - to the left from cursor + * 0 - the entire line + * 1 - to the right from cursor + */ + type Direction = -1 | 0 | 1; + /** + * Represents the writable side of a TTY. In normal circumstances,`process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there + * should be no reason to create additional instances. + * @since v0.5.8 + */ + class WriteStream extends net.Socket { + constructor(fd: number); + addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: 'resize', listener: () => void): this; + emit(event: string | symbol, ...args: any[]): boolean; + emit(event: 'resize'): boolean; + on(event: string, listener: (...args: any[]) => void): this; + on(event: 'resize', listener: () => void): this; + once(event: string, listener: (...args: any[]) => void): this; + once(event: 'resize', listener: () => void): this; + prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: 'resize', listener: () => void): this; + prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: 'resize', listener: () => void): this; + /** + * `writeStream.clearLine()` clears the current line of this `WriteStream` in a + * direction identified by `dir`. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + clearLine(dir: Direction, callback?: () => void): boolean; + /** + * `writeStream.clearScreenDown()` clears this `WriteStream` from the current + * cursor down. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + clearScreenDown(callback?: () => void): boolean; + /** + * `writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified + * position. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + cursorTo(x: number, y?: number, callback?: () => void): boolean; + cursorTo(x: number, callback: () => void): boolean; + /** + * `writeStream.moveCursor()` moves this `WriteStream`'s cursor _relative_ to its + * current position. + * @since v0.7.7 + * @param callback Invoked once the operation completes. + * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + */ + moveCursor(dx: number, dy: number, callback?: () => void): boolean; + /** + * Returns: + * + * * `1` for 2, + * * `4` for 16, + * * `8` for 256, + * * `24` for 16,777,216 colors supported. + * + * Use this to determine what colors the terminal supports. Due to the nature of + * colors in terminals it is possible to either have false positives or false + * negatives. It depends on process information and the environment variables that + * may lie about what terminal is used. + * It is possible to pass in an `env` object to simulate the usage of a specific + * terminal. This can be useful to check how specific environment settings behave. + * + * To enforce a specific color support, use one of the below environment settings. + * + * * 2 colors: `FORCE_COLOR = 0` (Disables colors) + * * 16 colors: `FORCE_COLOR = 1` + * * 256 colors: `FORCE_COLOR = 2` + * * 16,777,216 colors: `FORCE_COLOR = 3` + * + * Disabling color support is also possible by using the `NO_COLOR` and`NODE_DISABLE_COLORS` environment variables. + * @since v9.9.0 + * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal. + */ + getColorDepth(env?: object): number; + /** + * Returns `true` if the `writeStream` supports at least as many colors as provided + * in `count`. Minimum support is 2 (black and white). + * + * This has the same false positives and negatives as described in `writeStream.getColorDepth()`. + * + * ```js + * process.stdout.hasColors(); + * // Returns true or false depending on if `stdout` supports at least 16 colors. + * process.stdout.hasColors(256); + * // Returns true or false depending on if `stdout` supports at least 256 colors. + * process.stdout.hasColors({ TMUX: '1' }); + * // Returns true. + * process.stdout.hasColors(2 ** 24, { TMUX: '1' }); + * // Returns false (the environment setting pretends to support 2 ** 8 colors). + * ``` + * @since v11.13.0, v10.16.0 + * @param [count=16] The number of colors that are requested (minimum 2). + * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal. + */ + hasColors(count?: number): boolean; + hasColors(env?: object): boolean; + hasColors(count: number, env?: object): boolean; + /** + * `writeStream.getWindowSize()` returns the size of the TTY + * corresponding to this `WriteStream`. The array is of the type`[numColumns, numRows]` where `numColumns` and `numRows` represent the number + * of columns and rows in the corresponding TTY. + * @since v0.7.7 + */ + getWindowSize(): [number, number]; + /** + * A `number` specifying the number of columns the TTY currently has. This property + * is updated whenever the `'resize'` event is emitted. + * @since v0.7.7 + */ + columns: number; + /** + * A `number` specifying the number of rows the TTY currently has. This property + * is updated whenever the `'resize'` event is emitted. + * @since v0.7.7 + */ + rows: number; + /** + * A `boolean` that is always `true`. + * @since v0.5.8 + */ + isTTY: boolean; + } +} +declare module 'node:tty' { + export * from 'tty'; +} diff --git a/node_modules/@types/node/ts4.8/url.d.ts b/node_modules/@types/node/ts4.8/url.d.ts new file mode 100755 index 0000000..7bdaed1 --- /dev/null +++ b/node_modules/@types/node/ts4.8/url.d.ts @@ -0,0 +1,915 @@ +/** + * The `node:url` module provides utilities for URL resolution and parsing. It can + * be accessed using: + * + * ```js + * import url from 'node:url'; + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/url.js) + */ +declare module 'url' { + import { Blob as NodeBlob } from 'node:buffer'; + import { ClientRequestArgs } from 'node:http'; + import { ParsedUrlQuery, ParsedUrlQueryInput } from 'node:querystring'; + // Input to `url.format` + interface UrlObject { + auth?: string | null | undefined; + hash?: string | null | undefined; + host?: string | null | undefined; + hostname?: string | null | undefined; + href?: string | null | undefined; + pathname?: string | null | undefined; + protocol?: string | null | undefined; + search?: string | null | undefined; + slashes?: boolean | null | undefined; + port?: string | number | null | undefined; + query?: string | null | ParsedUrlQueryInput | undefined; + } + // Output of `url.parse` + interface Url { + auth: string | null; + hash: string | null; + host: string | null; + hostname: string | null; + href: string; + path: string | null; + pathname: string | null; + protocol: string | null; + search: string | null; + slashes: boolean | null; + port: string | null; + query: string | null | ParsedUrlQuery; + } + interface UrlWithParsedQuery extends Url { + query: ParsedUrlQuery; + } + interface UrlWithStringQuery extends Url { + query: string | null; + } + /** + * The `url.parse()` method takes a URL string, parses it, and returns a URL + * object. + * + * A `TypeError` is thrown if `urlString` is not a string. + * + * A `URIError` is thrown if the `auth` property is present but cannot be decoded. + * + * `url.parse()` uses a lenient, non-standard algorithm for parsing URL + * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted + * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead. + * @since v0.1.25 + * @deprecated Use the WHATWG URL API instead. + * @param urlString The URL string to parse. + * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property + * on the returned URL object will be an unparsed, undecoded string. + * @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the + * result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. + */ + function parse(urlString: string): UrlWithStringQuery; + function parse(urlString: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery; + function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; + function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; + /** + * The `url.format()` method returns a formatted URL string derived from`urlObject`. + * + * ```js + * const url = require('node:url'); + * url.format({ + * protocol: 'https', + * hostname: 'example.com', + * pathname: '/some/path', + * query: { + * page: 1, + * format: 'json', + * }, + * }); + * + * // => 'https://example.com/some/path?page=1&format=json' + * ``` + * + * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`. + * + * The formatting process operates as follows: + * + * * A new empty string `result` is created. + * * If `urlObject.protocol` is a string, it is appended as-is to `result`. + * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown. + * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII + * colon (`:`) character, the literal string `:` will be appended to `result`. + * * If either of the following conditions is true, then the literal string `//`will be appended to `result`: + * * `urlObject.slashes` property is true; + * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`; + * * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string + * and appended to `result`followed by the literal string `@`. + * * If the `urlObject.host` property is `undefined` then: + * * If the `urlObject.hostname` is a string, it is appended to `result`. + * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string, + * an `Error` is thrown. + * * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`: + * * The literal string `:` is appended to `result`, and + * * The value of `urlObject.port` is coerced to a string and appended to`result`. + * * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`. + * * If the `urlObject.pathname` property is a string that is not an empty string: + * * If the `urlObject.pathname`_does not start_ with an ASCII forward slash + * (`/`), then the literal string `'/'` is appended to `result`. + * * The value of `urlObject.pathname` is appended to `result`. + * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown. + * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the + * `querystring` module's `stringify()`method passing the value of `urlObject.query`. + * * Otherwise, if `urlObject.search` is a string: + * * If the value of `urlObject.search`_does not start_ with the ASCII question + * mark (`?`) character, the literal string `?` is appended to `result`. + * * The value of `urlObject.search` is appended to `result`. + * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown. + * * If the `urlObject.hash` property is a string: + * * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`) + * character, the literal string `#` is appended to `result`. + * * The value of `urlObject.hash` is appended to `result`. + * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a + * string, an `Error` is thrown. + * * `result` is returned. + * @since v0.1.25 + * @legacy Use the WHATWG URL API instead. + * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. + */ + function format(urlObject: URL, options?: URLFormatOptions): string; + /** + * The `url.format()` method returns a formatted URL string derived from`urlObject`. + * + * ```js + * const url = require('url'); + * url.format({ + * protocol: 'https', + * hostname: 'example.com', + * pathname: '/some/path', + * query: { + * page: 1, + * format: 'json' + * } + * }); + * + * // => 'https://example.com/some/path?page=1&format=json' + * ``` + * + * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`. + * + * The formatting process operates as follows: + * + * * A new empty string `result` is created. + * * If `urlObject.protocol` is a string, it is appended as-is to `result`. + * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown. + * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII + * colon (`:`) character, the literal string `:` will be appended to `result`. + * * If either of the following conditions is true, then the literal string `//`will be appended to `result`: + * * `urlObject.slashes` property is true; + * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`; + * * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string + * and appended to `result`followed by the literal string `@`. + * * If the `urlObject.host` property is `undefined` then: + * * If the `urlObject.hostname` is a string, it is appended to `result`. + * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string, + * an `Error` is thrown. + * * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`: + * * The literal string `:` is appended to `result`, and + * * The value of `urlObject.port` is coerced to a string and appended to`result`. + * * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`. + * * If the `urlObject.pathname` property is a string that is not an empty string: + * * If the `urlObject.pathname`_does not start_ with an ASCII forward slash + * (`/`), then the literal string `'/'` is appended to `result`. + * * The value of `urlObject.pathname` is appended to `result`. + * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown. + * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the + * `querystring` module's `stringify()`method passing the value of `urlObject.query`. + * * Otherwise, if `urlObject.search` is a string: + * * If the value of `urlObject.search`_does not start_ with the ASCII question + * mark (`?`) character, the literal string `?` is appended to `result`. + * * The value of `urlObject.search` is appended to `result`. + * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown. + * * If the `urlObject.hash` property is a string: + * * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`) + * character, the literal string `#` is appended to `result`. + * * The value of `urlObject.hash` is appended to `result`. + * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a + * string, an `Error` is thrown. + * * `result` is returned. + * @since v0.1.25 + * @legacy Use the WHATWG URL API instead. + * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. + */ + function format(urlObject: UrlObject | string): string; + /** + * The `url.resolve()` method resolves a target URL relative to a base URL in a + * manner similar to that of a web browser resolving an anchor tag. + * + * ```js + * const url = require('node:url'); + * url.resolve('/one/two/three', 'four'); // '/one/two/four' + * url.resolve('http://example.com/', '/one'); // 'http://example.com/one' + * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two' + * ``` + * + * To achieve the same result using the WHATWG URL API: + * + * ```js + * function resolve(from, to) { + * const resolvedUrl = new URL(to, new URL(from, 'resolve://')); + * if (resolvedUrl.protocol === 'resolve:') { + * // `from` is a relative URL. + * const { pathname, search, hash } = resolvedUrl; + * return pathname + search + hash; + * } + * return resolvedUrl.toString(); + * } + * + * resolve('/one/two/three', 'four'); // '/one/two/four' + * resolve('http://example.com/', '/one'); // 'http://example.com/one' + * resolve('http://example.com/one', '/two'); // 'http://example.com/two' + * ``` + * @since v0.1.25 + * @legacy Use the WHATWG URL API instead. + * @param from The base URL to use if `to` is a relative URL. + * @param to The target URL to resolve. + */ + function resolve(from: string, to: string): string; + /** + * Returns the [Punycode](https://tools.ietf.org/html/rfc5891#section-4.4) ASCII serialization of the `domain`. If `domain` is an + * invalid domain, the empty string is returned. + * + * It performs the inverse operation to {@link domainToUnicode}. + * + * ```js + * import url from 'node:url'; + * + * console.log(url.domainToASCII('español.com')); + * // Prints xn--espaol-zwa.com + * console.log(url.domainToASCII('中文.com')); + * // Prints xn--fiq228c.com + * console.log(url.domainToASCII('xn--iñvalid.com')); + * // Prints an empty string + * ``` + * @since v7.4.0, v6.13.0 + */ + function domainToASCII(domain: string): string; + /** + * Returns the Unicode serialization of the `domain`. If `domain` is an invalid + * domain, the empty string is returned. + * + * It performs the inverse operation to {@link domainToASCII}. + * + * ```js + * import url from 'node:url'; + * + * console.log(url.domainToUnicode('xn--espaol-zwa.com')); + * // Prints español.com + * console.log(url.domainToUnicode('xn--fiq228c.com')); + * // Prints 中文.com + * console.log(url.domainToUnicode('xn--iñvalid.com')); + * // Prints an empty string + * ``` + * @since v7.4.0, v6.13.0 + */ + function domainToUnicode(domain: string): string; + /** + * This function ensures the correct decodings of percent-encoded characters as + * well as ensuring a cross-platform valid absolute path string. + * + * ```js + * import { fileURLToPath } from 'node:url'; + * + * const __filename = fileURLToPath(import.meta.url); + * + * new URL('file:///C:/path/').pathname; // Incorrect: /C:/path/ + * fileURLToPath('file:///C:/path/'); // Correct: C:\path\ (Windows) + * + * new URL('file://nas/foo.txt').pathname; // Incorrect: /foo.txt + * fileURLToPath('file://nas/foo.txt'); // Correct: \\nas\foo.txt (Windows) + * + * new URL('file:///你好.txt').pathname; // Incorrect: /%E4%BD%A0%E5%A5%BD.txt + * fileURLToPath('file:///你好.txt'); // Correct: /你好.txt (POSIX) + * + * new URL('file:///hello world').pathname; // Incorrect: /hello%20world + * fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX) + * ``` + * @since v10.12.0 + * @param url The file URL string or URL object to convert to a path. + * @return The fully-resolved platform-specific Node.js file path. + */ + function fileURLToPath(url: string | URL): string; + /** + * This function ensures that `path` is resolved absolutely, and that the URL + * control characters are correctly encoded when converting into a File URL. + * + * ```js + * import { pathToFileURL } from 'node:url'; + * + * new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1 + * pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX) + * + * new URL('/some/path%.c', 'file:'); // Incorrect: file:///some/path%.c + * pathToFileURL('/some/path%.c'); // Correct: file:///some/path%25.c (POSIX) + * ``` + * @since v10.12.0 + * @param path The path to convert to a File URL. + * @return The file URL object. + */ + function pathToFileURL(path: string): URL; + /** + * This utility function converts a URL object into an ordinary options object as + * expected by the `http.request()` and `https.request()` APIs. + * + * ```js + * import { urlToHttpOptions } from 'node:url'; + * const myURL = new URL('https://a:b@測試?abc#foo'); + * + * console.log(urlToHttpOptions(myURL)); + * /* + * { + * protocol: 'https:', + * hostname: 'xn--g6w251d', + * hash: '#foo', + * search: '?abc', + * pathname: '/', + * path: '/?abc', + * href: 'https://a:b@xn--g6w251d/?abc#foo', + * auth: 'a:b' + * } + * + * ``` + * @since v15.7.0, v14.18.0 + * @param url The `WHATWG URL` object to convert to an options object. + * @return Options object + */ + function urlToHttpOptions(url: URL): ClientRequestArgs; + interface URLFormatOptions { + auth?: boolean | undefined; + fragment?: boolean | undefined; + search?: boolean | undefined; + unicode?: boolean | undefined; + } + /** + * Browser-compatible `URL` class, implemented by following the WHATWG URL + * Standard. [Examples of parsed URLs](https://url.spec.whatwg.org/#example-url-parsing) may be found in the Standard itself. + * The `URL` class is also available on the global object. + * + * In accordance with browser conventions, all properties of `URL` objects + * are implemented as getters and setters on the class prototype, rather than as + * data properties on the object itself. Thus, unlike `legacy urlObject` s, + * using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still + * return `true`. + * @since v7.0.0, v6.13.0 + */ + class URL { + /** + * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later. + * + * ```js + * const { + * Blob, + * resolveObjectURL, + * } = require('node:buffer'); + * + * const blob = new Blob(['hello']); + * const id = URL.createObjectURL(blob); + * + * // later... + * + * const otherBlob = resolveObjectURL(id); + * console.log(otherBlob.size); + * ``` + * + * The data stored by the registered `Blob` will be retained in memory until`URL.revokeObjectURL()` is called to remove it. + * + * `Blob` objects are registered within the current thread. If using Worker + * Threads, `Blob` objects registered within one Worker will not be available + * to other workers or the main thread. + * @since v16.7.0 + * @experimental + */ + static createObjectURL(blob: NodeBlob): string; + /** + * Removes the stored `Blob` identified by the given ID. Attempting to revoke a + * ID that isn't registered will silently fail. + * @since v16.7.0 + * @experimental + * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. + */ + static revokeObjectURL(objectUrl: string): void; + /** + * Checks if an `input` relative to the `base` can be parsed to a `URL`. + * + * ```js + * const isValid = URL.canParse('/foo', 'https://example.org/'); // true + * + * const isNotValid = URL.canParse('/foo'); // false + * ``` + * @since v19.9.0 + * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is + * `converted to a string` first. + * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first. + */ + static canParse(input: string, base?: string): boolean; + constructor(input: string, base?: string | URL); + /** + * Gets and sets the fragment portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org/foo#bar'); + * console.log(myURL.hash); + * // Prints #bar + * + * myURL.hash = 'baz'; + * console.log(myURL.href); + * // Prints https://example.org/foo#baz + * ``` + * + * Invalid URL characters included in the value assigned to the `hash` property + * are `percent-encoded`. The selection of which characters to + * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + hash: string; + /** + * Gets and sets the host portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org:81/foo'); + * console.log(myURL.host); + * // Prints example.org:81 + * + * myURL.host = 'example.com:82'; + * console.log(myURL.href); + * // Prints https://example.com:82/foo + * ``` + * + * Invalid host values assigned to the `host` property are ignored. + */ + host: string; + /** + * Gets and sets the host name portion of the URL. The key difference between`url.host` and `url.hostname` is that `url.hostname` does _not_ include the + * port. + * + * ```js + * const myURL = new URL('https://example.org:81/foo'); + * console.log(myURL.hostname); + * // Prints example.org + * + * // Setting the hostname does not change the port + * myURL.hostname = 'example.com'; + * console.log(myURL.href); + * // Prints https://example.com:81/foo + * + * // Use myURL.host to change the hostname and port + * myURL.host = 'example.org:82'; + * console.log(myURL.href); + * // Prints https://example.org:82/foo + * ``` + * + * Invalid host name values assigned to the `hostname` property are ignored. + */ + hostname: string; + /** + * Gets and sets the serialized URL. + * + * ```js + * const myURL = new URL('https://example.org/foo'); + * console.log(myURL.href); + * // Prints https://example.org/foo + * + * myURL.href = 'https://example.com/bar'; + * console.log(myURL.href); + * // Prints https://example.com/bar + * ``` + * + * Getting the value of the `href` property is equivalent to calling {@link toString}. + * + * Setting the value of this property to a new value is equivalent to creating a + * new `URL` object using `new URL(value)`. Each of the `URL`object's properties will be modified. + * + * If the value assigned to the `href` property is not a valid URL, a `TypeError`will be thrown. + */ + href: string; + /** + * Gets the read-only serialization of the URL's origin. + * + * ```js + * const myURL = new URL('https://example.org/foo/bar?baz'); + * console.log(myURL.origin); + * // Prints https://example.org + * ``` + * + * ```js + * const idnURL = new URL('https://測試'); + * console.log(idnURL.origin); + * // Prints https://xn--g6w251d + * + * console.log(idnURL.hostname); + * // Prints xn--g6w251d + * ``` + */ + readonly origin: string; + /** + * Gets and sets the password portion of the URL. + * + * ```js + * const myURL = new URL('https://abc:xyz@example.com'); + * console.log(myURL.password); + * // Prints xyz + * + * myURL.password = '123'; + * console.log(myURL.href); + * // Prints https://abc:123@example.com/ + * ``` + * + * Invalid URL characters included in the value assigned to the `password` property + * are `percent-encoded`. The selection of which characters to + * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + password: string; + /** + * Gets and sets the path portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org/abc/xyz?123'); + * console.log(myURL.pathname); + * // Prints /abc/xyz + * + * myURL.pathname = '/abcdef'; + * console.log(myURL.href); + * // Prints https://example.org/abcdef?123 + * ``` + * + * Invalid URL characters included in the value assigned to the `pathname`property are `percent-encoded`. The selection of which characters + * to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + pathname: string; + /** + * Gets and sets the port portion of the URL. + * + * The port value may be a number or a string containing a number in the range`0` to `65535` (inclusive). Setting the value to the default port of the`URL` objects given `protocol` will + * result in the `port` value becoming + * the empty string (`''`). + * + * The port value can be an empty string in which case the port depends on + * the protocol/scheme: + * + * + * + * Upon assigning a value to the port, the value will first be converted to a + * string using `.toString()`. + * + * If that string is invalid but it begins with a number, the leading number is + * assigned to `port`. + * If the number lies outside the range denoted above, it is ignored. + * + * ```js + * const myURL = new URL('https://example.org:8888'); + * console.log(myURL.port); + * // Prints 8888 + * + * // Default ports are automatically transformed to the empty string + * // (HTTPS protocol's default port is 443) + * myURL.port = '443'; + * console.log(myURL.port); + * // Prints the empty string + * console.log(myURL.href); + * // Prints https://example.org/ + * + * myURL.port = 1234; + * console.log(myURL.port); + * // Prints 1234 + * console.log(myURL.href); + * // Prints https://example.org:1234/ + * + * // Completely invalid port strings are ignored + * myURL.port = 'abcd'; + * console.log(myURL.port); + * // Prints 1234 + * + * // Leading numbers are treated as a port number + * myURL.port = '5678abcd'; + * console.log(myURL.port); + * // Prints 5678 + * + * // Non-integers are truncated + * myURL.port = 1234.5678; + * console.log(myURL.port); + * // Prints 1234 + * + * // Out-of-range numbers which are not represented in scientific notation + * // will be ignored. + * myURL.port = 1e10; // 10000000000, will be range-checked as described below + * console.log(myURL.port); + * // Prints 1234 + * ``` + * + * Numbers which contain a decimal point, + * such as floating-point numbers or numbers in scientific notation, + * are not an exception to this rule. + * Leading numbers up to the decimal point will be set as the URL's port, + * assuming they are valid: + * + * ```js + * myURL.port = 4.567e21; + * console.log(myURL.port); + * // Prints 4 (because it is the leading number in the string '4.567e21') + * ``` + */ + port: string; + /** + * Gets and sets the protocol portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org'); + * console.log(myURL.protocol); + * // Prints https: + * + * myURL.protocol = 'ftp'; + * console.log(myURL.href); + * // Prints ftp://example.org/ + * ``` + * + * Invalid URL protocol values assigned to the `protocol` property are ignored. + */ + protocol: string; + /** + * Gets and sets the serialized query portion of the URL. + * + * ```js + * const myURL = new URL('https://example.org/abc?123'); + * console.log(myURL.search); + * // Prints ?123 + * + * myURL.search = 'abc=xyz'; + * console.log(myURL.href); + * // Prints https://example.org/abc?abc=xyz + * ``` + * + * Any invalid URL characters appearing in the value assigned the `search`property will be `percent-encoded`. The selection of which + * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + search: string; + /** + * Gets the `URLSearchParams` object representing the query parameters of the + * URL. This property is read-only but the `URLSearchParams` object it provides + * can be used to mutate the URL instance; to replace the entirety of query + * parameters of the URL, use the {@link search} setter. See `URLSearchParams` documentation for details. + * + * Use care when using `.searchParams` to modify the `URL` because, + * per the WHATWG specification, the `URLSearchParams` object uses + * different rules to determine which characters to percent-encode. For + * instance, the `URL` object will not percent encode the ASCII tilde (`~`) + * character, while `URLSearchParams` will always encode it: + * + * ```js + * const myURL = new URL('https://example.org/abc?foo=~bar'); + * + * console.log(myURL.search); // prints ?foo=~bar + * + * // Modify the URL via searchParams... + * myURL.searchParams.sort(); + * + * console.log(myURL.search); // prints ?foo=%7Ebar + * ``` + */ + readonly searchParams: URLSearchParams; + /** + * Gets and sets the username portion of the URL. + * + * ```js + * const myURL = new URL('https://abc:xyz@example.com'); + * console.log(myURL.username); + * // Prints abc + * + * myURL.username = '123'; + * console.log(myURL.href); + * // Prints https://123:xyz@example.com/ + * ``` + * + * Any invalid URL characters appearing in the value assigned the `username`property will be `percent-encoded`. The selection of which + * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. + */ + username: string; + /** + * The `toString()` method on the `URL` object returns the serialized URL. The + * value returned is equivalent to that of {@link href} and {@link toJSON}. + */ + toString(): string; + /** + * The `toJSON()` method on the `URL` object returns the serialized URL. The + * value returned is equivalent to that of {@link href} and {@link toString}. + * + * This method is automatically called when an `URL` object is serialized + * with [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). + * + * ```js + * const myURLs = [ + * new URL('https://www.example.com'), + * new URL('https://test.example.org'), + * ]; + * console.log(JSON.stringify(myURLs)); + * // Prints ["https://www.example.com/","https://test.example.org/"] + * ``` + */ + toJSON(): string; + } + /** + * The `URLSearchParams` API provides read and write access to the query of a`URL`. The `URLSearchParams` class can also be used standalone with one of the + * four following constructors. + * The `URLSearchParams` class is also available on the global object. + * + * The WHATWG `URLSearchParams` interface and the `querystring` module have + * similar purpose, but the purpose of the `querystring` module is more + * general, as it allows the customization of delimiter characters (`&` and `=`). + * On the other hand, this API is designed purely for URL query strings. + * + * ```js + * const myURL = new URL('https://example.org/?abc=123'); + * console.log(myURL.searchParams.get('abc')); + * // Prints 123 + * + * myURL.searchParams.append('abc', 'xyz'); + * console.log(myURL.href); + * // Prints https://example.org/?abc=123&abc=xyz + * + * myURL.searchParams.delete('abc'); + * myURL.searchParams.set('a', 'b'); + * console.log(myURL.href); + * // Prints https://example.org/?a=b + * + * const newSearchParams = new URLSearchParams(myURL.searchParams); + * // The above is equivalent to + * // const newSearchParams = new URLSearchParams(myURL.search); + * + * newSearchParams.append('a', 'c'); + * console.log(myURL.href); + * // Prints https://example.org/?a=b + * console.log(newSearchParams.toString()); + * // Prints a=b&a=c + * + * // newSearchParams.toString() is implicitly called + * myURL.search = newSearchParams; + * console.log(myURL.href); + * // Prints https://example.org/?a=b&a=c + * newSearchParams.delete('a'); + * console.log(myURL.href); + * // Prints https://example.org/?a=b&a=c + * ``` + * @since v7.5.0, v6.13.0 + */ + class URLSearchParams implements Iterable<[string, string]> { + constructor(init?: URLSearchParams | string | Record> | Iterable<[string, string]> | ReadonlyArray<[string, string]>); + /** + * Append a new name-value pair to the query string. + */ + append(name: string, value: string): void; + /** + * If `value` is provided, removes all name-value pairs + * where name is `name` and value is `value`.. + * + * If `value` is not provided, removes all name-value pairs whose name is `name`. + */ + delete(name: string, value?: string): void; + /** + * Returns an ES6 `Iterator` over each of the name-value pairs in the query. + * Each item of the iterator is a JavaScript `Array`. The first item of the `Array`is the `name`, the second item of the `Array` is the `value`. + * + * Alias for `urlSearchParams[@@iterator]()`. + */ + entries(): IterableIterator<[string, string]>; + /** + * Iterates over each name-value pair in the query and invokes the given function. + * + * ```js + * const myURL = new URL('https://example.org/?a=b&c=d'); + * myURL.searchParams.forEach((value, name, searchParams) => { + * console.log(name, value, myURL.searchParams === searchParams); + * }); + * // Prints: + * // a b true + * // c d true + * ``` + * @param fn Invoked for each name-value pair in the query + * @param thisArg To be used as `this` value for when `fn` is called + */ + forEach(callback: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void, thisArg?: TThis): void; + /** + * Returns the value of the first name-value pair whose name is `name`. If there + * are no such pairs, `null` is returned. + * @return or `null` if there is no name-value pair with the given `name`. + */ + get(name: string): string | null; + /** + * Returns the values of all name-value pairs whose name is `name`. If there are + * no such pairs, an empty array is returned. + */ + getAll(name: string): string[]; + /** + * Checks if the `URLSearchParams` object contains key-value pair(s) based on`name` and an optional `value` argument. + * + * If `value` is provided, returns `true` when name-value pair with + * same `name` and `value` exists. + * + * If `value` is not provided, returns `true` if there is at least one name-value + * pair whose name is `name`. + */ + has(name: string, value?: string): boolean; + /** + * Returns an ES6 `Iterator` over the names of each name-value pair. + * + * ```js + * const params = new URLSearchParams('foo=bar&foo=baz'); + * for (const name of params.keys()) { + * console.log(name); + * } + * // Prints: + * // foo + * // foo + * ``` + */ + keys(): IterableIterator; + /** + * Sets the value in the `URLSearchParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`, + * set the first such pair's value to `value` and remove all others. If not, + * append the name-value pair to the query string. + * + * ```js + * const params = new URLSearchParams(); + * params.append('foo', 'bar'); + * params.append('foo', 'baz'); + * params.append('abc', 'def'); + * console.log(params.toString()); + * // Prints foo=bar&foo=baz&abc=def + * + * params.set('foo', 'def'); + * params.set('xyz', 'opq'); + * console.log(params.toString()); + * // Prints foo=def&abc=def&xyz=opq + * ``` + */ + set(name: string, value: string): void; + /** + * The total number of parameter entries. + * @since v19.8.0 + */ + readonly size: number; + /** + * Sort all existing name-value pairs in-place by their names. Sorting is done + * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs + * with the same name is preserved. + * + * This method can be used, in particular, to increase cache hits. + * + * ```js + * const params = new URLSearchParams('query[]=abc&type=search&query[]=123'); + * params.sort(); + * console.log(params.toString()); + * // Prints query%5B%5D=abc&query%5B%5D=123&type=search + * ``` + * @since v7.7.0, v6.13.0 + */ + sort(): void; + /** + * Returns the search parameters serialized as a string, with characters + * percent-encoded where necessary. + */ + toString(): string; + /** + * Returns an ES6 `Iterator` over the values of each name-value pair. + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator<[string, string]>; + } + import { URL as _URL, URLSearchParams as _URLSearchParams } from 'url'; + global { + interface URLSearchParams extends _URLSearchParams {} + interface URL extends _URL {} + interface Global { + URL: typeof _URL; + URLSearchParams: typeof _URLSearchParams; + } + /** + * `URL` class is a global reference for `require('url').URL` + * https://nodejs.org/api/url.html#the-whatwg-url-api + * @since v10.0.0 + */ + var URL: typeof globalThis extends { + onmessage: any; + URL: infer T; + } + ? T + : typeof _URL; + /** + * `URLSearchParams` class is a global reference for `require('url').URLSearchParams` + * https://nodejs.org/api/url.html#class-urlsearchparams + * @since v10.0.0 + */ + var URLSearchParams: typeof globalThis extends { + onmessage: any; + URLSearchParams: infer T; + } + ? T + : typeof _URLSearchParams; + } +} +declare module 'node:url' { + export * from 'url'; +} diff --git a/node_modules/@types/node/ts4.8/util.d.ts b/node_modules/@types/node/ts4.8/util.d.ts new file mode 100755 index 0000000..df1fd12 --- /dev/null +++ b/node_modules/@types/node/ts4.8/util.d.ts @@ -0,0 +1,2116 @@ +/** + * The `node:util` module supports the needs of Node.js internal APIs. Many of the + * utilities are useful for application and module developers as well. To access + * it: + * + * ```js + * const util = require('node:util'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/util.js) + */ +declare module 'util' { + import * as types from 'node:util/types'; + export interface InspectOptions { + /** + * If `true`, object's non-enumerable symbols and properties are included in the formatted result. + * `WeakMap` and `WeakSet` entries are also included as well as user defined prototype properties (excluding method properties). + * @default false + */ + showHidden?: boolean | undefined; + /** + * Specifies the number of times to recurse while formatting object. + * This is useful for inspecting large objects. + * To recurse up to the maximum call stack size pass `Infinity` or `null`. + * @default 2 + */ + depth?: number | null | undefined; + /** + * If `true`, the output is styled with ANSI color codes. Colors are customizable. + */ + colors?: boolean | undefined; + /** + * If `false`, `[util.inspect.custom](depth, opts, inspect)` functions are not invoked. + * @default true + */ + customInspect?: boolean | undefined; + /** + * If `true`, `Proxy` inspection includes the target and handler objects. + * @default false + */ + showProxy?: boolean | undefined; + /** + * Specifies the maximum number of `Array`, `TypedArray`, `WeakMap`, and `WeakSet` elements + * to include when formatting. Set to `null` or `Infinity` to show all elements. + * Set to `0` or negative to show no elements. + * @default 100 + */ + maxArrayLength?: number | null | undefined; + /** + * Specifies the maximum number of characters to + * include when formatting. Set to `null` or `Infinity` to show all elements. + * Set to `0` or negative to show no characters. + * @default 10000 + */ + maxStringLength?: number | null | undefined; + /** + * The length at which input values are split across multiple lines. + * Set to `Infinity` to format the input as a single line + * (in combination with `compact` set to `true` or any number >= `1`). + * @default 80 + */ + breakLength?: number | undefined; + /** + * Setting this to `false` causes each object key + * to be displayed on a new line. It will also add new lines to text that is + * longer than `breakLength`. If set to a number, the most `n` inner elements + * are united on a single line as long as all properties fit into + * `breakLength`. Short array elements are also grouped together. Note that no + * text will be reduced below 16 characters, no matter the `breakLength` size. + * For more information, see the example below. + * @default true + */ + compact?: boolean | number | undefined; + /** + * If set to `true` or a function, all properties of an object, and `Set` and `Map` + * entries are sorted in the resulting string. + * If set to `true` the default sort is used. + * If set to a function, it is used as a compare function. + */ + sorted?: boolean | ((a: string, b: string) => number) | undefined; + /** + * If set to `true`, getters are going to be + * inspected as well. If set to `'get'` only getters without setter are going + * to be inspected. If set to `'set'` only getters having a corresponding + * setter are going to be inspected. This might cause side effects depending on + * the getter function. + * @default false + */ + getters?: 'get' | 'set' | boolean | undefined; + /** + * If set to `true`, an underscore is used to separate every three digits in all bigints and numbers. + * @default false + */ + numericSeparator?: boolean | undefined; + } + export type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module'; + export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => any; // TODO: , inspect: inspect + export interface InspectOptionsStylized extends InspectOptions { + stylize(text: string, styleType: Style): string; + } + /** + * The `util.format()` method returns a formatted string using the first argument + * as a `printf`\-like format string which can contain zero or more format + * specifiers. Each specifier is replaced with the converted value from the + * corresponding argument. Supported specifiers are: + * + * If a specifier does not have a corresponding argument, it is not replaced: + * + * ```js + * util.format('%s:%s', 'foo'); + * // Returns: 'foo:%s' + * ``` + * + * Values that are not part of the format string are formatted using`util.inspect()` if their type is not `string`. + * + * If there are more arguments passed to the `util.format()` method than the + * number of specifiers, the extra arguments are concatenated to the returned + * string, separated by spaces: + * + * ```js + * util.format('%s:%s', 'foo', 'bar', 'baz'); + * // Returns: 'foo:bar baz' + * ``` + * + * If the first argument does not contain a valid format specifier, `util.format()`returns a string that is the concatenation of all arguments separated by spaces: + * + * ```js + * util.format(1, 2, 3); + * // Returns: '1 2 3' + * ``` + * + * If only one argument is passed to `util.format()`, it is returned as it is + * without any formatting: + * + * ```js + * util.format('%% %s'); + * // Returns: '%% %s' + * ``` + * + * `util.format()` is a synchronous method that is intended as a debugging tool. + * Some input values can have a significant performance overhead that can block the + * event loop. Use this function with care and never in a hot code path. + * @since v0.5.3 + * @param format A `printf`-like format string. + */ + export function format(format?: any, ...param: any[]): string; + /** + * This function is identical to {@link format}, except in that it takes + * an `inspectOptions` argument which specifies options that are passed along to {@link inspect}. + * + * ```js + * util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); + * // Returns 'See object { foo: 42 }', where `42` is colored as a number + * // when printed to a terminal. + * ``` + * @since v10.0.0 + */ + export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string; + /** + * Returns the string name for a numeric error code that comes from a Node.js API. + * The mapping between error codes and error names is platform-dependent. + * See `Common System Errors` for the names of common errors. + * + * ```js + * fs.access('file/that/does/not/exist', (err) => { + * const name = util.getSystemErrorName(err.errno); + * console.error(name); // ENOENT + * }); + * ``` + * @since v9.7.0 + */ + export function getSystemErrorName(err: number): string; + /** + * Returns a Map of all system error codes available from the Node.js API. + * The mapping between error codes and error names is platform-dependent. + * See `Common System Errors` for the names of common errors. + * + * ```js + * fs.access('file/that/does/not/exist', (err) => { + * const errorMap = util.getSystemErrorMap(); + * const name = errorMap.get(err.errno); + * console.error(name); // ENOENT + * }); + * ``` + * @since v16.0.0, v14.17.0 + */ + export function getSystemErrorMap(): Map; + /** + * The `util.log()` method prints the given `string` to `stdout` with an included + * timestamp. + * + * ```js + * const util = require('node:util'); + * + * util.log('Timestamped message.'); + * ``` + * @since v0.3.0 + * @deprecated Since v6.0.0 - Use a third party module instead. + */ + export function log(string: string): void; + /** + * Returns the `string` after replacing any surrogate code points + * (or equivalently, any unpaired surrogate code units) with the + * Unicode "replacement character" U+FFFD. + * @since v16.8.0, v14.18.0 + */ + export function toUSVString(string: string): string; + /** + * Creates and returns an `AbortController` instance whose `AbortSignal` is marked + * as transferable and can be used with `structuredClone()` or `postMessage()`. + * @since v18.11.0 + * @experimental + * @returns A transferable AbortController + */ + export function transferableAbortController(): AbortController; + /** + * Marks the given `AbortSignal` as transferable so that it can be used with`structuredClone()` and `postMessage()`. + * + * ```js + * const signal = transferableAbortSignal(AbortSignal.timeout(100)); + * const channel = new MessageChannel(); + * channel.port2.postMessage(signal, [signal]); + * ``` + * @since v18.11.0 + * @experimental + * @param signal The AbortSignal + * @returns The same AbortSignal + */ + export function transferableAbortSignal(signal: AbortSignal): AbortSignal; + /** + * Listens to abort event on the provided `signal` and + * returns a promise that is fulfilled when the `signal` is + * aborted. If the passed `resource` is garbage collected before the `signal` is + * aborted, the returned promise shall remain pending indefinitely. + * + * ```js + * import { aborted } from 'node:util'; + * + * const dependent = obtainSomethingAbortable(); + * + * aborted(dependent.signal, dependent).then(() => { + * // Do something when dependent is aborted. + * }); + * + * dependent.on('event', () => { + * dependent.abort(); + * }); + * ``` + * @since v19.7.0 + * @experimental + * @param resource Any non-null entity, reference to which is held weakly. + */ + export function aborted(signal: AbortSignal, resource: any): Promise; + /** + * The `util.inspect()` method returns a string representation of `object` that is + * intended for debugging. The output of `util.inspect` may change at any time + * and should not be depended upon programmatically. Additional `options` may be + * passed that alter the result.`util.inspect()` will use the constructor's name and/or `@@toStringTag` to make + * an identifiable tag for an inspected value. + * + * ```js + * class Foo { + * get [Symbol.toStringTag]() { + * return 'bar'; + * } + * } + * + * class Bar {} + * + * const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } }); + * + * util.inspect(new Foo()); // 'Foo [bar] {}' + * util.inspect(new Bar()); // 'Bar {}' + * util.inspect(baz); // '[foo] {}' + * ``` + * + * Circular references point to their anchor by using a reference index: + * + * ```js + * const { inspect } = require('node:util'); + * + * const obj = {}; + * obj.a = [obj]; + * obj.b = {}; + * obj.b.inner = obj.b; + * obj.b.obj = obj; + * + * console.log(inspect(obj)); + * // { + * // a: [ [Circular *1] ], + * // b: { inner: [Circular *2], obj: [Circular *1] } + * // } + * ``` + * + * The following example inspects all properties of the `util` object: + * + * ```js + * const util = require('node:util'); + * + * console.log(util.inspect(util, { showHidden: true, depth: null })); + * ``` + * + * The following example highlights the effect of the `compact` option: + * + * ```js + * const util = require('node:util'); + * + * const o = { + * a: [1, 2, [[ + * 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' + + * 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.', + * 'test', + * 'foo']], 4], + * b: new Map([['za', 1], ['zb', 'test']]), + * }; + * console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 })); + * + * // { a: + * // [ 1, + * // 2, + * // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line + * // 'test', + * // 'foo' ] ], + * // 4 ], + * // b: Map(2) { 'za' => 1, 'zb' => 'test' } } + * + * // Setting `compact` to false or an integer creates more reader friendly output. + * console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); + * + * // { + * // a: [ + * // 1, + * // 2, + * // [ + * // [ + * // 'Lorem ipsum dolor sit amet,\n' + + * // 'consectetur adipiscing elit, sed do eiusmod \n' + + * // 'tempor incididunt ut labore et dolore magna aliqua.', + * // 'test', + * // 'foo' + * // ] + * // ], + * // 4 + * // ], + * // b: Map(2) { + * // 'za' => 1, + * // 'zb' => 'test' + * // } + * // } + * + * // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a + * // single line. + * ``` + * + * The `showHidden` option allows [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and + * [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries to be + * inspected. If there are more entries than `maxArrayLength`, there is no + * guarantee which entries are displayed. That means retrieving the same [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may + * result in different output. Furthermore, entries + * with no remaining strong references may be garbage collected at any time. + * + * ```js + * const { inspect } = require('node:util'); + * + * const obj = { a: 1 }; + * const obj2 = { b: 2 }; + * const weakSet = new WeakSet([obj, obj2]); + * + * console.log(inspect(weakSet, { showHidden: true })); + * // WeakSet { { a: 1 }, { b: 2 } } + * ``` + * + * The `sorted` option ensures that an object's property insertion order does not + * impact the result of `util.inspect()`. + * + * ```js + * const { inspect } = require('node:util'); + * const assert = require('node:assert'); + * + * const o1 = { + * b: [2, 3, 1], + * a: '`a` comes before `b`', + * c: new Set([2, 3, 1]), + * }; + * console.log(inspect(o1, { sorted: true })); + * // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } } + * console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) })); + * // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } + * + * const o2 = { + * c: new Set([2, 1, 3]), + * a: '`a` comes before `b`', + * b: [2, 3, 1], + * }; + * assert.strict.equal( + * inspect(o1, { sorted: true }), + * inspect(o2, { sorted: true }), + * ); + * ``` + * + * The `numericSeparator` option adds an underscore every three digits to all + * numbers. + * + * ```js + * const { inspect } = require('node:util'); + * + * const thousand = 1_000; + * const million = 1_000_000; + * const bigNumber = 123_456_789n; + * const bigDecimal = 1_234.123_45; + * + * console.log(thousand, million, bigNumber, bigDecimal); + * // 1_000 1_000_000 123_456_789n 1_234.123_45 + * ``` + * + * `util.inspect()` is a synchronous method intended for debugging. Its maximum + * output length is approximately 128 MiB. Inputs that result in longer output will + * be truncated. + * @since v0.3.0 + * @param object Any JavaScript primitive or `Object`. + * @return The representation of `object`. + */ + export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; + export function inspect(object: any, options?: InspectOptions): string; + export namespace inspect { + let colors: NodeJS.Dict<[number, number]>; + let styles: { + [K in Style]: string; + }; + let defaultOptions: InspectOptions; + /** + * Allows changing inspect settings from the repl. + */ + let replDefaults: InspectOptions; + /** + * That can be used to declare custom inspect functions. + */ + const custom: unique symbol; + } + /** + * Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray). + * + * Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isArray([]); + * // Returns: true + * util.isArray(new Array()); + * // Returns: true + * util.isArray({}); + * // Returns: false + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Use `isArray` instead. + */ + export function isArray(object: unknown): object is unknown[]; + /** + * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isRegExp(/some regexp/); + * // Returns: true + * util.isRegExp(new RegExp('another regexp')); + * // Returns: true + * util.isRegExp({}); + * // Returns: false + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Deprecated + */ + export function isRegExp(object: unknown): object is RegExp; + /** + * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isDate(new Date()); + * // Returns: true + * util.isDate(Date()); + * // false (without 'new' returns a String) + * util.isDate({}); + * // Returns: false + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Use {@link types.isDate} instead. + */ + export function isDate(object: unknown): object is Date; + /** + * Returns `true` if the given `object` is an `Error`. Otherwise, returns`false`. + * + * ```js + * const util = require('node:util'); + * + * util.isError(new Error()); + * // Returns: true + * util.isError(new TypeError()); + * // Returns: true + * util.isError({ name: 'Error', message: 'an error occurred' }); + * // Returns: false + * ``` + * + * This method relies on `Object.prototype.toString()` behavior. It is + * possible to obtain an incorrect result when the `object` argument manipulates`@@toStringTag`. + * + * ```js + * const util = require('node:util'); + * const obj = { name: 'Error', message: 'an error occurred' }; + * + * util.isError(obj); + * // Returns: false + * obj[Symbol.toStringTag] = 'Error'; + * util.isError(obj); + * // Returns: true + * ``` + * @since v0.6.0 + * @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead. + */ + export function isError(object: unknown): object is Error; + /** + * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and`extends` keywords to get language level inheritance support. Also note + * that the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179). + * + * Inherit the prototype methods from one [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The + * prototype of `constructor` will be set to a new object created from`superConstructor`. + * + * This mainly adds some input validation on top of`Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`. + * As an additional convenience, `superConstructor` will be accessible + * through the `constructor.super_` property. + * + * ```js + * const util = require('node:util'); + * const EventEmitter = require('node:events'); + * + * function MyStream() { + * EventEmitter.call(this); + * } + * + * util.inherits(MyStream, EventEmitter); + * + * MyStream.prototype.write = function(data) { + * this.emit('data', data); + * }; + * + * const stream = new MyStream(); + * + * console.log(stream instanceof EventEmitter); // true + * console.log(MyStream.super_ === EventEmitter); // true + * + * stream.on('data', (data) => { + * console.log(`Received data: "${data}"`); + * }); + * stream.write('It works!'); // Received data: "It works!" + * ``` + * + * ES6 example using `class` and `extends`: + * + * ```js + * const EventEmitter = require('node:events'); + * + * class MyStream extends EventEmitter { + * write(data) { + * this.emit('data', data); + * } + * } + * + * const stream = new MyStream(); + * + * stream.on('data', (data) => { + * console.log(`Received data: "${data}"`); + * }); + * stream.write('With ES6'); + * ``` + * @since v0.3.0 + * @legacy Use ES2015 class syntax and `extends` keyword instead. + */ + export function inherits(constructor: unknown, superConstructor: unknown): void; + export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void; + export interface DebugLogger extends DebugLoggerFunction { + enabled: boolean; + } + /** + * The `util.debuglog()` method is used to create a function that conditionally + * writes debug messages to `stderr` based on the existence of the `NODE_DEBUG`environment variable. If the `section` name appears within the value of that + * environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op. + * + * ```js + * const util = require('node:util'); + * const debuglog = util.debuglog('foo'); + * + * debuglog('hello from foo [%d]', 123); + * ``` + * + * If this program is run with `NODE_DEBUG=foo` in the environment, then + * it will output something like: + * + * ```console + * FOO 3245: hello from foo [123] + * ``` + * + * where `3245` is the process id. If it is not run with that + * environment variable set, then it will not print anything. + * + * The `section` supports wildcard also: + * + * ```js + * const util = require('node:util'); + * const debuglog = util.debuglog('foo-bar'); + * + * debuglog('hi there, it\'s foo-bar [%d]', 2333); + * ``` + * + * if it is run with `NODE_DEBUG=foo*` in the environment, then it will output + * something like: + * + * ```console + * FOO-BAR 3257: hi there, it's foo-bar [2333] + * ``` + * + * Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`environment variable: `NODE_DEBUG=fs,net,tls`. + * + * The optional `callback` argument can be used to replace the logging function + * with a different function that doesn't have any initialization or + * unnecessary wrapping. + * + * ```js + * const util = require('node:util'); + * let debuglog = util.debuglog('internals', (debug) => { + * // Replace with a logging function that optimizes out + * // testing if the section is enabled + * debuglog = debug; + * }); + * ``` + * @since v0.11.3 + * @param section A string identifying the portion of the application for which the `debuglog` function is being created. + * @param callback A callback invoked the first time the logging function is called with a function argument that is a more optimized logging function. + * @return The logging function + */ + export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger; + export const debug: typeof debuglog; + /** + * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isBoolean(1); + * // Returns: false + * util.isBoolean(0); + * // Returns: false + * util.isBoolean(false); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead. + */ + export function isBoolean(object: unknown): object is boolean; + /** + * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isBuffer({ length: 0 }); + * // Returns: false + * util.isBuffer([]); + * // Returns: false + * util.isBuffer(Buffer.from('hello world')); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `isBuffer` instead. + */ + export function isBuffer(object: unknown): object is Buffer; + /** + * Returns `true` if the given `object` is a `Function`. Otherwise, returns`false`. + * + * ```js + * const util = require('node:util'); + * + * function Foo() {} + * const Bar = () => {}; + * + * util.isFunction({}); + * // Returns: false + * util.isFunction(Foo); + * // Returns: true + * util.isFunction(Bar); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead. + */ + export function isFunction(object: unknown): boolean; + /** + * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`. + * + * ```js + * const util = require('node:util'); + * + * util.isNull(0); + * // Returns: false + * util.isNull(undefined); + * // Returns: false + * util.isNull(null); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === null` instead. + */ + export function isNull(object: unknown): object is null; + /** + * Returns `true` if the given `object` is `null` or `undefined`. Otherwise, + * returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isNullOrUndefined(0); + * // Returns: false + * util.isNullOrUndefined(undefined); + * // Returns: true + * util.isNullOrUndefined(null); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead. + */ + export function isNullOrUndefined(object: unknown): object is null | undefined; + /** + * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isNumber(false); + * // Returns: false + * util.isNumber(Infinity); + * // Returns: true + * util.isNumber(0); + * // Returns: true + * util.isNumber(NaN); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead. + */ + export function isNumber(object: unknown): object is number; + /** + * Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript). + * Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isObject(5); + * // Returns: false + * util.isObject(null); + * // Returns: false + * util.isObject({}); + * // Returns: true + * util.isObject(() => {}); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value !== null && typeof value === 'object'` instead. + */ + export function isObject(object: unknown): boolean; + /** + * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`. + * + * ```js + * const util = require('node:util'); + * + * util.isPrimitive(5); + * // Returns: true + * util.isPrimitive('foo'); + * // Returns: true + * util.isPrimitive(false); + * // Returns: true + * util.isPrimitive(null); + * // Returns: true + * util.isPrimitive(undefined); + * // Returns: true + * util.isPrimitive({}); + * // Returns: false + * util.isPrimitive(() => {}); + * // Returns: false + * util.isPrimitive(/^$/); + * // Returns: false + * util.isPrimitive(new Date()); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. + */ + export function isPrimitive(object: unknown): boolean; + /** + * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isString(''); + * // Returns: true + * util.isString('foo'); + * // Returns: true + * util.isString(String('foo')); + * // Returns: true + * util.isString(5); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead. + */ + export function isString(object: unknown): object is string; + /** + * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * util.isSymbol(5); + * // Returns: false + * util.isSymbol('foo'); + * // Returns: false + * util.isSymbol(Symbol('foo')); + * // Returns: true + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead. + */ + export function isSymbol(object: unknown): object is symbol; + /** + * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`. + * + * ```js + * const util = require('node:util'); + * + * const foo = undefined; + * util.isUndefined(5); + * // Returns: false + * util.isUndefined(foo); + * // Returns: true + * util.isUndefined(null); + * // Returns: false + * ``` + * @since v0.11.5 + * @deprecated Since v4.0.0 - Use `value === undefined` instead. + */ + export function isUndefined(object: unknown): object is undefined; + /** + * The `util.deprecate()` method wraps `fn` (which may be a function or class) in + * such a way that it is marked as deprecated. + * + * ```js + * const util = require('node:util'); + * + * exports.obsoleteFunction = util.deprecate(() => { + * // Do something here. + * }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.'); + * ``` + * + * When called, `util.deprecate()` will return a function that will emit a`DeprecationWarning` using the `'warning'` event. The warning will + * be emitted and printed to `stderr` the first time the returned function is + * called. After the warning is emitted, the wrapped function is called without + * emitting a warning. + * + * If the same optional `code` is supplied in multiple calls to `util.deprecate()`, + * the warning will be emitted only once for that `code`. + * + * ```js + * const util = require('node:util'); + * + * const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001'); + * const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001'); + * fn1(); // Emits a deprecation warning with code DEP0001 + * fn2(); // Does not emit a deprecation warning because it has the same code + * ``` + * + * If either the `--no-deprecation` or `--no-warnings` command-line flags are + * used, or if the `process.noDeprecation` property is set to `true`_prior_ to + * the first deprecation warning, the `util.deprecate()` method does nothing. + * + * If the `--trace-deprecation` or `--trace-warnings` command-line flags are set, + * or the `process.traceDeprecation` property is set to `true`, a warning and a + * stack trace are printed to `stderr` the first time the deprecated function is + * called. + * + * If the `--throw-deprecation` command-line flag is set, or the`process.throwDeprecation` property is set to `true`, then an exception will be + * thrown when the deprecated function is called. + * + * The `--throw-deprecation` command-line flag and `process.throwDeprecation`property take precedence over `--trace-deprecation` and`process.traceDeprecation`. + * @since v0.8.0 + * @param fn The function that is being deprecated. + * @param msg A warning message to display when the deprecated function is invoked. + * @param code A deprecation code. See the `list of deprecated APIs` for a list of codes. + * @return The deprecated function wrapped to emit a warning. + */ + export function deprecate(fn: T, msg: string, code?: string): T; + /** + * Returns `true` if there is deep strict equality between `val1` and `val2`. + * Otherwise, returns `false`. + * + * See `assert.deepStrictEqual()` for more information about deep strict + * equality. + * @since v9.0.0 + */ + export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean; + /** + * Returns `str` with any ANSI escape codes removed. + * + * ```js + * console.log(util.stripVTControlCharacters('\u001B[4mvalue\u001B[0m')); + * // Prints "value" + * ``` + * @since v16.11.0 + */ + export function stripVTControlCharacters(str: string): string; + /** + * Takes an `async` function (or a function that returns a `Promise`) and returns a + * function following the error-first callback style, i.e. taking + * an `(err, value) => ...` callback as the last argument. In the callback, the + * first argument will be the rejection reason (or `null` if the `Promise`resolved), and the second argument will be the resolved value. + * + * ```js + * const util = require('node:util'); + * + * async function fn() { + * return 'hello world'; + * } + * const callbackFunction = util.callbackify(fn); + * + * callbackFunction((err, ret) => { + * if (err) throw err; + * console.log(ret); + * }); + * ``` + * + * Will print: + * + * ```text + * hello world + * ``` + * + * The callback is executed asynchronously, and will have a limited stack trace. + * If the callback throws, the process will emit an `'uncaughtException'` event, and if not handled will exit. + * + * Since `null` has a special meaning as the first argument to a callback, if a + * wrapped function rejects a `Promise` with a falsy value as a reason, the value + * is wrapped in an `Error` with the original value stored in a field named`reason`. + * + * ```js + * function fn() { + * return Promise.reject(null); + * } + * const callbackFunction = util.callbackify(fn); + * + * callbackFunction((err, ret) => { + * // When the Promise was rejected with `null` it is wrapped with an Error and + * // the original value is stored in `reason`. + * err && Object.hasOwn(err, 'reason') && err.reason === null; // true + * }); + * ``` + * @since v8.2.0 + * @param fn An `async` function + * @return a callback style function + */ + export function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify(fn: (arg1: T1) => Promise): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3) => Promise + ): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; + export function callbackify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; + export interface CustomPromisifyLegacy extends Function { + __promisify__: TCustom; + } + export interface CustomPromisifySymbol extends Function { + [promisify.custom]: TCustom; + } + export type CustomPromisify = CustomPromisifySymbol | CustomPromisifyLegacy; + /** + * Takes a function following the common error-first callback style, i.e. taking + * an `(err, value) => ...` callback as the last argument, and returns a version + * that returns promises. + * + * ```js + * const util = require('node:util'); + * const fs = require('node:fs'); + * + * const stat = util.promisify(fs.stat); + * stat('.').then((stats) => { + * // Do something with `stats` + * }).catch((error) => { + * // Handle the error. + * }); + * ``` + * + * Or, equivalently using `async function`s: + * + * ```js + * const util = require('node:util'); + * const fs = require('node:fs'); + * + * const stat = util.promisify(fs.stat); + * + * async function callStat() { + * const stats = await stat('.'); + * console.log(`This directory is owned by ${stats.uid}`); + * } + * ``` + * + * If there is an `original[util.promisify.custom]` property present, `promisify`will return its value, see `Custom promisified functions`. + * + * `promisify()` assumes that `original` is a function taking a callback as its + * final argument in all cases. If `original` is not a function, `promisify()`will throw an error. If `original` is a function but its last argument is not + * an error-first callback, it will still be passed an error-first + * callback as its last argument. + * + * Using `promisify()` on class methods or other methods that use `this` may not + * work as expected unless handled specially: + * + * ```js + * const util = require('node:util'); + * + * class Foo { + * constructor() { + * this.a = 42; + * } + * + * bar(callback) { + * callback(null, this.a); + * } + * } + * + * const foo = new Foo(); + * + * const naiveBar = util.promisify(foo.bar); + * // TypeError: Cannot read property 'a' of undefined + * // naiveBar().then(a => console.log(a)); + * + * naiveBar.call(foo).then((a) => console.log(a)); // '42' + * + * const bindBar = naiveBar.bind(foo); + * bindBar().then((a) => console.log(a)); // '42' + * ``` + * @since v8.0.0 + */ + export function promisify(fn: CustomPromisify): TCustom; + export function promisify(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise; + export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise; + export function promisify(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify( + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; + export function promisify(fn: Function): Function; + export namespace promisify { + /** + * That can be used to declare custom promisified variants of functions. + */ + const custom: unique symbol; + } + /** + * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API. + * + * ```js + * const decoder = new TextDecoder(); + * const u8arr = new Uint8Array([72, 101, 108, 108, 111]); + * console.log(decoder.decode(u8arr)); // Hello + * ``` + * @since v8.3.0 + */ + export class TextDecoder { + /** + * The encoding supported by the `TextDecoder` instance. + */ + readonly encoding: string; + /** + * The value will be `true` if decoding errors result in a `TypeError` being + * thrown. + */ + readonly fatal: boolean; + /** + * The value will be `true` if the decoding result will include the byte order + * mark. + */ + readonly ignoreBOM: boolean; + constructor( + encoding?: string, + options?: { + fatal?: boolean | undefined; + ignoreBOM?: boolean | undefined; + } + ); + /** + * Decodes the `input` and returns a string. If `options.stream` is `true`, any + * incomplete byte sequences occurring at the end of the `input` are buffered + * internally and emitted after the next call to `textDecoder.decode()`. + * + * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a`TypeError` being thrown. + * @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data. + */ + decode( + input?: NodeJS.ArrayBufferView | ArrayBuffer | null, + options?: { + stream?: boolean | undefined; + } + ): string; + } + export interface EncodeIntoResult { + /** + * The read Unicode code units of input. + */ + read: number; + /** + * The written UTF-8 bytes of output. + */ + written: number; + } + export { types }; + + //// TextEncoder/Decoder + /** + * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All + * instances of `TextEncoder` only support UTF-8 encoding. + * + * ```js + * const encoder = new TextEncoder(); + * const uint8array = encoder.encode('this is some data'); + * ``` + * + * The `TextEncoder` class is also available on the global object. + * @since v8.3.0 + */ + export class TextEncoder { + /** + * The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`. + */ + readonly encoding: string; + /** + * UTF-8 encodes the `input` string and returns a `Uint8Array` containing the + * encoded bytes. + * @param [input='an empty string'] The text to encode. + */ + encode(input?: string): Uint8Array; + /** + * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object + * containing the read Unicode code units and written UTF-8 bytes. + * + * ```js + * const encoder = new TextEncoder(); + * const src = 'this is some data'; + * const dest = new Uint8Array(10); + * const { read, written } = encoder.encodeInto(src, dest); + * ``` + * @param src The text to encode. + * @param dest The array to hold the encode result. + */ + encodeInto(src: string, dest: Uint8Array): EncodeIntoResult; + } + import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from 'util'; + global { + /** + * `TextDecoder` class is a global reference for `require('util').TextDecoder` + * https://nodejs.org/api/globals.html#textdecoder + * @since v11.0.0 + */ + var TextDecoder: typeof globalThis extends { + onmessage: any; + TextDecoder: infer TextDecoder; + } + ? TextDecoder + : typeof _TextDecoder; + /** + * `TextEncoder` class is a global reference for `require('util').TextEncoder` + * https://nodejs.org/api/globals.html#textencoder + * @since v11.0.0 + */ + var TextEncoder: typeof globalThis extends { + onmessage: any; + TextEncoder: infer TextEncoder; + } + ? TextEncoder + : typeof _TextEncoder; + } + + //// parseArgs + /** + * Provides a higher level API for command-line argument parsing than interacting + * with `process.argv` directly. Takes a specification for the expected arguments + * and returns a structured object with the parsed options and positionals. + * + * ```js + * import { parseArgs } from 'node:util'; + * const args = ['-f', '--bar', 'b']; + * const options = { + * foo: { + * type: 'boolean', + * short: 'f', + * }, + * bar: { + * type: 'string', + * }, + * }; + * const { + * values, + * positionals, + * } = parseArgs({ args, options }); + * console.log(values, positionals); + * // Prints: [Object: null prototype] { foo: true, bar: 'b' } [] + * ``` + * @since v18.3.0, v16.17.0 + * @param config Used to provide arguments for parsing and to configure the parser. `config` supports the following properties: + * @return The parsed command line arguments: + */ + export function parseArgs(config?: T): ParsedResults; + interface ParseArgsOptionConfig { + /** + * Type of argument. + */ + type: 'string' | 'boolean'; + /** + * Whether this option can be provided multiple times. + * If `true`, all values will be collected in an array. + * If `false`, values for the option are last-wins. + * @default false. + */ + multiple?: boolean | undefined; + /** + * A single character alias for the option. + */ + short?: string | undefined; + /** + * The default option value when it is not set by args. + * It must be of the same type as the the `type` property. + * When `multiple` is `true`, it must be an array. + * @since v18.11.0 + */ + default?: string | boolean | string[] | boolean[] | undefined; + } + interface ParseArgsOptionsConfig { + [longOption: string]: ParseArgsOptionConfig; + } + export interface ParseArgsConfig { + /** + * Array of argument strings. + */ + args?: string[] | undefined; + /** + * Used to describe arguments known to the parser. + */ + options?: ParseArgsOptionsConfig | undefined; + /** + * Should an error be thrown when unknown arguments are encountered, + * or when arguments are passed that do not match the `type` configured in `options`. + * @default true + */ + strict?: boolean | undefined; + /** + * Whether this command accepts positional arguments. + */ + allowPositionals?: boolean | undefined; + /** + * Return the parsed tokens. This is useful for extending the built-in behavior, + * from adding additional checks through to reprocessing the tokens in different ways. + * @default false + */ + tokens?: boolean | undefined; + } + /* + IfDefaultsTrue and IfDefaultsFalse are helpers to handle default values for missing boolean properties. + TypeScript does not have exact types for objects: https://github.com/microsoft/TypeScript/issues/12936 + This means it is impossible to distinguish between "field X is definitely not present" and "field X may or may not be present". + But we expect users to generally provide their config inline or `as const`, which means TS will always know whether a given field is present. + So this helper treats "not definitely present" (i.e., not `extends boolean`) as being "definitely not present", i.e. it should have its default value. + This is technically incorrect but is a much nicer UX for the common case. + The IfDefaultsTrue version is for things which default to true; the IfDefaultsFalse version is for things which default to false. + */ + type IfDefaultsTrue = T extends true + ? IfTrue + : T extends false + ? IfFalse + : IfTrue; + + // we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false` + type IfDefaultsFalse = T extends false + ? IfFalse + : T extends true + ? IfTrue + : IfFalse; + + type ExtractOptionValue = IfDefaultsTrue< + T['strict'], + O['type'] extends 'string' ? string : O['type'] extends 'boolean' ? boolean : string | boolean, + string | boolean + >; + + type ParsedValues = + & IfDefaultsTrue + & (T['options'] extends ParseArgsOptionsConfig + ? { + -readonly [LongOption in keyof T['options']]: IfDefaultsFalse< + T['options'][LongOption]['multiple'], + undefined | Array>, + undefined | ExtractOptionValue + >; + } + : {}); + + type ParsedPositionals = IfDefaultsTrue< + T['strict'], + IfDefaultsFalse, + IfDefaultsTrue + >; + + type PreciseTokenForOptions< + K extends string, + O extends ParseArgsOptionConfig, + > = O['type'] extends 'string' + ? { + kind: 'option'; + index: number; + name: K; + rawName: string; + value: string; + inlineValue: boolean; + } + : O['type'] extends 'boolean' + ? { + kind: 'option'; + index: number; + name: K; + rawName: string; + value: undefined; + inlineValue: undefined; + } + : OptionToken & { name: K }; + + type TokenForOptions< + T extends ParseArgsConfig, + K extends keyof T['options'] = keyof T['options'], + > = K extends unknown + ? T['options'] extends ParseArgsOptionsConfig + ? PreciseTokenForOptions + : OptionToken + : never; + + type ParsedOptionToken = IfDefaultsTrue, OptionToken>; + + type ParsedPositionalToken = IfDefaultsTrue< + T['strict'], + IfDefaultsFalse, + IfDefaultsTrue + >; + + type ParsedTokens = Array< + ParsedOptionToken | ParsedPositionalToken | { kind: 'option-terminator'; index: number } + >; + + type PreciseParsedResults = IfDefaultsFalse< + T['tokens'], + { + values: ParsedValues; + positionals: ParsedPositionals; + tokens: ParsedTokens; + }, + { + values: ParsedValues; + positionals: ParsedPositionals; + } + >; + + type OptionToken = + | { kind: 'option'; index: number; name: string; rawName: string; value: string; inlineValue: boolean } + | { + kind: 'option'; + index: number; + name: string; + rawName: string; + value: undefined; + inlineValue: undefined; + }; + + type Token = + | OptionToken + | { kind: 'positional'; index: number; value: string } + | { kind: 'option-terminator'; index: number }; + + // If ParseArgsConfig extends T, then the user passed config constructed elsewhere. + // So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above. + type ParsedResults = ParseArgsConfig extends T + ? { + values: { + [longOption: string]: undefined | string | boolean | Array; + }; + positionals: string[]; + tokens?: Token[]; + } + : PreciseParsedResults; + + /** + * An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/). + * + * In accordance with browser conventions, all properties of `MIMEType` objects + * are implemented as getters and setters on the class prototype, rather than as + * data properties on the object itself. + * + * A MIME string is a structured string containing multiple meaningful + * components. When parsed, a `MIMEType` object is returned containing + * properties for each of these components. + * @since v19.1.0, v18.13.0 + * @experimental + */ + export class MIMEType { + /** + * Creates a new MIMEType object by parsing the input. + * + * A `TypeError` will be thrown if the `input` is not a valid MIME. + * Note that an effort will be made to coerce the given values into strings. + * @param input The input MIME to parse. + */ + constructor(input: string | { toString: () => string }); + + /** + * Gets and sets the type portion of the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/javascript'); + * console.log(myMIME.type); + * // Prints: text + * myMIME.type = 'application'; + * console.log(myMIME.type); + * // Prints: application + * console.log(String(myMIME)); + * // Prints: application/javascript + * ``` + */ + type: string; + /** + * Gets and sets the subtype portion of the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/ecmascript'); + * console.log(myMIME.subtype); + * // Prints: ecmascript + * myMIME.subtype = 'javascript'; + * console.log(myMIME.subtype); + * // Prints: javascript + * console.log(String(myMIME)); + * // Prints: text/javascript + * ``` + */ + subtype: string; + /** + * Gets the essence of the MIME. This property is read only. + * Use `mime.type` or `mime.subtype` to alter the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/javascript;key=value'); + * console.log(myMIME.essence); + * // Prints: text/javascript + * myMIME.type = 'application'; + * console.log(myMIME.essence); + * // Prints: application/javascript + * console.log(String(myMIME)); + * // Prints: application/javascript;key=value + * ``` + */ + readonly essence: string; + /** + * Gets the `MIMEParams` object representing the + * parameters of the MIME. This property is read-only. See `MIMEParams` documentation for details. + */ + readonly params: MIMEParams; + /** + * The `toString()` method on the `MIMEType` object returns the serialized MIME. + * + * Because of the need for standard compliance, this method does not allow users + * to customize the serialization process of the MIME. + */ + toString(): string; + } + /** + * The `MIMEParams` API provides read and write access to the parameters of a`MIMEType`. + * @since v19.1.0, v18.13.0 + */ + export class MIMEParams { + /** + * Remove all name-value pairs whose name is `name`. + */ + delete(name: string): void; + /** + * Returns an iterator over each of the name-value pairs in the parameters. + * Each item of the iterator is a JavaScript `Array`. The first item of the array + * is the `name`, the second item of the array is the `value`. + */ + entries(): IterableIterator<[string, string]>; + /** + * Returns the value of the first name-value pair whose name is `name`. If there + * are no such pairs, `null` is returned. + * @return or `null` if there is no name-value pair with the given `name`. + */ + get(name: string): string | null; + /** + * Returns `true` if there is at least one name-value pair whose name is `name`. + */ + has(name: string): boolean; + /** + * Returns an iterator over the names of each name-value pair. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const { params } = new MIMEType('text/plain;foo=0;bar=1'); + * for (const name of params.keys()) { + * console.log(name); + * } + * // Prints: + * // foo + * // bar + * ``` + */ + keys(): IterableIterator; + /** + * Sets the value in the `MIMEParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`, + * set the first such pair's value to `value`. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const { params } = new MIMEType('text/plain;foo=0;bar=1'); + * params.set('foo', 'def'); + * params.set('baz', 'xyz'); + * console.log(params.toString()); + * // Prints: foo=def&bar=1&baz=xyz + * ``` + */ + set(name: string, value: string): void; + /** + * Returns an iterator over the values of each name-value pair. + */ + values(): IterableIterator; + /** + * Returns an iterator over each of the name-value pairs in the parameters. + */ + [Symbol.iterator]: typeof MIMEParams.prototype.entries; + } +} +declare module 'util/types' { + export * from 'util/types'; +} +declare module 'util/types' { + import { KeyObject, webcrypto } from 'node:crypto'; + /** + * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or + * [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance. + * + * See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`. + * + * ```js + * util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true + * util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true + * ``` + * @since v10.0.0 + */ + function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike; + /** + * Returns `true` if the value is an `arguments` object. + * + * ```js + * function foo() { + * util.types.isArgumentsObject(arguments); // Returns true + * } + * ``` + * @since v10.0.0 + */ + function isArgumentsObject(object: unknown): object is IArguments; + /** + * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance. + * This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is + * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that. + * + * ```js + * util.types.isArrayBuffer(new ArrayBuffer()); // Returns true + * util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false + * ``` + * @since v10.0.0 + */ + function isArrayBuffer(object: unknown): object is ArrayBuffer; + /** + * Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed + * array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to + * [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). + * + * ```js + * util.types.isArrayBufferView(new Int8Array()); // true + * util.types.isArrayBufferView(Buffer.from('hello world')); // true + * util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true + * util.types.isArrayBufferView(new ArrayBuffer()); // false + * ``` + * @since v10.0.0 + */ + function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView; + /** + * Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). + * This only reports back what the JavaScript engine is seeing; + * in particular, the return value may not match the original source code if + * a transpilation tool was used. + * + * ```js + * util.types.isAsyncFunction(function foo() {}); // Returns false + * util.types.isAsyncFunction(async function foo() {}); // Returns true + * ``` + * @since v10.0.0 + */ + function isAsyncFunction(object: unknown): boolean; + /** + * Returns `true` if the value is a `BigInt64Array` instance. + * + * ```js + * util.types.isBigInt64Array(new BigInt64Array()); // Returns true + * util.types.isBigInt64Array(new BigUint64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isBigInt64Array(value: unknown): value is BigInt64Array; + /** + * Returns `true` if the value is a `BigUint64Array` instance. + * + * ```js + * util.types.isBigUint64Array(new BigInt64Array()); // Returns false + * util.types.isBigUint64Array(new BigUint64Array()); // Returns true + * ``` + * @since v10.0.0 + */ + function isBigUint64Array(value: unknown): value is BigUint64Array; + /** + * Returns `true` if the value is a boolean object, e.g. created + * by `new Boolean()`. + * + * ```js + * util.types.isBooleanObject(false); // Returns false + * util.types.isBooleanObject(true); // Returns false + * util.types.isBooleanObject(new Boolean(false)); // Returns true + * util.types.isBooleanObject(new Boolean(true)); // Returns true + * util.types.isBooleanObject(Boolean(false)); // Returns false + * util.types.isBooleanObject(Boolean(true)); // Returns false + * ``` + * @since v10.0.0 + */ + function isBooleanObject(object: unknown): object is Boolean; + /** + * Returns `true` if the value is any boxed primitive object, e.g. created + * by `new Boolean()`, `new String()` or `Object(Symbol())`. + * + * For example: + * + * ```js + * util.types.isBoxedPrimitive(false); // Returns false + * util.types.isBoxedPrimitive(new Boolean(false)); // Returns true + * util.types.isBoxedPrimitive(Symbol('foo')); // Returns false + * util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true + * util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true + * ``` + * @since v10.11.0 + */ + function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol; + /** + * Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance. + * + * ```js + * const ab = new ArrayBuffer(20); + * util.types.isDataView(new DataView(ab)); // Returns true + * util.types.isDataView(new Float64Array()); // Returns false + * ``` + * + * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). + * @since v10.0.0 + */ + function isDataView(object: unknown): object is DataView; + /** + * Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance. + * + * ```js + * util.types.isDate(new Date()); // Returns true + * ``` + * @since v10.0.0 + */ + function isDate(object: unknown): object is Date; + /** + * Returns `true` if the value is a native `External` value. + * + * A native `External` value is a special type of object that contains a + * raw C++ pointer (`void*`) for access from native code, and has no other + * properties. Such objects are created either by Node.js internals or native + * addons. In JavaScript, they are [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a`null` prototype. + * + * ```c + * #include + * #include + * napi_value result; + * static napi_value MyNapi(napi_env env, napi_callback_info info) { + * int* raw = (int*) malloc(1024); + * napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result); + * if (status != napi_ok) { + * napi_throw_error(env, NULL, "napi_create_external failed"); + * return NULL; + * } + * return result; + * } + * ... + * DECLARE_NAPI_PROPERTY("myNapi", MyNapi) + * ... + * ``` + * + * ```js + * const native = require('napi_addon.node'); + * const data = native.myNapi(); + * util.types.isExternal(data); // returns true + * util.types.isExternal(0); // returns false + * util.types.isExternal(new String('foo')); // returns false + * ``` + * + * For further information on `napi_create_external`, refer to `napi_create_external()`. + * @since v10.0.0 + */ + function isExternal(object: unknown): boolean; + /** + * Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance. + * + * ```js + * util.types.isFloat32Array(new ArrayBuffer()); // Returns false + * util.types.isFloat32Array(new Float32Array()); // Returns true + * util.types.isFloat32Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isFloat32Array(object: unknown): object is Float32Array; + /** + * Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance. + * + * ```js + * util.types.isFloat64Array(new ArrayBuffer()); // Returns false + * util.types.isFloat64Array(new Uint8Array()); // Returns false + * util.types.isFloat64Array(new Float64Array()); // Returns true + * ``` + * @since v10.0.0 + */ + function isFloat64Array(object: unknown): object is Float64Array; + /** + * Returns `true` if the value is a generator function. + * This only reports back what the JavaScript engine is seeing; + * in particular, the return value may not match the original source code if + * a transpilation tool was used. + * + * ```js + * util.types.isGeneratorFunction(function foo() {}); // Returns false + * util.types.isGeneratorFunction(function* foo() {}); // Returns true + * ``` + * @since v10.0.0 + */ + function isGeneratorFunction(object: unknown): object is GeneratorFunction; + /** + * Returns `true` if the value is a generator object as returned from a + * built-in generator function. + * This only reports back what the JavaScript engine is seeing; + * in particular, the return value may not match the original source code if + * a transpilation tool was used. + * + * ```js + * function* foo() {} + * const generator = foo(); + * util.types.isGeneratorObject(generator); // Returns true + * ``` + * @since v10.0.0 + */ + function isGeneratorObject(object: unknown): object is Generator; + /** + * Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance. + * + * ```js + * util.types.isInt8Array(new ArrayBuffer()); // Returns false + * util.types.isInt8Array(new Int8Array()); // Returns true + * util.types.isInt8Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isInt8Array(object: unknown): object is Int8Array; + /** + * Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance. + * + * ```js + * util.types.isInt16Array(new ArrayBuffer()); // Returns false + * util.types.isInt16Array(new Int16Array()); // Returns true + * util.types.isInt16Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isInt16Array(object: unknown): object is Int16Array; + /** + * Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance. + * + * ```js + * util.types.isInt32Array(new ArrayBuffer()); // Returns false + * util.types.isInt32Array(new Int32Array()); // Returns true + * util.types.isInt32Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isInt32Array(object: unknown): object is Int32Array; + /** + * Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance. + * + * ```js + * util.types.isMap(new Map()); // Returns true + * ``` + * @since v10.0.0 + */ + function isMap(object: T | {}): object is T extends ReadonlyMap ? (unknown extends T ? never : ReadonlyMap) : Map; + /** + * Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance. + * + * ```js + * const map = new Map(); + * util.types.isMapIterator(map.keys()); // Returns true + * util.types.isMapIterator(map.values()); // Returns true + * util.types.isMapIterator(map.entries()); // Returns true + * util.types.isMapIterator(map[Symbol.iterator]()); // Returns true + * ``` + * @since v10.0.0 + */ + function isMapIterator(object: unknown): boolean; + /** + * Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects). + * + * ```js + * import * as ns from './a.js'; + * + * util.types.isModuleNamespaceObject(ns); // Returns true + * ``` + * @since v10.0.0 + */ + function isModuleNamespaceObject(value: unknown): boolean; + /** + * Returns `true` if the value was returned by the constructor of a [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects). + * + * ```js + * console.log(util.types.isNativeError(new Error())); // true + * console.log(util.types.isNativeError(new TypeError())); // true + * console.log(util.types.isNativeError(new RangeError())); // true + * ``` + * + * Subclasses of the native error types are also native errors: + * + * ```js + * class MyError extends Error {} + * console.log(util.types.isNativeError(new MyError())); // true + * ``` + * + * A value being `instanceof` a native error class is not equivalent to `isNativeError()`returning `true` for that value. `isNativeError()` returns `true` for errors + * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`for these errors: + * + * ```js + * const vm = require('node:vm'); + * const context = vm.createContext({}); + * const myError = vm.runInContext('new Error()', context); + * console.log(util.types.isNativeError(myError)); // true + * console.log(myError instanceof Error); // false + * ``` + * + * Conversely, `isNativeError()` returns `false` for all objects which were not + * returned by the constructor of a native error. That includes values + * which are `instanceof` native errors: + * + * ```js + * const myError = { __proto__: Error.prototype }; + * console.log(util.types.isNativeError(myError)); // false + * console.log(myError instanceof Error); // true + * ``` + * @since v10.0.0 + */ + function isNativeError(object: unknown): object is Error; + /** + * Returns `true` if the value is a number object, e.g. created + * by `new Number()`. + * + * ```js + * util.types.isNumberObject(0); // Returns false + * util.types.isNumberObject(new Number(0)); // Returns true + * ``` + * @since v10.0.0 + */ + function isNumberObject(object: unknown): object is Number; + /** + * Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). + * + * ```js + * util.types.isPromise(Promise.resolve(42)); // Returns true + * ``` + * @since v10.0.0 + */ + function isPromise(object: unknown): object is Promise; + /** + * Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance. + * + * ```js + * const target = {}; + * const proxy = new Proxy(target, {}); + * util.types.isProxy(target); // Returns false + * util.types.isProxy(proxy); // Returns true + * ``` + * @since v10.0.0 + */ + function isProxy(object: unknown): boolean; + /** + * Returns `true` if the value is a regular expression object. + * + * ```js + * util.types.isRegExp(/abc/); // Returns true + * util.types.isRegExp(new RegExp('abc')); // Returns true + * ``` + * @since v10.0.0 + */ + function isRegExp(object: unknown): object is RegExp; + /** + * Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance. + * + * ```js + * util.types.isSet(new Set()); // Returns true + * ``` + * @since v10.0.0 + */ + function isSet(object: T | {}): object is T extends ReadonlySet ? (unknown extends T ? never : ReadonlySet) : Set; + /** + * Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance. + * + * ```js + * const set = new Set(); + * util.types.isSetIterator(set.keys()); // Returns true + * util.types.isSetIterator(set.values()); // Returns true + * util.types.isSetIterator(set.entries()); // Returns true + * util.types.isSetIterator(set[Symbol.iterator]()); // Returns true + * ``` + * @since v10.0.0 + */ + function isSetIterator(object: unknown): boolean; + /** + * Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance. + * This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is + * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that. + * + * ```js + * util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false + * util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true + * ``` + * @since v10.0.0 + */ + function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer; + /** + * Returns `true` if the value is a string object, e.g. created + * by `new String()`. + * + * ```js + * util.types.isStringObject('foo'); // Returns false + * util.types.isStringObject(new String('foo')); // Returns true + * ``` + * @since v10.0.0 + */ + function isStringObject(object: unknown): object is String; + /** + * Returns `true` if the value is a symbol object, created + * by calling `Object()` on a `Symbol` primitive. + * + * ```js + * const symbol = Symbol('foo'); + * util.types.isSymbolObject(symbol); // Returns false + * util.types.isSymbolObject(Object(symbol)); // Returns true + * ``` + * @since v10.0.0 + */ + function isSymbolObject(object: unknown): object is Symbol; + /** + * Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance. + * + * ```js + * util.types.isTypedArray(new ArrayBuffer()); // Returns false + * util.types.isTypedArray(new Uint8Array()); // Returns true + * util.types.isTypedArray(new Float64Array()); // Returns true + * ``` + * + * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). + * @since v10.0.0 + */ + function isTypedArray(object: unknown): object is NodeJS.TypedArray; + /** + * Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance. + * + * ```js + * util.types.isUint8Array(new ArrayBuffer()); // Returns false + * util.types.isUint8Array(new Uint8Array()); // Returns true + * util.types.isUint8Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isUint8Array(object: unknown): object is Uint8Array; + /** + * Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance. + * + * ```js + * util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false + * util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true + * util.types.isUint8ClampedArray(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray; + /** + * Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance. + * + * ```js + * util.types.isUint16Array(new ArrayBuffer()); // Returns false + * util.types.isUint16Array(new Uint16Array()); // Returns true + * util.types.isUint16Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isUint16Array(object: unknown): object is Uint16Array; + /** + * Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance. + * + * ```js + * util.types.isUint32Array(new ArrayBuffer()); // Returns false + * util.types.isUint32Array(new Uint32Array()); // Returns true + * util.types.isUint32Array(new Float64Array()); // Returns false + * ``` + * @since v10.0.0 + */ + function isUint32Array(object: unknown): object is Uint32Array; + /** + * Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance. + * + * ```js + * util.types.isWeakMap(new WeakMap()); // Returns true + * ``` + * @since v10.0.0 + */ + function isWeakMap(object: unknown): object is WeakMap; + /** + * Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance. + * + * ```js + * util.types.isWeakSet(new WeakSet()); // Returns true + * ``` + * @since v10.0.0 + */ + function isWeakSet(object: unknown): object is WeakSet; + /** + * Returns `true` if `value` is a `KeyObject`, `false` otherwise. + * @since v16.2.0 + */ + function isKeyObject(object: unknown): object is KeyObject; + /** + * Returns `true` if `value` is a `CryptoKey`, `false` otherwise. + * @since v16.2.0 + */ + function isCryptoKey(object: unknown): object is webcrypto.CryptoKey; +} +declare module 'node:util' { + export * from 'util'; +} +declare module 'node:util/types' { + export * from 'util/types'; +} diff --git a/node_modules/@types/node/ts4.8/v8.d.ts b/node_modules/@types/node/ts4.8/v8.d.ts new file mode 100755 index 0000000..064f5d5 --- /dev/null +++ b/node_modules/@types/node/ts4.8/v8.d.ts @@ -0,0 +1,635 @@ +/** + * The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using: + * + * ```js + * const v8 = require('node:v8'); + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/v8.js) + */ +declare module 'v8' { + import { Readable } from 'node:stream'; + interface HeapSpaceInfo { + space_name: string; + space_size: number; + space_used_size: number; + space_available_size: number; + physical_space_size: number; + } + // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ + type DoesZapCodeSpaceFlag = 0 | 1; + interface HeapInfo { + total_heap_size: number; + total_heap_size_executable: number; + total_physical_size: number; + total_available_size: number; + used_heap_size: number; + heap_size_limit: number; + malloced_memory: number; + peak_malloced_memory: number; + does_zap_garbage: DoesZapCodeSpaceFlag; + number_of_native_contexts: number; + number_of_detached_contexts: number; + total_global_handles_size: number; + used_global_handles_size: number; + external_memory: number; + } + interface HeapCodeStatistics { + code_and_metadata_size: number; + bytecode_and_metadata_size: number; + external_script_source_size: number; + } + /** + * Returns an integer representing a version tag derived from the V8 version, + * command-line flags, and detected CPU features. This is useful for determining + * whether a `vm.Script` `cachedData` buffer is compatible with this instance + * of V8. + * + * ```js + * console.log(v8.cachedDataVersionTag()); // 3947234607 + * // The value returned by v8.cachedDataVersionTag() is derived from the V8 + * // version, command-line flags, and detected CPU features. Test that the value + * // does indeed update when flags are toggled. + * v8.setFlagsFromString('--allow_natives_syntax'); + * console.log(v8.cachedDataVersionTag()); // 183726201 + * ``` + * @since v8.0.0 + */ + function cachedDataVersionTag(): number; + /** + * Returns an object with the following properties: + * + * `does_zap_garbage` is a 0/1 boolean, which signifies whether the`--zap_code_space` option is enabled or not. This makes V8 overwrite heap + * garbage with a bit pattern. The RSS footprint (resident set size) gets bigger + * because it continuously touches all heap pages and that makes them less likely + * to get swapped out by the operating system. + * + * `number_of_native_contexts` The value of native\_context is the number of the + * top-level contexts currently active. Increase of this number over time indicates + * a memory leak. + * + * `number_of_detached_contexts` The value of detached\_context is the number + * of contexts that were detached and not yet garbage collected. This number + * being non-zero indicates a potential memory leak. + * + * `total_global_handles_size` The value of total\_global\_handles\_size is the + * total memory size of V8 global handles. + * + * `used_global_handles_size` The value of used\_global\_handles\_size is the + * used memory size of V8 global handles. + * + * `external_memory` The value of external\_memory is the memory size of array + * buffers and external strings. + * + * ```js + * { + * total_heap_size: 7326976, + * total_heap_size_executable: 4194304, + * total_physical_size: 7326976, + * total_available_size: 1152656, + * used_heap_size: 3476208, + * heap_size_limit: 1535115264, + * malloced_memory: 16384, + * peak_malloced_memory: 1127496, + * does_zap_garbage: 0, + * number_of_native_contexts: 1, + * number_of_detached_contexts: 0, + * total_global_handles_size: 8192, + * used_global_handles_size: 3296, + * external_memory: 318824 + * } + * ``` + * @since v1.0.0 + */ + function getHeapStatistics(): HeapInfo; + /** + * Returns statistics about the V8 heap spaces, i.e. the segments which make up + * the V8 heap. Neither the ordering of heap spaces, nor the availability of a + * heap space can be guaranteed as the statistics are provided via the + * V8[`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the + * next. + * + * The value returned is an array of objects containing the following properties: + * + * ```json + * [ + * { + * "space_name": "new_space", + * "space_size": 2063872, + * "space_used_size": 951112, + * "space_available_size": 80824, + * "physical_space_size": 2063872 + * }, + * { + * "space_name": "old_space", + * "space_size": 3090560, + * "space_used_size": 2493792, + * "space_available_size": 0, + * "physical_space_size": 3090560 + * }, + * { + * "space_name": "code_space", + * "space_size": 1260160, + * "space_used_size": 644256, + * "space_available_size": 960, + * "physical_space_size": 1260160 + * }, + * { + * "space_name": "map_space", + * "space_size": 1094160, + * "space_used_size": 201608, + * "space_available_size": 0, + * "physical_space_size": 1094160 + * }, + * { + * "space_name": "large_object_space", + * "space_size": 0, + * "space_used_size": 0, + * "space_available_size": 1490980608, + * "physical_space_size": 0 + * } + * ] + * ``` + * @since v6.0.0 + */ + function getHeapSpaceStatistics(): HeapSpaceInfo[]; + /** + * The `v8.setFlagsFromString()` method can be used to programmatically set + * V8 command-line flags. This method should be used with care. Changing settings + * after the VM has started may result in unpredictable behavior, including + * crashes and data loss; or it may simply do nothing. + * + * The V8 options available for a version of Node.js may be determined by running`node --v8-options`. + * + * Usage: + * + * ```js + * // Print GC events to stdout for one minute. + * const v8 = require('node:v8'); + * v8.setFlagsFromString('--trace_gc'); + * setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3); + * ``` + * @since v1.0.0 + */ + function setFlagsFromString(flags: string): void; + /** + * Generates a snapshot of the current V8 heap and returns a Readable + * Stream that may be used to read the JSON serialized representation. + * This JSON stream format is intended to be used with tools such as + * Chrome DevTools. The JSON schema is undocumented and specific to the + * V8 engine. Therefore, the schema may change from one version of V8 to the next. + * + * Creating a heap snapshot requires memory about twice the size of the heap at + * the time the snapshot is created. This results in the risk of OOM killers + * terminating the process. + * + * Generating a snapshot is a synchronous operation which blocks the event loop + * for a duration depending on the heap size. + * + * ```js + * // Print heap snapshot to the console + * const v8 = require('node:v8'); + * const stream = v8.getHeapSnapshot(); + * stream.pipe(process.stdout); + * ``` + * @since v11.13.0 + * @return A Readable containing the V8 heap snapshot. + */ + function getHeapSnapshot(): Readable; + /** + * Generates a snapshot of the current V8 heap and writes it to a JSON + * file. This file is intended to be used with tools such as Chrome + * DevTools. The JSON schema is undocumented and specific to the V8 + * engine, and may change from one version of V8 to the next. + * + * A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will + * not contain any information about the workers, and vice versa. + * + * Creating a heap snapshot requires memory about twice the size of the heap at + * the time the snapshot is created. This results in the risk of OOM killers + * terminating the process. + * + * Generating a snapshot is a synchronous operation which blocks the event loop + * for a duration depending on the heap size. + * + * ```js + * const { writeHeapSnapshot } = require('node:v8'); + * const { + * Worker, + * isMainThread, + * parentPort, + * } = require('node:worker_threads'); + * + * if (isMainThread) { + * const worker = new Worker(__filename); + * + * worker.once('message', (filename) => { + * console.log(`worker heapdump: ${filename}`); + * // Now get a heapdump for the main thread. + * console.log(`main thread heapdump: ${writeHeapSnapshot()}`); + * }); + * + * // Tell the worker to create a heapdump. + * worker.postMessage('heapdump'); + * } else { + * parentPort.once('message', (message) => { + * if (message === 'heapdump') { + * // Generate a heapdump for the worker + * // and return the filename to the parent. + * parentPort.postMessage(writeHeapSnapshot()); + * } + * }); + * } + * ``` + * @since v11.13.0 + * @param filename The file path where the V8 heap snapshot is to be saved. If not specified, a file name with the pattern `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be + * generated, where `{pid}` will be the PID of the Node.js process, `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a + * worker thread. + * @return The filename where the snapshot was saved. + */ + function writeHeapSnapshot(filename?: string): string; + /** + * Get statistics about code and its metadata in the heap, see + * V8[`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the + * following properties: + * + * ```js + * { + * code_and_metadata_size: 212208, + * bytecode_and_metadata_size: 161368, + * external_script_source_size: 1410794, + * cpu_profiler_metadata_size: 0, + * } + * ``` + * @since v12.8.0 + */ + function getHeapCodeStatistics(): HeapCodeStatistics; + /** + * @since v8.0.0 + */ + class Serializer { + /** + * Writes out a header, which includes the serialization format version. + */ + writeHeader(): void; + /** + * Serializes a JavaScript value and adds the serialized representation to the + * internal buffer. + * + * This throws an error if `value` cannot be serialized. + */ + writeValue(val: any): boolean; + /** + * Returns the stored internal buffer. This serializer should not be used once + * the buffer is released. Calling this method results in undefined behavior + * if a previous write has failed. + */ + releaseBuffer(): Buffer; + /** + * Marks an `ArrayBuffer` as having its contents transferred out of band. + * Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`. + * @param id A 32-bit unsigned integer. + * @param arrayBuffer An `ArrayBuffer` instance. + */ + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; + /** + * Write a raw 32-bit unsigned integer. + * For use inside of a custom `serializer._writeHostObject()`. + */ + writeUint32(value: number): void; + /** + * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. + * For use inside of a custom `serializer._writeHostObject()`. + */ + writeUint64(hi: number, lo: number): void; + /** + * Write a JS `number` value. + * For use inside of a custom `serializer._writeHostObject()`. + */ + writeDouble(value: number): void; + /** + * Write raw bytes into the serializer's internal buffer. The deserializer + * will require a way to compute the length of the buffer. + * For use inside of a custom `serializer._writeHostObject()`. + */ + writeRawBytes(buffer: NodeJS.TypedArray): void; + } + /** + * A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only + * stores the part of their underlying `ArrayBuffer`s that they are referring to. + * @since v8.0.0 + */ + class DefaultSerializer extends Serializer {} + /** + * @since v8.0.0 + */ + class Deserializer { + constructor(data: NodeJS.TypedArray); + /** + * Reads and validates a header (including the format version). + * May, for example, reject an invalid or unsupported wire format. In that case, + * an `Error` is thrown. + */ + readHeader(): boolean; + /** + * Deserializes a JavaScript value from the buffer and returns it. + */ + readValue(): any; + /** + * Marks an `ArrayBuffer` as having its contents transferred out of band. + * Pass the corresponding `ArrayBuffer` in the serializing context to `serializer.transferArrayBuffer()` (or return the `id` from `serializer._getSharedArrayBufferId()` in the case of + * `SharedArrayBuffer`s). + * @param id A 32-bit unsigned integer. + * @param arrayBuffer An `ArrayBuffer` instance. + */ + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; + /** + * Reads the underlying wire format version. Likely mostly to be useful to + * legacy code reading old wire format versions. May not be called before`.readHeader()`. + */ + getWireFormatVersion(): number; + /** + * Read a raw 32-bit unsigned integer and return it. + * For use inside of a custom `deserializer._readHostObject()`. + */ + readUint32(): number; + /** + * Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]`with two 32-bit unsigned integer entries. + * For use inside of a custom `deserializer._readHostObject()`. + */ + readUint64(): [number, number]; + /** + * Read a JS `number` value. + * For use inside of a custom `deserializer._readHostObject()`. + */ + readDouble(): number; + /** + * Read raw bytes from the deserializer's internal buffer. The `length` parameter + * must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`. + * For use inside of a custom `deserializer._readHostObject()`. + */ + readRawBytes(length: number): Buffer; + } + /** + * A subclass of `Deserializer` corresponding to the format written by `DefaultSerializer`. + * @since v8.0.0 + */ + class DefaultDeserializer extends Deserializer {} + /** + * Uses a `DefaultSerializer` to serialize `value` into a buffer. + * + * `ERR_BUFFER_TOO_LARGE` will be thrown when trying to + * serialize a huge object which requires buffer + * larger than `buffer.constants.MAX_LENGTH`. + * @since v8.0.0 + */ + function serialize(value: any): Buffer; + /** + * Uses a `DefaultDeserializer` with default options to read a JS value + * from a buffer. + * @since v8.0.0 + * @param buffer A buffer returned by {@link serialize}. + */ + function deserialize(buffer: NodeJS.TypedArray): any; + /** + * The `v8.takeCoverage()` method allows the user to write the coverage started by `NODE_V8_COVERAGE` to disk on demand. This method can be invoked multiple + * times during the lifetime of the process. Each time the execution counter will + * be reset and a new coverage report will be written to the directory specified + * by `NODE_V8_COVERAGE`. + * + * When the process is about to exit, one last coverage will still be written to + * disk unless {@link stopCoverage} is invoked before the process exits. + * @since v15.1.0, v14.18.0, v12.22.0 + */ + function takeCoverage(): void; + /** + * The `v8.stopCoverage()` method allows the user to stop the coverage collection + * started by `NODE_V8_COVERAGE`, so that V8 can release the execution count + * records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand. + * @since v15.1.0, v14.18.0, v12.22.0 + */ + function stopCoverage(): void; + /** + * This API collects GC data in current thread. + * @since v19.6.0, v18.15.0 + */ + class GCProfiler { + /** + * Start collecting GC data. + * @since v19.6.0, v18.15.0 + */ + start(): void; + /** + * Stop collecting GC data and return an object.The content of object + * is as follows. + * + * ```json + * { + * "version": 1, + * "startTime": 1674059033862, + * "statistics": [ + * { + * "gcType": "Scavenge", + * "beforeGC": { + * "heapStatistics": { + * "totalHeapSize": 5005312, + * "totalHeapSizeExecutable": 524288, + * "totalPhysicalSize": 5226496, + * "totalAvailableSize": 4341325216, + * "totalGlobalHandlesSize": 8192, + * "usedGlobalHandlesSize": 2112, + * "usedHeapSize": 4883840, + * "heapSizeLimit": 4345298944, + * "mallocedMemory": 254128, + * "externalMemory": 225138, + * "peakMallocedMemory": 181760 + * }, + * "heapSpaceStatistics": [ + * { + * "spaceName": "read_only_space", + * "spaceSize": 0, + * "spaceUsedSize": 0, + * "spaceAvailableSize": 0, + * "physicalSpaceSize": 0 + * } + * ] + * }, + * "cost": 1574.14, + * "afterGC": { + * "heapStatistics": { + * "totalHeapSize": 6053888, + * "totalHeapSizeExecutable": 524288, + * "totalPhysicalSize": 5500928, + * "totalAvailableSize": 4341101384, + * "totalGlobalHandlesSize": 8192, + * "usedGlobalHandlesSize": 2112, + * "usedHeapSize": 4059096, + * "heapSizeLimit": 4345298944, + * "mallocedMemory": 254128, + * "externalMemory": 225138, + * "peakMallocedMemory": 181760 + * }, + * "heapSpaceStatistics": [ + * { + * "spaceName": "read_only_space", + * "spaceSize": 0, + * "spaceUsedSize": 0, + * "spaceAvailableSize": 0, + * "physicalSpaceSize": 0 + * } + * ] + * } + * } + * ], + * "endTime": 1674059036865 + * } + * ``` + * + * Here's an example. + * + * ```js + * const { GCProfiler } = require('v8'); + * const profiler = new GCProfiler(); + * profiler.start(); + * setTimeout(() => { + * console.log(profiler.stop()); + * }, 1000); + * ``` + * @since v19.6.0, v18.15.0 + */ + stop(): GCProfilerResult; + } + interface GCProfilerResult { + version: number; + startTime: number; + endTime: number; + statistics: Array<{ + gcType: string; + cost: number; + beforeGC: { + heapStatistics: HeapStatistics; + heapSpaceStatistics: HeapSpaceStatistics[]; + }; + afterGC: { + heapStatistics: HeapStatistics; + heapSpaceStatistics: HeapSpaceStatistics[]; + }; + }>; + } + interface HeapStatistics { + totalHeapSize: number; + totalHeapSizeExecutable: number; + totalPhysicalSize: number; + totalAvailableSize: number; + totalGlobalHandlesSize: number; + usedGlobalHandlesSize: number; + usedHeapSize: number; + heapSizeLimit: number; + mallocedMemory: number; + externalMemory: number; + peakMallocedMemory: number; + } + interface HeapSpaceStatistics { + spaceName: string; + spaceSize: number; + spaceUsedSize: number; + spaceAvailableSize: number; + physicalSpaceSize: number; + } + /** + * Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will + * happen if a promise is created without ever getting a continuation. + * @since v17.1.0, v16.14.0 + * @param promise The promise being created. + * @param parent The promise continued from, if applicable. + */ + interface Init { + (promise: Promise, parent: Promise): void; + } + /** + * Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming. + * + * The before callback will be called 0 to N times. The before callback will typically be called 0 times if no continuation was ever made for the promise. + * The before callback may be called many times in the case where many continuations have been made from the same promise. + * @since v17.1.0, v16.14.0 + */ + interface Before { + (promise: Promise): void; + } + /** + * Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await. + * @since v17.1.0, v16.14.0 + */ + interface After { + (promise: Promise): void; + } + /** + * Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or + * {@link Promise.reject()}. + * @since v17.1.0, v16.14.0 + */ + interface Settled { + (promise: Promise): void; + } + /** + * Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or + * around an await, and when the promise resolves or rejects. + * + * Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and + * `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop. + * @since v17.1.0, v16.14.0 + */ + interface HookCallbacks { + init?: Init; + before?: Before; + after?: After; + settled?: Settled; + } + interface PromiseHooks { + /** + * The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param init The {@link Init | `init` callback} to call when a promise is created. + * @return Call to stop the hook. + */ + onInit: (init: Init) => Function; + /** + * The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param settled The {@link Settled | `settled` callback} to call when a promise is created. + * @return Call to stop the hook. + */ + onSettled: (settled: Settled) => Function; + /** + * The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param before The {@link Before | `before` callback} to call before a promise continuation executes. + * @return Call to stop the hook. + */ + onBefore: (before: Before) => Function; + /** + * The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param after The {@link After | `after` callback} to call after a promise continuation executes. + * @return Call to stop the hook. + */ + onAfter: (after: After) => Function; + /** + * Registers functions to be called for different lifetime events of each promise. + * The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime. + * All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed. + * The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop. + * @since v17.1.0, v16.14.0 + * @param callbacks The {@link HookCallbacks | Hook Callbacks} to register + * @return Used for disabling hooks + */ + createHook: (callbacks: HookCallbacks) => Function; + } + /** + * The `promiseHooks` interface can be used to track promise lifecycle events. + * @since v17.1.0, v16.14.0 + */ + const promiseHooks: PromiseHooks; +} +declare module 'node:v8' { + export * from 'v8'; +} diff --git a/node_modules/@types/node/ts4.8/vm.d.ts b/node_modules/@types/node/ts4.8/vm.d.ts new file mode 100755 index 0000000..b1aa99d --- /dev/null +++ b/node_modules/@types/node/ts4.8/vm.d.ts @@ -0,0 +1,895 @@ +/** + * The `node:vm` module enables compiling and running code within V8 Virtual + * Machine contexts. + * + * **The `node:vm` module is not a security** + * **mechanism. Do not use it to run untrusted code.** + * + * JavaScript code can be compiled and run immediately or + * compiled, saved, and run later. + * + * A common use case is to run the code in a different V8 Context. This means + * invoked code has a different global object than the invoking code. + * + * One can provide the context by `contextifying` an + * object. The invoked code treats any property in the context like a + * global variable. Any changes to global variables caused by the invoked + * code are reflected in the context object. + * + * ```js + * const vm = require('node:vm'); + * + * const x = 1; + * + * const context = { x: 2 }; + * vm.createContext(context); // Contextify the object. + * + * const code = 'x += 40; var y = 17;'; + * // `x` and `y` are global variables in the context. + * // Initially, x has the value 2 because that is the value of context.x. + * vm.runInContext(code, context); + * + * console.log(context.x); // 42 + * console.log(context.y); // 17 + * + * console.log(x); // 1; y is not defined. + * ``` + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/vm.js) + */ +declare module 'vm' { + import { ImportAssertions } from 'node:module'; + interface Context extends NodeJS.Dict {} + interface BaseOptions { + /** + * Specifies the filename used in stack traces produced by this script. + * Default: `''`. + */ + filename?: string | undefined; + /** + * Specifies the line number offset that is displayed in stack traces produced by this script. + * Default: `0`. + */ + lineOffset?: number | undefined; + /** + * Specifies the column number offset that is displayed in stack traces produced by this script. + * @default 0 + */ + columnOffset?: number | undefined; + } + interface ScriptOptions extends BaseOptions { + /** + * V8's code cache data for the supplied source. + */ + cachedData?: Buffer | NodeJS.ArrayBufferView | undefined; + /** @deprecated in favor of `script.createCachedData()` */ + produceCachedData?: boolean | undefined; + /** + * Called during evaluation of this module when `import()` is called. + * If this option is not specified, calls to `import()` will reject with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`. + */ + importModuleDynamically?: ((specifier: string, script: Script, importAssertions: ImportAssertions) => Module) | undefined; + } + interface RunningScriptOptions extends BaseOptions { + /** + * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. + * Default: `true`. + */ + displayErrors?: boolean | undefined; + /** + * Specifies the number of milliseconds to execute code before terminating execution. + * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer. + */ + timeout?: number | undefined; + /** + * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received. + * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that. + * If execution is terminated, an `Error` will be thrown. + * Default: `false`. + */ + breakOnSigint?: boolean | undefined; + } + interface RunningScriptInNewContextOptions extends RunningScriptOptions { + /** + * Human-readable name of the newly created context. + */ + contextName?: CreateContextOptions['name']; + /** + * Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL, + * but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object. + * Most notably, this string should omit the trailing slash, as that denotes a path. + */ + contextOrigin?: CreateContextOptions['origin']; + contextCodeGeneration?: CreateContextOptions['codeGeneration']; + /** + * If set to `afterEvaluate`, microtasks will be run immediately after the script has run. + */ + microtaskMode?: CreateContextOptions['microtaskMode']; + } + interface RunningCodeOptions extends RunningScriptOptions { + cachedData?: ScriptOptions['cachedData']; + importModuleDynamically?: ScriptOptions['importModuleDynamically']; + } + interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions { + cachedData?: ScriptOptions['cachedData']; + importModuleDynamically?: ScriptOptions['importModuleDynamically']; + } + interface CompileFunctionOptions extends BaseOptions { + /** + * Provides an optional data with V8's code cache data for the supplied source. + */ + cachedData?: Buffer | undefined; + /** + * Specifies whether to produce new cache data. + * Default: `false`, + */ + produceCachedData?: boolean | undefined; + /** + * The sandbox/context in which the said function should be compiled in. + */ + parsingContext?: Context | undefined; + /** + * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling + */ + contextExtensions?: Object[] | undefined; + } + interface CreateContextOptions { + /** + * Human-readable name of the newly created context. + * @default 'VM Context i' Where i is an ascending numerical index of the created context. + */ + name?: string | undefined; + /** + * Corresponds to the newly created context for display purposes. + * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary), + * like the value of the `url.origin` property of a URL object. + * Most notably, this string should omit the trailing slash, as that denotes a path. + * @default '' + */ + origin?: string | undefined; + codeGeneration?: + | { + /** + * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc) + * will throw an EvalError. + * @default true + */ + strings?: boolean | undefined; + /** + * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError. + * @default true + */ + wasm?: boolean | undefined; + } + | undefined; + /** + * If set to `afterEvaluate`, microtasks will be run immediately after the script has run. + */ + microtaskMode?: 'afterEvaluate' | undefined; + } + type MeasureMemoryMode = 'summary' | 'detailed'; + interface MeasureMemoryOptions { + /** + * @default 'summary' + */ + mode?: MeasureMemoryMode | undefined; + /** + * @default 'default' + */ + execution?: 'default' | 'eager' | undefined; + } + interface MemoryMeasurement { + total: { + jsMemoryEstimate: number; + jsMemoryRange: [number, number]; + }; + } + /** + * Instances of the `vm.Script` class contain precompiled scripts that can be + * executed in specific contexts. + * @since v0.3.1 + */ + class Script { + constructor(code: string, options?: ScriptOptions | string); + /** + * Runs the compiled code contained by the `vm.Script` object within the given`contextifiedObject` and returns the result. Running code does not have access + * to local scope. + * + * The following example compiles code that increments a global variable, sets + * the value of another global variable, then execute the code multiple times. + * The globals are contained in the `context` object. + * + * ```js + * const vm = require('node:vm'); + * + * const context = { + * animal: 'cat', + * count: 2, + * }; + * + * const script = new vm.Script('count += 1; name = "kitty";'); + * + * vm.createContext(context); + * for (let i = 0; i < 10; ++i) { + * script.runInContext(context); + * } + * + * console.log(context); + * // Prints: { animal: 'cat', count: 12, name: 'kitty' } + * ``` + * + * Using the `timeout` or `breakOnSigint` options will result in new event loops + * and corresponding threads being started, which have a non-zero performance + * overhead. + * @since v0.3.1 + * @param contextifiedObject A `contextified` object as returned by the `vm.createContext()` method. + * @return the result of the very last statement executed in the script. + */ + runInContext(contextifiedObject: Context, options?: RunningScriptOptions): any; + /** + * First contextifies the given `contextObject`, runs the compiled code contained + * by the `vm.Script` object within the created context, and returns the result. + * Running code does not have access to local scope. + * + * The following example compiles code that sets a global variable, then executes + * the code multiple times in different contexts. The globals are set on and + * contained within each individual `context`. + * + * ```js + * const vm = require('node:vm'); + * + * const script = new vm.Script('globalVar = "set"'); + * + * const contexts = [{}, {}, {}]; + * contexts.forEach((context) => { + * script.runInNewContext(context); + * }); + * + * console.log(contexts); + * // Prints: [{ globalVar: 'set' }, { globalVar: 'set' }, { globalVar: 'set' }] + * ``` + * @since v0.3.1 + * @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created. + * @return the result of the very last statement executed in the script. + */ + runInNewContext(contextObject?: Context, options?: RunningScriptInNewContextOptions): any; + /** + * Runs the compiled code contained by the `vm.Script` within the context of the + * current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object. + * + * The following example compiles code that increments a `global` variable then + * executes that code multiple times: + * + * ```js + * const vm = require('node:vm'); + * + * global.globalVar = 0; + * + * const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' }); + * + * for (let i = 0; i < 1000; ++i) { + * script.runInThisContext(); + * } + * + * console.log(globalVar); + * + * // 1000 + * ``` + * @since v0.3.1 + * @return the result of the very last statement executed in the script. + */ + runInThisContext(options?: RunningScriptOptions): any; + /** + * Creates a code cache that can be used with the `Script` constructor's`cachedData` option. Returns a `Buffer`. This method may be called at any + * time and any number of times. + * + * The code cache of the `Script` doesn't contain any JavaScript observable + * states. The code cache is safe to be saved along side the script source and + * used to construct new `Script` instances multiple times. + * + * Functions in the `Script` source can be marked as lazily compiled and they are + * not compiled at construction of the `Script`. These functions are going to be + * compiled when they are invoked the first time. The code cache serializes the + * metadata that V8 currently knows about the `Script` that it can use to speed up + * future compilations. + * + * ```js + * const script = new vm.Script(` + * function add(a, b) { + * return a + b; + * } + * + * const x = add(1, 2); + * `); + * + * const cacheWithoutAdd = script.createCachedData(); + * // In `cacheWithoutAdd` the function `add()` is marked for full compilation + * // upon invocation. + * + * script.runInThisContext(); + * + * const cacheWithAdd = script.createCachedData(); + * // `cacheWithAdd` contains fully compiled function `add()`. + * ``` + * @since v10.6.0 + */ + createCachedData(): Buffer; + /** @deprecated in favor of `script.createCachedData()` */ + cachedDataProduced?: boolean | undefined; + /** + * When `cachedData` is supplied to create the `vm.Script`, this value will be set + * to either `true` or `false` depending on acceptance of the data by V8\. + * Otherwise the value is `undefined`. + * @since v5.7.0 + */ + cachedDataRejected?: boolean | undefined; + cachedData?: Buffer | undefined; + /** + * When the script is compiled from a source that contains a source map magic + * comment, this property will be set to the URL of the source map. + * + * ```js + * import vm from 'node:vm'; + * + * const script = new vm.Script(` + * function myFunc() {} + * //# sourceMappingURL=sourcemap.json + * `); + * + * console.log(script.sourceMapURL); + * // Prints: sourcemap.json + * ``` + * @since v19.1.0, v18.13.0 + */ + sourceMapURL?: string | undefined; + } + /** + * If given a `contextObject`, the `vm.createContext()` method will `prepare + * that object` so that it can be used in calls to {@link runInContext} or `script.runInContext()`. Inside such scripts, + * the `contextObject` will be the global object, retaining all of its existing + * properties but also having the built-in objects and functions any standard [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global variables + * will remain unchanged. + * + * ```js + * const vm = require('node:vm'); + * + * global.globalVar = 3; + * + * const context = { globalVar: 1 }; + * vm.createContext(context); + * + * vm.runInContext('globalVar *= 2;', context); + * + * console.log(context); + * // Prints: { globalVar: 2 } + * + * console.log(global.globalVar); + * // Prints: 3 + * ``` + * + * If `contextObject` is omitted (or passed explicitly as `undefined`), a new, + * empty `contextified` object will be returned. + * + * The `vm.createContext()` method is primarily useful for creating a single + * context that can be used to run multiple scripts. For instance, if emulating a + * web browser, the method can be used to create a single context representing a + * window's global object, then run all ` + - - - - - - ReliefBox - - - - - - -
- - - -
-
- -
- - - - - -
- -
-
- - - - -
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
- -
-
- -
-
-
-
+
+
+ + + + +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
-
- +
+
+ +
-
- - - - \ No newline at end of file + \ No newline at end of file diff --git a/PWA/public/entry.html b/PWA/public/entry.html new file mode 100644 index 0000000..68614f1 --- /dev/null +++ b/PWA/public/entry.html @@ -0,0 +1,29 @@ +
+
+
+ +
+
+ + +
+
+
+ +
+
+
+ +
+
+
diff --git a/PWA/public/entry_not_found.html b/PWA/public/entry_not_found.html new file mode 100644 index 0000000..5089019 --- /dev/null +++ b/PWA/public/entry_not_found.html @@ -0,0 +1,13 @@ +
+
+ +
+
+ +
+
+
+ +
+
+
\ No newline at end of file diff --git a/PWA/public/index.html b/PWA/public/index.html index 145b385..8262aca 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -1,13 +1,13 @@ - + ReliefBox - + - - - - -
- - - -
-
- -
- - - - - -
- -
-
-
- {{#columns}} -
- -
- {{/columns}} -
- {{#rows}} -
-
-
- - -
-
-
- -
-
- -
-
- -
-
- -
-
- {{/rows}} + {{#rows}} +
+
+
+ -
-
-
- -
- +
+ +
+
+ +
+
+ +
+
+ {{/rows}}
-
- - - \ No newline at end of file + \ No newline at end of file diff --git a/PWA/public/manifest.json b/PWA/public/manifest.json index 7fc5bec..81a0126 100644 --- a/PWA/public/manifest.json +++ b/PWA/public/manifest.json @@ -15,7 +15,7 @@ ], "start_url": "/index.html", "scope": ".", - "display": "standalone", + "display": "fullscreen", "orientation": "portrait-primary", "background_color": "#00d1b2", "theme_color": "#00d1b2", diff --git a/PWA/public/name_distrib.html b/PWA/public/name_distrib.html index d349ee7..a51db93 100644 --- a/PWA/public/name_distrib.html +++ b/PWA/public/name_distrib.html @@ -7,7 +7,7 @@ ReliefBox - + - - - - -
- - - -
-
- -
- - - - - +
+
+
- -
-
- {{#errorMessages }} -
- {{ . }} -
- {{/errorMessages }} - -
-
- -
-
-
-
- -
-
-
-
-
Date
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
- -
-
- - -
+
+
+
+
Date
-
-
- -
- +
+
+ +
+
+
+
+ +
+
+ +
-
- - - \ No newline at end of file + \ No newline at end of file diff --git a/PWA/public/no_distrib.html b/PWA/public/no_distrib.html index 923df9e..4b30b21 100644 --- a/PWA/public/no_distrib.html +++ b/PWA/public/no_distrib.html @@ -2,7 +2,7 @@

-
+
diff --git a/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts index cc5cf4d..fcb8ecf 100644 --- a/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts @@ -22,8 +22,8 @@ export class CreateDistributionRequestHandler extends ActiveSessionContainer imp !this.isFilled(distribution.distrib_place) || !this.isFilled(distribution.distrib_date) ) { - return ResponseTools.replaceTemplateKeysWithValues( - await caches.match(RouteEvents.nameDistribution) as Response, + return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues( + RouteEvents.nameDistribution, { errorMessages: ["Specify the name, location and date of the distribution."] } ) } else { diff --git a/PWA/src/Services/FetchEventHandlers/NameDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/NameDistributionRequestHandler.ts index 476c642..a99a1a5 100644 --- a/PWA/src/Services/FetchEventHandlers/NameDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/NameDistributionRequestHandler.ts @@ -5,17 +5,10 @@ import { ResponseTools } from "../ResponseTools.js"; export class NameDistributionRequestHandler implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { - return event.request.url - .replace("?", "") - .endsWith(RouteEvents.nameDistribution); + return event.request.url.includes(RouteEvents.nameDistribution) } async handleEvent(event: FetchEvent): Promise { - return ResponseTools - .replaceTemplateKeysWithValues( - await caches - .match(event.request) as Response, - { errorMessages: [] } - ) + return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.nameDistribution, { errorMessages: [] }) } } \ No newline at end of file From 209773e713d1b8df53462261207ba5c105bfe1a8 Mon Sep 17 00:00:00 2001 From: Menno <129762469+rcmenno@users.noreply.github.com> Date: Fri, 2 Aug 2024 15:39:03 +0200 Subject: [PATCH 20/99] Make sure check who's missing has an empty state --- .../CheckWhosMissingPagehandler.js | 13 +++++++++---- .../CheckWhosMissingPagehandler.ts | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js b/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js index c7c4681..423d515 100644 --- a/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js +++ b/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js @@ -11,10 +11,15 @@ export class CheckWhosMissingPageHandler extends ActiveSessionContainer { const beneficiaries = await beneficiariesService.eligibleBeneficiariesForActiveDistribution(); console.log("Will display:"); console.log(beneficiaries); - return await ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.viewData, { - columns: this.columnsFromBeneficiaries(beneficiaries), - beneficiaries: beneficiaries, - }); + if (beneficiaries.length > 0) { + return await ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.viewData, { + columns: this.columnsFromBeneficiaries(beneficiaries), + beneficiaries: beneficiaries, + }); + } + else { + return await ResponseTools.wrapInHtmlTemplate(RouteEvents.noBeneficiariesFound); + } } columnsFromBeneficiaries(beneficiaries) { if (beneficiaries.length > 0) { diff --git a/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts b/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts index 934441c..a3c07f1 100644 --- a/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts +++ b/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts @@ -16,10 +16,14 @@ export class CheckWhosMissingPageHandler extends ActiveSessionContainer implemen const beneficiaries = await beneficiariesService.eligibleBeneficiariesForActiveDistribution(); console.log("Will display:"); console.log(beneficiaries); - return await ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.viewData, { + if(beneficiaries.length > 0) { + return await ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.viewData, { columns: this.columnsFromBeneficiaries(beneficiaries), beneficiaries: beneficiaries, }); + } else { + return await ResponseTools.wrapInHtmlTemplate(RouteEvents.noBeneficiariesFound) + } } private columnsFromBeneficiaries(beneficiaries: Beneficiary[]): string[] { From 4fe84f03ab85bb987c1f5ea9962597d98ec0df55 Mon Sep 17 00:00:00 2001 From: Menno <129762469+rcmenno@users.noreply.github.com> Date: Fri, 2 Aug 2024 15:49:17 +0200 Subject: [PATCH 21/99] Make sure only future dates can be selected --- PWA/public/Services/CacheFilePathService.js | 4 ++- PWA/public/Services/DateService.js | 17 ++++++++++ .../CreateDistributionRequestHandler.js | 6 +++- .../NameDistributionRequestHandler.js | 22 ++++++++++++- PWA/public/name_distrib.html | 2 +- PWA/src/Services/CacheFilePathService.ts | 4 ++- PWA/src/Services/DateService.ts | 24 ++++++++++++++ .../CreateDistributionRequestHandler.ts | 6 +++- .../NameDistributionRequestHandler.ts | 32 ++++++++++++++++++- 9 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 PWA/public/Services/DateService.js create mode 100644 PWA/src/Services/DateService.ts diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index 0f5a9a8..6f9fe02 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -26,6 +26,7 @@ import { BeneficiariesService } from "./BeneficiariesService.js"; import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissingPagehandler.js"; import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; +import { DateService } from "./DateService.js"; // Provides all the files that have to be cached for offline use export class CacheFilePathService { pathsOfFilesToCache() { @@ -105,7 +106,8 @@ export class CacheFilePathService { FormParser.name, BeneficiaryEligilityService.name, ActiveSession.name, - BeneficiariesService.name + BeneficiariesService.name, + DateService.name ]); } fetchEventHanderPaths() { diff --git a/PWA/public/Services/DateService.js b/PWA/public/Services/DateService.js new file mode 100644 index 0000000..57f45a9 --- /dev/null +++ b/PWA/public/Services/DateService.js @@ -0,0 +1,17 @@ +export class DateService { + static todaysDateString() { + var today = new Date(); + const year = today.getFullYear(); + const month = today.getMonth() + 1; + const day = today.getDate(); + let dateString = year + "-"; + if (month < 10) + dateString += "0"; + dateString += month; + dateString += "-"; + if (day < 10) + dateString += "0"; + dateString += day; + return dateString; + } +} diff --git a/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js index 820ed68..837b5bf 100644 --- a/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js @@ -3,6 +3,7 @@ import { ResponseTools } from "../ResponseTools.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; +import { DateService } from "../DateService.js"; export class CreateDistributionRequestHandler extends ActiveSessionContainer { constructor() { super(...arguments); @@ -16,7 +17,10 @@ export class CreateDistributionRequestHandler extends ActiveSessionContainer { if (!this.isFilled(distribution.distrib_name) || !this.isFilled(distribution.distrib_place) || !this.isFilled(distribution.distrib_date)) { - return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.nameDistribution, { errorMessages: ["Specify the name, location and date of the distribution."] }); + return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.nameDistribution, { + errorMessages: ["Specify the name, location and date of the distribution."], + todaysDateString: DateService.todaysDateString() + }); } else { try { diff --git a/PWA/public/Services/FetchEventHandlers/NameDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/NameDistributionRequestHandler.js index b84dc2b..9b1ab82 100644 --- a/PWA/public/Services/FetchEventHandlers/NameDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/NameDistributionRequestHandler.js @@ -5,6 +5,26 @@ export class NameDistributionRequestHandler { return event.request.url.includes(RouteEvents.nameDistribution); } async handleEvent(event) { - return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.nameDistribution, { errorMessages: [] }); + return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.nameDistribution, { + errorMessages: [], + todaysDateString: DateService.todaysDateString() + }); + } +} +export class DateService { + static todaysDateString() { + var today = new Date(); + const year = today.getFullYear(); + const month = today.getMonth() + 1; + const day = today.getDate(); + let dateString = year + "-"; + if (month < 10) + dateString += "0"; + dateString += month; + dateString += "-"; + if (day < 10) + dateString += "0"; + dateString += day; + return dateString; } } diff --git a/PWA/public/name_distrib.html b/PWA/public/name_distrib.html index 9d7192f..62ac890 100644 --- a/PWA/public/name_distrib.html +++ b/PWA/public/name_distrib.html @@ -23,7 +23,7 @@
- +
diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts index 50dd0e0..08d799f 100644 --- a/PWA/src/Services/CacheFilePathService.ts +++ b/PWA/src/Services/CacheFilePathService.ts @@ -26,6 +26,7 @@ import { BeneficiariesService } from "./BeneficiariesService.js"; import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissingPagehandler.js"; import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; +import { DateService } from "./DateService.js"; // Provides all the files that have to be cached for offline use export class CacheFilePathService { @@ -117,7 +118,8 @@ export class CacheFilePathService { FormParser.name, BeneficiaryEligilityService.name, ActiveSession.name, - BeneficiariesService.name + BeneficiariesService.name, + DateService.name ]); } diff --git a/PWA/src/Services/DateService.ts b/PWA/src/Services/DateService.ts new file mode 100644 index 0000000..6731083 --- /dev/null +++ b/PWA/src/Services/DateService.ts @@ -0,0 +1,24 @@ +export class DateService { + static todaysDateString(): string { + var today = new Date(); + + const year = today.getFullYear(); + const month = today.getMonth() + 1; + const day = today.getDate(); + + let dateString = year + "-" + + if(month < 10) + dateString += "0" + + dateString += month + dateString += "-" + + if(day < 10) + dateString += "0" + + dateString += day + + return dateString + } + } \ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts index fcb8ecf..890c41f 100644 --- a/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts @@ -6,6 +6,7 @@ import { ResponseTools } from "../ResponseTools.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; +import { DateService } from "../DateService.js"; export class CreateDistributionRequestHandler extends ActiveSessionContainer implements FetchEventHandler { benificiaryInfoService = new BenificiaryInfoService(this.activeSession.database) @@ -24,7 +25,10 @@ export class CreateDistributionRequestHandler extends ActiveSessionContainer imp ) { return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues( RouteEvents.nameDistribution, - { errorMessages: ["Specify the name, location and date of the distribution."] } + { + errorMessages: ["Specify the name, location and date of the distribution."], + todaysDateString: DateService.todaysDateString() + } ) } else { try { diff --git a/PWA/src/Services/FetchEventHandlers/NameDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/NameDistributionRequestHandler.ts index a99a1a5..144eed6 100644 --- a/PWA/src/Services/FetchEventHandlers/NameDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/NameDistributionRequestHandler.ts @@ -9,6 +9,36 @@ export class NameDistributionRequestHandler implements FetchEventHandler { } async handleEvent(event: FetchEvent): Promise { - return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.nameDistribution, { errorMessages: [] }) + return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues( + RouteEvents.nameDistribution, { + errorMessages: [], + todaysDateString: DateService.todaysDateString() + } + ) + } +} + +export class DateService { + static todaysDateString(): string { + var today = new Date(); + + const year = today.getFullYear(); + const month = today.getMonth() + 1; + const day = today.getDate(); + + let dateString = year + "-" + + if(month < 10) + dateString += "0" + + dateString += month + dateString += "-" + + if(day < 10) + dateString += "0" + + dateString += day + + return dateString } } \ No newline at end of file From 5c5a7ddb3b14d2b783fe6ec162064b484825c476 Mon Sep 17 00:00:00 2001 From: Menno <129762469+rcmenno@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:45:18 +0200 Subject: [PATCH 22/99] Make sure back to main menu button works from entry not found --- PWA/public/entry_not_found.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWA/public/entry_not_found.html b/PWA/public/entry_not_found.html index 5089019..2b08a76 100644 --- a/PWA/public/entry_not_found.html +++ b/PWA/public/entry_not_found.html @@ -6,7 +6,7 @@
-
+
From f045164d56530d12ee36258f2d8b43f2a7986cfc Mon Sep 17 00:00:00 2001 From: Menno <129762469+rcmenno@users.noreply.github.com> Date: Sun, 11 Aug 2024 22:52:56 +0200 Subject: [PATCH 23/99] Wip --- PWA/public/RouteEvents.js | 1 + PWA/public/Services/CacheFilePathService.js | 4 ++- .../ContinueDistributionHandler.js | 22 ++++++++++++++ .../FetchEventHandlers/FetchEventHandlers.js | 4 ++- ...tBenificiaryCodeInputMethodHandler copy.js | 29 +++++++++++++++++++ PWA/public/entry_not_found.html | 2 +- PWA/src/RouteEvents.ts | 1 + PWA/src/Services/CacheFilePathService.ts | 4 ++- .../ContinueDistributionHandler.ts | 27 +++++++++++++++++ .../FetchEventHandlers/FetchEventHandlers.ts | 4 ++- 10 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 PWA/public/Services/FetchEventHandlers/ContinueDistributionHandler.js create mode 100644 PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler copy.js create mode 100644 PWA/src/Services/FetchEventHandlers/ContinueDistributionHandler.ts diff --git a/PWA/public/RouteEvents.js b/PWA/public/RouteEvents.js index 431d6ef..51f6a0f 100644 --- a/PWA/public/RouteEvents.js +++ b/PWA/public/RouteEvents.js @@ -26,4 +26,5 @@ RouteEvents.selectBenificiaryCodeInputMethod = "/save_input_method"; RouteEvents.checkBenificiaryCodeInputMethod = "/entry"; RouteEvents.checkWhosMissing = "/missing"; RouteEvents.received = "/received"; +RouteEvents.continueDistribution = "/continueDistribution"; export { RouteEvents }; diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index 6f9fe02..d4c35c8 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -27,6 +27,7 @@ import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissi import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; import { DateService } from "./DateService.js"; +import { ContinueDistributionHandler } from "./FetchEventHandlers/ContinueDistributionHandler.js"; // Provides all the files that have to be cached for offline use export class CacheFilePathService { pathsOfFilesToCache() { @@ -126,7 +127,8 @@ export class CacheFilePathService { ViewDistributionDataHandler.name, CheckWhosMissingPageHandler.name, MarkAsReceivedPostHandler.name, - HomepageHandler.name + HomepageHandler.name, + ContinueDistributionHandler.name ]); } interfacesPaths() { diff --git a/PWA/public/Services/FetchEventHandlers/ContinueDistributionHandler.js b/PWA/public/Services/FetchEventHandlers/ContinueDistributionHandler.js new file mode 100644 index 0000000..a1f95b0 --- /dev/null +++ b/PWA/public/Services/FetchEventHandlers/ContinueDistributionHandler.js @@ -0,0 +1,22 @@ +import { RouteEvents } from "../../RouteEvents.js"; +import { ResponseTools } from "../ResponseTools.js"; +export class ContinueDistributionHandler { + canHandleEvent(event) { + return event.request.url.includes(RouteEvents.continueDistribution); + } + async handleEvent(event) { + //TODO this should be context aware + return await ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod("text")); + } + templatepageForInputMethod(inputMethod) { + if (inputMethod == "video") { + return RouteEvents.codeInputUsingCamera; + } + else if (inputMethod == "text") { + return RouteEvents.codeinputUsingTextField; + } + else { + throw "Unexpected input method: " + inputMethod; + } + } +} diff --git a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js index ba1f529..28c62aa 100644 --- a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js +++ b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js @@ -14,6 +14,7 @@ import { BeneficiaryCodePostHandler } from "./BeneficiaryCodePostHandler.js"; import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPagehandler.js"; import { MarkAsReceivedPostHandler } from "./MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./HomepageHandler.js"; +import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; export class FetchEventHandlers extends ActiveSessionContainer { constructor() { super(...arguments); @@ -32,7 +33,8 @@ export class FetchEventHandlers extends ActiveSessionContainer { new ViewDistributionDataHandler(this.activeSession), new CheckWhosMissingPageHandler(this.activeSession), new MarkAsReceivedPostHandler(this.activeSession), - new HomepageHandler() + new HomepageHandler(), + new ContinueDistributionHandler() ]; } handlersForEvent(event) { diff --git a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler copy.js b/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler copy.js new file mode 100644 index 0000000..8aab629 --- /dev/null +++ b/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler copy.js @@ -0,0 +1,29 @@ +import { RouteEvents } from "../../RouteEvents.js"; +import { DeserialisationService } from "../DeserialisationService.js"; +import { ResponseTools } from "../ResponseTools.js"; +export class SelectBenificiaryCodeInputMethodHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.selectBenificiaryCodeInputMethod); + } + async handleEvent(event) { + try { + const post = await DeserialisationService.deserializeFormDataFromRequest(event.request); + return ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod(post.input_method)); + } + catch (error) { + console.error(error); + return fetch(RouteEvents.home); + } + } + templatepageForInputMethod(inputMethod) { + if (inputMethod == "video") { + return RouteEvents.codeInputUsingCamera; + } + else if (inputMethod == "text") { + return RouteEvents.codeinputUsingTextField; + } + else { + throw "Unexpected input method: " + inputMethod; + } + } +} diff --git a/PWA/public/entry_not_found.html b/PWA/public/entry_not_found.html index 2b08a76..11f5e80 100644 --- a/PWA/public/entry_not_found.html +++ b/PWA/public/entry_not_found.html @@ -2,7 +2,7 @@

-
+

diff --git a/PWA/src/RouteEvents.ts b/PWA/src/RouteEvents.ts index 628c3de..8266aee 100644 --- a/PWA/src/RouteEvents.ts +++ b/PWA/src/RouteEvents.ts @@ -26,4 +26,5 @@ export class RouteEvents { static checkBenificiaryCodeInputMethod = "/entry" static checkWhosMissing = "/missing" static received = "/received" + static continueDistribution = "/continueDistribution" } \ No newline at end of file diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts index 08d799f..a0a4894 100644 --- a/PWA/src/Services/CacheFilePathService.ts +++ b/PWA/src/Services/CacheFilePathService.ts @@ -27,6 +27,7 @@ import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissi import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; import { DateService } from "./DateService.js"; +import { ContinueDistributionHandler } from "./FetchEventHandlers/ContinueDistributionHandler.js"; // Provides all the files that have to be cached for offline use export class CacheFilePathService { @@ -139,7 +140,8 @@ export class CacheFilePathService { ViewDistributionDataHandler.name, CheckWhosMissingPageHandler.name, MarkAsReceivedPostHandler.name, - HomepageHandler.name + HomepageHandler.name, + ContinueDistributionHandler.name ]); } diff --git a/PWA/src/Services/FetchEventHandlers/ContinueDistributionHandler.ts b/PWA/src/Services/FetchEventHandlers/ContinueDistributionHandler.ts new file mode 100644 index 0000000..6657839 --- /dev/null +++ b/PWA/src/Services/FetchEventHandlers/ContinueDistributionHandler.ts @@ -0,0 +1,27 @@ +import { FetchEvent } from "../../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; +import { BeneficiaryCodeInputMethodPost } from "../../Models/BeneficiaryCodeInputMethodPost.js"; +import { RouteEvents } from "../../RouteEvents.js"; +import { DeserialisationService } from "../DeserialisationService.js"; +import { ResponseTools } from "../ResponseTools.js"; + +export class ContinueDistributionHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.includes(RouteEvents.continueDistribution) + } + + async handleEvent(event: FetchEvent): Promise { + //TODO this should be context aware + return await ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod("text")) + } + + private templatepageForInputMethod(inputMethod: string): string { + if(inputMethod == "video") { + return RouteEvents.codeInputUsingCamera + } else if(inputMethod == "text") { + return RouteEvents.codeinputUsingTextField + } else { + throw "Unexpected input method: " + inputMethod + } + } + } \ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts index 816603e..269837e 100644 --- a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts +++ b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts @@ -16,6 +16,7 @@ import { BeneficiaryCodePostHandler } from "./BeneficiaryCodePostHandler.js"; import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPagehandler.js"; import { MarkAsReceivedPostHandler } from "./MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./HomepageHandler.js"; +import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; export class FetchEventHandlers extends ActiveSessionContainer implements FetchEventHandler { all: FetchEventHandler[] = [ @@ -33,7 +34,8 @@ export class FetchEventHandlers extends ActiveSessionContainer implements FetchE new ViewDistributionDataHandler(this.activeSession), new CheckWhosMissingPageHandler(this.activeSession), new MarkAsReceivedPostHandler(this.activeSession), - new HomepageHandler() + new HomepageHandler(), + new ContinueDistributionHandler() ]; handlersForEvent(event: FetchEvent): FetchEventHandler[] { From d55d3bc33480d1e3318578b4e41ea3b0f95a8012 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Thu, 15 Aug 2024 13:17:03 +0200 Subject: [PATCH 24/99] Wip before adding received when --- PWA/package-lock.json | 12 + PWA/package.json | 8 +- PWA/public/ExternalLibraries/xlsx.full.min.js | 382 +++++++++--------- PWA/public/Models/Distribution.js | 3 +- PWA/public/RouteEvents.js | 3 +- 5 files changed, 211 insertions(+), 197 deletions(-) diff --git a/PWA/package-lock.json b/PWA/package-lock.json index 72226d1..2a67831 100644 --- a/PWA/package-lock.json +++ b/PWA/package-lock.json @@ -8,6 +8,9 @@ "name": "ReliefBox", "version": "1.0.0", "license": "ISC", + "dependencies": { + "fake-indexeddb": "^6.0.0" + }, "devDependencies": { "@babel/preset-env": "^7.23.8", "@babel/preset-typescript": "^7.23.3", @@ -3495,6 +3498,15 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/fake-indexeddb": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/fake-indexeddb/-/fake-indexeddb-6.0.0.tgz", + "integrity": "sha512-YEboHE5VfopUclOck7LncgIqskAqnv4q0EWbYCaxKKjAvO93c+TJIaBuGy8CBFdbg9nKdpN3AuPRwVBJ4k7NrQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", diff --git a/PWA/package.json b/PWA/package.json index 6977cf9..8ebfe23 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -11,7 +11,6 @@ "author": "Red Cross", "license": "ISC", "devDependencies": { - "http-server": "^0.10.0", "@babel/preset-env": "^7.23.8", "@babel/preset-typescript": "^7.23.3", "@types/jest": "^29.5.11", @@ -20,6 +19,11 @@ }, "jest": { "verbose": false, - "roots": ["public"] + "roots": [ + "public" + ] + }, + "dependencies": { + "fake-indexeddb": "^6.0.0" } } diff --git a/PWA/public/ExternalLibraries/xlsx.full.min.js b/PWA/public/ExternalLibraries/xlsx.full.min.js index bbc2c13..ae55044 100644 --- a/PWA/public/ExternalLibraries/xlsx.full.min.js +++ b/PWA/public/ExternalLibraries/xlsx.full.min.js @@ -11,25 +11,25 @@ var $cptable; var VALID_ANSI = [874, 932, 936, 949, 950, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000]; /* ECMA-376 Part I 18.4.1 charset to codepage mapping */ var CS2CP = ({ - /*::[*/ 0 /*::]*/: 1252, - /*::[*/ 1 /*::]*/: 65001, - /*::[*/ 2 /*::]*/: 65001, - /*::[*/ 77 /*::]*/: 10000, - /*::[*/ 128 /*::]*/: 932, - /*::[*/ 129 /*::]*/: 949, - /*::[*/ 130 /*::]*/: 1361, - /*::[*/ 134 /*::]*/: 936, - /*::[*/ 136 /*::]*/: 950, - /*::[*/ 161 /*::]*/: 1253, - /*::[*/ 162 /*::]*/: 1254, - /*::[*/ 163 /*::]*/: 1258, - /*::[*/ 177 /*::]*/: 1255, - /*::[*/ 178 /*::]*/: 1256, - /*::[*/ 186 /*::]*/: 1257, - /*::[*/ 204 /*::]*/: 1251, - /*::[*/ 222 /*::]*/: 874, - /*::[*/ 238 /*::]*/: 1250, - /*::[*/ 255 /*::]*/: 1252, + /*::[*/ 0 /*::]*/: 1252, /* ANSI */ + /*::[*/ 1 /*::]*/: 65001, /* DEFAULT */ + /*::[*/ 2 /*::]*/: 65001, /* SYMBOL */ + /*::[*/ 77 /*::]*/: 10000, /* MAC */ + /*::[*/ 128 /*::]*/: 932, /* SHIFTJIS */ + /*::[*/ 129 /*::]*/: 949, /* HANGUL */ + /*::[*/ 130 /*::]*/: 1361, /* JOHAB */ + /*::[*/ 134 /*::]*/: 936, /* GB2312 */ + /*::[*/ 136 /*::]*/: 950, /* CHINESEBIG5 */ + /*::[*/ 161 /*::]*/: 1253, /* GREEK */ + /*::[*/ 162 /*::]*/: 1254, /* TURKISH */ + /*::[*/ 163 /*::]*/: 1258, /* VIETNAMESE */ + /*::[*/ 177 /*::]*/: 1255, /* HEBREW */ + /*::[*/ 178 /*::]*/: 1256, /* ARABIC */ + /*::[*/ 186 /*::]*/: 1257, /* BALTIC */ + /*::[*/ 204 /*::]*/: 1251, /* RUSSIAN */ + /*::[*/ 222 /*::]*/: 874, /* THAI */ + /*::[*/ 238 /*::]*/: 1250, /* EASTEUROPE */ + /*::[*/ 255 /*::]*/: 1252, /* OEM */ /*::[*/ 69 /*::]*/: 6969 /* MISC */ } /*:any*/); var set_ansi = function (cp /*:number*/) { if (VALID_ANSI.indexOf(cp) == -1) @@ -436,17 +436,17 @@ var table_fmt = { /* Defaults determined by systematically testing in Excel 2019 */ /* These formats appear to default to other formats in the table */ var SSF_default_map = { - 5: 37, 6: 38, 7: 39, 8: 40, - 23: 0, 24: 0, 25: 0, 26: 0, - 27: 14, 28: 14, 29: 14, 30: 14, 31: 14, - 50: 14, 51: 14, 52: 14, 53: 14, 54: 14, + 5: 37, 6: 38, 7: 39, 8: 40, // 5 -> 37 ... 8 -> 40 + 23: 0, 24: 0, 25: 0, 26: 0, // 23 -> 0 ... 26 -> 0 + 27: 14, 28: 14, 29: 14, 30: 14, 31: 14, // 27 -> 14 ... 31 -> 14 + 50: 14, 51: 14, 52: 14, 53: 14, 54: 14, // 50 -> 14 ... 58 -> 14 55: 14, 56: 14, 57: 14, 58: 14, - 59: 1, 60: 2, 61: 3, 62: 4, - 67: 9, 68: 10, - 69: 12, 70: 13, 71: 14, - 72: 14, 73: 15, 74: 16, 75: 17, - 76: 20, 77: 21, 78: 22, - 79: 45, 80: 46, 81: 47, + 59: 1, 60: 2, 61: 3, 62: 4, // 59 -> 1 ... 62 -> 4 + 67: 9, 68: 10, // 67 -> 9 ... 68 -> 10 + 69: 12, 70: 13, 71: 14, // 69 -> 12 ... 71 -> 14 + 72: 14, 73: 15, 74: 16, 75: 17, // 72 -> 14 ... 75 -> 17 + 76: 20, 77: 21, 78: 22, // 76 -> 20 ... 78 -> 22 + 79: 45, 80: 46, 81: 47, // 79 -> 45 ... 81 -> 47 82: 0 // 82 -> 0 ... 65536 -> 0 (omitted) }; /* These formats technically refer to Accounting formats with no equivalent */ @@ -5988,55 +5988,55 @@ var SummaryPIDSI = { }; /* [MS-XLS] 2.4.63 Country/Region codes */ var CountryEnum = { - /*::[*/ 0x0001 /*::]*/: "US", - /*::[*/ 0x0002 /*::]*/: "CA", - /*::[*/ 0x0003 /*::]*/: "", - /*::[*/ 0x0007 /*::]*/: "RU", - /*::[*/ 0x0014 /*::]*/: "EG", - /*::[*/ 0x001E /*::]*/: "GR", - /*::[*/ 0x001F /*::]*/: "NL", - /*::[*/ 0x0020 /*::]*/: "BE", - /*::[*/ 0x0021 /*::]*/: "FR", - /*::[*/ 0x0022 /*::]*/: "ES", - /*::[*/ 0x0024 /*::]*/: "HU", - /*::[*/ 0x0027 /*::]*/: "IT", - /*::[*/ 0x0029 /*::]*/: "CH", - /*::[*/ 0x002B /*::]*/: "AT", - /*::[*/ 0x002C /*::]*/: "GB", - /*::[*/ 0x002D /*::]*/: "DK", - /*::[*/ 0x002E /*::]*/: "SE", - /*::[*/ 0x002F /*::]*/: "NO", - /*::[*/ 0x0030 /*::]*/: "PL", - /*::[*/ 0x0031 /*::]*/: "DE", - /*::[*/ 0x0034 /*::]*/: "MX", - /*::[*/ 0x0037 /*::]*/: "BR", - /*::[*/ 0x003d /*::]*/: "AU", - /*::[*/ 0x0040 /*::]*/: "NZ", - /*::[*/ 0x0042 /*::]*/: "TH", - /*::[*/ 0x0051 /*::]*/: "JP", - /*::[*/ 0x0052 /*::]*/: "KR", - /*::[*/ 0x0054 /*::]*/: "VN", - /*::[*/ 0x0056 /*::]*/: "CN", - /*::[*/ 0x005A /*::]*/: "TR", - /*::[*/ 0x0069 /*::]*/: "JS", - /*::[*/ 0x00D5 /*::]*/: "DZ", - /*::[*/ 0x00D8 /*::]*/: "MA", - /*::[*/ 0x00DA /*::]*/: "LY", - /*::[*/ 0x015F /*::]*/: "PT", - /*::[*/ 0x0162 /*::]*/: "IS", - /*::[*/ 0x0166 /*::]*/: "FI", - /*::[*/ 0x01A4 /*::]*/: "CZ", - /*::[*/ 0x0376 /*::]*/: "TW", - /*::[*/ 0x03C1 /*::]*/: "LB", - /*::[*/ 0x03C2 /*::]*/: "JO", - /*::[*/ 0x03C3 /*::]*/: "SY", - /*::[*/ 0x03C4 /*::]*/: "IQ", - /*::[*/ 0x03C5 /*::]*/: "KW", - /*::[*/ 0x03C6 /*::]*/: "SA", - /*::[*/ 0x03CB /*::]*/: "AE", - /*::[*/ 0x03CC /*::]*/: "IL", - /*::[*/ 0x03CE /*::]*/: "QA", - /*::[*/ 0x03D5 /*::]*/: "IR", + /*::[*/ 0x0001 /*::]*/: "US", // United States + /*::[*/ 0x0002 /*::]*/: "CA", // Canada + /*::[*/ 0x0003 /*::]*/: "", // Latin America (except Brazil) + /*::[*/ 0x0007 /*::]*/: "RU", // Russia + /*::[*/ 0x0014 /*::]*/: "EG", // Egypt + /*::[*/ 0x001E /*::]*/: "GR", // Greece + /*::[*/ 0x001F /*::]*/: "NL", // Netherlands + /*::[*/ 0x0020 /*::]*/: "BE", // Belgium + /*::[*/ 0x0021 /*::]*/: "FR", // France + /*::[*/ 0x0022 /*::]*/: "ES", // Spain + /*::[*/ 0x0024 /*::]*/: "HU", // Hungary + /*::[*/ 0x0027 /*::]*/: "IT", // Italy + /*::[*/ 0x0029 /*::]*/: "CH", // Switzerland + /*::[*/ 0x002B /*::]*/: "AT", // Austria + /*::[*/ 0x002C /*::]*/: "GB", // United Kingdom + /*::[*/ 0x002D /*::]*/: "DK", // Denmark + /*::[*/ 0x002E /*::]*/: "SE", // Sweden + /*::[*/ 0x002F /*::]*/: "NO", // Norway + /*::[*/ 0x0030 /*::]*/: "PL", // Poland + /*::[*/ 0x0031 /*::]*/: "DE", // Germany + /*::[*/ 0x0034 /*::]*/: "MX", // Mexico + /*::[*/ 0x0037 /*::]*/: "BR", // Brazil + /*::[*/ 0x003d /*::]*/: "AU", // Australia + /*::[*/ 0x0040 /*::]*/: "NZ", // New Zealand + /*::[*/ 0x0042 /*::]*/: "TH", // Thailand + /*::[*/ 0x0051 /*::]*/: "JP", // Japan + /*::[*/ 0x0052 /*::]*/: "KR", // Korea + /*::[*/ 0x0054 /*::]*/: "VN", // Viet Nam + /*::[*/ 0x0056 /*::]*/: "CN", // China + /*::[*/ 0x005A /*::]*/: "TR", // Turkey + /*::[*/ 0x0069 /*::]*/: "JS", // Ramastan + /*::[*/ 0x00D5 /*::]*/: "DZ", // Algeria + /*::[*/ 0x00D8 /*::]*/: "MA", // Morocco + /*::[*/ 0x00DA /*::]*/: "LY", // Libya + /*::[*/ 0x015F /*::]*/: "PT", // Portugal + /*::[*/ 0x0162 /*::]*/: "IS", // Iceland + /*::[*/ 0x0166 /*::]*/: "FI", // Finland + /*::[*/ 0x01A4 /*::]*/: "CZ", // Czech Republic + /*::[*/ 0x0376 /*::]*/: "TW", // Taiwan + /*::[*/ 0x03C1 /*::]*/: "LB", // Lebanon + /*::[*/ 0x03C2 /*::]*/: "JO", // Jordan + /*::[*/ 0x03C3 /*::]*/: "SY", // Syria + /*::[*/ 0x03C4 /*::]*/: "IQ", // Iraq + /*::[*/ 0x03C5 /*::]*/: "KW", // Kuwait + /*::[*/ 0x03C6 /*::]*/: "SA", // Saudi Arabia + /*::[*/ 0x03CB /*::]*/: "AE", // United Arab Emirates + /*::[*/ 0x03CC /*::]*/: "IL", // Israel + /*::[*/ 0x03CE /*::]*/: "QA", // Qatar + /*::[*/ 0x03D5 /*::]*/: "IR", // Iran /*::[*/ 0xFFFF /*::]*/: "US" // United States }; /* [MS-XLS] 2.5.127 */ @@ -6132,23 +6132,23 @@ var _XLSIcv = /*#__PURE__*/ rgbify([ 0x333399, 0x333333, /* Other entries to appease BIFF8/12 */ - 0x000000, - 0xFFFFFF, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, - 0x000000, + 0x000000, /* 0x40 icvForeground ?? */ + 0xFFFFFF, /* 0x41 icvBackground ?? */ + 0x000000, /* 0x42 icvFrame ?? */ + 0x000000, /* 0x43 icv3D ?? */ + 0x000000, /* 0x44 icv3DText ?? */ + 0x000000, /* 0x45 icv3DHilite ?? */ + 0x000000, /* 0x46 icv3DShadow ?? */ + 0x000000, /* 0x47 icvHilite ?? */ + 0x000000, /* 0x48 icvCtlText ?? */ + 0x000000, /* 0x49 icvCtlScrl ?? */ + 0x000000, /* 0x4A icvCtlInv ?? */ + 0x000000, /* 0x4B icvCtlBody ?? */ + 0x000000, /* 0x4C icvCtlFrame ?? */ + 0x000000, /* 0x4D icvCtlFore ?? */ + 0x000000, /* 0x4E icvCtlBack ?? */ + 0x000000, /* 0x4F icvCtlNeutral */ + 0x000000, /* 0x50 icvInfoBk ?? */ 0x000000 /* 0x51 icvInfoText ?? */ ]); var XLSIcv = /*#__PURE__*/ dup(_XLSIcv); @@ -6206,7 +6206,7 @@ var ct2type /*{[string]:string}*/ = ({ /* Worksheet */ "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets", "application/vnd.ms-excel.worksheet": "sheets", - "application/vnd.ms-excel.binIndexWs": "TODO", + "application/vnd.ms-excel.binIndexWs": "TODO", /* Binary Index */ /* Chartsheet */ "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts", "application/vnd.ms-excel.chartsheet": "charts", @@ -6214,7 +6214,7 @@ var ct2type /*{[string]:string}*/ = ({ "application/vnd.ms-excel.macrosheet+xml": "macros", "application/vnd.ms-excel.macrosheet": "macros", "application/vnd.ms-excel.intlmacrosheet": "TODO", - "application/vnd.ms-excel.binIndexMs": "TODO", + "application/vnd.ms-excel.binIndexMs": "TODO", /* Binary Index */ /* Dialogsheet */ "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs", "application/vnd.ms-excel.dialogsheet": "dialogs", @@ -6299,8 +6299,8 @@ var ct2type /*{[string]:string}*/ = ({ /* Theme Override */ "application/vnd.openxmlformats-officedocument.themeOverride+xml": "TODO", /* Timeline */ - "application/vnd.ms-excel.Timeline+xml": "TODO", - "application/vnd.ms-excel.TimelineCache+xml": "TODO", + "application/vnd.ms-excel.Timeline+xml": "TODO", /* verify */ + "application/vnd.ms-excel.TimelineCache+xml": "TODO", /* verify */ /* VBA */ "application/vnd.ms-office.vbaProject": "vba", "application/vnd.ms-office.vbaProjectSignature": "TODO", @@ -6975,8 +6975,8 @@ var XLMLDocPropsMap = { /* Paragraphs */ /* CharactersWithSpaces */ AppVersion: 'Version', - ContentStatus: 'ContentStatus', - Identifier: 'Identifier', + ContentStatus: 'ContentStatus', /* NOTE: missing from schema */ + Identifier: 'Identifier', /* NOTE: missing from schema */ Language: 'Language' /* NOTE: missing from schema */ }; var evert_XLMLDPM; @@ -7980,24 +7980,24 @@ function parse_FtCf(blob) { /* [MS-XLS] 2.5.140 - 2.5.154 and friends */ function parse_FtSkip(blob) { blob.l += 2; blob.l += blob.read_shift(2); } var FtTab = { - /*::[*/ 0x00 /*::]*/: parse_FtSkip, - /*::[*/ 0x04 /*::]*/: parse_FtSkip, - /*::[*/ 0x05 /*::]*/: parse_FtSkip, - /*::[*/ 0x06 /*::]*/: parse_FtSkip, - /*::[*/ 0x07 /*::]*/: parse_FtCf, - /*::[*/ 0x08 /*::]*/: parse_FtSkip, - /*::[*/ 0x09 /*::]*/: parse_FtSkip, - /*::[*/ 0x0A /*::]*/: parse_FtSkip, - /*::[*/ 0x0B /*::]*/: parse_FtSkip, - /*::[*/ 0x0C /*::]*/: parse_FtSkip, - /*::[*/ 0x0D /*::]*/: parse_FtNts, - /*::[*/ 0x0E /*::]*/: parse_FtSkip, - /*::[*/ 0x0F /*::]*/: parse_FtSkip, - /*::[*/ 0x10 /*::]*/: parse_FtSkip, - /*::[*/ 0x11 /*::]*/: parse_FtSkip, - /*::[*/ 0x12 /*::]*/: parse_FtSkip, - /*::[*/ 0x13 /*::]*/: parse_FtSkip, - /*::[*/ 0x14 /*::]*/: parse_FtSkip, + /*::[*/ 0x00 /*::]*/: parse_FtSkip, /* FtEnd */ + /*::[*/ 0x04 /*::]*/: parse_FtSkip, /* FtMacro */ + /*::[*/ 0x05 /*::]*/: parse_FtSkip, /* FtButton */ + /*::[*/ 0x06 /*::]*/: parse_FtSkip, /* FtGmo */ + /*::[*/ 0x07 /*::]*/: parse_FtCf, /* FtCf */ + /*::[*/ 0x08 /*::]*/: parse_FtSkip, /* FtPioGrbit */ + /*::[*/ 0x09 /*::]*/: parse_FtSkip, /* FtPictFmla */ + /*::[*/ 0x0A /*::]*/: parse_FtSkip, /* FtCbls */ + /*::[*/ 0x0B /*::]*/: parse_FtSkip, /* FtRbo */ + /*::[*/ 0x0C /*::]*/: parse_FtSkip, /* FtSbs */ + /*::[*/ 0x0D /*::]*/: parse_FtNts, /* FtNts */ + /*::[*/ 0x0E /*::]*/: parse_FtSkip, /* FtSbsFmla */ + /*::[*/ 0x0F /*::]*/: parse_FtSkip, /* FtGboData */ + /*::[*/ 0x10 /*::]*/: parse_FtSkip, /* FtEdoData */ + /*::[*/ 0x11 /*::]*/: parse_FtSkip, /* FtRboData */ + /*::[*/ 0x12 /*::]*/: parse_FtSkip, /* FtCblsData */ + /*::[*/ 0x13 /*::]*/: parse_FtSkip, /* FtLbsData */ + /*::[*/ 0x14 /*::]*/: parse_FtSkip, /* FtCblsFmla */ /*::[*/ 0x15 /*::]*/: parse_FtCmo }; function parse_FtArray(blob, length /*::, ot*/) { @@ -10623,9 +10623,9 @@ var WK_ = /*#__PURE__*/ (function () { "dd-mmm-yyyy", "dd-mmm", "mmm-yyyy", - "@", + "@", // "text"? "mm/dd", - "hh:mm:ss AM/PM", + "hh:mm:ss AM/PM", // 7 "hh:mm AM/PM", "mm/dd/yyyy", "mm/dd", @@ -11188,9 +11188,9 @@ var WK_ = /*#__PURE__*/ (function () { // 0x70 V }; var BinOpTab = [ - "", "", "", "", "", "", "", "", - "", "+", "-", "*", "/", "^", "=", "<>", - "<=", ">=", "<", ">", "", "", "", "", + "", "", "", "", "", "", "", "", // eslint-disable-line no-mixed-spaces-and-tabs + "", "+", "-", "*", "/", "^", "=", "<>", // eslint-disable-line no-mixed-spaces-and-tabs + "<=", ">=", "<", ">", "", "", "", "", // eslint-disable-line no-mixed-spaces-and-tabs "&", "", "", "", "", "", "", "" // eslint-disable-line no-mixed-spaces-and-tabs ]; function wk1_fmla_to_csf(blob, o) { @@ -11692,7 +11692,7 @@ var WK_ = /*#__PURE__*/ (function () { /*::[*/ 0x05 /*::*/: "dd-mmm-yy", /*::[*/ 0x06 /*::*/: "dd-mmm", /*::[*/ 0x07 /*::*/: "mmm-yy", - /*::[*/ 0x08 /*::*/: "mm/dd/yy", + /*::[*/ 0x08 /*::*/: "mm/dd/yy", // Long Date Intl /*::[*/ 0x0A /*::*/: "hh:mm:ss AM/PM", /*::[*/ 0x0B /*::*/: "hh:mm AM/PM", /*::[*/ 0x0E /*::*/: "dd-mmm-yyyy", @@ -19368,20 +19368,20 @@ function write_BrtSheetProtection(sp, o) { o.write_shift(2, sp.password ? crypto_CreatePasswordVerifier_Method1(sp.password) : 0); o.write_shift(4, 1); // this record should not be written if no protection [ - ["objects", false], - ["scenarios", false], - ["formatCells", true], - ["formatColumns", true], - ["formatRows", true], - ["insertColumns", true], - ["insertRows", true], - ["insertHyperlinks", true], - ["deleteColumns", true], - ["deleteRows", true], - ["selectLockedCells", false], - ["sort", true], - ["autoFilter", true], - ["pivotTables", true], + ["objects", false], // fObjects + ["scenarios", false], // fScenarios + ["formatCells", true], // fFormatCells + ["formatColumns", true], // fFormatColumns + ["formatRows", true], // fFormatRows + ["insertColumns", true], // fInsertColumns + ["insertRows", true], // fInsertRows + ["insertHyperlinks", true], // fInsertHyperlinks + ["deleteColumns", true], // fDeleteColumns + ["deleteRows", true], // fDeleteRows + ["selectLockedCells", false], // fSelLockedCells + ["sort", true], // fSort + ["autoFilter", true], // fAutoFilter + ["pivotTables", true], // fPivotTables ["selectUnlockedCells", false] // fSelUnlockedCells ].forEach(function (n) { /*:: if(o == null) throw "unreachable"; */ @@ -22877,16 +22877,16 @@ function parse_workbook(blob, options /*:ParseOpts*/) { } }; var opts = ({ - enc: false, - sbcch: 0, - snames: [], - sharedf: sharedf, - arrayf: arrayf, - rrtabid: [], - lastuser: "", - biff: 8, - codepage: 0, - winlocked: 0, + enc: false, // encrypted + sbcch: 0, // cch in the preceding SupBook + snames: [], // sheetnames + sharedf: sharedf, // shared formulae by address + arrayf: arrayf, // array formulae array + rrtabid: [], // RRTabId + lastuser: "", // Last User from WriteAccess + biff: 8, // BIFF version + codepage: 0, // CP from CodePage record + winlocked: 0, // fLockWn from WinProtect cellStyles: !!options && !!options.cellStyles, WTF: !!options && !!options.wtf } /*:any*/); @@ -24593,12 +24593,12 @@ var XLSRecordEnum = { /* [MS-XLS] 2.3 Record Enumeration 2021-08-17 */ /*::[*/ 0x0006 /*::]*/: { /* n:"Formula", */ f: parse_Formula }, /*::[*/ 0x000a /*::]*/: { /* n:"EOF", */ f: parsenoop2 }, - /*::[*/ 0x000c /*::]*/: { /* n:"CalcCount", */ f: parseuint16 }, - /*::[*/ 0x000d /*::]*/: { /* n:"CalcMode", */ f: parseuint16 }, - /*::[*/ 0x000e /*::]*/: { /* n:"CalcPrecision", */ f: parsebool }, - /*::[*/ 0x000f /*::]*/: { /* n:"CalcRefMode", */ f: parsebool }, - /*::[*/ 0x0010 /*::]*/: { /* n:"CalcDelta", */ f: parse_Xnum }, - /*::[*/ 0x0011 /*::]*/: { /* n:"CalcIter", */ f: parsebool }, + /*::[*/ 0x000c /*::]*/: { /* n:"CalcCount", */ f: parseuint16 }, // + /*::[*/ 0x000d /*::]*/: { /* n:"CalcMode", */ f: parseuint16 }, // + /*::[*/ 0x000e /*::]*/: { /* n:"CalcPrecision", */ f: parsebool }, // + /*::[*/ 0x000f /*::]*/: { /* n:"CalcRefMode", */ f: parsebool }, // + /*::[*/ 0x0010 /*::]*/: { /* n:"CalcDelta", */ f: parse_Xnum }, // + /*::[*/ 0x0011 /*::]*/: { /* n:"CalcIter", */ f: parsebool }, // /*::[*/ 0x0012 /*::]*/: { /* n:"Protect", */ f: parsebool }, /*::[*/ 0x0013 /*::]*/: { /* n:"Password", */ f: parseuint16 }, /*::[*/ 0x0014 /*::]*/: { /* n:"Header", */ f: parse_XLHeaderFooter }, @@ -24612,10 +24612,10 @@ var XLSRecordEnum = { /*::[*/ 0x001d /*::]*/: { /* n:"Selection", */}, /*::[*/ 0x0022 /*::]*/: { /* n:"Date1904", */ f: parsebool }, /*::[*/ 0x0023 /*::]*/: { /* n:"ExternName", */ f: parse_ExternName }, - /*::[*/ 0x0026 /*::]*/: { /* n:"LeftMargin", */ f: parse_Xnum }, - /*::[*/ 0x0027 /*::]*/: { /* n:"RightMargin", */ f: parse_Xnum }, - /*::[*/ 0x0028 /*::]*/: { /* n:"TopMargin", */ f: parse_Xnum }, - /*::[*/ 0x0029 /*::]*/: { /* n:"BottomMargin", */ f: parse_Xnum }, + /*::[*/ 0x0026 /*::]*/: { /* n:"LeftMargin", */ f: parse_Xnum }, // * + /*::[*/ 0x0027 /*::]*/: { /* n:"RightMargin", */ f: parse_Xnum }, // * + /*::[*/ 0x0028 /*::]*/: { /* n:"TopMargin", */ f: parse_Xnum }, // * + /*::[*/ 0x0029 /*::]*/: { /* n:"BottomMargin", */ f: parse_Xnum }, // * /*::[*/ 0x002a /*::]*/: { /* n:"PrintRowCol", */ f: parsebool }, /*::[*/ 0x002b /*::]*/: { /* n:"PrintGrid", */ f: parsebool }, /*::[*/ 0x002f /*::]*/: { /* n:"FilePass", */ f: parse_FilePass }, @@ -24637,7 +24637,7 @@ var XLSRecordEnum = { /*::[*/ 0x005c /*::]*/: { /* n:"WriteAccess", */ f: parse_WriteAccess }, /*::[*/ 0x005d /*::]*/: { /* n:"Obj", */ f: parse_Obj }, /*::[*/ 0x005e /*::]*/: { /* n:"Uncalced", */}, - /*::[*/ 0x005f /*::]*/: { /* n:"CalcSaveRecalc", */ f: parsebool }, + /*::[*/ 0x005f /*::]*/: { /* n:"CalcSaveRecalc", */ f: parsebool }, // /*::[*/ 0x0060 /*::]*/: { /* n:"Template", */}, /*::[*/ 0x0061 /*::]*/: { /* n:"Intl", */}, /*::[*/ 0x0063 /*::]*/: { /* n:"ObjProtect", */ f: parsebool }, @@ -24765,7 +24765,7 @@ var XLSRecordEnum = { /*::[*/ 0x01b2 /*::]*/: { /* n:"DVal", */}, /*::[*/ 0x01b5 /*::]*/: { /* n:"DConBin", */}, /*::[*/ 0x01b6 /*::]*/: { /* n:"TxO", */ f: parse_TxO }, - /*::[*/ 0x01b7 /*::]*/: { /* n:"RefreshAll", */ f: parsebool }, + /*::[*/ 0x01b7 /*::]*/: { /* n:"RefreshAll", */ f: parsebool }, // /*::[*/ 0x01b8 /*::]*/: { /* n:"HLink", */ f: parse_HLink }, /*::[*/ 0x01b9 /*::]*/: { /* n:"Lel", */}, /*::[*/ 0x01ba /*::]*/: { /* n:"CodeName", */ f: parse_XLUnicodeString }, @@ -24956,7 +24956,7 @@ var XLSRecordEnum = { /*::[*/ 0x000b /*::]*/: { /* n:"Index", */}, /*::[*/ 0x0016 /*::]*/: { /* n:"ExternCount", */ f: parseuint16 }, /*::[*/ 0x001e /*::]*/: { /* n:"BIFF2FORMAT", */ f: parse_BIFF2Format }, - /*::[*/ 0x001f /*::]*/: { /* n:"BIFF2FMTCNT", */}, + /*::[*/ 0x001f /*::]*/: { /* n:"BIFF2FMTCNT", */}, /* 16-bit cnt of BIFF2FORMAT records */ /*::[*/ 0x0020 /*::]*/: { /* n:"BIFF2COLINFO", */}, /*::[*/ 0x0021 /*::]*/: { /* n:"Array", */ f: parse_Array }, /*::[*/ 0x0024 /*::]*/: { /* n:"COLWIDTH", */}, @@ -24990,8 +24990,8 @@ var XLSRecordEnum = { /*::[*/ 0x0043 /*::]*/: { /* n:"BIFF2XF", */ f: parse_BIFF2XF }, /*::[*/ 0x0044 /*::]*/: { /* n:"BIFF2XFINDEX", */ f: parseuint16 }, /*::[*/ 0x0045 /*::]*/: { /* n:"BIFF2FONTCLR", */}, - /*::[*/ 0x0056 /*::]*/: { /* n:"BIFF4FMTCNT", */}, - /*::[*/ 0x007e /*::]*/: { /* n:"RK", */}, + /*::[*/ 0x0056 /*::]*/: { /* n:"BIFF4FMTCNT", */}, /* 16-bit cnt, similar to BIFF2 */ + /*::[*/ 0x007e /*::]*/: { /* n:"RK", */}, /* Not necessarily same as 0x027e */ /*::[*/ 0x007f /*::]*/: { /* n:"ImData", */ f: parse_ImData }, /*::[*/ 0x0087 /*::]*/: { /* n:"Addin", */}, /*::[*/ 0x0088 /*::]*/: { /* n:"Edg", */}, @@ -25010,7 +25010,7 @@ var XLSRecordEnum = { // 0xA8 /*::[*/ 0x00a9 /*::]*/: { /* n:"CoordList", */}, /*::[*/ 0x00ab /*::]*/: { /* n:"GCW", */}, - /*::[*/ 0x00bc /*::]*/: { /* n:"ShrFmla", */}, + /*::[*/ 0x00bc /*::]*/: { /* n:"ShrFmla", */}, /* Not necessarily same as 0x04bc */ /*::[*/ 0x00bf /*::]*/: { /* n:"ToolbarHdr", */}, /*::[*/ 0x00c0 /*::]*/: { /* n:"ToolbarEnd", */}, /*::[*/ 0x00c2 /*::]*/: { /* n:"AddMenu", */}, @@ -25046,14 +25046,14 @@ var XLSRecordEnum = { /*::[*/ 0x08cb /*::]*/: { /* n:"CrtCoopt", */}, /*::[*/ 0x08d6 /*::]*/: { /* n:"FRTArchId$", */ r: 12 }, /* --- multiplan 4 records --- */ - /*::[*/ 0x0065 /*::]*/: { /* n:"", */}, - /*::[*/ 0x0066 /*::]*/: { /* n:"", */}, - /*::[*/ 0x0069 /*::]*/: { /* n:"", */}, - /*::[*/ 0x006a /*::]*/: { /* n:"", */}, - /*::[*/ 0x006b /*::]*/: { /* n:"", */}, - /*::[*/ 0x006d /*::]*/: { /* n:"", */}, - /*::[*/ 0x0070 /*::]*/: { /* n:"", */}, - /*::[*/ 0x0072 /*::]*/: { /* n:"", */}, + /*::[*/ 0x0065 /*::]*/: { /* n:"", */}, // one per window + /*::[*/ 0x0066 /*::]*/: { /* n:"", */}, // calc settings + /*::[*/ 0x0069 /*::]*/: { /* n:"", */}, // print header + /*::[*/ 0x006a /*::]*/: { /* n:"", */}, // print footer + /*::[*/ 0x006b /*::]*/: { /* n:"", */}, // print settings + /*::[*/ 0x006d /*::]*/: { /* n:"", */}, // one per window + /*::[*/ 0x0070 /*::]*/: { /* n:"", */}, // includes default col width + /*::[*/ 0x0072 /*::]*/: { /* n:"", */}, // includes selected cell /*::[*/ 0x7262 /*::]*/: {} }; function write_biff_rec(ba /*:BufArray*/, type /*:number*/, payload, length /*:?number*/) { @@ -30079,29 +30079,29 @@ function fix_opts_func(defaults /*:Array >*/) { } function fix_read_opts(opts) { fix_opts_func([ - ['cellNF', false], - ['cellHTML', true], - ['cellFormula', true], - ['cellStyles', false], - ['cellText', true], - ['cellDates', false], - ['sheetStubs', false], - ['sheetRows', 0, 'n'], - ['bookDeps', false], - ['bookSheets', false], - ['bookProps', false], - ['bookFiles', false], - ['bookVBA', false], - ['password', ''], + ['cellNF', false], /* emit cell number format string as .z */ + ['cellHTML', true], /* emit html string as .h */ + ['cellFormula', true], /* emit formulae as .f */ + ['cellStyles', false], /* emits style/theme as .s */ + ['cellText', true], /* emit formatted text as .w */ + ['cellDates', false], /* emit date cells with type `d` */ + ['sheetStubs', false], /* emit empty cells */ + ['sheetRows', 0, 'n'], /* read n rows (0 = read all rows) */ + ['bookDeps', false], /* parse calculation chains */ + ['bookSheets', false], /* only try to get sheet names (no Sheets) */ + ['bookProps', false], /* only try to get properties (no Sheets) */ + ['bookFiles', false], /* include raw file structure (keys, files, cfb) */ + ['bookVBA', false], /* include vba raw data (vbaraw) */ + ['password', ''], /* password */ ['WTF', false] /* WTF mode (throws errors) */ ])(opts); } function fix_write_opts(opts) { fix_opts_func([ - ['cellDates', false], - ['bookSST', false], - ['bookType', 'xlsx'], - ['compression', false], + ['cellDates', false], /* write date cells with type `d` */ + ['bookSST', false], /* Generate Shared String Table */ + ['bookType', 'xlsx'], /* Type of workbook (xlsx/m/b) */ + ['compression', false], /* Use file compression */ ['WTF', false] /* WTF mode (throws errors) */ ])(opts); } diff --git a/PWA/public/Models/Distribution.js b/PWA/public/Models/Distribution.js index a4cd680..57a9055 100644 --- a/PWA/public/Models/Distribution.js +++ b/PWA/public/Models/Distribution.js @@ -1,4 +1,4 @@ -class Distribution { +export class Distribution { constructor(distrib_items, distrib_date, distrib_place, distrib_name) { this.distrib_date = distrib_date; this.distrib_items = distrib_items; @@ -16,4 +16,3 @@ Distribution.colums = [ "Items Distributed", "Donor", ]; -export { Distribution }; diff --git a/PWA/public/RouteEvents.js b/PWA/public/RouteEvents.js index 51f6a0f..ae86606 100644 --- a/PWA/public/RouteEvents.js +++ b/PWA/public/RouteEvents.js @@ -1,4 +1,4 @@ -class RouteEvents { +export class RouteEvents { } RouteEvents.home = "/index.html"; RouteEvents.distributionsHome = "/distrib.html"; @@ -27,4 +27,3 @@ RouteEvents.checkBenificiaryCodeInputMethod = "/entry"; RouteEvents.checkWhosMissing = "/missing"; RouteEvents.received = "/received"; RouteEvents.continueDistribution = "/continueDistribution"; -export { RouteEvents }; From 1ae5dde628279d69e448a7af060633d6668c7d60 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:02:30 +0200 Subject: [PATCH 25/99] Make sure manual entries work --- .../FetchEventHandlers/BeneficiaryCodePostHandler.js | 1 + PWA/public/input.html | 2 +- .../FetchEventHandlers/BeneficiaryCodePostHandler.ts | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js index b53b388..09c412c 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js @@ -65,6 +65,7 @@ export class BeneficiaryCodePostHandler extends ActiveSessionContainer { } } else { + console.error("Failed to retrieve code from URL"); return ResponseTools.wrapInHtmlTemplate(RouteEvents.codeInputNotFound); } } diff --git a/PWA/public/input.html b/PWA/public/input.html index f92f5d6..0570e74 100644 --- a/PWA/public/input.html +++ b/PWA/public/input.html @@ -1,5 +1,5 @@
-
+
diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts index 0ea56b7..eb1dcf6 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts @@ -70,10 +70,11 @@ export class BeneficiaryCodePostHandler extends ActiveSessionContainer implement eligibility_info_values: beneficiary.values, } ) + } else { + return ResponseTools.wrapInHtmlTemplate(RouteEvents.codeInputNotFound) + } } else { - return ResponseTools.wrapInHtmlTemplate(RouteEvents.codeInputNotFound) - } - } else { + console.error("Failed to retrieve code from URL") return ResponseTools.wrapInHtmlTemplate(RouteEvents.codeInputNotFound) } } From 87f633af8e7cb25b25997ff996e28879bdbec627 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:02:13 +0200 Subject: [PATCH 26/99] Make sure data can be downloaded as excel sheet. --- PWA/README.MD | 9 ----- PWA/public/Models/DistributionBeneficiary.js | 3 +- PWA/public/RouteEvents.js | 1 + .../BeneficiaryDeserializationService.js | 4 +- .../Services/BeneficiaryStatusService.js | 37 ++++++++++++++++++ PWA/public/Services/CacheFilePathService.js | 8 +++- PWA/public/Services/Database.js | 16 +++++++- .../FetchEventHandlers/DownloadDataHandler.js | 23 +++++++++++ .../FetchEventHandlers/FetchEventHandlers.js | 4 +- PWA/public/Services/SpreadSheetFileParser.js | 18 ++++++--- PWA/public/Services/SpreadSheetService.js | 31 +++++++++++++++ PWA/src/Models/DistributionBeneficiary.ts | 9 ++++- PWA/src/RouteEvents.ts | 1 + .../BeneficiaryDeserializationService.ts | 4 +- PWA/src/Services/BeneficiaryStatusService.ts | 38 ++++++++++++++++++ PWA/src/Services/CacheFilePathService.ts | 8 +++- PWA/src/Services/Database.ts | 16 +++++++- .../FetchEventHandlers/DownloadDataHandler.ts | 26 +++++++++++++ .../FetchEventHandlers/FetchEventHandlers.ts | 4 +- PWA/src/Services/SpreadSheetFileParser.ts | 21 ---------- PWA/src/Services/SpreadSheetService.ts | 39 +++++++++++++++++++ 21 files changed, 268 insertions(+), 52 deletions(-) delete mode 100644 PWA/README.MD create mode 100644 PWA/public/Services/BeneficiaryStatusService.js create mode 100644 PWA/public/Services/FetchEventHandlers/DownloadDataHandler.js create mode 100644 PWA/public/Services/SpreadSheetService.js create mode 100644 PWA/src/Services/BeneficiaryStatusService.ts create mode 100644 PWA/src/Services/FetchEventHandlers/DownloadDataHandler.ts delete mode 100644 PWA/src/Services/SpreadSheetFileParser.ts create mode 100644 PWA/src/Services/SpreadSheetService.ts diff --git a/PWA/README.MD b/PWA/README.MD deleted file mode 100644 index e0c60b4..0000000 --- a/PWA/README.MD +++ /dev/null @@ -1,9 +0,0 @@ -# Progressive Web Apps - Complete Guide -This source code is part of Maximilian Schwarzmüller's "Progressive Web Apps - Complete Guide" course on udemy.com. - -# How to Use -You need [Node.js](https://nodejs.org) installed on your machine. Simply download the installer from [nodejs.org](https://nodejs.org) and go through the installation steps. - -Once Node.js is installed, open your command prompt or terminal and **navigate into this project folder**. There, run `npm install` to install all required dependencies. - -Finally, run `npm start` to start the development server and visit [localhost:8080](http://localhost:8080) to see the running application. diff --git a/PWA/public/Models/DistributionBeneficiary.js b/PWA/public/Models/DistributionBeneficiary.js index 560549b..fc4c785 100644 --- a/PWA/public/Models/DistributionBeneficiary.js +++ b/PWA/public/Models/DistributionBeneficiary.js @@ -1,7 +1,8 @@ export class DistributionBeneficiary { - constructor(beneficiaryCode, distributionName, hasBeenMarkedAsReceived = false) { + constructor(beneficiaryCode, distributionName, hasBeenMarkedAsReceived = false, dateReceived = undefined) { this.beneficiaryCode = beneficiaryCode; this.distributionName = distributionName; this.hasBeenMarkedAsReceived = hasBeenMarkedAsReceived; + this.dateReceived = dateReceived; } } diff --git a/PWA/public/RouteEvents.js b/PWA/public/RouteEvents.js index ae86606..b2e6ec6 100644 --- a/PWA/public/RouteEvents.js +++ b/PWA/public/RouteEvents.js @@ -27,3 +27,4 @@ RouteEvents.checkBenificiaryCodeInputMethod = "/entry"; RouteEvents.checkWhosMissing = "/missing"; RouteEvents.received = "/received"; RouteEvents.continueDistribution = "/continueDistribution"; +RouteEvents.downloadData = "/download_data"; diff --git a/PWA/public/Services/BeneficiaryDeserializationService.js b/PWA/public/Services/BeneficiaryDeserializationService.js index f06742c..d4f1cea 100644 --- a/PWA/public/Services/BeneficiaryDeserializationService.js +++ b/PWA/public/Services/BeneficiaryDeserializationService.js @@ -1,12 +1,12 @@ import { Beneficiary } from "../Models/Beneficiary.js"; import { FormParser } from "./FormParser.js"; -import { SpreadSheetFileParser } from "./SpreadSheetFileParser.js"; +import { SpreadSheetService } from "./SpreadSheetService.js"; export class BeneficiaryDeserializationService { async deserializeFormDataFromRequest(request) { return new Promise(async (resolve, reject) => { const possibleFile = FormParser.firstFileFromFormData(await request.formData()); if (possibleFile instanceof File) { - const json = await SpreadSheetFileParser.jsonFromSpreadSheetFile(possibleFile); + const json = await SpreadSheetService.jsonFromSpreadSheetFile(possibleFile); try { return resolve(this.deserializeJson(json)); } diff --git a/PWA/public/Services/BeneficiaryStatusService.js b/PWA/public/Services/BeneficiaryStatusService.js new file mode 100644 index 0000000..e830bc0 --- /dev/null +++ b/PWA/public/Services/BeneficiaryStatusService.js @@ -0,0 +1,37 @@ +import { ActiveSessionContainer } from "./ActiveSession.js"; +export class BeneficiaryStatusService extends ActiveSessionContainer { + async generateBeneficiariyStatusses() { + var _a; + if (this.activeSession.nameOfLastViewedDistribution) { + var beneficiariesWithStatus = []; + const currentDistribution = await this.activeSession.database.distributionWithName(this.activeSession.nameOfLastViewedDistribution); + if (currentDistribution) { + const distributionBeneficiaries = await this.activeSession.database.benificiariesForDistribution(currentDistribution); + for (let i = 0; i < distributionBeneficiaries.length; i++) { + const currentDistributionBeneficiary = distributionBeneficiaries[i]; + const currentBeneficiary = await this.activeSession.database.beneficiaryWithCode(currentDistributionBeneficiary.beneficiaryCode); + if (currentBeneficiary) { + let currentBeneficaryWithStatus = {}; + currentBeneficaryWithStatus["code"] = currentBeneficiary.code; + for (let j = 1; j < currentBeneficiary.columns.length; j++) { + currentBeneficaryWithStatus[currentBeneficiary.columns[j]] = currentBeneficiary.values[j]; + } + currentBeneficaryWithStatus["Recepient"] = currentDistributionBeneficiary.hasBeenMarkedAsReceived ? "Yes" : "No"; + currentBeneficaryWithStatus["Received_when"] = (_a = currentDistributionBeneficiary.dateReceived) !== null && _a !== void 0 ? _a : "None"; + beneficiariesWithStatus.push(currentBeneficaryWithStatus); + } + else { + throw new Error('Expected beneficiary for code ' + currentDistributionBeneficiary.beneficiaryCode); + } + } + return beneficiariesWithStatus; + } + else { + throw new Error('Expected distribution'); + } + } + else { + throw new Error('Expected active distribution'); + } + } +} diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index d4c35c8..3f4dc59 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -28,6 +28,8 @@ import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPo import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; import { DateService } from "./DateService.js"; import { ContinueDistributionHandler } from "./FetchEventHandlers/ContinueDistributionHandler.js"; +import { DownloadDataHandler } from "./FetchEventHandlers/DownloadDataHandler.js"; +import { BeneficiaryStatusService } from "./BeneficiaryStatusService.js"; // Provides all the files that have to be cached for offline use export class CacheFilePathService { pathsOfFilesToCache() { @@ -108,7 +110,8 @@ export class CacheFilePathService { BeneficiaryEligilityService.name, ActiveSession.name, BeneficiariesService.name, - DateService.name + DateService.name, + BeneficiaryStatusService.name ]); } fetchEventHanderPaths() { @@ -128,7 +131,8 @@ export class CacheFilePathService { CheckWhosMissingPageHandler.name, MarkAsReceivedPostHandler.name, HomepageHandler.name, - ContinueDistributionHandler.name + ContinueDistributionHandler.name, + DownloadDataHandler.name ]); } interfacesPaths() { diff --git a/PWA/public/Services/Database.js b/PWA/public/Services/Database.js index 260dbba..96a7b74 100644 --- a/PWA/public/Services/Database.js +++ b/PWA/public/Services/Database.js @@ -32,7 +32,8 @@ function columnsForObjectStore(objectStore) { return [ { name: "distributionName", isUnique: false }, { name: "beneficiaryCode", isUnique: false }, - { name: "hasBeenMarkedAsReceived", isUnique: false } + { name: "hasBeenMarkedAsReceived", isUnique: false }, + { name: "dateReceived", isUnique: false } ]; case ObjectStoreName.activeDistribution: return [ @@ -107,6 +108,17 @@ export class Database { console.log(distributionBeneficiaries); return distributionBeneficiaries.filter((distributionBeneficiary) => distributionBeneficiary.distributionName == distribution.distrib_name); } + async distributionBeneficiary(distribution, beneficiary) { + let distributionBeneficiaries = await this.benificiariesForDistribution(distribution); + let filteredDistributionBeneficiaries = distributionBeneficiaries + .filter((distributionBeneficiary) => distributionBeneficiary.beneficiaryCode == beneficiary.code); + if (filteredDistributionBeneficiaries.length > 0) { + return filteredDistributionBeneficiaries[0]; + } + else { + return undefined; + } + } async addBenificiary(beneficiary) { return this.addElement(ObjectStoreName.beneficiary, beneficiary); } @@ -142,7 +154,7 @@ export class Database { async markBeneficiaryAsReceived(beneficiaryCode, distributionName) { const key = await this.keyForDistributionBeneficiary(beneficiaryCode, distributionName); await this.removeElement(ObjectStoreName.distributionBeneficiaries, key); - await this.addElement(ObjectStoreName.distributionBeneficiaries, new DistributionBeneficiary(beneficiaryCode, distributionName, true)); + await this.addElement(ObjectStoreName.distributionBeneficiaries, new DistributionBeneficiary(beneficiaryCode, distributionName, true, (new Date()).toUTCString())); } async keyForDistributionBeneficiary(beneficiaryCode, distributionName) { const distributionBeneficiaries = await this.readDistributionBeneficiaries(); diff --git a/PWA/public/Services/FetchEventHandlers/DownloadDataHandler.js b/PWA/public/Services/FetchEventHandlers/DownloadDataHandler.js new file mode 100644 index 0000000..2a5a368 --- /dev/null +++ b/PWA/public/Services/FetchEventHandlers/DownloadDataHandler.js @@ -0,0 +1,23 @@ +import { RouteEvents } from "../../RouteEvents.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; +import { SpreadSheetService } from "../SpreadSheetService.js"; +import { BeneficiaryStatusService } from "../BeneficiaryStatusService.js"; +export class DownloadDataHandler extends ActiveSessionContainer { + canHandleEvent(event) { + return event.request.url.includes(RouteEvents.downloadData); + } + async handleEvent(event) { + try { + const beneficiaryStatusService = new BeneficiaryStatusService(this.activeSession); + return new Response(await SpreadSheetService.fileFromJson(await beneficiaryStatusService.generateBeneficiariyStatusses()), { + headers: { + 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'Content-Disposition': 'attachment; filename="data_processed.xlsx"' + } + }); + } + catch (error) { + return Promise.reject(error); + } + } +} diff --git a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js index 28c62aa..1ec3fea 100644 --- a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js +++ b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js @@ -15,6 +15,7 @@ import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPagehandler.js"; import { MarkAsReceivedPostHandler } from "./MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./HomepageHandler.js"; import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; +import { DownloadDataHandler } from "./DownloadDataHandler.js"; export class FetchEventHandlers extends ActiveSessionContainer { constructor() { super(...arguments); @@ -34,7 +35,8 @@ export class FetchEventHandlers extends ActiveSessionContainer { new CheckWhosMissingPageHandler(this.activeSession), new MarkAsReceivedPostHandler(this.activeSession), new HomepageHandler(), - new ContinueDistributionHandler() + new ContinueDistributionHandler(), + new DownloadDataHandler(this.activeSession) ]; } handlersForEvent(event) { diff --git a/PWA/public/Services/SpreadSheetFileParser.js b/PWA/public/Services/SpreadSheetFileParser.js index 6a5fafa..3f26ce8 100644 --- a/PWA/public/Services/SpreadSheetFileParser.js +++ b/PWA/public/Services/SpreadSheetFileParser.js @@ -1,5 +1,15 @@ -import { read, utils } from "../ExternalLibraries/xlsx.full.min.js"; -export class SpreadSheetFileParser { +import { read, utils, write } from "../ExternalLibraries/xlsx.full.min.js"; +export class SpreadSheetService { + static async jsonFromSpreadSheetFile(spreadSheetFile) { + const spreadSheet = await this.firstSheetFromSpreadSheetFile(spreadSheetFile); + return utils.sheet_to_json(spreadSheet); + } + static async fileFromJson(json) { + const ws = utils.json_to_sheet(json); + const wb = utils.book_new(); + utils.book_append_sheet(wb, ws, 'Sheet1'); + return write(wb, { bookType: 'xlsx', type: 'blob' }); + } static async firstSheetFromSpreadSheetFile(spreadSheetFile) { const workBook = read(await spreadSheetFile.arrayBuffer(), { type: "array", @@ -8,8 +18,4 @@ export class SpreadSheetFileParser { const firstSheet = workBook.Sheets[spreadSheetNames[0]]; return firstSheet; } - static async jsonFromSpreadSheetFile(spreadSheetFile) { - const spreadSheet = await this.firstSheetFromSpreadSheetFile(spreadSheetFile); - return utils.sheet_to_json(spreadSheet); - } } diff --git a/PWA/public/Services/SpreadSheetService.js b/PWA/public/Services/SpreadSheetService.js new file mode 100644 index 0000000..df02d10 --- /dev/null +++ b/PWA/public/Services/SpreadSheetService.js @@ -0,0 +1,31 @@ +import { read, utils, write } from "../ExternalLibraries/xlsx.full.min.js"; +export class SpreadSheetService { + static async jsonFromSpreadSheetFile(spreadSheetFile) { + const spreadSheet = await this.firstSheetFromSpreadSheetFile(spreadSheetFile); + return utils.sheet_to_json(spreadSheet); + } + static async fileFromJson(json) { + const ws = utils.json_to_sheet(json); + const wb = utils.book_new(); + utils.book_append_sheet(wb, ws, 'Sheet1'); + const file = write(wb, { bookType: 'xlsx', type: 'binary' }); + return new Blob([this.stringToArrayBuffer(file)], { + type: 'application/octet-stream' + }); + } + static async firstSheetFromSpreadSheetFile(spreadSheetFile) { + const workBook = read(await spreadSheetFile.arrayBuffer(), { + type: "array", + }); + const spreadSheetNames = workBook.SheetNames; + const firstSheet = workBook.Sheets[spreadSheetNames[0]]; + return firstSheet; + } + static stringToArrayBuffer(string) { + const buffer = new ArrayBuffer(string.length); + const view = new Uint8Array(buffer); + for (let i = 0; i < string.length; i++) + view[i] = string.charCodeAt(i) & 0xff; + return buffer; + } +} diff --git a/PWA/src/Models/DistributionBeneficiary.ts b/PWA/src/Models/DistributionBeneficiary.ts index 041209b..e1211b3 100644 --- a/PWA/src/Models/DistributionBeneficiary.ts +++ b/PWA/src/Models/DistributionBeneficiary.ts @@ -2,10 +2,17 @@ export class DistributionBeneficiary { beneficiaryCode: string; distributionName: string; hasBeenMarkedAsReceived: boolean; + dateReceived?: string - constructor(beneficiaryCode: string, distributionName: string, hasBeenMarkedAsReceived: boolean = false) { + constructor( + beneficiaryCode: string, + distributionName: string, + hasBeenMarkedAsReceived: boolean = false, + dateReceived: (string | undefined) = undefined + ) { this.beneficiaryCode = beneficiaryCode; this.distributionName = distributionName; this.hasBeenMarkedAsReceived = hasBeenMarkedAsReceived + this.dateReceived = dateReceived } } diff --git a/PWA/src/RouteEvents.ts b/PWA/src/RouteEvents.ts index 8266aee..e0174eb 100644 --- a/PWA/src/RouteEvents.ts +++ b/PWA/src/RouteEvents.ts @@ -27,4 +27,5 @@ export class RouteEvents { static checkWhosMissing = "/missing" static received = "/received" static continueDistribution = "/continueDistribution" + static downloadData = "/download_data" } \ No newline at end of file diff --git a/PWA/src/Services/BeneficiaryDeserializationService.ts b/PWA/src/Services/BeneficiaryDeserializationService.ts index db34fbc..70ddf1a 100644 --- a/PWA/src/Services/BeneficiaryDeserializationService.ts +++ b/PWA/src/Services/BeneficiaryDeserializationService.ts @@ -1,6 +1,6 @@ import { Beneficiary } from "../Models/Beneficiary.js"; import { FormParser } from "./FormParser.js"; -import { SpreadSheetFileParser } from "./SpreadSheetFileParser.js"; +import { SpreadSheetService } from "./SpreadSheetService.js"; export class BeneficiaryDeserializationService { async deserializeFormDataFromRequest( @@ -9,7 +9,7 @@ export class BeneficiaryDeserializationService { return new Promise(async (resolve, reject) => { const possibleFile = FormParser.firstFileFromFormData(await request.formData()); if (possibleFile instanceof File) { - const json = await SpreadSheetFileParser.jsonFromSpreadSheetFile( + const json = await SpreadSheetService.jsonFromSpreadSheetFile( possibleFile ); try { diff --git a/PWA/src/Services/BeneficiaryStatusService.ts b/PWA/src/Services/BeneficiaryStatusService.ts new file mode 100644 index 0000000..c0bcc40 --- /dev/null +++ b/PWA/src/Services/BeneficiaryStatusService.ts @@ -0,0 +1,38 @@ +import { ActiveSessionContainer } from "./ActiveSession.js" + + +export class BeneficiaryStatusService extends ActiveSessionContainer { + async generateBeneficiariyStatusses(): Promise { + if(this.activeSession.nameOfLastViewedDistribution) { + var beneficiariesWithStatus: any[] = [] + const currentDistribution = await this.activeSession.database.distributionWithName(this.activeSession.nameOfLastViewedDistribution) + if(currentDistribution) { + const distributionBeneficiaries = await this.activeSession.database.benificiariesForDistribution(currentDistribution) + for (let i = 0; i < distributionBeneficiaries.length; i++) { + const currentDistributionBeneficiary = distributionBeneficiaries[i] + const currentBeneficiary = await this.activeSession.database.beneficiaryWithCode(currentDistributionBeneficiary.beneficiaryCode) + if(currentBeneficiary) { + let currentBeneficaryWithStatus: any = {} + + currentBeneficaryWithStatus["code"] = currentBeneficiary.code + for(let j=1; j { + let distributionBeneficiaries = await this.benificiariesForDistribution(distribution) + let filteredDistributionBeneficiaries = distributionBeneficiaries + .filter((distributionBeneficiary) => distributionBeneficiary.beneficiaryCode == beneficiary.code) + if(filteredDistributionBeneficiaries.length > 0) { + return filteredDistributionBeneficiaries[0] + } else { + return undefined + } + } + async addBenificiary(beneficiary: Beneficiary): Promise { return this.addElement(ObjectStoreName.beneficiary, beneficiary); } @@ -196,7 +208,7 @@ export class Database { const key = await this.keyForDistributionBeneficiary(beneficiaryCode, distributionName) await this.removeElement(ObjectStoreName.distributionBeneficiaries, key) - await this.addElement(ObjectStoreName.distributionBeneficiaries, new DistributionBeneficiary(beneficiaryCode, distributionName, true)) + await this.addElement(ObjectStoreName.distributionBeneficiaries, new DistributionBeneficiary(beneficiaryCode, distributionName, true, (new Date()).toUTCString())) } private async keyForDistributionBeneficiary(beneficiaryCode: string, distributionName: string): Promise { diff --git a/PWA/src/Services/FetchEventHandlers/DownloadDataHandler.ts b/PWA/src/Services/FetchEventHandlers/DownloadDataHandler.ts new file mode 100644 index 0000000..39400bf --- /dev/null +++ b/PWA/src/Services/FetchEventHandlers/DownloadDataHandler.ts @@ -0,0 +1,26 @@ +import { RouteEvents } from "../../RouteEvents.js"; +import { FetchEvent } from "../../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; +import { SpreadSheetService } from "../SpreadSheetService.js"; +import { BeneficiaryStatusService } from "../BeneficiaryStatusService.js"; + +export class DownloadDataHandler extends ActiveSessionContainer implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.includes(RouteEvents.downloadData); + } + + async handleEvent(event: FetchEvent): Promise { + try { + const beneficiaryStatusService = new BeneficiaryStatusService(this.activeSession) + return new Response(await SpreadSheetService.fileFromJson(await beneficiaryStatusService.generateBeneficiariyStatusses()), { + headers: { + 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'Content-Disposition': 'attachment; filename="data_processed.xlsx"' + } + }); + } catch(error) { + return Promise.reject(error); + } + } +} \ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts index 269837e..419829a 100644 --- a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts +++ b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts @@ -17,6 +17,7 @@ import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPagehandler.js"; import { MarkAsReceivedPostHandler } from "./MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./HomepageHandler.js"; import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; +import { DownloadDataHandler } from "./DownloadDataHandler.js"; export class FetchEventHandlers extends ActiveSessionContainer implements FetchEventHandler { all: FetchEventHandler[] = [ @@ -35,7 +36,8 @@ export class FetchEventHandlers extends ActiveSessionContainer implements FetchE new CheckWhosMissingPageHandler(this.activeSession), new MarkAsReceivedPostHandler(this.activeSession), new HomepageHandler(), - new ContinueDistributionHandler() + new ContinueDistributionHandler(), + new DownloadDataHandler(this.activeSession) ]; handlersForEvent(event: FetchEvent): FetchEventHandler[] { diff --git a/PWA/src/Services/SpreadSheetFileParser.ts b/PWA/src/Services/SpreadSheetFileParser.ts deleted file mode 100644 index c9802b2..0000000 --- a/PWA/src/Services/SpreadSheetFileParser.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { read, utils } from "../ExternalLibraries/xlsx.full.min.js"; - -export class SpreadSheetFileParser { - static async firstSheetFromSpreadSheetFile( - spreadSheetFile: File - ): Promise { - const workBook = read(await spreadSheetFile.arrayBuffer(), { - type: "array", - }); - const spreadSheetNames = workBook.SheetNames; - const firstSheet = workBook.Sheets[spreadSheetNames[0]]; - return firstSheet; - } - - static async jsonFromSpreadSheetFile(spreadSheetFile: File): Promise { - const spreadSheet = await this.firstSheetFromSpreadSheetFile( - spreadSheetFile - ); - return utils.sheet_to_json(spreadSheet); - } -} diff --git a/PWA/src/Services/SpreadSheetService.ts b/PWA/src/Services/SpreadSheetService.ts new file mode 100644 index 0000000..3b9df1c --- /dev/null +++ b/PWA/src/Services/SpreadSheetService.ts @@ -0,0 +1,39 @@ +import { read, utils, write } from "../ExternalLibraries/xlsx.full.min.js"; + +export class SpreadSheetService { + static async jsonFromSpreadSheetFile(spreadSheetFile: File): Promise { + const spreadSheet = await this.firstSheetFromSpreadSheetFile( + spreadSheetFile + ); + return utils.sheet_to_json(spreadSheet); + } + + static async fileFromJson(json: any): Promise { + const ws = utils.json_to_sheet(json); + const wb = utils.book_new(); + utils.book_append_sheet(wb, ws, 'Sheet1'); + + const file = write(wb, { bookType: 'xlsx', type: 'binary' }); + return new Blob([this.stringToArrayBuffer(file)], { + type: 'application/octet-stream' + }) + } + + private static async firstSheetFromSpreadSheetFile( + spreadSheetFile: File + ): Promise { + const workBook = read(await spreadSheetFile.arrayBuffer(), { + type: "array", + }); + const spreadSheetNames = workBook.SheetNames; + const firstSheet = workBook.Sheets[spreadSheetNames[0]]; + return firstSheet; + } + + private static stringToArrayBuffer(string: string) { + const buffer = new ArrayBuffer(string.length) + const view = new Uint8Array(buffer) + for (let i = 0; i < string.length; i++) view[i] = string.charCodeAt(i) & 0xff + return buffer + } +} From 7a8f8762bf6d1c1cbeb5e408e9c011f5db115ed6 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:56:00 +0200 Subject: [PATCH 27/99] Maker sure input method is remembered --- PWA/public/Services/ActiveSession.js | 8 ++++++ .../ContinueDistributionHandler.js | 11 +++++--- .../FetchEventHandlers/FetchEventHandlers.js | 4 +-- .../MarkAsReceivedPostHandler.js | 26 +++++++++++++++--- ...SelectBenificiaryCodeInputMethodHandler.js | 6 ++++- PWA/public/sw.js | 18 ++++++++----- PWA/src/Services/ActiveSession.ts | 12 +++++++++ .../ContinueDistributionHandler.ts | 14 ++++++---- .../FetchEventHandlers/FetchEventHandlers.ts | 4 +-- .../MarkAsReceivedPostHandler.ts | 27 ++++++++++++++++--- ...SelectBenificiaryCodeInputMethodHandler.ts | 6 ++++- PWA/src/sw.ts | 19 ++++++++----- 12 files changed, 120 insertions(+), 35 deletions(-) diff --git a/PWA/public/Services/ActiveSession.js b/PWA/public/Services/ActiveSession.js index 890370d..cbf6b43 100644 --- a/PWA/public/Services/ActiveSession.js +++ b/PWA/public/Services/ActiveSession.js @@ -11,6 +11,14 @@ export class ActiveSession { console.log(value); this._nameOfLastViewedDistribution = value; } + get nameOfLastUsedDistributionInputMethod() { + return this._nameOfLastUsedDistributionInputMethod; + } + set nameOfLastUsedDistributionInputMethod(value) { + console.log("ℹ️ name of last used distribution input method is now:"); + console.log(value); + this._nameOfLastUsedDistributionInputMethod = value; + } } export class ActiveSessionContainer { constructor(activeSession) { diff --git a/PWA/public/Services/FetchEventHandlers/ContinueDistributionHandler.js b/PWA/public/Services/FetchEventHandlers/ContinueDistributionHandler.js index a1f95b0..eac8095 100644 --- a/PWA/public/Services/FetchEventHandlers/ContinueDistributionHandler.js +++ b/PWA/public/Services/FetchEventHandlers/ContinueDistributionHandler.js @@ -1,12 +1,17 @@ import { RouteEvents } from "../../RouteEvents.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; import { ResponseTools } from "../ResponseTools.js"; -export class ContinueDistributionHandler { +export class ContinueDistributionHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.includes(RouteEvents.continueDistribution); } async handleEvent(event) { - //TODO this should be context aware - return await ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod("text")); + if (this.activeSession.nameOfLastUsedDistributionInputMethod) { + return await ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod(this.activeSession.nameOfLastUsedDistributionInputMethod)); + } + else { + throw "Expected nameOfLastUsedDistributionInputMethod"; + } } templatepageForInputMethod(inputMethod) { if (inputMethod == "video") { diff --git a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js index 1ec3fea..aee2c70 100644 --- a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js +++ b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js @@ -29,13 +29,13 @@ export class FetchEventHandlers extends ActiveSessionContainer { new UploadDataHandler(), new BeneficiaryDataUploadHandler(this.activeSession), new ChooseBenificiaryCodeInputMethodPageHandler(), - new SelectBenificiaryCodeInputMethodHandler(), + new SelectBenificiaryCodeInputMethodHandler(this.activeSession), new BeneficiaryCodePostHandler(this.activeSession), new ViewDistributionDataHandler(this.activeSession), new CheckWhosMissingPageHandler(this.activeSession), new MarkAsReceivedPostHandler(this.activeSession), new HomepageHandler(), - new ContinueDistributionHandler(), + new ContinueDistributionHandler(this.activeSession), new DownloadDataHandler(this.activeSession) ]; } diff --git a/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js b/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js index 3b72c33..8790766 100644 --- a/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js @@ -23,14 +23,18 @@ export class MarkAsReceivedPostHandler extends ActiveSessionContainer { } } else { - console.error("Expected active distribution"); + return Promise.reject(new Error("Expected active distribution")); } } else { - console.error("Expected benificiarycode"); + return Promise.reject(new Error("Expected benificiarycode")); + } + if (this.activeSession.nameOfLastUsedDistributionInputMethod) { + return ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod(this.activeSession.nameOfLastUsedDistributionInputMethod)); + } + else { + return Promise.reject(new Error("Expected nameOfLastUsedDistributionInputMethod")); } - //TODO should be non camera when coming from non camera - return ResponseTools.wrapInHtmlTemplate(RouteEvents.codeInputUsingCamera); } beneficiaryCodeFromRequest(request) { var _a; @@ -39,4 +43,18 @@ export class MarkAsReceivedPostHandler extends ActiveSessionContainer { console.log(searchParams); return (_a = url.searchParams.get('code')) !== null && _a !== void 0 ? _a : undefined; } + templatepageForInputMethod(inputMethod) { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod; + if (inputMethod == "video") { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod; + return RouteEvents.codeInputUsingCamera; + } + else if (inputMethod == "text") { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod; + return RouteEvents.codeinputUsingTextField; + } + else { + throw "Unexpected input method: " + inputMethod; + } + } } diff --git a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js b/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js index 8aab629..410be3f 100644 --- a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js +++ b/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js @@ -1,7 +1,8 @@ import { RouteEvents } from "../../RouteEvents.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { ResponseTools } from "../ResponseTools.js"; -export class SelectBenificiaryCodeInputMethodHandler { +export class SelectBenificiaryCodeInputMethodHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.selectBenificiaryCodeInputMethod); } @@ -16,10 +17,13 @@ export class SelectBenificiaryCodeInputMethodHandler { } } templatepageForInputMethod(inputMethod) { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod; if (inputMethod == "video") { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod; return RouteEvents.codeInputUsingCamera; } else if (inputMethod == "text") { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod; return RouteEvents.codeinputUsingTextField; } else { diff --git a/PWA/public/sw.js b/PWA/public/sw.js index 2f7cff7..3be73a2 100644 --- a/PWA/public/sw.js +++ b/PWA/public/sw.js @@ -40,12 +40,18 @@ self.addEventListener("activate", function (event) { self.addEventListener("fetch", function (event) { let customHandlers = new FetchEventHandlers(activeSession); console.info("ℹ️ Handling fetch request " + event.request.url); - if (customHandlers.canHandleEvent(event)) { - console.log("using custom event handler"); - event.respondWith(customHandlers.handleEvent(event)); + try { + if (customHandlers.canHandleEvent(event)) { + console.log("using custom event handler"); + event.respondWith(customHandlers.handleEvent(event)); + } + else { + console.log("using custom cache"); + event.respondWith(caches.match(event.request)); + } } - else { - console.log("using custom cache"); - event.respondWith(caches.match(event.request)); + catch (error) { + console.error("Failed with error:"); + console.error(error); } }); diff --git a/PWA/src/Services/ActiveSession.ts b/PWA/src/Services/ActiveSession.ts index 7853bf4..bfb425f 100644 --- a/PWA/src/Services/ActiveSession.ts +++ b/PWA/src/Services/ActiveSession.ts @@ -2,6 +2,7 @@ import { Database } from "./Database.js" export class ActiveSession { private _nameOfLastViewedDistribution?: string + private _nameOfLastUsedDistributionInputMethod?: string database: Database constructor(database: Database) { @@ -12,11 +13,22 @@ export class ActiveSession { get nameOfLastViewedDistribution() { return this._nameOfLastViewedDistribution; } + set nameOfLastViewedDistribution(value) { console.log("ℹ️ name of last viewed distribution is now:") console.log(value) this._nameOfLastViewedDistribution = value; } + + get nameOfLastUsedDistributionInputMethod() { + return this._nameOfLastUsedDistributionInputMethod; + } + + set nameOfLastUsedDistributionInputMethod(value) { + console.log("ℹ️ name of last used distribution input method is now:") + console.log(value) + this._nameOfLastUsedDistributionInputMethod = value; + } } export class ActiveSessionContainer { diff --git a/PWA/src/Services/FetchEventHandlers/ContinueDistributionHandler.ts b/PWA/src/Services/FetchEventHandlers/ContinueDistributionHandler.ts index 6657839..1298aa3 100644 --- a/PWA/src/Services/FetchEventHandlers/ContinueDistributionHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/ContinueDistributionHandler.ts @@ -1,18 +1,22 @@ import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; -import { BeneficiaryCodeInputMethodPost } from "../../Models/BeneficiaryCodeInputMethodPost.js"; import { RouteEvents } from "../../RouteEvents.js"; -import { DeserialisationService } from "../DeserialisationService.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; import { ResponseTools } from "../ResponseTools.js"; -export class ContinueDistributionHandler implements FetchEventHandler { +export class ContinueDistributionHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { return event.request.url.includes(RouteEvents.continueDistribution) } async handleEvent(event: FetchEvent): Promise { - //TODO this should be context aware - return await ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod("text")) + if(this.activeSession.nameOfLastUsedDistributionInputMethod) { + return await ResponseTools.wrapInHtmlTemplate( + this.templatepageForInputMethod(this.activeSession.nameOfLastUsedDistributionInputMethod) + ) + } else { + throw "Expected nameOfLastUsedDistributionInputMethod" + } } private templatepageForInputMethod(inputMethod: string): string { diff --git a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts index 419829a..8d2472f 100644 --- a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts +++ b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts @@ -30,13 +30,13 @@ export class FetchEventHandlers extends ActiveSessionContainer implements FetchE new UploadDataHandler(), new BeneficiaryDataUploadHandler(this.activeSession), new ChooseBenificiaryCodeInputMethodPageHandler(), - new SelectBenificiaryCodeInputMethodHandler(), + new SelectBenificiaryCodeInputMethodHandler(this.activeSession), new BeneficiaryCodePostHandler(this.activeSession), new ViewDistributionDataHandler(this.activeSession), new CheckWhosMissingPageHandler(this.activeSession), new MarkAsReceivedPostHandler(this.activeSession), new HomepageHandler(), - new ContinueDistributionHandler(), + new ContinueDistributionHandler(this.activeSession), new DownloadDataHandler(this.activeSession) ]; diff --git a/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts b/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts index a3f12a7..0272831 100644 --- a/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts @@ -32,13 +32,19 @@ export class MarkAsReceivedPostHandler extends ActiveSessionContainer implements console.error(error) } } else { - console.error("Expected active distribution") + return Promise.reject(new Error("Expected active distribution")) } } else { - console.error("Expected benificiarycode") + return Promise.reject(new Error("Expected benificiarycode")) + } + + if(this.activeSession.nameOfLastUsedDistributionInputMethod) { + return ResponseTools.wrapInHtmlTemplate( + this.templatepageForInputMethod(this.activeSession.nameOfLastUsedDistributionInputMethod) + ) + } else { + return Promise.reject(new Error("Expected nameOfLastUsedDistributionInputMethod")) } - //TODO should be non camera when coming from non camera - return ResponseTools.wrapInHtmlTemplate(RouteEvents.codeInputUsingCamera) } private beneficiaryCodeFromRequest(request: Request): string | undefined { @@ -47,4 +53,17 @@ export class MarkAsReceivedPostHandler extends ActiveSessionContainer implements console.log(searchParams) return url.searchParams.get('code') ?? undefined } + + private templatepageForInputMethod(inputMethod: string): string { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod + if(inputMethod == "video") { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod + return RouteEvents.codeInputUsingCamera + } else if(inputMethod == "text") { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod + return RouteEvents.codeinputUsingTextField + } else { + throw "Unexpected input method: " + inputMethod + } + } } \ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts b/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts index 70717f5..5ab64f1 100644 --- a/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts @@ -2,10 +2,11 @@ import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { BeneficiaryCodeInputMethodPost } from "../../Models/BeneficiaryCodeInputMethodPost.js"; import { RouteEvents } from "../../RouteEvents.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { ResponseTools } from "../ResponseTools.js"; -export class SelectBenificiaryCodeInputMethodHandler implements FetchEventHandler { +export class SelectBenificiaryCodeInputMethodHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.selectBenificiaryCodeInputMethod); } @@ -21,9 +22,12 @@ export class SelectBenificiaryCodeInputMethodHandler implements FetchEventHandle } private templatepageForInputMethod(inputMethod: string): string { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod if(inputMethod == "video") { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod return RouteEvents.codeInputUsingCamera } else if(inputMethod == "text") { + this.activeSession.nameOfLastUsedDistributionInputMethod = inputMethod return RouteEvents.codeinputUsingTextField } else { throw "Unexpected input method: " + inputMethod diff --git a/PWA/src/sw.ts b/PWA/src/sw.ts index ab99a48..a7288c5 100644 --- a/PWA/src/sw.ts +++ b/PWA/src/sw.ts @@ -52,11 +52,16 @@ self.addEventListener("activate", function (event: any) { self.addEventListener("fetch", function (event: any) { let customHandlers = new FetchEventHandlers(activeSession); console.info("ℹ️ Handling fetch request " + event.request.url); - if (customHandlers.canHandleEvent(event)) { - console.log("using custom event handler"); - event.respondWith(customHandlers.handleEvent(event)) - } else { - console.log("using custom cache"); - event.respondWith(caches.match(event.request)); - } + try { + if (customHandlers.canHandleEvent(event)) { + console.log("using custom event handler"); + event.respondWith(customHandlers.handleEvent(event)) + } else { + console.log("using custom cache"); + event.respondWith(caches.match(event.request)); + } + } catch (error) { + console.error("Failed with error:") + console.error(error) + } }); \ No newline at end of file From 0e97f8146a8fdfa17a99b3b9e08572dfe2eacdb7 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:20:34 +0200 Subject: [PATCH 28/99] Make sure beneficiary codes are always stored as string --- PWA/public/Services/BeneficiaryDeserializationService.js | 2 +- PWA/src/Services/BeneficiaryDeserializationService.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PWA/public/Services/BeneficiaryDeserializationService.js b/PWA/public/Services/BeneficiaryDeserializationService.js index d4f1cea..7c1f391 100644 --- a/PWA/public/Services/BeneficiaryDeserializationService.js +++ b/PWA/public/Services/BeneficiaryDeserializationService.js @@ -31,7 +31,7 @@ export class BeneficiaryDeserializationService { codeFromJsonRow(jsonRow) { const code = jsonRow["code"]; if (code) { - return code; + return code.toString(); } else { throw Error("Expected beneficiary code"); diff --git a/PWA/src/Services/BeneficiaryDeserializationService.ts b/PWA/src/Services/BeneficiaryDeserializationService.ts index 70ddf1a..c14f0cc 100644 --- a/PWA/src/Services/BeneficiaryDeserializationService.ts +++ b/PWA/src/Services/BeneficiaryDeserializationService.ts @@ -41,7 +41,7 @@ export class BeneficiaryDeserializationService { private codeFromJsonRow(jsonRow: any): string { const code = jsonRow["code"] if(code) { - return code + return code.toString() } else { throw Error("Expected beneficiary code") } From 3532b016a825a982d2584f19eee675b5bd95669c Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:30:28 +0200 Subject: [PATCH 29/99] Make sure correct background color is shown when beneficiary isn't eligible. --- PWA/public/Services/BeneficiaryEligilityService.js | 7 ++++--- .../FetchEventHandlers/BeneficiaryCodePostHandler.js | 2 +- PWA/src/Services/BeneficiaryEligilityService.ts | 7 ++++--- .../FetchEventHandlers/BeneficiaryCodePostHandler.ts | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/PWA/public/Services/BeneficiaryEligilityService.js b/PWA/public/Services/BeneficiaryEligilityService.js index a535d60..a368e54 100644 --- a/PWA/public/Services/BeneficiaryEligilityService.js +++ b/PWA/public/Services/BeneficiaryEligilityService.js @@ -8,20 +8,21 @@ export class BeneficiaryEligilityService { const distribution = await this.activeSession.database.distributionWithName(nameOfActiveDistribution); if (distribution) { const distributionBeneficiaries = await this.activeSession.database.benificiariesForDistribution(distribution); - console.log("🦆 there is a distribution"); + console.log("There is a distribution"); console.log(distributionBeneficiaries); const matchedBeneficiaries = distributionBeneficiaries.filter((beneficiary) => { return beneficiary.beneficiaryCode === beneficiaryCode; }); if (matchedBeneficiaries.length == 1) { - return true; + const beneficiary = matchedBeneficiaries[0]; + return !beneficiary.hasBeenMarkedAsReceived; } else { return false; } } else { - console.error("Active distrution named " + nameOfActiveDistribution + " not found in database"); + console.error("Active distributedion named \"" + nameOfActiveDistribution + "\" not found in database"); return false; } } diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js index 09c412c..2da38bc 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js @@ -55,7 +55,7 @@ export class BeneficiaryCodePostHandler extends ActiveSessionContainer { const beneficiary = await this.activeSession.database.beneficiaryWithCode(beneficiaryCode); if (beneficiary) { return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.codeInputFound, { - eligibility_info_box_id: await this.eligebilityService.isBenificiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "ineligible", + eligibility_info_box_id: await this.eligebilityService.isBenificiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "noteligible", eligibility_info_name: beneficiary.code, eligibility_info_values: beneficiary.values, }); diff --git a/PWA/src/Services/BeneficiaryEligilityService.ts b/PWA/src/Services/BeneficiaryEligilityService.ts index b0774bd..baf328a 100644 --- a/PWA/src/Services/BeneficiaryEligilityService.ts +++ b/PWA/src/Services/BeneficiaryEligilityService.ts @@ -14,18 +14,19 @@ export class BeneficiaryEligilityService { const distribution = await this.activeSession.database.distributionWithName(nameOfActiveDistribution) if(distribution) { const distributionBeneficiaries = await this.activeSession.database.benificiariesForDistribution(distribution) - console.log("🦆 there is a distribution") + console.log("There is a distribution") console.log(distributionBeneficiaries) const matchedBeneficiaries = distributionBeneficiaries.filter((beneficiary) => { return beneficiary.beneficiaryCode === beneficiaryCode }) if(matchedBeneficiaries.length == 1) { - return true + const beneficiary = matchedBeneficiaries[0] + return !beneficiary.hasBeenMarkedAsReceived } else { return false } } else { - console.error("Active distrution named " + nameOfActiveDistribution + " not found in database") + console.error("Active distributedion named \"" + nameOfActiveDistribution + "\" not found in database") return false } } else { diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts index eb1dcf6..533eced 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts @@ -65,7 +65,7 @@ export class BeneficiaryCodePostHandler extends ActiveSessionContainer implement if(beneficiary) { return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues( RouteEvents.codeInputFound, { - eligibility_info_box_id: await this.eligebilityService.isBenificiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "ineligible", + eligibility_info_box_id: await this.eligebilityService.isBenificiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "noteligible", eligibility_info_name: beneficiary.code, eligibility_info_values: beneficiary.values, } From 2790c5936c56138a745bfa84819238844a4b979b Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:54:08 +0200 Subject: [PATCH 30/99] Make sure activeDistribution container is at the expected place --- .../BeneficiaryCodePostHandler.js | 6 +- .../BeneficiaryDataUploadHandler.js | 2 +- .../DeleteDistributionPostHandler.js | 2 +- .../DeleteDistributionRequestHandler.js | 2 +- .../ListDistributionRequestHandler.js | 2 +- .../MarkAsReceivedPostHandler.js | 6 +- .../SelectDistributionRequestHandler.js | 2 +- PWA/src/Services/ActiveSession.ts | 62 +++++++++---------- .../BeneficiaryCodePostHandler.ts | 13 +--- .../BeneficiaryDataUploadHandler.ts | 2 +- .../DeleteDistributionPostHandler.ts | 2 +- .../DeleteDistributionRequestHandler.ts | 2 +- .../ListDistributionRequestHandler.ts | 2 +- .../MarkAsReceivedPostHandler.ts | 10 +-- .../SelectDistributionRequestHandler.ts | 2 +- 15 files changed, 46 insertions(+), 71 deletions(-) diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js index 2da38bc..bbc2bb0 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js @@ -1,6 +1,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; import { BeneficiaryEligilityService } from "../BeneficiaryEligilityService.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; /* @main.route('/entry', methods=['POST', 'GET']) @login_required @@ -36,11 +37,6 @@ def beneficiary(): return render_template('entry.html', data=beneficiary_data) */ -export class ActiveSessionContainer { - constructor(activeSession) { - this.activeSession = activeSession; - } -} export class BeneficiaryCodePostHandler extends ActiveSessionContainer { constructor() { super(...arguments); diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js index 7dc83e7..5eecca0 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js @@ -1,8 +1,8 @@ import { RouteEvents } from "../../RouteEvents.js"; import { BeneficiaryDeserializationService } from "../BeneficiaryDeserializationService.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; import { ResponseTools } from "../ResponseTools.js"; import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class BeneficiaryDataUploadHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.endsWith("/uploader"); diff --git a/PWA/public/Services/FetchEventHandlers/DeleteDistributionPostHandler.js b/PWA/public/Services/FetchEventHandlers/DeleteDistributionPostHandler.js index d2a8d17..5dba6a0 100644 --- a/PWA/public/Services/FetchEventHandlers/DeleteDistributionPostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/DeleteDistributionPostHandler.js @@ -1,6 +1,6 @@ import { RouteEvents } from "../../RouteEvents.js"; import { DeserialisationService } from "../DeserialisationService.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class DeleteDistributionPostHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.postDeleteDistribution); diff --git a/PWA/public/Services/FetchEventHandlers/DeleteDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/DeleteDistributionRequestHandler.js index 2bb5f2d..691d1c4 100644 --- a/PWA/public/Services/FetchEventHandlers/DeleteDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/DeleteDistributionRequestHandler.js @@ -1,7 +1,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { Distribution } from "../../Models/Distribution.js"; import { ResponseTools } from "../ResponseTools.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class DeleteDistributionRequestHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.deleteDistribution); diff --git a/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js index 8fd6717..c9c17af 100644 --- a/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js @@ -1,7 +1,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { Distribution } from "../../Models/Distribution.js"; import { ResponseTools } from "../ResponseTools.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class ListDistributionRequestHandler extends ActiveSessionContainer { canHandleEvent(event) { const url = event.request.url; diff --git a/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js b/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js index 8790766..aa15aec 100644 --- a/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js @@ -1,10 +1,6 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; -export class ActiveSessionContainer { - constructor(activeSession) { - this.activeSession = activeSession; - } -} +import { ActiveSessionContainer } from "../ActiveSession.js"; export class MarkAsReceivedPostHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.includes(RouteEvents.received); diff --git a/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js index f664a39..f932042 100644 --- a/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js @@ -2,7 +2,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class SelectDistributionRequestHandler extends ActiveSessionContainer { constructor() { super(...arguments); diff --git a/PWA/src/Services/ActiveSession.ts b/PWA/src/Services/ActiveSession.ts index bfb425f..182155c 100644 --- a/PWA/src/Services/ActiveSession.ts +++ b/PWA/src/Services/ActiveSession.ts @@ -1,40 +1,40 @@ import { Database } from "./Database.js" export class ActiveSession { - private _nameOfLastViewedDistribution?: string - private _nameOfLastUsedDistributionInputMethod?: string - database: Database - - constructor(database: Database) { - console.info("ℹ️ Constructing active session, should only happen once ") - this.database = database - } + private _nameOfLastViewedDistribution?: string + private _nameOfLastUsedDistributionInputMethod?: string + database: Database + + constructor(database: Database) { + console.info("ℹ️ Constructing active session, should only happen once ") + this.database = database + } - get nameOfLastViewedDistribution() { - return this._nameOfLastViewedDistribution; - } + get nameOfLastViewedDistribution() { + return this._nameOfLastViewedDistribution; + } - set nameOfLastViewedDistribution(value) { - console.log("ℹ️ name of last viewed distribution is now:") - console.log(value) - this._nameOfLastViewedDistribution = value; - } + set nameOfLastViewedDistribution(value) { + console.log("ℹ️ name of last viewed distribution is now:") + console.log(value) + this._nameOfLastViewedDistribution = value; + } - get nameOfLastUsedDistributionInputMethod() { - return this._nameOfLastUsedDistributionInputMethod; - } + get nameOfLastUsedDistributionInputMethod() { + return this._nameOfLastUsedDistributionInputMethod; + } - set nameOfLastUsedDistributionInputMethod(value) { - console.log("ℹ️ name of last used distribution input method is now:") - console.log(value) - this._nameOfLastUsedDistributionInputMethod = value; - } + set nameOfLastUsedDistributionInputMethod(value) { + console.log("ℹ️ name of last used distribution input method is now:") + console.log(value) + this._nameOfLastUsedDistributionInputMethod = value; } +} - export class ActiveSessionContainer { - activeSession: ActiveSession; - - constructor(activeSession: ActiveSession) { - this.activeSession = activeSession; - } -} \ No newline at end of file +export class ActiveSessionContainer { + activeSession: ActiveSession + + constructor(activeSession: ActiveSession) { + this.activeSession = activeSession; + } +} diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts index 533eced..536d1e1 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts @@ -3,7 +3,8 @@ import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { ResponseTools } from "../ResponseTools.js"; import { BeneficiaryEligilityService } from "../BeneficiaryEligilityService.js"; -import { ActiveSession } from "../ActiveSession.js"; +import { ActiveSession, ActiveSessionContainer } from "../ActiveSession.js"; + /* @main.route('/entry', methods=['POST', 'GET']) @@ -41,16 +42,6 @@ def beneficiary(): data=beneficiary_data) */ - - -export class ActiveSessionContainer { - activeSession: ActiveSession; - - constructor(activeSession: ActiveSession) { - this.activeSession = activeSession; - } -} - export class BeneficiaryCodePostHandler extends ActiveSessionContainer implements FetchEventHandler { eligebilityService = new BeneficiaryEligilityService(this.activeSession) diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts index 7c40f9a..70e5f9d 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts @@ -2,9 +2,9 @@ import { RouteEvents } from "../../RouteEvents.js"; import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { BeneficiaryDeserializationService } from "../BeneficiaryDeserializationService.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; import { ResponseTools } from "../ResponseTools.js"; import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class BeneficiaryDataUploadHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { diff --git a/PWA/src/Services/FetchEventHandlers/DeleteDistributionPostHandler.ts b/PWA/src/Services/FetchEventHandlers/DeleteDistributionPostHandler.ts index 4b11f72..aeafc70 100644 --- a/PWA/src/Services/FetchEventHandlers/DeleteDistributionPostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/DeleteDistributionPostHandler.ts @@ -3,7 +3,7 @@ import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { DeleteDistributionPost } from "../../Models/DeleteDistributionPost.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class DeleteDistributionPostHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { diff --git a/PWA/src/Services/FetchEventHandlers/DeleteDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/DeleteDistributionRequestHandler.ts index 6cea490..fbb6cf6 100644 --- a/PWA/src/Services/FetchEventHandlers/DeleteDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/DeleteDistributionRequestHandler.ts @@ -3,7 +3,7 @@ import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { Distribution } from "../../Models/Distribution.js"; import { ResponseTools } from "../ResponseTools.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class DeleteDistributionRequestHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { diff --git a/PWA/src/Services/FetchEventHandlers/ListDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/ListDistributionRequestHandler.ts index 6b77293..00983bd 100644 --- a/PWA/src/Services/FetchEventHandlers/ListDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/ListDistributionRequestHandler.ts @@ -3,7 +3,7 @@ import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { Distribution } from "../../Models/Distribution.js"; import { ResponseTools } from "../ResponseTools.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class ListDistributionRequestHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { diff --git a/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts b/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts index 0272831..8e7c53c 100644 --- a/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts @@ -3,15 +3,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { ResponseTools } from "../ResponseTools.js"; -import { ActiveSession } from "../ActiveSession.js"; - -export class ActiveSessionContainer { - activeSession: ActiveSession; - - constructor(activeSession: ActiveSession) { - this.activeSession = activeSession; - } -} +import { ActiveSession, ActiveSessionContainer } from "../ActiveSession.js"; export class MarkAsReceivedPostHandler extends ActiveSessionContainer implements FetchEventHandler { diff --git a/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts index f50d48a..3e12b99 100644 --- a/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts @@ -5,7 +5,7 @@ import { SelectDistributionPost } from "../../Models/SelectDistributionPost.js"; import { ResponseTools } from "../ResponseTools.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; -import { ActiveSessionContainer } from "./BeneficiaryCodePostHandler.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; export class SelectDistributionRequestHandler extends ActiveSessionContainer implements FetchEventHandler { benificiaryInfoService = new BenificiaryInfoService(this.activeSession.database) From 7c5d434d6eca8e59f6cc2be09992647722db759d Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:59:09 +0200 Subject: [PATCH 31/99] Make sure continue button and home button work --- PWA/public/entry.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWA/public/entry.html b/PWA/public/entry.html index 68614f1..8894f07 100644 --- a/PWA/public/entry.html +++ b/PWA/public/entry.html @@ -14,13 +14,13 @@
-
+

-
+ From 2ebc0ecc900d2d356f6b743cc69d3a54ed887733 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:21:07 +0200 Subject: [PATCH 32/99] Make sure the number of served benificiaries are shown --- PWA/public/Services/BenificiaryInfoService.js | 5 ++--- PWA/src/Services/BenificiaryInfoService.ts | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/PWA/public/Services/BenificiaryInfoService.js b/PWA/public/Services/BenificiaryInfoService.js index 3b2239c..8af36c5 100644 --- a/PWA/public/Services/BenificiaryInfoService.js +++ b/PWA/public/Services/BenificiaryInfoService.js @@ -4,10 +4,9 @@ export class BenificiaryInfoService { } async benificiaryInfoTextFromDistribution(distribution) { const benificiaries = await this.database.benificiariesForDistribution(distribution); - const numberOfServedBenificiaries = 42; //TODO: implement proper calculation + const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length; if (benificiaries.length > 0) { - //Beneficiaries served: {{ number_recipients }} / {{ number_beneficiaries }} - return "Beneficiaries served: " + numberOfServedBenificiaries; + return "Beneficiaries served: " + numberOfServedBenificiaries + " / " + benificiaries.length; } else { return "No beneficiary data found"; diff --git a/PWA/src/Services/BenificiaryInfoService.ts b/PWA/src/Services/BenificiaryInfoService.ts index f31144d..32ee351 100644 --- a/PWA/src/Services/BenificiaryInfoService.ts +++ b/PWA/src/Services/BenificiaryInfoService.ts @@ -12,10 +12,9 @@ export class BenificiaryInfoService { async benificiaryInfoTextFromDistribution(distribution: Distribution): Promise { const benificiaries: DistributionBeneficiary[] = await this.database.benificiariesForDistribution(distribution) - const numberOfServedBenificiaries = 42 //TODO: implement proper calculation + const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length if(benificiaries.length > 0) { - //Beneficiaries served: {{ number_recipients }} / {{ number_beneficiaries }} - return "Beneficiaries served: " + numberOfServedBenificiaries + return "Beneficiaries served: " + numberOfServedBenificiaries +" / " + benificiaries.length } else { return "No beneficiary data found" } From ca60e3055a9a2ec48a0011624658d54e48ebcb0f Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:22:34 +0200 Subject: [PATCH 33/99] Make sure Beneficiary is spelled correct wip --- PWA/public/RouteEvents.js | 8 ++++---- PWA/public/Services/BeneficiaryInfoService.js | 15 +++++++++++++++ PWA/public/Services/BenificiaryInfoService.js | 4 ++-- PWA/public/Services/CacheFilePathService.js | 6 +++--- .../BeneficiaryCodePostHandler.js | 2 +- .../BeneficiaryDataUploadHandler.js | 6 +++--- ...ChooseBenificiaryCodeInputMethodPageHandler.js | 4 ++-- .../CreateDistributionRequestHandler.js | 6 +++--- .../SelectBenificiaryCodeInputMethodHandler.js | 2 +- .../SelectDistributionRequestHandler.js | 6 +++--- PWA/src/RouteEvents.ts | 8 ++++---- ...ryInfoService.ts => BeneficiaryInfoService.ts} | 4 ++-- PWA/src/Services/CacheFilePathService.ts | 6 +++--- .../BeneficiaryCodePostHandler.ts | 2 +- .../BeneficiaryDataUploadHandler.ts | 6 +++--- ...ChooseBenificiaryCodeInputMethodPageHandler.ts | 4 ++-- .../CreateDistributionRequestHandler.ts | 6 +++--- .../SelectBenificiaryCodeInputMethodHandler.ts | 2 +- .../SelectDistributionRequestHandler.ts | 6 +++--- 19 files changed, 59 insertions(+), 44 deletions(-) create mode 100644 PWA/public/Services/BeneficiaryInfoService.js rename PWA/src/Services/{BenificiaryInfoService.ts => BeneficiaryInfoService.ts} (88%) diff --git a/PWA/public/RouteEvents.js b/PWA/public/RouteEvents.js index b2e6ec6..dac10dd 100644 --- a/PWA/public/RouteEvents.js +++ b/PWA/public/RouteEvents.js @@ -11,7 +11,7 @@ RouteEvents.viewData = "/view_data.html"; RouteEvents.noBeneficiariesFound = "no_data.html"; RouteEvents.uploadDataError = "/upload_error.html"; RouteEvents.template = "/template.html"; -RouteEvents.chooseBenificiaryCodeInputMethodPage = "/choose_input_method.html"; +RouteEvents.chooseBeneficiaryCodeInputMethodPage = "/choose_input_method.html"; RouteEvents.codeInputUsingCamera = "/input_video.html"; RouteEvents.codeinputUsingTextField = "/input.html"; RouteEvents.codeInputNotFound = "/entry_not_found.html"; @@ -21,9 +21,9 @@ RouteEvents.postCreateDistribution = "/create_distrib"; RouteEvents.postSelectDistribution = "/select_distrib"; RouteEvents.postDeleteDistribution = "/delete_distrib_confirm"; RouteEvents.listDistributionsFormAction = "/distrib?"; -RouteEvents.chooseBenificiaryCodeInputMethod = "/choose_input_method?"; -RouteEvents.selectBenificiaryCodeInputMethod = "/save_input_method"; -RouteEvents.checkBenificiaryCodeInputMethod = "/entry"; +RouteEvents.chooseBeneficiaryCodeInputMethod = "/choose_input_method?"; +RouteEvents.selectBeneficiaryCodeInputMethod = "/save_input_method"; +RouteEvents.checkBeneficiaryCodeInputMethod = "/entry"; RouteEvents.checkWhosMissing = "/missing"; RouteEvents.received = "/received"; RouteEvents.continueDistribution = "/continueDistribution"; diff --git a/PWA/public/Services/BeneficiaryInfoService.js b/PWA/public/Services/BeneficiaryInfoService.js new file mode 100644 index 0000000..d666ae4 --- /dev/null +++ b/PWA/public/Services/BeneficiaryInfoService.js @@ -0,0 +1,15 @@ +export class BeneficiaryInfoService { + constructor(database) { + this.database = database; + } + async beneficiaryInfoTextFromDistribution(distribution) { + const benificiaries = await this.database.benificiariesForDistribution(distribution); + const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length; + if (benificiaries.length > 0) { + return "Beneficiaries served: " + numberOfServedBenificiaries + " / " + benificiaries.length; + } + else { + return "No beneficiary data found"; + } + } +} diff --git a/PWA/public/Services/BenificiaryInfoService.js b/PWA/public/Services/BenificiaryInfoService.js index 8af36c5..d666ae4 100644 --- a/PWA/public/Services/BenificiaryInfoService.js +++ b/PWA/public/Services/BenificiaryInfoService.js @@ -1,8 +1,8 @@ -export class BenificiaryInfoService { +export class BeneficiaryInfoService { constructor(database) { this.database = database; } - async benificiaryInfoTextFromDistribution(distribution) { + async beneficiaryInfoTextFromDistribution(distribution) { const benificiaries = await this.database.benificiariesForDistribution(distribution); const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length; if (benificiaries.length > 0) { diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index 3f4dc59..8bfb566 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -13,7 +13,7 @@ import { DeleteDistributionPost } from "../Models/DeleteDistributionPost.js"; import { Distribution } from "../Models/Distribution.js"; import { SelectDistributionPost } from "../Models/SelectDistributionPost.js"; import { RouteEvents } from "../RouteEvents.js"; -import { BenificiaryInfoService } from "./BenificiaryInfoService.js"; +import { BeneficiaryInfoService } from "./BeneficiaryInfoService.js"; import { Database } from "./Database.js"; import { DeserialisationService } from "./DeserialisationService.js"; import { FormParser } from "./FormParser.js"; @@ -57,7 +57,7 @@ export class CacheFilePathService { RouteEvents.deleteDistribution, RouteEvents.uploadData, RouteEvents.uploadDataError, - RouteEvents.chooseBenificiaryCodeInputMethodPage, + RouteEvents.chooseBeneficiaryCodeInputMethodPage, RouteEvents.codeInputUsingCamera, RouteEvents.codeinputUsingTextField, RouteEvents.codeInputFound, @@ -102,7 +102,7 @@ export class CacheFilePathService { } servicePaths() { return this.pathsForTypesInFolder("Services", [ - BenificiaryInfoService.name, + BeneficiaryInfoService.name, CacheFilePathService.name, Database.name, DeserialisationService.name, diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js index bbc2bb0..fe80b9c 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js @@ -43,7 +43,7 @@ export class BeneficiaryCodePostHandler extends ActiveSessionContainer { this.eligebilityService = new BeneficiaryEligilityService(this.activeSession); } canHandleEvent(event) { - return event.request.url.includes(RouteEvents.checkBenificiaryCodeInputMethod); + return event.request.url.includes(RouteEvents.checkBeneficiaryCodeInputMethod); } async handleEvent(event) { const beneficiaryCode = this.beneficiaryCodeFromRequest(event.request); diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js index 5eecca0..b04b785 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js @@ -1,7 +1,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { BeneficiaryDeserializationService } from "../BeneficiaryDeserializationService.js"; import { ResponseTools } from "../ResponseTools.js"; -import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; +import { BeneficiaryInfoService } from "../BeneficiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; export class BeneficiaryDataUploadHandler extends ActiveSessionContainer { canHandleEvent(event) { @@ -18,12 +18,12 @@ export class BeneficiaryDataUploadHandler extends ActiveSessionContainer { await beneficiaries.forEach(async (beneficiary) => await database.addBenificiary(beneficiary)); await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiaryToDistribution(beneficiary, distribution)); this.activeSession.nameOfLastViewedDistribution = distributionName; - const benificiaryInfoService = new BenificiaryInfoService(this.activeSession.database); + const benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); return await ResponseTools.replaceTemplateKeysWithValues(await ResponseTools.wrapInHtmlTemplate(RouteEvents.distributionsHome), { "distrib_name": distribution.distrib_name, "distrib_place": distribution.distrib_place, "distrib_date": distribution.distrib_date, - beneficiary_info: await benificiaryInfoService.benificiaryInfoTextFromDistribution(distribution) + beneficiary_info: await benificiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) }); } else { diff --git a/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js b/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js index 03b8303..c6102c6 100644 --- a/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js +++ b/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js @@ -2,9 +2,9 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; export class ChooseBenificiaryCodeInputMethodPageHandler { canHandleEvent(event) { - return event.request.url.endsWith(RouteEvents.chooseBenificiaryCodeInputMethod); + return event.request.url.endsWith(RouteEvents.chooseBeneficiaryCodeInputMethod); } async handleEvent(event) { - return ResponseTools.wrapInHtmlTemplate(RouteEvents.chooseBenificiaryCodeInputMethodPage); + return ResponseTools.wrapInHtmlTemplate(RouteEvents.chooseBeneficiaryCodeInputMethodPage); } } diff --git a/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js index 837b5bf..1b99922 100644 --- a/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js @@ -1,13 +1,13 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; import { DeserialisationService } from "../DeserialisationService.js"; -import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; +import { BeneficiaryInfoService } from "../BeneficiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { DateService } from "../DateService.js"; export class CreateDistributionRequestHandler extends ActiveSessionContainer { constructor() { super(...arguments); - this.benificiaryInfoService = new BenificiaryInfoService(this.activeSession.database); + this.benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); } canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.postCreateDistribution); @@ -30,7 +30,7 @@ export class CreateDistributionRequestHandler extends ActiveSessionContainer { "distrib_name": distribution.distrib_name, "distrib_place": distribution.distrib_place, "distrib_date": distribution.distrib_date, - beneficiary_info: await this.benificiaryInfoService.benificiaryInfoTextFromDistribution(distribution) + beneficiary_info: await this.benificiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) }); } catch (error) { diff --git a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js b/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js index 410be3f..6ec3b90 100644 --- a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js +++ b/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js @@ -4,7 +4,7 @@ import { DeserialisationService } from "../DeserialisationService.js"; import { ResponseTools } from "../ResponseTools.js"; export class SelectBenificiaryCodeInputMethodHandler extends ActiveSessionContainer { canHandleEvent(event) { - return event.request.url.endsWith(RouteEvents.selectBenificiaryCodeInputMethod); + return event.request.url.endsWith(RouteEvents.selectBeneficiaryCodeInputMethod); } async handleEvent(event) { try { diff --git a/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js index f932042..f98a7f5 100644 --- a/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js @@ -1,12 +1,12 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; import { DeserialisationService } from "../DeserialisationService.js"; -import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; +import { BeneficiaryInfoService } from "../BeneficiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; export class SelectDistributionRequestHandler extends ActiveSessionContainer { constructor() { super(...arguments); - this.benificiaryInfoService = new BenificiaryInfoService(this.activeSession.database); + this.benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); } canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.postSelectDistribution); @@ -20,7 +20,7 @@ export class SelectDistributionRequestHandler extends ActiveSessionContainer { "distrib_name": selectedDistribution.distrib_name, "distrib_place": selectedDistribution.distrib_place, "distrib_date": selectedDistribution.distrib_date, - beneficiary_info: await this.benificiaryInfoService.benificiaryInfoTextFromDistribution(selectedDistribution) + beneficiary_info: await this.benificiaryInfoService.beneficiaryInfoTextFromDistribution(selectedDistribution) }); } else { diff --git a/PWA/src/RouteEvents.ts b/PWA/src/RouteEvents.ts index e0174eb..83bfb63 100644 --- a/PWA/src/RouteEvents.ts +++ b/PWA/src/RouteEvents.ts @@ -10,7 +10,7 @@ export class RouteEvents { static noBeneficiariesFound = "no_data.html" static uploadDataError = "/upload_error.html" static template = "/template.html" - static chooseBenificiaryCodeInputMethodPage = "/choose_input_method.html" + static chooseBeneficiaryCodeInputMethodPage = "/choose_input_method.html" static codeInputUsingCamera = "/input_video.html" static codeinputUsingTextField = "/input.html" static codeInputNotFound = "/entry_not_found.html" @@ -21,9 +21,9 @@ export class RouteEvents { static postSelectDistribution = "/select_distrib" static postDeleteDistribution = "/delete_distrib_confirm" static listDistributionsFormAction = "/distrib?" - static chooseBenificiaryCodeInputMethod = "/choose_input_method?" - static selectBenificiaryCodeInputMethod = "/save_input_method" - static checkBenificiaryCodeInputMethod = "/entry" + static chooseBeneficiaryCodeInputMethod = "/choose_input_method?" + static selectBeneficiaryCodeInputMethod = "/save_input_method" + static checkBeneficiaryCodeInputMethod = "/entry" static checkWhosMissing = "/missing" static received = "/received" static continueDistribution = "/continueDistribution" diff --git a/PWA/src/Services/BenificiaryInfoService.ts b/PWA/src/Services/BeneficiaryInfoService.ts similarity index 88% rename from PWA/src/Services/BenificiaryInfoService.ts rename to PWA/src/Services/BeneficiaryInfoService.ts index 32ee351..4b4a812 100644 --- a/PWA/src/Services/BenificiaryInfoService.ts +++ b/PWA/src/Services/BeneficiaryInfoService.ts @@ -3,14 +3,14 @@ import { Distribution } from "../Models/Distribution.js" import { DistributionBeneficiary } from "../Models/DistributionBeneficiary.js" import { Database } from "./Database.js" -export class BenificiaryInfoService { +export class BeneficiaryInfoService { database: Database constructor(database: Database) { this.database = database } - async benificiaryInfoTextFromDistribution(distribution: Distribution): Promise { + async beneficiaryInfoTextFromDistribution(distribution: Distribution): Promise { const benificiaries: DistributionBeneficiary[] = await this.database.benificiariesForDistribution(distribution) const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length if(benificiaries.length > 0) { diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts index 23f91f1..af23f0e 100644 --- a/PWA/src/Services/CacheFilePathService.ts +++ b/PWA/src/Services/CacheFilePathService.ts @@ -13,7 +13,7 @@ import { DeleteDistributionPost } from "../Models/DeleteDistributionPost.js"; import { Distribution } from "../Models/Distribution.js"; import { SelectDistributionPost } from "../Models/SelectDistributionPost.js"; import { RouteEvents } from "../RouteEvents.js"; -import { BenificiaryInfoService } from "./BenificiaryInfoService.js"; +import { BeneficiaryInfoService } from "./BeneficiaryInfoService.js"; import { Database } from "./Database.js"; import { DeserialisationService } from "./DeserialisationService.js"; import { FormParser } from "./FormParser.js"; @@ -59,7 +59,7 @@ export class CacheFilePathService { RouteEvents.deleteDistribution, RouteEvents.uploadData, RouteEvents.uploadDataError, - RouteEvents.chooseBenificiaryCodeInputMethodPage, + RouteEvents.chooseBeneficiaryCodeInputMethodPage, RouteEvents.codeInputUsingCamera, RouteEvents.codeinputUsingTextField, RouteEvents.codeInputFound, @@ -114,7 +114,7 @@ export class CacheFilePathService { private servicePaths(): string[] { return this.pathsForTypesInFolder("Services", [ - BenificiaryInfoService.name, + BeneficiaryInfoService.name, CacheFilePathService.name, Database.name, DeserialisationService.name, diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts index 536d1e1..580d3a8 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts @@ -46,7 +46,7 @@ export class BeneficiaryCodePostHandler extends ActiveSessionContainer implement eligebilityService = new BeneficiaryEligilityService(this.activeSession) canHandleEvent(event: FetchEvent): boolean { - return event.request.url.includes(RouteEvents.checkBenificiaryCodeInputMethod); + return event.request.url.includes(RouteEvents.checkBeneficiaryCodeInputMethod); } async handleEvent(event: FetchEvent): Promise { diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts index 70e5f9d..72c51da 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts @@ -3,7 +3,7 @@ import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { BeneficiaryDeserializationService } from "../BeneficiaryDeserializationService.js"; import { ResponseTools } from "../ResponseTools.js"; -import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; +import { BeneficiaryInfoService } from "../BeneficiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; export class BeneficiaryDataUploadHandler extends ActiveSessionContainer implements FetchEventHandler { @@ -22,13 +22,13 @@ export class BeneficiaryDataUploadHandler extends ActiveSessionContainer impleme await beneficiaries.forEach(async (beneficiary) => await database.addBenificiary(beneficiary)) await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiaryToDistribution(beneficiary, distribution)) this.activeSession.nameOfLastViewedDistribution = distributionName - const benificiaryInfoService = new BenificiaryInfoService(this.activeSession.database) + const benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) return await ResponseTools.replaceTemplateKeysWithValues(await ResponseTools.wrapInHtmlTemplate(RouteEvents.distributionsHome), { "distrib_name": distribution.distrib_name, "distrib_place": distribution.distrib_place, "distrib_date": distribution.distrib_date, - beneficiary_info: await benificiaryInfoService.benificiaryInfoTextFromDistribution(distribution) + beneficiary_info: await benificiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) }); } else { throw "Expeced distribution named " + distributionName diff --git a/PWA/src/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.ts b/PWA/src/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.ts index a135847..5b5665e 100644 --- a/PWA/src/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.ts @@ -5,10 +5,10 @@ import { ResponseTools } from "../ResponseTools.js"; export class ChooseBenificiaryCodeInputMethodPageHandler implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { - return event.request.url.endsWith(RouteEvents.chooseBenificiaryCodeInputMethod); + return event.request.url.endsWith(RouteEvents.chooseBeneficiaryCodeInputMethod); } async handleEvent(event: FetchEvent): Promise { - return ResponseTools.wrapInHtmlTemplate(RouteEvents.chooseBenificiaryCodeInputMethodPage) + return ResponseTools.wrapInHtmlTemplate(RouteEvents.chooseBeneficiaryCodeInputMethodPage) } } \ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts index 890c41f..07fb181 100644 --- a/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts @@ -4,12 +4,12 @@ import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { Distribution } from "../../Models/Distribution.js"; import { ResponseTools } from "../ResponseTools.js"; import { DeserialisationService } from "../DeserialisationService.js"; -import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; +import { BeneficiaryInfoService } from "../BeneficiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { DateService } from "../DateService.js"; export class CreateDistributionRequestHandler extends ActiveSessionContainer implements FetchEventHandler { - benificiaryInfoService = new BenificiaryInfoService(this.activeSession.database) + benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.postCreateDistribution); @@ -39,7 +39,7 @@ export class CreateDistributionRequestHandler extends ActiveSessionContainer imp "distrib_name": distribution.distrib_name, "distrib_place": distribution.distrib_place, "distrib_date": distribution.distrib_date, - beneficiary_info: await this.benificiaryInfoService.benificiaryInfoTextFromDistribution(distribution) + beneficiary_info: await this.benificiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) } ) } catch(error) { diff --git a/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts b/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts index 5ab64f1..6689f3e 100644 --- a/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts @@ -8,7 +8,7 @@ import { ResponseTools } from "../ResponseTools.js"; export class SelectBenificiaryCodeInputMethodHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { - return event.request.url.endsWith(RouteEvents.selectBenificiaryCodeInputMethod); + return event.request.url.endsWith(RouteEvents.selectBeneficiaryCodeInputMethod); } async handleEvent(event: FetchEvent): Promise { diff --git a/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts index 3e12b99..a59b8f2 100644 --- a/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts @@ -4,11 +4,11 @@ import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { SelectDistributionPost } from "../../Models/SelectDistributionPost.js"; import { ResponseTools } from "../ResponseTools.js"; import { DeserialisationService } from "../DeserialisationService.js"; -import { BenificiaryInfoService } from "../BenificiaryInfoService.js"; +import { BeneficiaryInfoService } from "../BeneficiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; export class SelectDistributionRequestHandler extends ActiveSessionContainer implements FetchEventHandler { - benificiaryInfoService = new BenificiaryInfoService(this.activeSession.database) + benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.postSelectDistribution); @@ -25,7 +25,7 @@ export class SelectDistributionRequestHandler extends ActiveSessionContainer imp "distrib_name": selectedDistribution.distrib_name, "distrib_place": selectedDistribution.distrib_place, "distrib_date": selectedDistribution.distrib_date, - beneficiary_info: await this.benificiaryInfoService.benificiaryInfoTextFromDistribution(selectedDistribution) + beneficiary_info: await this.benificiaryInfoService.beneficiaryInfoTextFromDistribution(selectedDistribution) } ) } else { From 1592452e76c49e0b57480989958a5d3b22df486a Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Sun, 8 Sep 2024 16:57:06 +0200 Subject: [PATCH 34/99] Make it more clear which file is cached and wether or not is has succeeded --- PWA/public/sw.js | 23 ++++++++++++++++++++--- PWA/src/sw.ts | 24 +++++++++++++++++++++--- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/PWA/public/sw.js b/PWA/public/sw.js index 3be73a2..33ff7d3 100644 --- a/PWA/public/sw.js +++ b/PWA/public/sw.js @@ -9,19 +9,36 @@ self.addEventListener("install", function (event) { console.log("ℹ️ Installing Service Worker ...", event); console.log(new CacheFilePathService().pathsOfFilesToCache()); event.waitUntil(caches.open(CACHE_STATIC_NAME) - .then(function (cache) { + .then(async (cache) => { console.log("ℹ️ Precaching App Shell.."); - cache.addAll([ + const urlsToCache = [ "/", "/favicon.ico", "/manifest.json", "/apple-touch-icon.png", "/apple-touch-icon-precomposed.png" ] - .concat(new CacheFilePathService().pathsOfFilesToCache())); + .concat(new CacheFilePathService().pathsOfFilesToCache()); + for (const url of urlsToCache) { + try { + const response = await fetch(url); + if (!response.ok) { + console.error(`Failed to fetch ${url}: ${response.statusText}`); + } + else { + await cache.put(url, response); + console.log(`Cached: ${url}`); + } + } + catch (error) { + console.error(`Error fetching ${url}:`, error); + } + } }) .then(() => { console.log("ℹ️ Serviceworker installed ✅"); + }).catch((error) => { + console.error("Promise rejected with:", error); })); }); self.addEventListener("activate", function (event) { diff --git a/PWA/src/sw.ts b/PWA/src/sw.ts index a7288c5..990fce4 100644 --- a/PWA/src/sw.ts +++ b/PWA/src/sw.ts @@ -13,9 +13,9 @@ self.addEventListener("install", function (event: any) { console.log(new CacheFilePathService().pathsOfFilesToCache()) event.waitUntil( caches.open(CACHE_STATIC_NAME) - .then(function (cache) { + .then(async (cache) => { console.log("ℹ️ Precaching App Shell.."); - cache.addAll([ + const urlsToCache = [ "/", "/favicon.ico", "/manifest.json", @@ -23,10 +23,25 @@ self.addEventListener("install", function (event: any) { "/apple-touch-icon-precomposed.png" ] .concat(new CacheFilePathService().pathsOfFilesToCache()) - ); + + for (const url of urlsToCache) { + try { + const response = await fetch(url); + if (!response.ok) { + console.error(`Failed to fetch ${url}: ${response.statusText}`); + } else { + await cache.put(url, response); + console.log(`Cached: ${url}`); + } + } catch (error) { + console.error(`Error fetching ${url}:`, error); + } + } }) .then(() => { console.log("ℹ️ Serviceworker installed ✅") + }).catch((error) => { + console.error("Promise rejected with:", error); }) ); }); @@ -44,6 +59,9 @@ self.addEventListener("activate", function (event: any) { }) ); }) + .catch((error) => { + console.error("Promise rejected with:", error); + }) ); return (self as any).clients.claim(); }); From 23dba49d69cc30bec7005bc9f11e26d244f1f466 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Sun, 8 Sep 2024 17:11:51 +0200 Subject: [PATCH 35/99] Clean up public folder --- ...ificiaryCodeInputMethodPageHandler copy.js | 10 ---- PWA/public/src/sw.js | 47 ------------------- .../CheckWhosMissingPagehandler.ts | 3 +- 3 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler copy.js delete mode 100644 PWA/public/src/sw.js diff --git a/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler copy.js b/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler copy.js deleted file mode 100644 index 03b8303..0000000 --- a/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler copy.js +++ /dev/null @@ -1,10 +0,0 @@ -import { RouteEvents } from "../../RouteEvents.js"; -import { ResponseTools } from "../ResponseTools.js"; -export class ChooseBenificiaryCodeInputMethodPageHandler { - canHandleEvent(event) { - return event.request.url.endsWith(RouteEvents.chooseBenificiaryCodeInputMethod); - } - async handleEvent(event) { - return ResponseTools.wrapInHtmlTemplate(RouteEvents.chooseBenificiaryCodeInputMethodPage); - } -} diff --git a/PWA/public/src/sw.js b/PWA/public/src/sw.js deleted file mode 100644 index 9f02005..0000000 --- a/PWA/public/src/sw.js +++ /dev/null @@ -1,47 +0,0 @@ -import { FetchEventHandlers } from "./Services/FetchEventHandlers/FetchEventHandlers.js"; -import { CacheFilePathService } from "./Services/CacheFilePathService.js"; -import { ActiveSession } from "./SessionState/ActiveSession.js"; -import { Database } from "./Services/Database.js"; -var CACHE_STATIC_NAME = "static-v10"; -var CACHE_DYNAMIC_NAME = "dynamic-v2"; -self.addEventListener("install", function (event) { - console.log("[Service Worker] Installing Service Worker ...", event); - console.log(new CacheFilePathService().pathsOfFilesToCache()); - event.waitUntil(caches.open(CACHE_STATIC_NAME) - .then(function (cache) { - console.log("[Service Worker] Precaching App Shell"); - cache.addAll([ - "/", - "/favicon.ico", - "/manifest.json", - "/apple-touch-icon.png", - "/apple-touch-icon-precomposed.png" - ] - .concat(new CacheFilePathService().pathsOfFilesToCache())); - })); -}); -self.addEventListener("activate", function (event) { - console.log("[Service Worker] Activating Service Worker ....", event); - event.waitUntil(caches.keys().then(function (keyList) { - return Promise.all(keyList.map(function (key) { - if (key !== CACHE_STATIC_NAME && key !== CACHE_DYNAMIC_NAME) { - console.log("[Service Worker] Removing old cache.", key); - return caches.delete(key); - } - })); - })); - return self.clients.claim(); -}); -// Cache-only -self.addEventListener("fetch", function (event) { - let customHandlers = new FetchEventHandlers(new ActiveSession(new Database(indexedDB))); - console.log("Handling fetch request " + event.request.url); - if (customHandlers.canHandleEvent(event)) { - console.log("using custom event handler"); - event.respondWith(customHandlers.handleEvent(event)); - } - else { - console.log("using custom cache"); - event.respondWith(caches.match(event.request)); - } -}); diff --git a/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts b/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts index a3c07f1..a51e951 100644 --- a/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts +++ b/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts @@ -14,8 +14,7 @@ export class CheckWhosMissingPageHandler extends ActiveSessionContainer implemen async handleEvent(event: FetchEvent): Promise { const beneficiariesService = new BeneficiariesService(this.activeSession); const beneficiaries = await beneficiariesService.eligibleBeneficiariesForActiveDistribution(); - console.log("Will display:"); - console.log(beneficiaries); + console.log("Will display:", beneficiaries); if(beneficiaries.length > 0) { return await ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.viewData, { columns: this.columnsFromBeneficiaries(beneficiaries), From 8286847158957c1cb291e80297690af933171a29 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Thu, 19 Sep 2024 15:37:03 +0200 Subject: [PATCH 36/99] Rename incorrect spelling of beneficiary --- .../Services/BeneficiariesService.test.js | 12 ++++---- .../Services/BeneficiaryEligilityService.js | 2 +- .../BeneficiaryEligilityService.test.js | 6 ++-- PWA/public/Services/BeneficiaryInfoService.js | 8 ++--- PWA/public/Services/BenificiaryInfoService.js | 15 ---------- PWA/public/Services/CacheFilePathService.js | 8 ++--- PWA/public/Services/Database.js | 8 ++--- PWA/public/Services/Database.test.js | 2 +- .../BeneficiaryCodePostHandler.js | 2 +- .../BeneficiaryDataUploadHandler.js | 6 ++-- ...eBeneficiaryCodeInputMethodPageHandler.js} | 2 +- .../CreateDistributionRequestHandler.js | 4 +-- .../FetchEventHandlers/FetchEventHandlers.js | 8 ++--- .../MarkAsReceivedPostHandler.js | 2 +- ...electBeneficiaryCodeInputMethodHandler.js} | 2 +- ...tBenificiaryCodeInputMethodHandler copy.js | 29 ------------------- .../SelectDistributionRequestHandler.js | 4 +-- PWA/public/sw.js | 3 ++ PWA/src/Services/BeneficiariesService.test.ts | 12 ++++---- .../BeneficiaryEligilityService.test.ts | 6 ++-- .../Services/BeneficiaryEligilityService.ts | 2 +- PWA/src/Services/BeneficiaryInfoService.ts | 8 ++--- PWA/src/Services/CacheFilePathService.ts | 8 ++--- PWA/src/Services/Database.test.ts | 2 +- PWA/src/Services/Database.ts | 8 ++--- .../BeneficiaryCodePostHandler.ts | 2 +- .../BeneficiaryDataUploadHandler.ts | 6 ++-- ...eBeneficiaryCodeInputMethodPageHandler.ts} | 2 +- .../CreateDistributionRequestHandler.ts | 4 +-- .../FetchEventHandlers/FetchEventHandlers.ts | 8 ++--- .../MarkAsReceivedPostHandler.ts | 2 +- ...electBeneficiaryCodeInputMethodHandler.ts} | 2 +- .../SelectDistributionRequestHandler.ts | 4 +-- 33 files changed, 79 insertions(+), 120 deletions(-) delete mode 100644 PWA/public/Services/BenificiaryInfoService.js rename PWA/public/Services/FetchEventHandlers/{ChooseBenificiaryCodeInputMethodPageHandler.js => ChooseBeneficiaryCodeInputMethodPageHandler.js} (86%) rename PWA/public/Services/FetchEventHandlers/{SelectBenificiaryCodeInputMethodHandler.js => SelectBeneficiaryCodeInputMethodHandler.js} (95%) delete mode 100644 PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler copy.js rename PWA/src/Services/FetchEventHandlers/{ChooseBenificiaryCodeInputMethodPageHandler.ts => ChooseBeneficiaryCodeInputMethodPageHandler.ts} (90%) rename PWA/src/Services/FetchEventHandlers/{SelectBenificiaryCodeInputMethodHandler.ts => SelectBeneficiaryCodeInputMethodHandler.ts} (96%) diff --git a/PWA/public/Services/BeneficiariesService.test.js b/PWA/public/Services/BeneficiariesService.test.js index 8826784..a04b0ab 100644 --- a/PWA/public/Services/BeneficiariesService.test.js +++ b/PWA/public/Services/BeneficiariesService.test.js @@ -52,8 +52,8 @@ describe('BeneficiariesService', () => { const distributions = await database.readDistributions(); console.log(distributions); await database.addDistribution(existingDistribution); - await database.addBenificiary(beneficiary1); - await database.addBenificiary(beneficiary2); + await database.addBeneficiary(beneficiary1); + await database.addBeneficiary(beneficiary2); await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution); await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution); const beneficiaries = await sut.beneficiariesForActiveDistribution(); @@ -66,8 +66,8 @@ describe('BeneficiariesService', () => { const distributions = await database.readDistributions(); console.log(distributions); await database.addDistribution(existingDistribution); - await database.addBenificiary(beneficiary1); - await database.addBenificiary(beneficiary2); + await database.addBeneficiary(beneficiary1); + await database.addBeneficiary(beneficiary2); await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution); await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution); const eligibleBeneficiaries = await sut.eligibleBeneficiariesForActiveDistribution(); @@ -78,8 +78,8 @@ describe('BeneficiariesService', () => { const distributions = await database.readDistributions(); console.log(distributions); await database.addDistribution(existingDistribution); - await database.addBenificiary(beneficiary1); - await database.addBenificiary(beneficiary2); + await database.addBeneficiary(beneficiary1); + await database.addBeneficiary(beneficiary2); await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution); await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution); await database.markBeneficiaryAsReceived(beneficiary1.code, existingDistributionName); diff --git a/PWA/public/Services/BeneficiaryEligilityService.js b/PWA/public/Services/BeneficiaryEligilityService.js index a368e54..8b27064 100644 --- a/PWA/public/Services/BeneficiaryEligilityService.js +++ b/PWA/public/Services/BeneficiaryEligilityService.js @@ -2,7 +2,7 @@ export class BeneficiaryEligilityService { constructor(activeSession) { this.activeSession = activeSession; } - async isBenificiaryEligibleForCurrentDistribution(beneficiaryCode) { + async isBeneficiaryEligibleForCurrentDistribution(beneficiaryCode) { const nameOfActiveDistribution = this.activeSession.nameOfLastViewedDistribution; if (nameOfActiveDistribution) { const distribution = await this.activeSession.database.distributionWithName(nameOfActiveDistribution); diff --git a/PWA/public/Services/BeneficiaryEligilityService.test.js b/PWA/public/Services/BeneficiaryEligilityService.test.js index d923940..7e70cdb 100644 --- a/PWA/public/Services/BeneficiaryEligilityService.test.js +++ b/PWA/public/Services/BeneficiaryEligilityService.test.js @@ -26,20 +26,20 @@ describe("BeneficiaryEligilityService", () => { const activeSession = await new ActiveSession(await setupDatabase()); activeSession.nameOfLastViewedDistribution = activeDistribution.distrib_name; const sut = new BeneficiaryEligilityService(activeSession); - expect(await sut.isBenificiaryEligibleForCurrentDistribution(inActiveEligibleBeneficiaryCode)).toEqual(false); + expect(await sut.isBeneficiaryEligibleForCurrentDistribution(inActiveEligibleBeneficiaryCode)).toEqual(false); }); test("When checking elible code from active distribution during active distrubtion Then eligible", async () => { const activeSession = await new ActiveSession(await setupDatabase()); activeSession.nameOfLastViewedDistribution = activeDistribution.distrib_name; const sut = new BeneficiaryEligilityService(activeSession); - expect(await sut.isBenificiaryEligibleForCurrentDistribution(activeEligibleBeneficiaryCode)).toEqual(true); + expect(await sut.isBeneficiaryEligibleForCurrentDistribution(activeEligibleBeneficiaryCode)).toEqual(true); }); test("When checking code from any distribution during inactive distrubtion Then error is thrown", async () => { const activeSession = await new ActiveSession(await setupDatabase()); activeSession.nameOfLastViewedDistribution = undefined; const sut = new BeneficiaryEligilityService(activeSession); try { - const result = await sut.isBenificiaryEligibleForCurrentDistribution("could have been any code"); + const result = await sut.isBeneficiaryEligibleForCurrentDistribution("could have been any code"); fail("Expected error"); } catch (error) { diff --git a/PWA/public/Services/BeneficiaryInfoService.js b/PWA/public/Services/BeneficiaryInfoService.js index d666ae4..bf0994b 100644 --- a/PWA/public/Services/BeneficiaryInfoService.js +++ b/PWA/public/Services/BeneficiaryInfoService.js @@ -3,10 +3,10 @@ export class BeneficiaryInfoService { this.database = database; } async beneficiaryInfoTextFromDistribution(distribution) { - const benificiaries = await this.database.benificiariesForDistribution(distribution); - const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length; - if (benificiaries.length > 0) { - return "Beneficiaries served: " + numberOfServedBenificiaries + " / " + benificiaries.length; + const beneficiaries = await this.database.benificiariesForDistribution(distribution); + const numberOfServedBeneficiaries = beneficiaries.filter(beneficiary => beneficiary.hasBeenMarkedAsReceived).length; + if (beneficiaries.length > 0) { + return "Beneficiaries served: " + numberOfServedBeneficiaries + " / " + beneficiaries.length; } else { return "No beneficiary data found"; diff --git a/PWA/public/Services/BenificiaryInfoService.js b/PWA/public/Services/BenificiaryInfoService.js deleted file mode 100644 index d666ae4..0000000 --- a/PWA/public/Services/BenificiaryInfoService.js +++ /dev/null @@ -1,15 +0,0 @@ -export class BeneficiaryInfoService { - constructor(database) { - this.database = database; - } - async beneficiaryInfoTextFromDistribution(distribution) { - const benificiaries = await this.database.benificiariesForDistribution(distribution); - const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length; - if (benificiaries.length > 0) { - return "Beneficiaries served: " + numberOfServedBenificiaries + " / " + benificiaries.length; - } - else { - return "No beneficiary data found"; - } - } -} diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index 8bfb566..97c9943 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -1,11 +1,11 @@ import { BeneficiaryDataUploadHandler } from "./FetchEventHandlers/BeneficiaryDataUploadHandler.js"; -import { ChooseBenificiaryCodeInputMethodPageHandler } from "./FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js"; +import { ChooseBeneficiaryCodeInputMethodPageHandler } from "./FetchEventHandlers/ChooseBeneficiaryCodeInputMethodPageHandler.js"; import { CreateDistributionRequestHandler } from "./FetchEventHandlers/CreateDistributionRequestHandler.js"; import { DeleteDistributionPostHandler } from "./FetchEventHandlers/DeleteDistributionPostHandler.js"; import { FetchEventHandlers } from "./FetchEventHandlers/FetchEventHandlers.js"; import { ListDistributionRequestHandler } from "./FetchEventHandlers/ListDistributionRequestHandler.js"; import { NameDistributionRequestHandler } from "./FetchEventHandlers/NameDistributionRequestHandler.js"; -import { SelectBenificiaryCodeInputMethodHandler } from "./FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js"; +import { SelectBeneficiaryCodeInputMethodHandler } from "./FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js"; import { SelectDistributionRequestHandler } from "./FetchEventHandlers/SelectDistributionRequestHandler.js"; import { UploadDataHandler } from "./FetchEventHandlers/UploadDataHandler.js"; import { Beneficiary } from "../Models/Beneficiary.js"; @@ -124,8 +124,8 @@ export class CacheFilePathService { NameDistributionRequestHandler.name, SelectDistributionRequestHandler.name, UploadDataHandler.name, - ChooseBenificiaryCodeInputMethodPageHandler.name, - SelectBenificiaryCodeInputMethodHandler.name, + ChooseBeneficiaryCodeInputMethodPageHandler.name, + SelectBeneficiaryCodeInputMethodHandler.name, BeneficiaryCodePostHandler.name, ViewDistributionDataHandler.name, CheckWhosMissingPageHandler.name, diff --git a/PWA/public/Services/Database.js b/PWA/public/Services/Database.js index 96a7b74..485729f 100644 --- a/PWA/public/Services/Database.js +++ b/PWA/public/Services/Database.js @@ -119,7 +119,7 @@ export class Database { return undefined; } } - async addBenificiary(beneficiary) { + async addBeneficiary(beneficiary) { return this.addElement(ObjectStoreName.beneficiary, beneficiary); } async setActiveDistribution(activeDistribution) { @@ -147,7 +147,7 @@ export class Database { }); const existingBeneficiary = await this.beneficiaryWithCode(beneficiary.code); if (!existingBeneficiary) { - this.addBenificiary(beneficiary); + this.addBeneficiary(beneficiary); } return this.addElement(ObjectStoreName.distributionBeneficiaries, new DistributionBeneficiary(beneficiary.code, distribution.distrib_name)); } @@ -159,8 +159,8 @@ export class Database { async keyForDistributionBeneficiary(beneficiaryCode, distributionName) { const distributionBeneficiaries = await this.readDistributionBeneficiaries(); for (let i = 0; i < distributionBeneficiaries.length; i++) { - const currentBenificiary = distributionBeneficiaries[i]; - if (currentBenificiary.distributionName == distributionName && currentBenificiary.beneficiaryCode == beneficiaryCode) { + const currentBeneficiary = distributionBeneficiaries[i]; + if (currentBeneficiary.distributionName == distributionName && currentBeneficiary.beneficiaryCode == beneficiaryCode) { return i + 1; } } diff --git a/PWA/public/Services/Database.test.js b/PWA/public/Services/Database.test.js index 0ef0a6c..0230869 100644 --- a/PWA/public/Services/Database.test.js +++ b/PWA/public/Services/Database.test.js @@ -26,7 +26,7 @@ describe('Database', () => { } }); test("When adding a beneficiary, it can be retrieved", async () => { - await sut.addBenificiary(beneficiary); + await sut.addBeneficiary(beneficiary); const receivedBeneficiary = await sut.beneficiaryWithCode(beneficiaryCode); expect(receivedBeneficiary.code).toEqual(beneficiaryCode); }); diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js index fe80b9c..ebf33d3 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js @@ -51,7 +51,7 @@ export class BeneficiaryCodePostHandler extends ActiveSessionContainer { const beneficiary = await this.activeSession.database.beneficiaryWithCode(beneficiaryCode); if (beneficiary) { return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.codeInputFound, { - eligibility_info_box_id: await this.eligebilityService.isBenificiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "noteligible", + eligibility_info_box_id: await this.eligebilityService.isBeneficiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "noteligible", eligibility_info_name: beneficiary.code, eligibility_info_values: beneficiary.values, }); diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js index b04b785..8461ead 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js @@ -15,15 +15,15 @@ export class BeneficiaryDataUploadHandler extends ActiveSessionContainer { if (distributionName) { const distribution = await database.distributionWithName(distributionName); if (distribution) { - await beneficiaries.forEach(async (beneficiary) => await database.addBenificiary(beneficiary)); + await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiary(beneficiary)); await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiaryToDistribution(beneficiary, distribution)); this.activeSession.nameOfLastViewedDistribution = distributionName; - const benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); + const beneficiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); return await ResponseTools.replaceTemplateKeysWithValues(await ResponseTools.wrapInHtmlTemplate(RouteEvents.distributionsHome), { "distrib_name": distribution.distrib_name, "distrib_place": distribution.distrib_place, "distrib_date": distribution.distrib_date, - beneficiary_info: await benificiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) + beneficiary_info: await beneficiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) }); } else { diff --git a/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js b/PWA/public/Services/FetchEventHandlers/ChooseBeneficiaryCodeInputMethodPageHandler.js similarity index 86% rename from PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js rename to PWA/public/Services/FetchEventHandlers/ChooseBeneficiaryCodeInputMethodPageHandler.js index c6102c6..64dafd0 100644 --- a/PWA/public/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js +++ b/PWA/public/Services/FetchEventHandlers/ChooseBeneficiaryCodeInputMethodPageHandler.js @@ -1,6 +1,6 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; -export class ChooseBenificiaryCodeInputMethodPageHandler { +export class ChooseBeneficiaryCodeInputMethodPageHandler { canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.chooseBeneficiaryCodeInputMethod); } diff --git a/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js index 1b99922..628ac1e 100644 --- a/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js @@ -7,7 +7,7 @@ import { DateService } from "../DateService.js"; export class CreateDistributionRequestHandler extends ActiveSessionContainer { constructor() { super(...arguments); - this.benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); + this.beneficiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); } canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.postCreateDistribution); @@ -30,7 +30,7 @@ export class CreateDistributionRequestHandler extends ActiveSessionContainer { "distrib_name": distribution.distrib_name, "distrib_place": distribution.distrib_place, "distrib_date": distribution.distrib_date, - beneficiary_info: await this.benificiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) + beneficiary_info: await this.beneficiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) }); } catch (error) { diff --git a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js index aee2c70..ecc98c4 100644 --- a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js +++ b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js @@ -6,8 +6,8 @@ import { DeleteDistributionRequestHandler } from "./DeleteDistributionRequestHan import { UploadDataHandler } from "./UploadDataHandler.js"; import { BeneficiaryDataUploadHandler } from "./BeneficiaryDataUploadHandler.js"; import { DeleteDistributionPostHandler } from "./DeleteDistributionPostHandler.js"; -import { ChooseBenificiaryCodeInputMethodPageHandler } from "./ChooseBenificiaryCodeInputMethodPageHandler.js"; -import { SelectBenificiaryCodeInputMethodHandler } from "./SelectBenificiaryCodeInputMethodHandler.js"; +import { ChooseBeneficiaryCodeInputMethodPageHandler } from "./ChooseBeneficiaryCodeInputMethodPageHandler.js"; +import { SelectBeneficiaryCodeInputMethodHandler } from "./SelectBeneficiaryCodeInputMethodHandler.js"; import { ViewDistributionDataHandler } from "./ViewDistributionDataHandler.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { BeneficiaryCodePostHandler } from "./BeneficiaryCodePostHandler.js"; @@ -28,8 +28,8 @@ export class FetchEventHandlers extends ActiveSessionContainer { new DeleteDistributionPostHandler(this.activeSession), new UploadDataHandler(), new BeneficiaryDataUploadHandler(this.activeSession), - new ChooseBenificiaryCodeInputMethodPageHandler(), - new SelectBenificiaryCodeInputMethodHandler(this.activeSession), + new ChooseBeneficiaryCodeInputMethodPageHandler(), + new SelectBeneficiaryCodeInputMethodHandler(this.activeSession), new BeneficiaryCodePostHandler(this.activeSession), new ViewDistributionDataHandler(this.activeSession), new CheckWhosMissingPageHandler(this.activeSession), diff --git a/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js b/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js index aa15aec..69a14cd 100644 --- a/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/MarkAsReceivedPostHandler.js @@ -23,7 +23,7 @@ export class MarkAsReceivedPostHandler extends ActiveSessionContainer { } } else { - return Promise.reject(new Error("Expected benificiarycode")); + return Promise.reject(new Error("Expected beneficiarycode")); } if (this.activeSession.nameOfLastUsedDistributionInputMethod) { return ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod(this.activeSession.nameOfLastUsedDistributionInputMethod)); diff --git a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js b/PWA/public/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js similarity index 95% rename from PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js rename to PWA/public/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js index 6ec3b90..f10977d 100644 --- a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js +++ b/PWA/public/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js @@ -2,7 +2,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { ResponseTools } from "../ResponseTools.js"; -export class SelectBenificiaryCodeInputMethodHandler extends ActiveSessionContainer { +export class SelectBeneficiaryCodeInputMethodHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.selectBeneficiaryCodeInputMethod); } diff --git a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler copy.js b/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler copy.js deleted file mode 100644 index 8aab629..0000000 --- a/PWA/public/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler copy.js +++ /dev/null @@ -1,29 +0,0 @@ -import { RouteEvents } from "../../RouteEvents.js"; -import { DeserialisationService } from "../DeserialisationService.js"; -import { ResponseTools } from "../ResponseTools.js"; -export class SelectBenificiaryCodeInputMethodHandler { - canHandleEvent(event) { - return event.request.url.endsWith(RouteEvents.selectBenificiaryCodeInputMethod); - } - async handleEvent(event) { - try { - const post = await DeserialisationService.deserializeFormDataFromRequest(event.request); - return ResponseTools.wrapInHtmlTemplate(this.templatepageForInputMethod(post.input_method)); - } - catch (error) { - console.error(error); - return fetch(RouteEvents.home); - } - } - templatepageForInputMethod(inputMethod) { - if (inputMethod == "video") { - return RouteEvents.codeInputUsingCamera; - } - else if (inputMethod == "text") { - return RouteEvents.codeinputUsingTextField; - } - else { - throw "Unexpected input method: " + inputMethod; - } - } -} diff --git a/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js index f98a7f5..939cd54 100644 --- a/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js @@ -6,7 +6,7 @@ import { ActiveSessionContainer } from "../ActiveSession.js"; export class SelectDistributionRequestHandler extends ActiveSessionContainer { constructor() { super(...arguments); - this.benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); + this.beneficiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); } canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.postSelectDistribution); @@ -20,7 +20,7 @@ export class SelectDistributionRequestHandler extends ActiveSessionContainer { "distrib_name": selectedDistribution.distrib_name, "distrib_place": selectedDistribution.distrib_place, "distrib_date": selectedDistribution.distrib_date, - beneficiary_info: await this.benificiaryInfoService.beneficiaryInfoTextFromDistribution(selectedDistribution) + beneficiary_info: await this.beneficiaryInfoService.beneficiaryInfoTextFromDistribution(selectedDistribution) }); } else { diff --git a/PWA/public/sw.js b/PWA/public/sw.js index 33ff7d3..538af96 100644 --- a/PWA/public/sw.js +++ b/PWA/public/sw.js @@ -50,6 +50,9 @@ self.addEventListener("activate", function (event) { return caches.delete(key); } })); + }) + .catch((error) => { + console.error("Promise rejected with:", error); })); return self.clients.claim(); }); diff --git a/PWA/src/Services/BeneficiariesService.test.ts b/PWA/src/Services/BeneficiariesService.test.ts index 7001712..c7ffacf 100644 --- a/PWA/src/Services/BeneficiariesService.test.ts +++ b/PWA/src/Services/BeneficiariesService.test.ts @@ -57,8 +57,8 @@ describe('BeneficiariesService', () => { const distributions = await database.readDistributions() console.log(distributions) await database.addDistribution(existingDistribution) - await database.addBenificiary(beneficiary1) - await database.addBenificiary(beneficiary2) + await database.addBeneficiary(beneficiary1) + await database.addBeneficiary(beneficiary2) await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution) await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution) const beneficiaries = await sut.beneficiariesForActiveDistribution() @@ -72,8 +72,8 @@ describe('BeneficiariesService', () => { const distributions = await database.readDistributions() console.log(distributions) await database.addDistribution(existingDistribution) - await database.addBenificiary(beneficiary1) - await database.addBenificiary(beneficiary2) + await database.addBeneficiary(beneficiary1) + await database.addBeneficiary(beneficiary2) await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution) await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution) const eligibleBeneficiaries = await sut.eligibleBeneficiariesForActiveDistribution() @@ -86,8 +86,8 @@ describe('BeneficiariesService', () => { const distributions = await database.readDistributions() console.log(distributions) await database.addDistribution(existingDistribution) - await database.addBenificiary(beneficiary1) - await database.addBenificiary(beneficiary2) + await database.addBeneficiary(beneficiary1) + await database.addBeneficiary(beneficiary2) await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution) await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution) diff --git a/PWA/src/Services/BeneficiaryEligilityService.test.ts b/PWA/src/Services/BeneficiaryEligilityService.test.ts index 417e1c4..b31b13e 100644 --- a/PWA/src/Services/BeneficiaryEligilityService.test.ts +++ b/PWA/src/Services/BeneficiaryEligilityService.test.ts @@ -55,7 +55,7 @@ describe("BeneficiaryEligilityService", () => { activeSession.nameOfLastViewedDistribution = activeDistribution.distrib_name; const sut = new BeneficiaryEligilityService(activeSession); expect( - await sut.isBenificiaryEligibleForCurrentDistribution( + await sut.isBeneficiaryEligibleForCurrentDistribution( inActiveEligibleBeneficiaryCode ) ).toEqual(false); @@ -66,7 +66,7 @@ describe("BeneficiaryEligilityService", () => { activeSession.nameOfLastViewedDistribution = activeDistribution.distrib_name; const sut = new BeneficiaryEligilityService(activeSession); expect( - await sut.isBenificiaryEligibleForCurrentDistribution( + await sut.isBeneficiaryEligibleForCurrentDistribution( activeEligibleBeneficiaryCode ) ).toEqual(true); @@ -77,7 +77,7 @@ describe("BeneficiaryEligilityService", () => { activeSession.nameOfLastViewedDistribution = undefined; const sut = new BeneficiaryEligilityService(activeSession); try { - const result = await sut.isBenificiaryEligibleForCurrentDistribution( + const result = await sut.isBeneficiaryEligibleForCurrentDistribution( "could have been any code" ); fail("Expected error"); diff --git a/PWA/src/Services/BeneficiaryEligilityService.ts b/PWA/src/Services/BeneficiaryEligilityService.ts index baf328a..0b959e4 100644 --- a/PWA/src/Services/BeneficiaryEligilityService.ts +++ b/PWA/src/Services/BeneficiaryEligilityService.ts @@ -8,7 +8,7 @@ export class BeneficiaryEligilityService { this.activeSession = activeSession } - async isBenificiaryEligibleForCurrentDistribution(beneficiaryCode: string | undefined): Promise { + async isBeneficiaryEligibleForCurrentDistribution(beneficiaryCode: string | undefined): Promise { const nameOfActiveDistribution = this.activeSession.nameOfLastViewedDistribution if(nameOfActiveDistribution) { const distribution = await this.activeSession.database.distributionWithName(nameOfActiveDistribution) diff --git a/PWA/src/Services/BeneficiaryInfoService.ts b/PWA/src/Services/BeneficiaryInfoService.ts index 4b4a812..0687c75 100644 --- a/PWA/src/Services/BeneficiaryInfoService.ts +++ b/PWA/src/Services/BeneficiaryInfoService.ts @@ -11,10 +11,10 @@ export class BeneficiaryInfoService { } async beneficiaryInfoTextFromDistribution(distribution: Distribution): Promise { - const benificiaries: DistributionBeneficiary[] = await this.database.benificiariesForDistribution(distribution) - const numberOfServedBenificiaries = benificiaries.filter(benificiary => benificiary.hasBeenMarkedAsReceived).length - if(benificiaries.length > 0) { - return "Beneficiaries served: " + numberOfServedBenificiaries +" / " + benificiaries.length + const beneficiaries: DistributionBeneficiary[] = await this.database.benificiariesForDistribution(distribution) + const numberOfServedBeneficiaries = beneficiaries.filter(beneficiary => beneficiary.hasBeenMarkedAsReceived).length + if(beneficiaries.length > 0) { + return "Beneficiaries served: " + numberOfServedBeneficiaries +" / " + beneficiaries.length } else { return "No beneficiary data found" } diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts index af23f0e..5283e48 100644 --- a/PWA/src/Services/CacheFilePathService.ts +++ b/PWA/src/Services/CacheFilePathService.ts @@ -1,11 +1,11 @@ import { BeneficiaryDataUploadHandler } from "./FetchEventHandlers/BeneficiaryDataUploadHandler.js"; -import { ChooseBenificiaryCodeInputMethodPageHandler } from "./FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.js"; +import { ChooseBeneficiaryCodeInputMethodPageHandler } from "./FetchEventHandlers/ChooseBeneficiaryCodeInputMethodPageHandler.js"; import { CreateDistributionRequestHandler } from "./FetchEventHandlers/CreateDistributionRequestHandler.js"; import { DeleteDistributionPostHandler } from "./FetchEventHandlers/DeleteDistributionPostHandler.js"; import { FetchEventHandlers } from "./FetchEventHandlers/FetchEventHandlers.js"; import { ListDistributionRequestHandler } from "./FetchEventHandlers/ListDistributionRequestHandler.js"; import { NameDistributionRequestHandler } from "./FetchEventHandlers/NameDistributionRequestHandler.js"; -import { SelectBenificiaryCodeInputMethodHandler } from "./FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.js"; +import { SelectBeneficiaryCodeInputMethodHandler } from "./FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js"; import { SelectDistributionRequestHandler } from "./FetchEventHandlers/SelectDistributionRequestHandler.js"; import { UploadDataHandler } from "./FetchEventHandlers/UploadDataHandler.js"; import { Beneficiary } from "../Models/Beneficiary.js"; @@ -137,8 +137,8 @@ export class CacheFilePathService { NameDistributionRequestHandler.name, SelectDistributionRequestHandler.name, UploadDataHandler.name, - ChooseBenificiaryCodeInputMethodPageHandler.name, - SelectBenificiaryCodeInputMethodHandler.name, + ChooseBeneficiaryCodeInputMethodPageHandler.name, + SelectBeneficiaryCodeInputMethodHandler.name, BeneficiaryCodePostHandler.name, ViewDistributionDataHandler.name, CheckWhosMissingPageHandler.name, diff --git a/PWA/src/Services/Database.test.ts b/PWA/src/Services/Database.test.ts index 871d122..f2ef998 100644 --- a/PWA/src/Services/Database.test.ts +++ b/PWA/src/Services/Database.test.ts @@ -35,7 +35,7 @@ describe('Database', () => { }) test("When adding a beneficiary, it can be retrieved", async () => { - await sut.addBenificiary(beneficiary) + await sut.addBeneficiary(beneficiary) const receivedBeneficiary: any = await sut.beneficiaryWithCode(beneficiaryCode) expect( receivedBeneficiary.code diff --git a/PWA/src/Services/Database.ts b/PWA/src/Services/Database.ts index 494167c..ced3077 100644 --- a/PWA/src/Services/Database.ts +++ b/PWA/src/Services/Database.ts @@ -156,7 +156,7 @@ export class Database { } } - async addBenificiary(beneficiary: Beneficiary): Promise { + async addBeneficiary(beneficiary: Beneficiary): Promise { return this.addElement(ObjectStoreName.beneficiary, beneficiary); } @@ -195,7 +195,7 @@ export class Database { beneficiary.code ); if (!existingBeneficiary) { - this.addBenificiary(beneficiary); + this.addBeneficiary(beneficiary); } return this.addElement( @@ -214,8 +214,8 @@ export class Database { private async keyForDistributionBeneficiary(beneficiaryCode: string, distributionName: string): Promise { const distributionBeneficiaries = await this.readDistributionBeneficiaries(); for (let i = 0; i < distributionBeneficiaries.length; i++) { - const currentBenificiary = distributionBeneficiaries[i] - if (currentBenificiary.distributionName == distributionName && currentBenificiary.beneficiaryCode == beneficiaryCode) { + const currentBeneficiary = distributionBeneficiaries[i] + if (currentBeneficiary.distributionName == distributionName && currentBeneficiary.beneficiaryCode == beneficiaryCode) { return i + 1; } } diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts index 580d3a8..be8fe12 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryCodePostHandler.ts @@ -56,7 +56,7 @@ export class BeneficiaryCodePostHandler extends ActiveSessionContainer implement if(beneficiary) { return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues( RouteEvents.codeInputFound, { - eligibility_info_box_id: await this.eligebilityService.isBenificiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "noteligible", + eligibility_info_box_id: await this.eligebilityService.isBeneficiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "noteligible", eligibility_info_name: beneficiary.code, eligibility_info_values: beneficiary.values, } diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts index 72c51da..e440de4 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts @@ -19,16 +19,16 @@ export class BeneficiaryDataUploadHandler extends ActiveSessionContainer impleme if(distributionName) { const distribution = await database.distributionWithName(distributionName) if(distribution) { - await beneficiaries.forEach(async (beneficiary) => await database.addBenificiary(beneficiary)) + await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiary(beneficiary)) await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiaryToDistribution(beneficiary, distribution)) this.activeSession.nameOfLastViewedDistribution = distributionName - const benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) + const beneficiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) return await ResponseTools.replaceTemplateKeysWithValues(await ResponseTools.wrapInHtmlTemplate(RouteEvents.distributionsHome), { "distrib_name": distribution.distrib_name, "distrib_place": distribution.distrib_place, "distrib_date": distribution.distrib_date, - beneficiary_info: await benificiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) + beneficiary_info: await beneficiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) }); } else { throw "Expeced distribution named " + distributionName diff --git a/PWA/src/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.ts b/PWA/src/Services/FetchEventHandlers/ChooseBeneficiaryCodeInputMethodPageHandler.ts similarity index 90% rename from PWA/src/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.ts rename to PWA/src/Services/FetchEventHandlers/ChooseBeneficiaryCodeInputMethodPageHandler.ts index 5b5665e..0ff6dab 100644 --- a/PWA/src/Services/FetchEventHandlers/ChooseBenificiaryCodeInputMethodPageHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/ChooseBeneficiaryCodeInputMethodPageHandler.ts @@ -3,7 +3,7 @@ import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; -export class ChooseBenificiaryCodeInputMethodPageHandler implements FetchEventHandler { +export class ChooseBeneficiaryCodeInputMethodPageHandler implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.chooseBeneficiaryCodeInputMethod); } diff --git a/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts index 07fb181..5e7f6d6 100644 --- a/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/CreateDistributionRequestHandler.ts @@ -9,7 +9,7 @@ import { ActiveSessionContainer } from "../ActiveSession.js"; import { DateService } from "../DateService.js"; export class CreateDistributionRequestHandler extends ActiveSessionContainer implements FetchEventHandler { - benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) + beneficiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.postCreateDistribution); @@ -39,7 +39,7 @@ export class CreateDistributionRequestHandler extends ActiveSessionContainer imp "distrib_name": distribution.distrib_name, "distrib_place": distribution.distrib_place, "distrib_date": distribution.distrib_date, - beneficiary_info: await this.benificiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) + beneficiary_info: await this.beneficiaryInfoService.beneficiaryInfoTextFromDistribution(distribution) } ) } catch(error) { diff --git a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts index 8d2472f..0a8a8ac 100644 --- a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts +++ b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts @@ -8,8 +8,8 @@ import { DeleteDistributionRequestHandler } from "./DeleteDistributionRequestHan import { UploadDataHandler } from "./UploadDataHandler.js"; import { BeneficiaryDataUploadHandler } from "./BeneficiaryDataUploadHandler.js" import { DeleteDistributionPostHandler } from "./DeleteDistributionPostHandler.js"; -import { ChooseBenificiaryCodeInputMethodPageHandler } from "./ChooseBenificiaryCodeInputMethodPageHandler.js"; -import { SelectBenificiaryCodeInputMethodHandler } from "./SelectBenificiaryCodeInputMethodHandler.js"; +import { ChooseBeneficiaryCodeInputMethodPageHandler } from "./ChooseBeneficiaryCodeInputMethodPageHandler.js"; +import { SelectBeneficiaryCodeInputMethodHandler } from "./SelectBeneficiaryCodeInputMethodHandler.js"; import { ViewDistributionDataHandler } from "./ViewDistributionDataHandler.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { BeneficiaryCodePostHandler } from "./BeneficiaryCodePostHandler.js"; @@ -29,8 +29,8 @@ export class FetchEventHandlers extends ActiveSessionContainer implements FetchE new DeleteDistributionPostHandler(this.activeSession), new UploadDataHandler(), new BeneficiaryDataUploadHandler(this.activeSession), - new ChooseBenificiaryCodeInputMethodPageHandler(), - new SelectBenificiaryCodeInputMethodHandler(this.activeSession), + new ChooseBeneficiaryCodeInputMethodPageHandler(), + new SelectBeneficiaryCodeInputMethodHandler(this.activeSession), new BeneficiaryCodePostHandler(this.activeSession), new ViewDistributionDataHandler(this.activeSession), new CheckWhosMissingPageHandler(this.activeSession), diff --git a/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts b/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts index 8e7c53c..c11ac2a 100644 --- a/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/MarkAsReceivedPostHandler.ts @@ -27,7 +27,7 @@ export class MarkAsReceivedPostHandler extends ActiveSessionContainer implements return Promise.reject(new Error("Expected active distribution")) } } else { - return Promise.reject(new Error("Expected benificiarycode")) + return Promise.reject(new Error("Expected beneficiarycode")) } if(this.activeSession.nameOfLastUsedDistributionInputMethod) { diff --git a/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts b/PWA/src/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.ts similarity index 96% rename from PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts rename to PWA/src/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.ts index 6689f3e..51c5124 100644 --- a/PWA/src/Services/FetchEventHandlers/SelectBenificiaryCodeInputMethodHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.ts @@ -6,7 +6,7 @@ import { ActiveSessionContainer } from "../ActiveSession.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { ResponseTools } from "../ResponseTools.js"; -export class SelectBenificiaryCodeInputMethodHandler extends ActiveSessionContainer implements FetchEventHandler { +export class SelectBeneficiaryCodeInputMethodHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.selectBeneficiaryCodeInputMethod); } diff --git a/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts index a59b8f2..5ada5da 100644 --- a/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/SelectDistributionRequestHandler.ts @@ -8,7 +8,7 @@ import { BeneficiaryInfoService } from "../BeneficiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; export class SelectDistributionRequestHandler extends ActiveSessionContainer implements FetchEventHandler { - benificiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) + beneficiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.postSelectDistribution); @@ -25,7 +25,7 @@ export class SelectDistributionRequestHandler extends ActiveSessionContainer imp "distrib_name": selectedDistribution.distrib_name, "distrib_place": selectedDistribution.distrib_place, "distrib_date": selectedDistribution.distrib_date, - beneficiary_info: await this.benificiaryInfoService.beneficiaryInfoTextFromDistribution(selectedDistribution) + beneficiary_info: await this.beneficiaryInfoService.beneficiaryInfoTextFromDistribution(selectedDistribution) } ) } else { From f5288957d5a3aeddeaf77a3528f89826b7912a35 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:08:48 +0200 Subject: [PATCH 37/99] Make sure ChechWhosMissingPagehandler file has correct casing --- PWA/public/Services/CacheFilePathService.js | 2 +- .../Services/FetchEventHandlers/CheckWhosMissingPagehandler.js | 3 +-- PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js | 2 +- PWA/src/Services/CacheFilePathService.ts | 2 +- .../Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts | 2 +- PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index 97c9943..84acef5 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -23,7 +23,7 @@ import { ActiveSession } from "./ActiveSession.js"; import { BeneficiaryEligilityService } from "./BeneficiaryEligilityService.js"; import { ViewDistributionDataHandler } from "./FetchEventHandlers/ViewDistributionDataHandler.js"; import { BeneficiariesService } from "./BeneficiariesService.js"; -import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissingPagehandler.js"; +import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissingPageHandler.js"; import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; import { DateService } from "./DateService.js"; diff --git a/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js b/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js index 423d515..4a8f660 100644 --- a/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js +++ b/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js @@ -9,8 +9,7 @@ export class CheckWhosMissingPageHandler extends ActiveSessionContainer { async handleEvent(event) { const beneficiariesService = new BeneficiariesService(this.activeSession); const beneficiaries = await beneficiariesService.eligibleBeneficiariesForActiveDistribution(); - console.log("Will display:"); - console.log(beneficiaries); + console.log("Will display:", beneficiaries); if (beneficiaries.length > 0) { return await ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.viewData, { columns: this.columnsFromBeneficiaries(beneficiaries), diff --git a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js index ecc98c4..ce260bc 100644 --- a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js +++ b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js @@ -11,7 +11,7 @@ import { SelectBeneficiaryCodeInputMethodHandler } from "./SelectBeneficiaryCode import { ViewDistributionDataHandler } from "./ViewDistributionDataHandler.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { BeneficiaryCodePostHandler } from "./BeneficiaryCodePostHandler.js"; -import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPagehandler.js"; +import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPageHandler.js"; import { MarkAsReceivedPostHandler } from "./MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./HomepageHandler.js"; import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts index 5283e48..ed3154f 100644 --- a/PWA/src/Services/CacheFilePathService.ts +++ b/PWA/src/Services/CacheFilePathService.ts @@ -23,7 +23,7 @@ import { ActiveSession } from "./ActiveSession.js"; import { BeneficiaryEligilityService } from "./BeneficiaryEligilityService.js"; import { ViewDistributionDataHandler } from "./FetchEventHandlers/ViewDistributionDataHandler.js"; import { BeneficiariesService } from "./BeneficiariesService.js"; -import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissingPagehandler.js"; +import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissingPageHandler.js"; import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; import { DateService } from "./DateService.js"; diff --git a/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts b/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts index a51e951..76d7903 100644 --- a/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts +++ b/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts @@ -10,7 +10,7 @@ export class CheckWhosMissingPageHandler extends ActiveSessionContainer implemen canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.checkWhosMissing); } - + async handleEvent(event: FetchEvent): Promise { const beneficiariesService = new BeneficiariesService(this.activeSession); const beneficiaries = await beneficiariesService.eligibleBeneficiariesForActiveDistribution(); diff --git a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts index 0a8a8ac..cad73a0 100644 --- a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts +++ b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts @@ -13,7 +13,7 @@ import { SelectBeneficiaryCodeInputMethodHandler } from "./SelectBeneficiaryCode import { ViewDistributionDataHandler } from "./ViewDistributionDataHandler.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { BeneficiaryCodePostHandler } from "./BeneficiaryCodePostHandler.js"; -import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPagehandler.js"; +import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPageHandler.js"; import { MarkAsReceivedPostHandler } from "./MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./HomepageHandler.js"; import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; From efe4ce6d314f04d9167474c0bbe78a7678a3e91d Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:12:49 +0200 Subject: [PATCH 38/99] Revert "Make it more clear which file is cached and wether or not is has succeeded" This reverts commit d63fdcfc5f944934f32a61a7261aaa610546b6f5. --- PWA/public/sw.js | 23 +++-------------------- PWA/src/sw.ts | 24 +++--------------------- 2 files changed, 6 insertions(+), 41 deletions(-) diff --git a/PWA/public/sw.js b/PWA/public/sw.js index 538af96..553c12e 100644 --- a/PWA/public/sw.js +++ b/PWA/public/sw.js @@ -9,36 +9,19 @@ self.addEventListener("install", function (event) { console.log("ℹ️ Installing Service Worker ...", event); console.log(new CacheFilePathService().pathsOfFilesToCache()); event.waitUntil(caches.open(CACHE_STATIC_NAME) - .then(async (cache) => { + .then(function (cache) { console.log("ℹ️ Precaching App Shell.."); - const urlsToCache = [ + cache.addAll([ "/", "/favicon.ico", "/manifest.json", "/apple-touch-icon.png", "/apple-touch-icon-precomposed.png" ] - .concat(new CacheFilePathService().pathsOfFilesToCache()); - for (const url of urlsToCache) { - try { - const response = await fetch(url); - if (!response.ok) { - console.error(`Failed to fetch ${url}: ${response.statusText}`); - } - else { - await cache.put(url, response); - console.log(`Cached: ${url}`); - } - } - catch (error) { - console.error(`Error fetching ${url}:`, error); - } - } + .concat(new CacheFilePathService().pathsOfFilesToCache())); }) .then(() => { console.log("ℹ️ Serviceworker installed ✅"); - }).catch((error) => { - console.error("Promise rejected with:", error); })); }); self.addEventListener("activate", function (event) { diff --git a/PWA/src/sw.ts b/PWA/src/sw.ts index 990fce4..a7288c5 100644 --- a/PWA/src/sw.ts +++ b/PWA/src/sw.ts @@ -13,9 +13,9 @@ self.addEventListener("install", function (event: any) { console.log(new CacheFilePathService().pathsOfFilesToCache()) event.waitUntil( caches.open(CACHE_STATIC_NAME) - .then(async (cache) => { + .then(function (cache) { console.log("ℹ️ Precaching App Shell.."); - const urlsToCache = [ + cache.addAll([ "/", "/favicon.ico", "/manifest.json", @@ -23,25 +23,10 @@ self.addEventListener("install", function (event: any) { "/apple-touch-icon-precomposed.png" ] .concat(new CacheFilePathService().pathsOfFilesToCache()) - - for (const url of urlsToCache) { - try { - const response = await fetch(url); - if (!response.ok) { - console.error(`Failed to fetch ${url}: ${response.statusText}`); - } else { - await cache.put(url, response); - console.log(`Cached: ${url}`); - } - } catch (error) { - console.error(`Error fetching ${url}:`, error); - } - } + ); }) .then(() => { console.log("ℹ️ Serviceworker installed ✅") - }).catch((error) => { - console.error("Promise rejected with:", error); }) ); }); @@ -59,9 +44,6 @@ self.addEventListener("activate", function (event: any) { }) ); }) - .catch((error) => { - console.error("Promise rejected with:", error); - }) ); return (self as any).clients.claim(); }); From 25310ea53d729b6eae54e090bd0de43c6b542373 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Thu, 3 Oct 2024 09:35:30 +0200 Subject: [PATCH 39/99] Add missing images to cache --- .../apple-touch-icon-120x120-precomposed.png | Bin 0 -> 14761 bytes PWA/public/apple-touch-icon-120x120.png | Bin 0 -> 14761 bytes PWA/src/sw.ts | 5 ++++- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 PWA/public/apple-touch-icon-120x120-precomposed.png create mode 100644 PWA/public/apple-touch-icon-120x120.png diff --git a/PWA/public/apple-touch-icon-120x120-precomposed.png b/PWA/public/apple-touch-icon-120x120-precomposed.png new file mode 100644 index 0000000000000000000000000000000000000000..f45a89f45ad735aa0729f6ebe22a57dfd9b453e2 GIT binary patch literal 14761 zcmZ|019T_f(l+{w?TM3#ZQJ(5_QbaB%*3{B{$kq`+qR86|8vfL-?Q#_zwWiWYF9l^ z)kd$?y}I{~_#rQW0E+_)000oABt@0}O80*XH00ka*H8A@zXIG$NKOab&T z20(zI0>J)iAb(E)2oB(%Xn!?;Gzjkh=t>}z|G|I)0AUsY@c&@6{>pz2$-m_v&c7vC zF3A5z%mw`)w0kbt|LXtH-j+Ep{t6g-NlhmJ01oY+0s=_S!~y_7nJrW_oHgWRxsB~? z=na3`8JW<#+t~lZ0`R(X|5a^FoDB)xZLDpbxZU}P|ApZGtN&wWASV15#Mz3ESVQgy zp@^NM2_ZW@BRwNAKP(|3A+O_4Q*I?u@&C~O*7%6cot^Eu85rE$-00m{=9E61(sp{ldJq8xbYlB{QX$M`+wf)FaV{alX>V!Prk(>G6N*?MRP#=GL{@_97NGH!DQ6cA zG|u)w!rmaX1Cm~i&X=>o7UjnVyR@-G{Xa6xOAunj60sglD1HJAIB$mf&|v-4s! zQC$Q9?cREpKO!%!Xp$nyILjqno3w;?8zfl?Ib8FHI7oH?HNM*P#7sgYZN}Vu1zt|8 z$o@eyYE??9&Qy*MlrUP0RmpL)P$Mh%CNxoYb|l_2BzwUn=|L(Qz0YJ#2gqU< z4Q3hr<&G6*IefK2W<3#Zv_Zpjl9{I7gj-RSbxV0LkVl#*oKYZy9lVBMgnA zb6WlgWL6#yS90Ee=WybM`>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i`vcHd-zDbBm(NqyfOhOyg484|lXklIJ7 zD&8o~6ahNQfYe96dbl8ZD|B*`$Sj50+%FMxehy1)KRT*DL!Sc1D73GZ|fxnR{e0pLqF=qf!aXtS8eut*+P?vLEc`A0FU`*kVSw$F{)Tcg%+ zktrW)mN@BjBvlo@7GMXx+DO_2Yha~!_kS1eyyX%60+4Gb-2qy{;I@n4F|`~4Qe8Cl7j?Ru=Cd(h-@5sm>1;v9 z9s=xedPmi~J=!(z zC!19|d?Dr4KOBRgY?NLi2@&Xo?aFm{W(dy=KqmKCZ9GB``)0I$V)O4!Cmu&EVJQYyy8; z3^adiGiZ$G5kMY7&H31Y!JFn~xU#@K;1+gFBp#oSm}GFhRlDFn7n<-~Zar*jv$bD& z_-6_Iv8Sq3A{wvbPVuSQ$U5~RU|hfh`$FkqqQKAvS(&_qs_52L2{}IW8XD26zNHCk z9jShQ2JyVjT}4Df{&huHMgZb%_tJe?^mm6=Tf_4v#`PD-)|Ut=*Ke+-e>NaWiOGvr I3mXLfKLIa1YybcN literal 0 HcmV?d00001 diff --git a/PWA/public/apple-touch-icon-120x120.png b/PWA/public/apple-touch-icon-120x120.png new file mode 100644 index 0000000000000000000000000000000000000000..f45a89f45ad735aa0729f6ebe22a57dfd9b453e2 GIT binary patch literal 14761 zcmZ|019T_f(l+{w?TM3#ZQJ(5_QbaB%*3{B{$kq`+qR86|8vfL-?Q#_zwWiWYF9l^ z)kd$?y}I{~_#rQW0E+_)000oABt@0}O80*XH00ka*H8A@zXIG$NKOab&T z20(zI0>J)iAb(E)2oB(%Xn!?;Gzjkh=t>}z|G|I)0AUsY@c&@6{>pz2$-m_v&c7vC zF3A5z%mw`)w0kbt|LXtH-j+Ep{t6g-NlhmJ01oY+0s=_S!~y_7nJrW_oHgWRxsB~? z=na3`8JW<#+t~lZ0`R(X|5a^FoDB)xZLDpbxZU}P|ApZGtN&wWASV15#Mz3ESVQgy zp@^NM2_ZW@BRwNAKP(|3A+O_4Q*I?u@&C~O*7%6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", "/manifest.json", "/apple-touch-icon.png", - "/apple-touch-icon-precomposed.png" + "/apple-touch-icon-precomposed.png", + "/images/icons/app-icon-192x192.png", + "/apple-touch-icon-120x120.png", + "/apple-touch-icon-120x120-precomposed.png" ] .concat(new CacheFilePathService().pathsOfFilesToCache()) ); From ff7310682fc05702e7a5553cd994df224c871d41 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:18:31 +0200 Subject: [PATCH 40/99] Improve error logging --- PWA/public/app.js | 3 +++ PWA/public/sw.js | 11 +++++++---- PWA/src/app.ts | 5 ++++- PWA/src/sw.ts | 3 +++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/PWA/public/app.js b/PWA/public/app.js index 8aeaed3..3e75dd4 100644 --- a/PWA/public/app.js +++ b/PWA/public/app.js @@ -5,6 +5,9 @@ if ('serviceWorker' in navigator) { .register('/sw.js', { type: 'module' }) .then(function () { console.info('Service worker registered!'); + }) + .catch((error) => { + console.error('Failed to register service worker', error); }); } else { diff --git a/PWA/public/sw.js b/PWA/public/sw.js index 553c12e..8b4ee81 100644 --- a/PWA/public/sw.js +++ b/PWA/public/sw.js @@ -16,12 +16,18 @@ self.addEventListener("install", function (event) { "/favicon.ico", "/manifest.json", "/apple-touch-icon.png", - "/apple-touch-icon-precomposed.png" + "/apple-touch-icon-precomposed.png", + "/images/icons/app-icon-192x192.png", + "/apple-touch-icon-120x120.png", + "/apple-touch-icon-120x120-precomposed.png" ] .concat(new CacheFilePathService().pathsOfFilesToCache())); }) .then(() => { console.log("ℹ️ Serviceworker installed ✅"); + }) + .catch((error) => { + console.error('Failed to install service worker:', error); })); }); self.addEventListener("activate", function (event) { @@ -33,9 +39,6 @@ self.addEventListener("activate", function (event) { return caches.delete(key); } })); - }) - .catch((error) => { - console.error("Promise rejected with:", error); })); return self.clients.claim(); }); diff --git a/PWA/src/app.ts b/PWA/src/app.ts index b157fe4..bf8dc39 100644 --- a/PWA/src/app.ts +++ b/PWA/src/app.ts @@ -4,7 +4,10 @@ if ('serviceWorker' in navigator) { .register('/sw.js', { type: 'module' }) .then(function() { console.info('Service worker registered!'); - }); + }) + .catch((error) => { + console.error('Failed to register service worker', error); + }); } else { console.error('Service worker not supported in this browser..') } \ No newline at end of file diff --git a/PWA/src/sw.ts b/PWA/src/sw.ts index a4404e7..2d4292c 100644 --- a/PWA/src/sw.ts +++ b/PWA/src/sw.ts @@ -31,6 +31,9 @@ self.addEventListener("install", function (event: any) { .then(() => { console.log("ℹ️ Serviceworker installed ✅") }) + .catch((error) => { + console.error('Failed to install service worker:', error) + }) ); }); From db29ae8cb4639a10135ec07cb9b5475caf4ce59c Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:44:54 +0200 Subject: [PATCH 41/99] turn script into module --- PWA/public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWA/public/index.html b/PWA/public/index.html index 8262aca..7d199ed 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -103,6 +103,6 @@
- + \ No newline at end of file From 6bd833c93ecae3269a6d2d2018f271b136f384f5 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:24:14 +0200 Subject: [PATCH 42/99] Fix 404 on surge --- PWA/public/Services/CacheFilePathService.js | 4 ++-- ...sMissingPagehandler.js => CheckWhoIsMissingPageHandler.js} | 2 +- PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js | 4 ++-- PWA/src/Services/CacheFilePathService.ts | 4 ++-- ...sMissingPagehandler.ts => CheckWhoIsMissingPageHandler.ts} | 2 +- PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) rename PWA/public/Services/FetchEventHandlers/{CheckWhosMissingPagehandler.js => CheckWhoIsMissingPageHandler.js} (94%) rename PWA/src/Services/FetchEventHandlers/{CheckWhosMissingPagehandler.ts => CheckWhoIsMissingPageHandler.ts} (93%) diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index 84acef5..7ca6478 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -23,7 +23,7 @@ import { ActiveSession } from "./ActiveSession.js"; import { BeneficiaryEligilityService } from "./BeneficiaryEligilityService.js"; import { ViewDistributionDataHandler } from "./FetchEventHandlers/ViewDistributionDataHandler.js"; import { BeneficiariesService } from "./BeneficiariesService.js"; -import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissingPageHandler.js"; +import { CheckWhoIsMissingPageHandler } from "./FetchEventHandlers/CheckWhoIsMissingPageHandler.js"; import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; import { DateService } from "./DateService.js"; @@ -128,7 +128,7 @@ export class CacheFilePathService { SelectBeneficiaryCodeInputMethodHandler.name, BeneficiaryCodePostHandler.name, ViewDistributionDataHandler.name, - CheckWhosMissingPageHandler.name, + CheckWhoIsMissingPageHandler.name, MarkAsReceivedPostHandler.name, HomepageHandler.name, ContinueDistributionHandler.name, diff --git a/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js b/PWA/public/Services/FetchEventHandlers/CheckWhoIsMissingPageHandler.js similarity index 94% rename from PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js rename to PWA/public/Services/FetchEventHandlers/CheckWhoIsMissingPageHandler.js index 4a8f660..d494148 100644 --- a/PWA/public/Services/FetchEventHandlers/CheckWhosMissingPagehandler.js +++ b/PWA/public/Services/FetchEventHandlers/CheckWhoIsMissingPageHandler.js @@ -2,7 +2,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { BeneficiariesService } from "../BeneficiariesService.js"; import { ResponseTools } from "../ResponseTools.js"; -export class CheckWhosMissingPageHandler extends ActiveSessionContainer { +export class CheckWhoIsMissingPageHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.checkWhosMissing); } diff --git a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js index ce260bc..3b8c165 100644 --- a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js +++ b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js @@ -11,7 +11,7 @@ import { SelectBeneficiaryCodeInputMethodHandler } from "./SelectBeneficiaryCode import { ViewDistributionDataHandler } from "./ViewDistributionDataHandler.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { BeneficiaryCodePostHandler } from "./BeneficiaryCodePostHandler.js"; -import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPageHandler.js"; +import { CheckWhoIsMissingPageHandler } from "./CheckWhoIsMissingPageHandler.js"; import { MarkAsReceivedPostHandler } from "./MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./HomepageHandler.js"; import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; @@ -32,7 +32,7 @@ export class FetchEventHandlers extends ActiveSessionContainer { new SelectBeneficiaryCodeInputMethodHandler(this.activeSession), new BeneficiaryCodePostHandler(this.activeSession), new ViewDistributionDataHandler(this.activeSession), - new CheckWhosMissingPageHandler(this.activeSession), + new CheckWhoIsMissingPageHandler(this.activeSession), new MarkAsReceivedPostHandler(this.activeSession), new HomepageHandler(), new ContinueDistributionHandler(this.activeSession), diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts index ed3154f..68e8e8b 100644 --- a/PWA/src/Services/CacheFilePathService.ts +++ b/PWA/src/Services/CacheFilePathService.ts @@ -23,7 +23,7 @@ import { ActiveSession } from "./ActiveSession.js"; import { BeneficiaryEligilityService } from "./BeneficiaryEligilityService.js"; import { ViewDistributionDataHandler } from "./FetchEventHandlers/ViewDistributionDataHandler.js"; import { BeneficiariesService } from "./BeneficiariesService.js"; -import { CheckWhosMissingPageHandler } from "./FetchEventHandlers/CheckWhosMissingPageHandler.js"; +import { CheckWhoIsMissingPageHandler } from "./FetchEventHandlers/CheckWhoIsMissingPageHandler.js"; import { MarkAsReceivedPostHandler } from "./FetchEventHandlers/MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./FetchEventHandlers/HomepageHandler.js"; import { DateService } from "./DateService.js"; @@ -141,7 +141,7 @@ export class CacheFilePathService { SelectBeneficiaryCodeInputMethodHandler.name, BeneficiaryCodePostHandler.name, ViewDistributionDataHandler.name, - CheckWhosMissingPageHandler.name, + CheckWhoIsMissingPageHandler.name, MarkAsReceivedPostHandler.name, HomepageHandler.name, ContinueDistributionHandler.name, diff --git a/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts b/PWA/src/Services/FetchEventHandlers/CheckWhoIsMissingPageHandler.ts similarity index 93% rename from PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts rename to PWA/src/Services/FetchEventHandlers/CheckWhoIsMissingPageHandler.ts index 76d7903..da80a1b 100644 --- a/PWA/src/Services/FetchEventHandlers/CheckWhosMissingPagehandler.ts +++ b/PWA/src/Services/FetchEventHandlers/CheckWhoIsMissingPageHandler.ts @@ -6,7 +6,7 @@ import { ActiveSessionContainer } from "../ActiveSession.js"; import { BeneficiariesService } from "../BeneficiariesService.js"; import { ResponseTools } from "../ResponseTools.js"; -export class CheckWhosMissingPageHandler extends ActiveSessionContainer implements FetchEventHandler { +export class CheckWhoIsMissingPageHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { return event.request.url.endsWith(RouteEvents.checkWhosMissing); } diff --git a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts index cad73a0..ff59895 100644 --- a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts +++ b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts @@ -13,7 +13,7 @@ import { SelectBeneficiaryCodeInputMethodHandler } from "./SelectBeneficiaryCode import { ViewDistributionDataHandler } from "./ViewDistributionDataHandler.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; import { BeneficiaryCodePostHandler } from "./BeneficiaryCodePostHandler.js"; -import { CheckWhosMissingPageHandler } from "./CheckWhosMissingPageHandler.js"; +import { CheckWhoIsMissingPageHandler } from "./CheckWhoIsMissingPageHandler.js"; import { MarkAsReceivedPostHandler } from "./MarkAsReceivedPostHandler.js"; import { HomepageHandler } from "./HomepageHandler.js"; import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; @@ -33,7 +33,7 @@ export class FetchEventHandlers extends ActiveSessionContainer implements FetchE new SelectBeneficiaryCodeInputMethodHandler(this.activeSession), new BeneficiaryCodePostHandler(this.activeSession), new ViewDistributionDataHandler(this.activeSession), - new CheckWhosMissingPageHandler(this.activeSession), + new CheckWhoIsMissingPageHandler(this.activeSession), new MarkAsReceivedPostHandler(this.activeSession), new HomepageHandler(), new ContinueDistributionHandler(this.activeSession), From 9733f21c7e86a600cd2a99bda841b260fe5acb8e Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:48:31 +0200 Subject: [PATCH 43/99] Temporarily link to other page instead of index --- PWA/public/Services/FetchEventHandlers/HomepageHandler.js | 2 +- PWA/public/index.html | 2 +- PWA/src/Services/FetchEventHandlers/HomepageHandler.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PWA/public/Services/FetchEventHandlers/HomepageHandler.js b/PWA/public/Services/FetchEventHandlers/HomepageHandler.js index ee0349a..3494040 100644 --- a/PWA/public/Services/FetchEventHandlers/HomepageHandler.js +++ b/PWA/public/Services/FetchEventHandlers/HomepageHandler.js @@ -4,6 +4,6 @@ export class HomepageHandler { return event.request.url.includes(RouteEvents.home); } async handleEvent(event) { - return fetch(RouteEvents.home); + return fetch(RouteEvents.codeInputNotFound); } } diff --git a/PWA/public/index.html b/PWA/public/index.html index 7d199ed..d42cd7a 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - +
- -
-
- -
- - - - - -
- -
-
-
- {{#columns}} -
- -
- {{/columns}} -
- {{#rows}} -
-
- - - - -
-
- -
-
- -
-
- -
-
- -
-
- {{/rows}} + {{#rows}} +
+
+
+ -
-
-
- -
- +
+ +
+
+ +
+
+ +
+
+ {{/rows}}
-
- - - \ No newline at end of file +
\ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/ListDistributionRequestHandler.ts b/PWA/src/Services/FetchEventHandlers/ListDistributionRequestHandler.ts index 00983bd..e691c13 100644 --- a/PWA/src/Services/FetchEventHandlers/ListDistributionRequestHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/ListDistributionRequestHandler.ts @@ -17,7 +17,7 @@ export class ListDistributionRequestHandler extends ActiveSessionContainer imple console.log(distributions) if(distributions.length > 0) { - return ResponseTools.replaceTemplateKeysWithValues( + return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues( await fetch(RouteEvents.listDistributions), { columns: Distribution.colums, rows: distributions From ba9e87d0f578039eaf6e6dcf5a474c6a8d3c2d54 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 14 Oct 2024 09:42:43 +0200 Subject: [PATCH 49/99] fix mistake and bump to 0.1.11 --- PWA/package.json | 2 +- .../FetchEventHandlers/ListDistributionRequestHandler.js | 2 +- PWA/public/index.html | 2 +- .../FetchEventHandlers/ListDistributionRequestHandler.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PWA/package.json b/PWA/package.json index 7a85713..0b8915e 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -1,6 +1,6 @@ { "name": "ReliefBox", - "version": "0.1.10", + "version": "0.1.11", "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", "main": "index.js", "scripts": { diff --git a/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js index 6250987..90ad990 100644 --- a/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js @@ -12,7 +12,7 @@ export class ListDistributionRequestHandler extends ActiveSessionContainer { const distributions = await this.activeSession.database.readDistributions(); console.log(distributions); if (distributions.length > 0) { - return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(await fetch(RouteEvents.listDistributions), { + return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.listDistributions, { columns: Distribution.colums, rows: distributions }); diff --git a/PWA/public/index.html b/PWA/public/index.html index 6be48a4..e84b93f 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - +
- -
-
- -
- - - - - -
-
-
- - - -
- -
-
- -
-
- - -
-
-
-
- -
- -
-
- - - \ No newline at end of file + + +
\ No newline at end of file diff --git a/PWA/public/upload_error.html b/PWA/public/upload_error.html index 2a6ca5e..39804f2 100644 --- a/PWA/public/upload_error.html +++ b/PWA/public/upload_error.html @@ -1,106 +1,13 @@ - - - - - - - - - ReliefBox - - - - - - -
- - - -
-
- -
- - - - - -
-
-
- -
-
- -
-
-
- -
-
-
-
+
+
+ +
+
+ +
+
+
+ +
- -
- -
-
- - - \ No newline at end of file +
\ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/UploadDataHandler.ts b/PWA/src/Services/FetchEventHandlers/UploadDataHandler.ts index ed0c4e1..c8df88c 100644 --- a/PWA/src/Services/FetchEventHandlers/UploadDataHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/UploadDataHandler.ts @@ -1,6 +1,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { FetchEvent } from "../../Interfaces/FetchEvent.js"; import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; +import { ResponseTools } from "../ResponseTools.js"; export class UploadDataHandler implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { @@ -8,6 +9,6 @@ export class UploadDataHandler implements FetchEventHandler { } async handleEvent(event: FetchEvent): Promise { - return fetch(RouteEvents.uploadData) + return ResponseTools.wrapInHtmlTemplate(RouteEvents.uploadData) } } From c776062d94ba352bd836439206602e33e404863c Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:24:39 +0200 Subject: [PATCH 52/99] Remove unused code bump to 0.4.0 --- PWA/package-lock.json | 6 +++--- PWA/package.json | 2 +- PWA/public/Services/Database.js | 24 ------------------------ PWA/public/Services/Database.test.js | 23 ----------------------- PWA/public/index.html | 2 +- PWA/src/Services/Database.test.ts | 26 +------------------------- PWA/src/Services/Database.ts | 26 -------------------------- 7 files changed, 6 insertions(+), 103 deletions(-) diff --git a/PWA/package-lock.json b/PWA/package-lock.json index df20b86..13343f5 100644 --- a/PWA/package-lock.json +++ b/PWA/package-lock.json @@ -25,7 +25,7 @@ "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", "dev": true, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/gen-mapping": "^0.4.0", "@jridgewell/trace-mapping": "^0.3.9" }, "engines": { @@ -2557,8 +2557,8 @@ } }, "node_modules/@sinonjs/fake-timers": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.4.0.tgz", "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", "dev": true, "dependencies": { diff --git a/PWA/package.json b/PWA/package.json index d0e48a8..8a36ff5 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -1,6 +1,6 @@ { "name": "ReliefBox", - "version": "0.3.0", + "version": "0.4.0", "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", "main": "index.js", "scripts": { diff --git a/PWA/public/Services/Database.js b/PWA/public/Services/Database.js index 485729f..4ab1636 100644 --- a/PWA/public/Services/Database.js +++ b/PWA/public/Services/Database.js @@ -5,13 +5,11 @@ export var ObjectStoreName; ObjectStoreName["distribution"] = "Distributions"; ObjectStoreName["beneficiary"] = "Beneficiaries"; ObjectStoreName["distributionBeneficiaries"] = "DistributionBeneficiary"; - ObjectStoreName["activeDistribution"] = "activeDistribution"; })(ObjectStoreName || (ObjectStoreName = {})); const allObjectStoreNames = [ ObjectStoreName.beneficiary, ObjectStoreName.distribution, ObjectStoreName.distributionBeneficiaries, - ObjectStoreName.activeDistribution, ]; function columnsForObjectStore(objectStore) { switch (objectStore) { @@ -35,13 +33,6 @@ function columnsForObjectStore(objectStore) { { name: "hasBeenMarkedAsReceived", isUnique: false }, { name: "dateReceived", isUnique: false } ]; - case ObjectStoreName.activeDistribution: - return [ - { name: "distrib_name", isUnique: false }, - { name: "distrib_place", isUnique: false }, - { name: "distrib_date", isUnique: false }, - { name: "distrib_items", isUnique: false }, - ]; } } export class Database { @@ -122,21 +113,6 @@ export class Database { async addBeneficiary(beneficiary) { return this.addElement(ObjectStoreName.beneficiary, beneficiary); } - async setActiveDistribution(activeDistribution) { - return this.addElement(ObjectStoreName.activeDistribution, activeDistribution); - } - async getActiveDistributions() { - return this.getElement(ObjectStoreName.activeDistribution); - } - async getActiveDistribution() { - const distributions = await this.getActiveDistributions(); - if (distributions.length > 0) { - return distributions[distributions.length - 1]; - } - else { - throw Error("No active distribution found"); - } - } async addBeneficiaryToDistribution(beneficiary, distribution) { const existing = await this.readDistributionBeneficiaries(); existing.forEach((curent) => { diff --git a/PWA/public/Services/Database.test.js b/PWA/public/Services/Database.test.js index 0230869..15a5f43 100644 --- a/PWA/public/Services/Database.test.js +++ b/PWA/public/Services/Database.test.js @@ -61,27 +61,4 @@ describe('Database', () => { expect(receivedBeneficiaries[0].hasBeenMarkedAsReceived).toEqual(true); expect(receivedBeneficiaries[1].hasBeenMarkedAsReceived).toEqual(true); }); - test("When setting an active distribution, they can be retrieved", async () => { - const distribution = new Distribution("12", "123", "Arnhem", "Name"); - try { - await sut.setActiveDistribution(distribution); - const result = await sut.getActiveDistributions(); - expect(result[0].distrib_name).toBe(distribution.distrib_name); - expect(result.length).toBe(1); - } - catch (error) { - expect(error.message).toBe("Empty"); - } - }); - test("When setting an active distribution, it can be retrieved", async () => { - const distribution = new Distribution("12", "123", "Arnhem", "Name"); - try { - await sut.setActiveDistribution(distribution); - const result = await sut.getActiveDistribution(); - expect(result.distrib_name).toBe(distribution.distrib_name); - } - catch (error) { - expect(error.message).toBe("Empty"); - } - }); }); diff --git a/PWA/public/index.html b/PWA/public/index.html index a1db876..3e19653 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - + \ No newline at end of file From 69f0f26565df8feff15f1a170cdf55379a0ecf4d Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:47:20 +0200 Subject: [PATCH 62/99] Remove unneeded pipeline --- .github/workflows/static.yml | 47 ------------------------------------ 1 file changed, 47 deletions(-) delete mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml deleted file mode 100644 index 57f1fdd..0000000 --- a/.github/workflows/static.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Simple workflow for deploying static content to GitHub Pages -name: Deploy static content to Pages - -on: - # Runs on pushes targeting the default branch - push: - branches: - # - "main" - - "feature/#5-app-should-work-offline" - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - # Single deploy job since we're just deploying - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Pages - uses: actions/configure-pages@v3 - - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - with: - path: './PWA/public/' - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 From 06fe8615b718fcecea15e73f57e3a90310e40094 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:02:14 +0200 Subject: [PATCH 63/99] Make sure buttons aren't a form bump 0.6.1 --- PWA/package.json | 2 +- PWA/public/index.html | 2 +- PWA/public/upload_error.html | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/PWA/package.json b/PWA/package.json index 0bef9fb..6efdaa5 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -1,6 +1,6 @@ { "name": "ReliefBox", - "version": "0.6.0", + "version": "0.6.1", "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", "main": "index.js", "scripts": { diff --git a/PWA/public/index.html b/PWA/public/index.html index f30767f..724d4f3 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - + \ No newline at end of file From 42a22cc7fe487574d71c89ba5a4e272d591e7410 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:19:08 +0200 Subject: [PATCH 64/99] Make sure index.html is always attempted to be retrieved from cache bump 0.6.2 --- PWA/package.json | 2 +- .../CreateDistributionRequestHandler.js | 2 +- .../DeleteDistributionPostHandler.js | 3 ++- .../DeleteDistributionRequestHandler.js | 2 +- .../Services/FetchEventHandlers/HomepageHandler.js | 11 ++--------- .../ListDistributionRequestHandler.js | 2 +- .../SelectBeneficiaryCodeInputMethodHandler.js | 2 +- .../SelectDistributionRequestHandler.js | 2 +- .../FetchEventHandlers/ViewDistributionDataHandler.js | 2 +- PWA/public/Services/ResponseTools.js | 11 +++++++++++ PWA/public/index.html | 2 +- .../CreateDistributionRequestHandler.ts | 2 +- .../DeleteDistributionPostHandler.ts | 3 ++- .../DeleteDistributionRequestHandler.ts | 2 +- .../Services/FetchEventHandlers/HomepageHandler.ts | 10 ++-------- .../ListDistributionRequestHandler.ts | 2 +- .../SelectBeneficiaryCodeInputMethodHandler.ts | 2 +- .../SelectDistributionRequestHandler.ts | 2 +- .../FetchEventHandlers/ViewDistributionDataHandler.ts | 2 +- PWA/src/Services/ResponseTools.ts | 11 +++++++++++ 20 files changed, 44 insertions(+), 33 deletions(-) diff --git a/PWA/package.json b/PWA/package.json index 6efdaa5..7910bad 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -1,6 +1,6 @@ { "name": "ReliefBox", - "version": "0.6.1", + "version": "0.6.2", "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", "main": "index.js", "scripts": { diff --git a/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js index 628ac1e..8d10384 100644 --- a/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/CreateDistributionRequestHandler.js @@ -35,7 +35,7 @@ export class CreateDistributionRequestHandler extends ActiveSessionContainer { } catch (error) { console.error(error); - return fetch(RouteEvents.home); + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); } } } diff --git a/PWA/public/Services/FetchEventHandlers/DeleteDistributionPostHandler.js b/PWA/public/Services/FetchEventHandlers/DeleteDistributionPostHandler.js index 5dba6a0..638a28c 100644 --- a/PWA/public/Services/FetchEventHandlers/DeleteDistributionPostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/DeleteDistributionPostHandler.js @@ -1,6 +1,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { DeserialisationService } from "../DeserialisationService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; +import { ResponseTools } from "../ResponseTools.js"; export class DeleteDistributionPostHandler extends ActiveSessionContainer { canHandleEvent(event) { return event.request.url.endsWith(RouteEvents.postDeleteDistribution); @@ -11,6 +12,6 @@ export class DeleteDistributionPostHandler extends ActiveSessionContainer { if (distributionToDelete) { await this.activeSession.database.deleteDistributionWithName(distributionToDelete.distrib_name); } - return fetch(RouteEvents.home); + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); } } diff --git a/PWA/public/Services/FetchEventHandlers/DeleteDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/DeleteDistributionRequestHandler.js index 691d1c4..cd5dca1 100644 --- a/PWA/public/Services/FetchEventHandlers/DeleteDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/DeleteDistributionRequestHandler.js @@ -17,6 +17,6 @@ export class DeleteDistributionRequestHandler extends ActiveSessionContainer { catch (error) { console.error(error); } - return fetch(RouteEvents.home); + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); } } diff --git a/PWA/public/Services/FetchEventHandlers/HomepageHandler.js b/PWA/public/Services/FetchEventHandlers/HomepageHandler.js index 7987166..afda209 100644 --- a/PWA/public/Services/FetchEventHandlers/HomepageHandler.js +++ b/PWA/public/Services/FetchEventHandlers/HomepageHandler.js @@ -1,17 +1,10 @@ import { RouteEvents } from "../../RouteEvents.js"; +import { ResponseTools } from "../ResponseTools.js"; export class HomepageHandler { canHandleEvent(event) { return event.request.url.includes(RouteEvents.home); } async handleEvent(event) { - const responseFromCache = await caches.match(event.request); - if (responseFromCache) { - console.log("Retrieved index from cache 🎉"); - return responseFromCache; - } - else { - console.log("Failed to retrief index from cache :("); - return fetch(RouteEvents.home); - } + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); } } diff --git a/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js index 90ad990..5dee952 100644 --- a/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/ListDistributionRequestHandler.js @@ -24,6 +24,6 @@ export class ListDistributionRequestHandler extends ActiveSessionContainer { catch { console.log("something went wrong"); } - return fetch(RouteEvents.home); + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); } } diff --git a/PWA/public/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js b/PWA/public/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js index f10977d..dbd179d 100644 --- a/PWA/public/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js +++ b/PWA/public/Services/FetchEventHandlers/SelectBeneficiaryCodeInputMethodHandler.js @@ -13,7 +13,7 @@ export class SelectBeneficiaryCodeInputMethodHandler extends ActiveSessionContai } catch (error) { console.error(error); - return fetch(RouteEvents.home); + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); } } templatepageForInputMethod(inputMethod) { diff --git a/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js b/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js index 939cd54..0859e5c 100644 --- a/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js +++ b/PWA/public/Services/FetchEventHandlers/SelectDistributionRequestHandler.js @@ -25,7 +25,7 @@ export class SelectDistributionRequestHandler extends ActiveSessionContainer { } else { console.error("Expected distribution named " + post.distrib_name + " to exist in database"); - return fetch(RouteEvents.home); + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); } } isFilled(field) { diff --git a/PWA/public/Services/FetchEventHandlers/ViewDistributionDataHandler.js b/PWA/public/Services/FetchEventHandlers/ViewDistributionDataHandler.js index c895920..e381ea6 100644 --- a/PWA/public/Services/FetchEventHandlers/ViewDistributionDataHandler.js +++ b/PWA/public/Services/FetchEventHandlers/ViewDistributionDataHandler.js @@ -25,7 +25,7 @@ export class ViewDistributionDataHandler extends ActiveSessionContainer { catch (error) { console.error(error); } - return fetch(RouteEvents.home); + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); } columnsFromBeneficiaries(beneficiaries) { if (beneficiaries.length > 0) { diff --git a/PWA/public/Services/ResponseTools.js b/PWA/public/Services/ResponseTools.js index 6b58d1a..b6f7fd9 100644 --- a/PWA/public/Services/ResponseTools.js +++ b/PWA/public/Services/ResponseTools.js @@ -20,6 +20,17 @@ export class ResponseTools { content: await (await this.cachedPage(routeEvent)).text() }); } + static async fetchFromCacheWithRemoteAsFallBack(file) { + const responseFromCache = await caches.match(file); + if (responseFromCache) { + console.log("Retrieved index from cache"); + return responseFromCache; + } + else { + console.log("Failed to retrief index from cache"); + return fetch(RouteEvents.home); + } + } static async changeResponseText(oldResponse, responseTextChanger) { try { const oldResponseText = await oldResponse.text(); diff --git a/PWA/public/index.html b/PWA/public/index.html index 724d4f3..7e18c39 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - + No \ No newline at end of file diff --git a/PWA/public/index.html b/PWA/public/index.html index 7b04d29..5bfa7f5 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - + Home + + Distributions + Documentation diff --git a/PWA/public/template.html b/PWA/public/template.html index b7540c8..7a0f4a8 100644 --- a/PWA/public/template.html +++ b/PWA/public/template.html @@ -52,7 +52,9 @@ Home - + + Distributions + Documentation diff --git a/PWA/src/RouteEvents.ts b/PWA/src/RouteEvents.ts index ef37504..2c98863 100644 --- a/PWA/src/RouteEvents.ts +++ b/PWA/src/RouteEvents.ts @@ -31,4 +31,5 @@ export class RouteEvents { static continueDistribution = "/continueDistribution" static downloadData = "/download_data" static downloadSpreadsheetTemplate = "/download_template" + static distributions = "/distributions" } \ No newline at end of file diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts index 77dbf9a..f7de52f 100644 --- a/PWA/src/Services/CacheFilePathService.ts +++ b/PWA/src/Services/CacheFilePathService.ts @@ -33,6 +33,7 @@ import { BeneficiaryStatusService } from "./BeneficiaryStatusService.js"; import { DownloadSpreadsheetTemplateHandler } from "./FetchEventHandlers/DownloadSpreadsheetTemplateHandler.js"; import { DeleteDistributionsConfirmHandler } from "./FetchEventHandlers/DeleteDistributionsConfirmHandler.js"; import { DistributionResponseProvider } from "./DistributionResponseProvider.js"; +import { DistributionsHandler } from "./FetchEventHandlers/DistributionsHandler.js"; // Provides all the files that have to be cached for offline use export class CacheFilePathService { @@ -152,7 +153,8 @@ export class CacheFilePathService { ContinueDistributionHandler.name, DownloadDataHandler.name, DownloadSpreadsheetTemplateHandler.name, - DeleteDistributionsConfirmHandler.name + DeleteDistributionsConfirmHandler.name, + DistributionsHandler.name ]); } diff --git a/PWA/src/Services/FetchEventHandlers/DistributionsHandler.ts b/PWA/src/Services/FetchEventHandlers/DistributionsHandler.ts new file mode 100644 index 0000000..485f753 --- /dev/null +++ b/PWA/src/Services/FetchEventHandlers/DistributionsHandler.ts @@ -0,0 +1,14 @@ +import { FetchEvent } from "../../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; +import { RouteEvents } from "../../RouteEvents.js"; +import { ResponseTools } from "../ResponseTools.js"; + +export class DistributionsHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith(RouteEvents.distributions); + } + + async handleEvent(event: FetchEvent): Promise { + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); + } +} diff --git a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts index 9fd8412..41c46e6 100644 --- a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts +++ b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts @@ -20,6 +20,7 @@ import { ContinueDistributionHandler } from "./ContinueDistributionHandler.js"; import { DownloadDataHandler } from "./DownloadDataHandler.js"; import { DownloadSpreadsheetTemplateHandler } from "./DownloadSpreadsheetTemplateHandler.js"; import { DeleteDistributionsConfirmHandler } from "./DeleteDistributionsConfirmHandler.js"; +import { DistributionsHandler } from "./DistributionsHandler.js"; export class FetchEventHandlers extends ActiveSessionContainer implements FetchEventHandler { all: FetchEventHandler[] = [ @@ -41,7 +42,8 @@ export class FetchEventHandlers extends ActiveSessionContainer implements FetchE new ContinueDistributionHandler(this.activeSession), new DownloadDataHandler(this.activeSession), new DownloadSpreadsheetTemplateHandler(), - new DeleteDistributionsConfirmHandler() + new DeleteDistributionsConfirmHandler(), + new DistributionsHandler() ]; handlersForEvent(event: FetchEvent): FetchEventHandler[] { diff --git a/PWA/src/Services/FetchEventHandlers/HomepageHandler.ts b/PWA/src/Services/FetchEventHandlers/HomepageHandler.ts index 1427aea..ede1016 100644 --- a/PWA/src/Services/FetchEventHandlers/HomepageHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/HomepageHandler.ts @@ -17,4 +17,4 @@ export class HomepageHandler extends ActiveSessionContainer implements FetchEven return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home) } } -} +} \ No newline at end of file From 525184f9861a5d489f7133c533832ed6d44756c5 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:06:12 +0200 Subject: [PATCH 74/99] Update readme --- PWA/README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 PWA/README.md diff --git a/PWA/README.md b/PWA/README.md new file mode 100644 index 0000000..1630db1 --- /dev/null +++ b/PWA/README.md @@ -0,0 +1,41 @@ +# Reliefbox Progressive web app +Offline version of reliefbox, built using typescript and relying heavily on service workers and IDB database. + +### During development + +Make sure all terninal tabs are in the PWA directory, then run: +`npm start` to launch the local server +`tsc --watch` to make sure typescript files get compiled as you code +`npm run test -- --watch` to make sure run as you code + +* All new files need to be added to `CachePathFileService` +* All new `FetchEventHandler` classes need to be added to `FetchEventHandlers` + +### Architercture / dataflow + +1. HTTP requests are handled by serviceworker +2. Service worker dispatches request to `FetchEventHandlers` +3. `FetchEventHandlers` chooses which `FetchEventHander` should handle the request +4. `FetchEventHandler` handles the request and serves a new page using `ResponseTools` and using a service if there's been a need for shared or separated logic. +5. `ResponseTools` leverages the mustache templating system to render pages with the least amount of redundancy + +### IDB Database schema + +* Beneficiary + * Contains all the info of a beneficary +* Distribution + * Contains all the info of a distribution +* DistributionBeneficary + * Contains the info of + * which beneficary belongs to which distribution + * wether or not the beneficiary has received it's goods + +### Third party code used +* [SheetJS](https://sheetjs.com) (PWA/public/ExternalLibraries/xlsx.full.min.js) + * For handling spreadsheat files +* [Mustache](https://github.com/janl/mustache.js/) (PWA/public/ExternalLibraries/mustache.js) + * For html templating +* [Zxing](https://github.com/zxing-js/library) (PWA/public/ExternalLibraries/zxing.js) + * For barcode scanning +* [Bulma.io](https://bulma.io) (PWA/public/ExternalLibraries/bulma.css) + * For page styling styling \ No newline at end of file From ac46d3863e665ad240bd9a0f6a0a56cf3ca7e7c5 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:55:41 +0100 Subject: [PATCH 75/99] Make sure only two tables are needed, and beneficiary codes only have to be unique per distribution bump 0.11.0 --- PWA/package.json | 2 +- PWA/public/Models/Beneficiary.js | 5 +- PWA/public/Models/DistributionBeneficiary.js | 8 -- PWA/public/Services/BeneficiariesService.js | 60 ++--------- .../Services/BeneficiariesService.test.js | 10 +- .../BeneficiaryDeserializationService.js | 8 +- .../BeneficiaryDeserializationService.test.js | 21 +++- .../Services/BeneficiaryEligilityService.js | 34 ------ .../BeneficiaryEligilityService.test.js | 49 --------- PWA/public/Services/BeneficiaryInfoService.js | 2 +- .../Services/BeneficiaryStatusService.js | 26 ++--- PWA/public/Services/CacheFilePathService.js | 2 - PWA/public/Services/Database.js | 66 ++---------- PWA/public/Services/Database.test.js | 30 ++---- .../BeneficiaryCodePostHandler.js | 60 +++-------- .../BeneficiaryDataUploadHandler.js | 3 +- PWA/public/index.html | 2 +- PWA/src/Models/Beneficiary.ts | 9 +- PWA/src/Models/DistributionBeneficiary.ts | 18 ---- PWA/src/Services/BeneficiariesService.test.ts | 10 +- PWA/src/Services/BeneficiariesService.ts | 68 ++---------- .../BeneficiaryDeserializationService.test.ts | 23 +++- .../BeneficiaryDeserializationService.ts | 10 +- .../BeneficiaryEligilityService.test.ts | 88 --------------- .../Services/BeneficiaryEligilityService.ts | 37 ------- PWA/src/Services/BeneficiaryInfoService.ts | 3 +- PWA/src/Services/BeneficiaryStatusService.ts | 18 ++-- PWA/src/Services/CacheFilePathService.ts | 2 - PWA/src/Services/Database.test.ts | 40 ++----- PWA/src/Services/Database.ts | 101 ++++-------------- .../BeneficiaryCodePostHandler.ts | 61 +++-------- .../BeneficiaryDataUploadHandler.ts | 33 +++--- 32 files changed, 181 insertions(+), 728 deletions(-) delete mode 100644 PWA/public/Models/DistributionBeneficiary.js delete mode 100644 PWA/public/Services/BeneficiaryEligilityService.js delete mode 100644 PWA/public/Services/BeneficiaryEligilityService.test.js delete mode 100644 PWA/src/Models/DistributionBeneficiary.ts delete mode 100644 PWA/src/Services/BeneficiaryEligilityService.test.ts delete mode 100644 PWA/src/Services/BeneficiaryEligilityService.ts diff --git a/PWA/package.json b/PWA/package.json index 21aabd1..640f9bc 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -1,6 +1,6 @@ { "name": "ReliefBox", - "version": "0.10.0", + "version": "0.11.0", "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", "main": "index.js", "scripts": { diff --git a/PWA/public/Models/Beneficiary.js b/PWA/public/Models/Beneficiary.js index 51cfa5b..83c4918 100644 --- a/PWA/public/Models/Beneficiary.js +++ b/PWA/public/Models/Beneficiary.js @@ -1,7 +1,10 @@ export class Beneficiary { - constructor(code, columns, values) { + constructor(code, columns, values, distributionName) { this.code = code; this.columns = columns; this.values = values; + this.distributionName = distributionName; + this.hasBeenMarkedAsReceived = false; + this.dateReceived = undefined; } } diff --git a/PWA/public/Models/DistributionBeneficiary.js b/PWA/public/Models/DistributionBeneficiary.js deleted file mode 100644 index fc4c785..0000000 --- a/PWA/public/Models/DistributionBeneficiary.js +++ /dev/null @@ -1,8 +0,0 @@ -export class DistributionBeneficiary { - constructor(beneficiaryCode, distributionName, hasBeenMarkedAsReceived = false, dateReceived = undefined) { - this.beneficiaryCode = beneficiaryCode; - this.distributionName = distributionName; - this.hasBeenMarkedAsReceived = hasBeenMarkedAsReceived; - this.dateReceived = dateReceived; - } -} diff --git a/PWA/public/Services/BeneficiariesService.js b/PWA/public/Services/BeneficiariesService.js index 4476a4e..960e24e 100644 --- a/PWA/public/Services/BeneficiariesService.js +++ b/PWA/public/Services/BeneficiariesService.js @@ -6,19 +6,7 @@ export class BeneficiariesService extends ActiveSessionContainer { if (activeDistributionName) { const distribution = await database.distributionWithName(activeDistributionName); if (distribution) { - const activeDistributionBeneficiaries = await this.distributionBenificiariesForActiveDistribution(); - const activeDistributionBeneficiaryCodes = activeDistributionBeneficiaries - .map((distributionBeneficiary) => { - return distributionBeneficiary.beneficiaryCode; - }); - const allBeneficiaries = await database.readBeneficiaries(); - const beneficiaries = allBeneficiaries - .filter((beneficiary) => { - return activeDistributionBeneficiaryCodes.indexOf(beneficiary.code) != -1; - }); - console.log("ℹ️"); - console.log(allBeneficiaries); - console.log(beneficiaries); + const beneficiaries = await database.beneficiariesForDistributionNamed(activeDistributionName); return beneficiaries; } else { @@ -29,50 +17,16 @@ export class BeneficiariesService extends ActiveSessionContainer { throw "Expected active distribution name"; } } - async distributionBenificiariesForActiveDistribution() { - const database = this.activeSession.database; - const activeDistributionName = this.activeSession.nameOfLastViewedDistribution; - if (activeDistributionName) { - const distribution = await database.distributionWithName(activeDistributionName); - if (distribution) { - const activeDistributionBeneficiaries = (await database.benificiariesForDistribution(distribution)).filter((distributionBeneficiary) => { - return distributionBeneficiary.distributionName === activeDistributionName; - }); - return activeDistributionBeneficiaries; - } - else { - throw "Expected distribution"; - } - } - else { - throw "Expected active distributionName"; - } - } - async isBeneficiaryEligible(beneficiary) { - const activeDistributionBeneficiaries = await this.distributionBenificiariesForActiveDistribution(); - var isEligible = false; - activeDistributionBeneficiaries.forEach(element => { - if (element.beneficiaryCode == beneficiary.beneficiaryCode) { - isEligible = element.hasBeenMarkedAsReceived == false; - } - }); - return isEligible; + isBeneficiaryEligible(beneficiary) { + return beneficiary.hasBeenMarkedAsReceived == false; } async eligibleBeneficiariesForActiveDistribution() { - const allDistributionBenificiaries = await this.distributionBenificiariesForActiveDistribution(); - let eligibleDistributionBeneficiaries = []; + const allDistributionBenificiaries = await this.beneficiariesForActiveDistribution(); + let eligibleBeneficiaries = []; for (let i = 0; i < allDistributionBenificiaries.length; i++) { const current = allDistributionBenificiaries[i]; - if (current.hasBeenMarkedAsReceived == false) { - eligibleDistributionBeneficiaries.push(current); - } - } - let eligibleBeneficiaries = []; - for (let i = 0; i < eligibleDistributionBeneficiaries.length; i++) { - const current = eligibleDistributionBeneficiaries[i]; - const currentBeneficiary = await this.activeSession.database.beneficiaryWithCode(current.beneficiaryCode); - if (currentBeneficiary) { - eligibleBeneficiaries.push(currentBeneficiary); + if (this.isBeneficiaryEligible(current)) { + eligibleBeneficiaries.push(current); } } return eligibleBeneficiaries; diff --git a/PWA/public/Services/BeneficiariesService.test.js b/PWA/public/Services/BeneficiariesService.test.js index a04b0ab..b025832 100644 --- a/PWA/public/Services/BeneficiariesService.test.js +++ b/PWA/public/Services/BeneficiariesService.test.js @@ -11,8 +11,8 @@ describe('BeneficiariesService', () => { const beneficiaryCode1 = "code1"; const beneficiaryCode2 = "code2"; const existingDistribution = new Distribution("", "", "", existingDistributionName); - const beneficiary1 = new Beneficiary(beneficiaryCode1, [], []); - const beneficiary2 = new Beneficiary(beneficiaryCode2, [], []); + const beneficiary1 = new Beneficiary(beneficiaryCode1, [], [], existingDistributionName); + const beneficiary2 = new Beneficiary(beneficiaryCode2, [], [], existingDistributionName); var database = new Database(new IDBFactory()); var activeSesion = new ActiveSession(database); var sut = new BeneficiariesService(activeSesion); @@ -54,8 +54,6 @@ describe('BeneficiariesService', () => { await database.addDistribution(existingDistribution); await database.addBeneficiary(beneficiary1); await database.addBeneficiary(beneficiary2); - await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution); - await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution); const beneficiaries = await sut.beneficiariesForActiveDistribution(); expect(beneficiaries.length).toEqual(2); expect(beneficiaries[0].code).toEqual(beneficiaryCode1); @@ -68,8 +66,6 @@ describe('BeneficiariesService', () => { await database.addDistribution(existingDistribution); await database.addBeneficiary(beneficiary1); await database.addBeneficiary(beneficiary2); - await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution); - await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution); const eligibleBeneficiaries = await sut.eligibleBeneficiariesForActiveDistribution(); expect(eligibleBeneficiaries.length).toEqual(2); }); @@ -80,8 +76,6 @@ describe('BeneficiariesService', () => { await database.addDistribution(existingDistribution); await database.addBeneficiary(beneficiary1); await database.addBeneficiary(beneficiary2); - await database.addBeneficiaryToDistribution(beneficiary1, existingDistribution); - await database.addBeneficiaryToDistribution(beneficiary2, existingDistribution); await database.markBeneficiaryAsReceived(beneficiary1.code, existingDistributionName); const eligibleBeneficiaries = await sut.eligibleBeneficiariesForActiveDistribution(); expect(eligibleBeneficiaries.length).toEqual(1); diff --git a/PWA/public/Services/BeneficiaryDeserializationService.js b/PWA/public/Services/BeneficiaryDeserializationService.js index 7c1f391..f00eb8b 100644 --- a/PWA/public/Services/BeneficiaryDeserializationService.js +++ b/PWA/public/Services/BeneficiaryDeserializationService.js @@ -2,13 +2,13 @@ import { Beneficiary } from "../Models/Beneficiary.js"; import { FormParser } from "./FormParser.js"; import { SpreadSheetService } from "./SpreadSheetService.js"; export class BeneficiaryDeserializationService { - async deserializeFormDataFromRequest(request) { + async deserializeFormDataFromRequest(request, distributionName) { return new Promise(async (resolve, reject) => { const possibleFile = FormParser.firstFileFromFormData(await request.formData()); if (possibleFile instanceof File) { const json = await SpreadSheetService.jsonFromSpreadSheetFile(possibleFile); try { - return resolve(this.deserializeJson(json)); + return resolve(this.deserializeJson(json, distributionName)); } catch (error) { return reject(error); @@ -19,10 +19,10 @@ export class BeneficiaryDeserializationService { } }); } - deserializeJson(json) { + deserializeJson(json, distributionName) { return this.rowsFromJson(json) .map((row) => { - return new Beneficiary(this.codeFromJsonRow(row), this.columnsFromJsonRow(row), this.valuesFromJsonRow(row)); + return new Beneficiary(this.codeFromJsonRow(row), this.columnsFromJsonRow(row), this.valuesFromJsonRow(row), distributionName); }); } rowsFromJson(json) { diff --git a/PWA/public/Services/BeneficiaryDeserializationService.test.js b/PWA/public/Services/BeneficiaryDeserializationService.test.js index 037478a..561a852 100644 --- a/PWA/public/Services/BeneficiaryDeserializationService.test.js +++ b/PWA/public/Services/BeneficiaryDeserializationService.test.js @@ -2,6 +2,7 @@ import { describe, test, expect } from '@jest/globals'; import { BeneficiaryDeserializationService } from './BeneficiaryDeserializationService'; import { fail } from 'assert'; describe('BeneficiaryDeserializationService', () => { + const distributionName = "distributionName"; const sut = new BeneficiaryDeserializationService(); const validJson = [ { @@ -31,23 +32,35 @@ describe('BeneficiaryDeserializationService', () => { } ]; test("When deserializing valid json, then all codes are correct", () => { - const results = sut.deserializeJson(validJson); + const results = sut.deserializeJson(validJson, distributionName); expect(results[0].code).toBe("3700476611447"); expect(results[1].code).toBe("8710400392279"); }); + test("When deserializing valid json, then distributionName is correct", () => { + const results = sut.deserializeJson(validJson, distributionName); + expect(results[0].distributionName).toBe(distributionName); + expect(results[1].distributionName).toBe(distributionName); + }); + test("When deserializing valid json, then default values are correct", () => { + const results = sut.deserializeJson(validJson, distributionName); + expect(results[0].hasBeenMarkedAsReceived).toBe(false); + expect(results[1].hasBeenMarkedAsReceived).toBe(false); + expect(results[0].dateReceived).toBe(undefined); + expect(results[1].dateReceived).toBe(undefined); + }); test("When deserializing valid json, then all columns are correct", () => { - const results = sut.deserializeJson(validJson); + const results = sut.deserializeJson(validJson, distributionName); expect(results[0].columns).toStrictEqual(["code", "name", "surname", "gender"]); expect(results[1].columns).toStrictEqual(["code", "name", "surname", "gender"]); }); test("When deserializing valid json, then all values are correct", () => { - const results = sut.deserializeJson(validJson); + const results = sut.deserializeJson(validJson, distributionName); expect(results[0].values).toStrictEqual(["3700476611447", "Jacopo", "Margutti", "Male"]); expect(results[1].values).toStrictEqual(["8710400392279", "Susan", "Ellis", "Female"]); }); test("When deserializing json with missing code, then correct error is thrown", () => { try { - const results = sut.deserializeJson(invalidJsonBecauseOfMissingCode); + const results = sut.deserializeJson(invalidJsonBecauseOfMissingCode, distributionName); fail("Should have thown error"); } catch (error) { diff --git a/PWA/public/Services/BeneficiaryEligilityService.js b/PWA/public/Services/BeneficiaryEligilityService.js deleted file mode 100644 index 8b27064..0000000 --- a/PWA/public/Services/BeneficiaryEligilityService.js +++ /dev/null @@ -1,34 +0,0 @@ -export class BeneficiaryEligilityService { - constructor(activeSession) { - this.activeSession = activeSession; - } - async isBeneficiaryEligibleForCurrentDistribution(beneficiaryCode) { - const nameOfActiveDistribution = this.activeSession.nameOfLastViewedDistribution; - if (nameOfActiveDistribution) { - const distribution = await this.activeSession.database.distributionWithName(nameOfActiveDistribution); - if (distribution) { - const distributionBeneficiaries = await this.activeSession.database.benificiariesForDistribution(distribution); - console.log("There is a distribution"); - console.log(distributionBeneficiaries); - const matchedBeneficiaries = distributionBeneficiaries.filter((beneficiary) => { - return beneficiary.beneficiaryCode === beneficiaryCode; - }); - if (matchedBeneficiaries.length == 1) { - const beneficiary = matchedBeneficiaries[0]; - return !beneficiary.hasBeenMarkedAsReceived; - } - else { - return false; - } - } - else { - console.error("Active distributedion named \"" + nameOfActiveDistribution + "\" not found in database"); - return false; - } - } - else { - throw Error("Expected active distribution"); - } - return false; - } -} diff --git a/PWA/public/Services/BeneficiaryEligilityService.test.js b/PWA/public/Services/BeneficiaryEligilityService.test.js deleted file mode 100644 index 7e70cdb..0000000 --- a/PWA/public/Services/BeneficiaryEligilityService.test.js +++ /dev/null @@ -1,49 +0,0 @@ -import { describe, test, expect } from "@jest/globals"; -import { BeneficiaryEligilityService } from "./BeneficiaryEligilityService"; -import { Database } from "./Database"; -import "fake-indexeddb/auto"; -import { IDBFactory } from "fake-indexeddb"; -import { ActiveSession } from "./ActiveSession"; -import { Distribution } from "../Models/Distribution"; -import { Beneficiary } from "../Models/Beneficiary"; -import { fail } from "assert"; -const activeEligibleBeneficiaryCode = "1234AA"; -const inActiveEligibleBeneficiaryCode = "5432"; -const eligibleActiveDistributionBeneficiary = new Beneficiary(activeEligibleBeneficiaryCode, ["code", "name"], [activeEligibleBeneficiaryCode, "henry"]); -const eligibleInactiveDistributionBeneficiary = new Beneficiary(activeEligibleBeneficiaryCode, ["code", "name"], [inActiveEligibleBeneficiaryCode, "tedd"]); -const activeDistribution = new Distribution("items", "date", "place", "activeDistribution"); -const inactiveDistribution = new Distribution("items", "date", "place", "inactiveDistribution"); -async function setupDatabase() { - const database = new Database(new IDBFactory()); - await database.addDistribution(activeDistribution); - await database.addDistribution(inactiveDistribution); - await database.addBeneficiaryToDistribution(eligibleActiveDistributionBeneficiary, activeDistribution); - await database.addBeneficiaryToDistribution(eligibleInactiveDistributionBeneficiary, inactiveDistribution); - return database; -} -describe("BeneficiaryEligilityService", () => { - test("When checking elible code from inactive distribution during active distrubution Then not eligible", async () => { - const activeSession = await new ActiveSession(await setupDatabase()); - activeSession.nameOfLastViewedDistribution = activeDistribution.distrib_name; - const sut = new BeneficiaryEligilityService(activeSession); - expect(await sut.isBeneficiaryEligibleForCurrentDistribution(inActiveEligibleBeneficiaryCode)).toEqual(false); - }); - test("When checking elible code from active distribution during active distrubtion Then eligible", async () => { - const activeSession = await new ActiveSession(await setupDatabase()); - activeSession.nameOfLastViewedDistribution = activeDistribution.distrib_name; - const sut = new BeneficiaryEligilityService(activeSession); - expect(await sut.isBeneficiaryEligibleForCurrentDistribution(activeEligibleBeneficiaryCode)).toEqual(true); - }); - test("When checking code from any distribution during inactive distrubtion Then error is thrown", async () => { - const activeSession = await new ActiveSession(await setupDatabase()); - activeSession.nameOfLastViewedDistribution = undefined; - const sut = new BeneficiaryEligilityService(activeSession); - try { - const result = await sut.isBeneficiaryEligibleForCurrentDistribution("could have been any code"); - fail("Expected error"); - } - catch (error) { - expect(error).toEqual(Error("Expected active distribution")); - } - }); -}); diff --git a/PWA/public/Services/BeneficiaryInfoService.js b/PWA/public/Services/BeneficiaryInfoService.js index 2e3edbc..cf53845 100644 --- a/PWA/public/Services/BeneficiaryInfoService.js +++ b/PWA/public/Services/BeneficiaryInfoService.js @@ -3,7 +3,7 @@ export class BeneficiaryInfoService { this.database = database; } async beneficiaryInfoTextFromDistribution(distribution) { - const beneficiaries = await this.database.benificiariesForDistribution(distribution); + const beneficiaries = await this.database.beneficiariesForDistributionNamed(distribution.distrib_name); const numberOfServedBeneficiaries = beneficiaries.filter(beneficiary => beneficiary.hasBeenMarkedAsReceived).length; return this.beneficiaryInfoTextFromNumberOfBeneficiariesAndNumberServed(beneficiaries.length, numberOfServedBeneficiaries); } diff --git a/PWA/public/Services/BeneficiaryStatusService.js b/PWA/public/Services/BeneficiaryStatusService.js index e830bc0..d530d6e 100644 --- a/PWA/public/Services/BeneficiaryStatusService.js +++ b/PWA/public/Services/BeneficiaryStatusService.js @@ -6,23 +6,17 @@ export class BeneficiaryStatusService extends ActiveSessionContainer { var beneficiariesWithStatus = []; const currentDistribution = await this.activeSession.database.distributionWithName(this.activeSession.nameOfLastViewedDistribution); if (currentDistribution) { - const distributionBeneficiaries = await this.activeSession.database.benificiariesForDistribution(currentDistribution); - for (let i = 0; i < distributionBeneficiaries.length; i++) { - const currentDistributionBeneficiary = distributionBeneficiaries[i]; - const currentBeneficiary = await this.activeSession.database.beneficiaryWithCode(currentDistributionBeneficiary.beneficiaryCode); - if (currentBeneficiary) { - let currentBeneficaryWithStatus = {}; - currentBeneficaryWithStatus["code"] = currentBeneficiary.code; - for (let j = 1; j < currentBeneficiary.columns.length; j++) { - currentBeneficaryWithStatus[currentBeneficiary.columns[j]] = currentBeneficiary.values[j]; - } - currentBeneficaryWithStatus["Recepient"] = currentDistributionBeneficiary.hasBeenMarkedAsReceived ? "Yes" : "No"; - currentBeneficaryWithStatus["Received_when"] = (_a = currentDistributionBeneficiary.dateReceived) !== null && _a !== void 0 ? _a : "None"; - beneficiariesWithStatus.push(currentBeneficaryWithStatus); - } - else { - throw new Error('Expected beneficiary for code ' + currentDistributionBeneficiary.beneficiaryCode); + const beneficiaries = await this.activeSession.database.beneficiariesForDistributionNamed(currentDistribution.distrib_name); + for (let i = 0; i < beneficiaries.length; i++) { + const currentBeneficiary = beneficiaries[i]; + let currentBeneficaryWithStatus = {}; + currentBeneficaryWithStatus["code"] = currentBeneficiary.code; + for (let j = 1; j < currentBeneficiary.columns.length; j++) { + currentBeneficaryWithStatus[currentBeneficiary.columns[j]] = currentBeneficiary.values[j]; } + currentBeneficaryWithStatus["Recepient"] = currentBeneficiary.hasBeenMarkedAsReceived ? "Yes" : "No"; + currentBeneficaryWithStatus["Received_when"] = (_a = currentBeneficiary.dateReceived) !== null && _a !== void 0 ? _a : "None"; + beneficiariesWithStatus.push(currentBeneficaryWithStatus); } return beneficiariesWithStatus; } diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index 84e0ae7..006f479 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -20,7 +20,6 @@ import { FormParser } from "./FormParser.js"; import { BeneficiaryCodePostHandler } from "./FetchEventHandlers/BeneficiaryCodePostHandler.js"; import { BeneficiaryCodeInputMethodPost } from "../Models/BeneficiaryCodeInputMethodPost.js"; import { ActiveSession } from "./ActiveSession.js"; -import { BeneficiaryEligilityService } from "./BeneficiaryEligilityService.js"; import { ViewDistributionDataHandler } from "./FetchEventHandlers/ViewDistributionDataHandler.js"; import { BeneficiariesService } from "./BeneficiariesService.js"; import { CheckWhoIsMissingPageHandler } from "./FetchEventHandlers/CheckWhoIsMissingPageHandler.js"; @@ -112,7 +111,6 @@ export class CacheFilePathService { Database.name, DeserialisationService.name, FormParser.name, - BeneficiaryEligilityService.name, ActiveSession.name, BeneficiariesService.name, DateService.name, diff --git a/PWA/public/Services/Database.js b/PWA/public/Services/Database.js index c8fe48f..d2f1440 100644 --- a/PWA/public/Services/Database.js +++ b/PWA/public/Services/Database.js @@ -1,15 +1,12 @@ -import { DistributionBeneficiary } from "../Models/DistributionBeneficiary.js"; let db; export var ObjectStoreName; (function (ObjectStoreName) { ObjectStoreName["distribution"] = "Distributions"; ObjectStoreName["beneficiary"] = "Beneficiaries"; - ObjectStoreName["distributionBeneficiaries"] = "DistributionBeneficiary"; })(ObjectStoreName || (ObjectStoreName = {})); const allObjectStoreNames = [ ObjectStoreName.beneficiary, - ObjectStoreName.distribution, - ObjectStoreName.distributionBeneficiaries, + ObjectStoreName.distribution ]; function columnsForObjectStore(objectStore) { switch (objectStore) { @@ -22,14 +19,10 @@ function columnsForObjectStore(objectStore) { ]; case ObjectStoreName.beneficiary: return [ - { name: "code", isUnique: true }, + { name: "code", isUnique: false }, { name: "columns", isUnique: false }, { name: "values", isUnique: false }, - ]; - case ObjectStoreName.distributionBeneficiaries: - return [ { name: "distributionName", isUnique: false }, - { name: "beneficiaryCode", isUnique: false }, { name: "hasBeenMarkedAsReceived", isUnique: false }, { name: "dateReceived", isUnique: false } ]; @@ -62,9 +55,6 @@ export class Database { async readBeneficiaries() { return this.getElement(ObjectStoreName.beneficiary); } - async readDistributionBeneficiaries() { - return this.getElement(ObjectStoreName.distributionBeneficiaries); - } async distributionWithName(name) { const distributions = await this.readDistributions(); console.log("known distributions:"); @@ -77,9 +67,9 @@ export class Database { return undefined; } } - async beneficiaryWithCode(code) { + async beneficiaryWithCode(code, distributionName) { const beneficiaries = await this.readBeneficiaries(); - const foundBeneficiaries = beneficiaries.filter((beneficiary) => beneficiary.code == code); + const foundBeneficiaries = beneficiaries.filter((beneficiary) => beneficiary.code == code && beneficiary.distributionName == distributionName); if (foundBeneficiaries.length > 0) { return foundBeneficiaries[0]; } @@ -93,60 +83,24 @@ export class Database { async deleteDistributionWithName(name) { return this.removeElement(ObjectStoreName.distribution, await this.keyForDistributionWithName(name)); } - async benificiariesForDistribution(distribution) { - const distributionBeneficiaries = await this.readDistributionBeneficiaries(); + async beneficiariesForDistributionNamed(distributionName) { + const beneficiaries = await this.readBeneficiaries(); console.log("distribution benefeciaries:"); - console.log(distributionBeneficiaries); - return distributionBeneficiaries.filter((distributionBeneficiary) => distributionBeneficiary.distributionName == distribution.distrib_name); - } - async distributionBeneficiary(distribution, beneficiary) { - let distributionBeneficiaries = await this.benificiariesForDistribution(distribution); - let filteredDistributionBeneficiaries = distributionBeneficiaries - .filter((distributionBeneficiary) => distributionBeneficiary.beneficiaryCode == beneficiary.code); - if (filteredDistributionBeneficiaries.length > 0) { - return filteredDistributionBeneficiaries[0]; - } - else { - return undefined; - } + console.log(beneficiaries); + return beneficiaries.filter((beneficiary) => beneficiary.distributionName == distributionName); } async addBeneficiary(beneficiary) { return this.addElement(ObjectStoreName.beneficiary, beneficiary); } - async addBeneficiaryToDistribution(beneficiary, distribution) { - const existing = await this.readDistributionBeneficiaries(); - existing.forEach((curent) => { - if (curent.beneficiaryCode === beneficiary.code && - curent.distributionName === distribution.distrib_name) { - throw Error("Beneficiary with code " + curent.beneficiaryCode + " was already added to distribution named " + curent.distributionName); - } - }); - const existingBeneficiary = await this.beneficiaryWithCode(beneficiary.code); - if (!existingBeneficiary) { - this.addBeneficiary(beneficiary); - } - return this.addElement(ObjectStoreName.distributionBeneficiaries, new DistributionBeneficiary(beneficiary.code, distribution.distrib_name)); - } async markBeneficiaryAsReceived(beneficiaryCode, distributionName) { - const key = await this.keyForDistributionBeneficiary(beneficiaryCode, distributionName); - this.updatElementIf(ObjectStoreName.distributionBeneficiaries, (beneficiary) => { - return beneficiary.beneficiaryCode == beneficiaryCode && beneficiary.distributionName == distributionName; + this.updatElementIf(ObjectStoreName.beneficiary, (beneficiary) => { + return beneficiary.code == beneficiaryCode && beneficiary.distributionName == distributionName; }, (beneficiary) => { beneficiary.hasBeenMarkedAsReceived = true; beneficiary.dateReceived = (new Date()).toUTCString(); return beneficiary; }); } - async keyForDistributionBeneficiary(beneficiaryCode, distributionName) { - const distributionBeneficiaries = await this.readDistributionBeneficiaries(); - for (let i = 0; i < distributionBeneficiaries.length; i++) { - const currentBeneficiary = distributionBeneficiaries[i]; - if (currentBeneficiary.distributionName == distributionName && currentBeneficiary.beneficiaryCode == beneficiaryCode) { - return i + 1; - } - } - throw Error("Not found"); - } async keyForDistributionWithName(name) { const distributions = await this.readDistributions(); const keys = await this.performRequestForObjectStoreNamed(ObjectStoreName.distribution, "readonly", (store) => { diff --git a/PWA/public/Services/Database.test.js b/PWA/public/Services/Database.test.js index ee4ad4d..a912407 100644 --- a/PWA/public/Services/Database.test.js +++ b/PWA/public/Services/Database.test.js @@ -9,8 +9,8 @@ describe('Database', () => { const distribution = new Distribution("items", "date", "location", distributionName); const beneficiaryCode = "123"; const beneficiary2Code = "1234"; - const beneficiary = new Beneficiary(beneficiaryCode, ["code"], [beneficiaryCode]); - const beneficiary2 = new Beneficiary(beneficiary2Code, ["code"], [beneficiaryCode]); + const beneficiary = new Beneficiary(beneficiaryCode, ["code"], [beneficiaryCode], distributionName); + const beneficiary2 = new Beneficiary(beneficiary2Code, ["code"], [beneficiaryCode], distributionName); test("When adding distribution, it can be retrieved", async () => { await sut.addDistribution(distribution); const receivedDistribution = await sut.distributionWithName(distributionName); @@ -27,37 +27,21 @@ describe('Database', () => { }); test("When adding a beneficiary, it can be retrieved", async () => { await sut.addBeneficiary(beneficiary); - const receivedBeneficiary = await sut.beneficiaryWithCode(beneficiaryCode); + const receivedBeneficiary = await sut.beneficiaryWithCode(beneficiaryCode, distributionName); expect(receivedBeneficiary.code).toEqual(beneficiaryCode); }); - test("When adding beneficiary to distribution, it can be retrieved", async () => { - await sut.addBeneficiaryToDistribution(beneficiary, distribution); - const receivedBeneficiaries = await sut.benificiariesForDistribution(distribution); - expect(receivedBeneficiaries.length).toEqual(1); - expect(receivedBeneficiaries[0].beneficiaryCode).toEqual(beneficiary.code); - expect(receivedBeneficiaries[0].distributionName).toEqual(distribution.distrib_name); - }); - test("When adding beneficiary to distribution twice, an error is thown", async () => { - try { - await sut.addBeneficiaryToDistribution(beneficiary, distribution); - throw Error("expected error to be thown at this point"); - } - catch (error) { - expect(error.message).toBe("Beneficiary with code 123 was already added to distribution named UniqueDistributionName"); - } - }); test("When marking a benefificiary as marked, it shows as marked", async () => { - await sut.addBeneficiaryToDistribution(beneficiary2, distribution); - var receivedBeneficiaries = await sut.benificiariesForDistribution(distribution); + await sut.addBeneficiary(beneficiary2); + var receivedBeneficiaries = await sut.beneficiariesForDistributionNamed(distributionName); expect(receivedBeneficiaries.length).toEqual(2); expect(receivedBeneficiaries[0].hasBeenMarkedAsReceived).toEqual(false); expect(receivedBeneficiaries[1].hasBeenMarkedAsReceived).toEqual(false); await sut.markBeneficiaryAsReceived(beneficiary2.code, distribution.distrib_name); - var receivedBeneficiaries = await sut.benificiariesForDistribution(distribution); + var receivedBeneficiaries = await sut.beneficiariesForDistributionNamed(distributionName); expect(receivedBeneficiaries[0].hasBeenMarkedAsReceived).toEqual(false); expect(receivedBeneficiaries[1].hasBeenMarkedAsReceived).toEqual(true); await sut.markBeneficiaryAsReceived(beneficiary.code, distribution.distrib_name); - var receivedBeneficiaries = await sut.benificiariesForDistribution(distribution); + var receivedBeneficiaries = await sut.beneficiariesForDistributionNamed(distributionName); console.log(receivedBeneficiaries); expect(receivedBeneficiaries[0].hasBeenMarkedAsReceived).toEqual(true); expect(receivedBeneficiaries[1].hasBeenMarkedAsReceived).toEqual(true); diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js index ebf33d3..1217a09 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryCodePostHandler.js @@ -1,62 +1,28 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; -import { BeneficiaryEligilityService } from "../BeneficiaryEligilityService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; -/* -@main.route('/entry', methods=['POST', 'GET']) -@login_required -def beneficiary(): - """Get beneficiary data.""" - if 'distrib_id' not in session.keys(): - return render_template('index_distrib.html') - - if 'code' in request.form.keys(): - if request.form['code'].strip() == '': - return render_template('input.html') - else: - code = str(request.form['code']) - elif 'code' in request.args.keys(): - if request.args['code'].strip() == '': - return render_template('input.html') - else: - code = str(request.args['code']) - else: - return render_template('input.html') - - beneficiary_data = get_beneficiary_entry(beneficiary_id=str(session['distrib_id'])+str(code), - user_email=current_user.email, - distrib_id=session['distrib_id']) - if beneficiary_data == "not_found": - return render_template('entry_not_found.html') - elif beneficiary_data == "no_data": - return render_template('no_data.html') - else: - for internal_field in ['id', 'distrib_id', 'partitionKey']: - if internal_field in beneficiary_data.keys(): - beneficiary_data.pop(internal_field) - return render_template('entry.html', - data=beneficiary_data) -*/ export class BeneficiaryCodePostHandler extends ActiveSessionContainer { - constructor() { - super(...arguments); - this.eligebilityService = new BeneficiaryEligilityService(this.activeSession); - } canHandleEvent(event) { return event.request.url.includes(RouteEvents.checkBeneficiaryCodeInputMethod); } async handleEvent(event) { const beneficiaryCode = this.beneficiaryCodeFromRequest(event.request); if (beneficiaryCode) { - const beneficiary = await this.activeSession.database.beneficiaryWithCode(beneficiaryCode); - if (beneficiary) { - return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.codeInputFound, { - eligibility_info_box_id: await this.eligebilityService.isBeneficiaryEligibleForCurrentDistribution(beneficiaryCode) ? "eligible" : "noteligible", - eligibility_info_name: beneficiary.code, - eligibility_info_values: beneficiary.values, - }); + if (this.activeSession.nameOfLastViewedDistribution) { + const beneficiary = await this.activeSession.database.beneficiaryWithCode(beneficiaryCode, this.activeSession.nameOfLastViewedDistribution); + if (beneficiary) { + return ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.codeInputFound, { + eligibility_info_box_id: beneficiary.hasBeenMarkedAsReceived ? "noteligible" : "eligible", + eligibility_info_name: beneficiary.code, + eligibility_info_values: beneficiary.values, + }); + } + else { + return ResponseTools.wrapInHtmlTemplate(RouteEvents.codeInputNotFound); + } } else { + console.error("Expected activeDistribution"); return ResponseTools.wrapInHtmlTemplate(RouteEvents.codeInputNotFound); } } diff --git a/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js b/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js index d5ebbe3..35cc006 100644 --- a/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js +++ b/PWA/public/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.js @@ -9,14 +9,13 @@ export class BeneficiaryDataUploadHandler extends ActiveSessionContainer { } async handleEvent(event) { try { - const beneficiaries = await new BeneficiaryDeserializationService().deserializeFormDataFromRequest(event.request); const database = this.activeSession.database; const distributionName = this.activeSession.nameOfLastViewedDistribution; if (distributionName) { const distribution = await database.distributionWithName(distributionName); if (distribution) { + const beneficiaries = await new BeneficiaryDeserializationService().deserializeFormDataFromRequest(event.request, distributionName); await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiary(beneficiary)); - await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiaryToDistribution(beneficiary, distribution)); this.activeSession.nameOfLastViewedDistribution = distributionName; const beneficiaryInfoService = new BeneficiaryInfoService(this.activeSession.database); return await ResponseTools.wrapInHTPLTemplateAndReplaceKeysWithValues(RouteEvents.distributionsHome, { diff --git a/PWA/public/index.html b/PWA/public/index.html index fdd8ac0..faaa825 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - +
Download data template
diff --git a/PWA/src/Services/Database.ts b/PWA/src/Services/Database.ts index a093ba4..ea308e7 100644 --- a/PWA/src/Services/Database.ts +++ b/PWA/src/Services/Database.ts @@ -124,6 +124,10 @@ export class Database { } async addBeneficiary(beneficiary: Beneficiary): Promise { + if(await this.beneficiaryWithCode(beneficiary.code, beneficiary.distributionName)) { + throw "There's already a distribution with code " + beneficiary.code + " in distribution " + beneficiary.distributionName + } + return this.addElement(ObjectStoreName.beneficiary, beneficiary); } diff --git a/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts b/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts index 09cb381..8dfee7e 100644 --- a/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts +++ b/PWA/src/Services/FetchEventHandlers/BeneficiaryDataUploadHandler.ts @@ -5,6 +5,7 @@ import { BeneficiaryDeserializationService } from "../BeneficiaryDeserialization import { ResponseTools } from "../ResponseTools.js"; import { BeneficiaryInfoService } from "../BeneficiaryInfoService.js"; import { ActiveSessionContainer } from "../ActiveSession.js"; +import { Beneficiary } from "../../Models/Beneficiary.js"; export class BeneficiaryDataUploadHandler extends ActiveSessionContainer implements FetchEventHandler { canHandleEvent(event: FetchEvent): boolean { @@ -19,7 +20,12 @@ export class BeneficiaryDataUploadHandler extends ActiveSessionContainer impleme const distribution = await database.distributionWithName(distributionName) if (distribution) { const beneficiaries = await new BeneficiaryDeserializationService().deserializeFormDataFromRequest(event.request, distributionName) - await beneficiaries.forEach(async (beneficiary) => await database.addBeneficiary(beneficiary)) + if(!this.areAllCodesUnique(beneficiaries)) { + throw "All beneficiary codes should be unique" + } + for (const beneficiary of beneficiaries) { + await database.addBeneficiary(beneficiary); + } this.activeSession.nameOfLastViewedDistribution = distributionName const beneficiaryInfoService = new BeneficiaryInfoService(this.activeSession.database) @@ -40,4 +46,17 @@ export class BeneficiaryDataUploadHandler extends ActiveSessionContainer impleme return ResponseTools.wrapInHtmlTemplate(RouteEvents.uploadDataError) } } + + private areAllCodesUnique(beneficiaries: Beneficiary[]): boolean { + const codes = new Set() + + for (const beneficiary of beneficiaries) { + if (codes.has(beneficiary.code)) { + return false + } + codes.add(beneficiary.code); + } + + return true + } } From 80c0d9941f3001efe9ddd8bcd10c7caa3d5902a6 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:35:25 +0100 Subject: [PATCH 77/99] Start shipping documentation bump 0.15.1 --- PWA/package.json | 2 +- PWA/public/RouteEvents.js | 1 + PWA/public/Services/CacheFilePathService.js | 7 +- .../DocumentationPagehandler.js | 10 +++ .../FetchEventHandlers/FetchEventHandlers.js | 4 +- .../HomepageHandler copy.js | 17 +++++ PWA/public/documentation.html | 64 +++++++++++++++++++ PWA/public/index.html | 4 +- PWA/public/template.html | 2 +- PWA/src/RouteEvents.ts | 1 + PWA/src/Services/CacheFilePathService.ts | 7 +- .../DocumentationPagehandler.ts | 14 ++++ .../FetchEventHandlers/FetchEventHandlers.ts | 4 +- 13 files changed, 127 insertions(+), 10 deletions(-) create mode 100644 PWA/public/Services/FetchEventHandlers/DocumentationPagehandler.js create mode 100644 PWA/public/Services/FetchEventHandlers/HomepageHandler copy.js create mode 100644 PWA/public/documentation.html create mode 100644 PWA/src/Services/FetchEventHandlers/DocumentationPagehandler.ts diff --git a/PWA/package.json b/PWA/package.json index 23d260a..ef10569 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -1,6 +1,6 @@ { "name": "ReliefBox", - "version": "0.12.0", + "version": "0.15.1", "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", "main": "index.js", "scripts": { diff --git a/PWA/public/RouteEvents.js b/PWA/public/RouteEvents.js index ee66019..e4232f3 100644 --- a/PWA/public/RouteEvents.js +++ b/PWA/public/RouteEvents.js @@ -17,6 +17,7 @@ RouteEvents.codeInputUsingCamera = "/input_video.html"; RouteEvents.codeinputUsingTextField = "/input.html"; RouteEvents.codeInputNotFound = "/entry_not_found.html"; RouteEvents.codeInputFound = "/entry.html"; +RouteEvents.documentation = "/documentation.html"; //Non page route events RouteEvents.postCreateDistribution = "/create_distrib"; RouteEvents.postSelectDistribution = "/select_distrib"; diff --git a/PWA/public/Services/CacheFilePathService.js b/PWA/public/Services/CacheFilePathService.js index 006f479..98e7ec8 100644 --- a/PWA/public/Services/CacheFilePathService.js +++ b/PWA/public/Services/CacheFilePathService.js @@ -33,6 +33,7 @@ import { DownloadSpreadsheetTemplateHandler } from "./FetchEventHandlers/Downloa import { DeleteDistributionsConfirmHandler } from "./FetchEventHandlers/DeleteDistributionsConfirmHandler.js"; import { DistributionResponseProvider } from "./DistributionResponseProvider.js"; import { DistributionsHandler } from "./FetchEventHandlers/DistributionsHandler.js"; +import { DocumentationPageHandler } from "./FetchEventHandlers/DocumentationPagehandler.js"; // Provides all the files that have to be cached for offline use export class CacheFilePathService { pathsOfFilesToCache() { @@ -67,7 +68,8 @@ export class CacheFilePathService { RouteEvents.codeInputNotFound, RouteEvents.viewData, RouteEvents.noBeneficiariesFound, - RouteEvents.confirmDistributionDeletion + RouteEvents.confirmDistributionDeletion, + RouteEvents.documentation ]; } toplevelScriptsPaths() { @@ -139,7 +141,8 @@ export class CacheFilePathService { DownloadDataHandler.name, DownloadSpreadsheetTemplateHandler.name, DeleteDistributionsConfirmHandler.name, - DistributionsHandler.name + DistributionsHandler.name, + DocumentationPageHandler.name ]); } interfacesPaths() { diff --git a/PWA/public/Services/FetchEventHandlers/DocumentationPagehandler.js b/PWA/public/Services/FetchEventHandlers/DocumentationPagehandler.js new file mode 100644 index 0000000..eb171d9 --- /dev/null +++ b/PWA/public/Services/FetchEventHandlers/DocumentationPagehandler.js @@ -0,0 +1,10 @@ +import { RouteEvents } from "../../RouteEvents.js"; +import { ResponseTools } from "../ResponseTools.js"; +export class DocumentationPageHandler { + canHandleEvent(event) { + return event.request.url.endsWith(RouteEvents.documentation); + } + async handleEvent(event) { + return await ResponseTools.wrapInHtmlTemplate(RouteEvents.documentation); + } +} diff --git a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js index cccba66..4969a7b 100644 --- a/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js +++ b/PWA/public/Services/FetchEventHandlers/FetchEventHandlers.js @@ -19,6 +19,7 @@ import { DownloadDataHandler } from "./DownloadDataHandler.js"; import { DownloadSpreadsheetTemplateHandler } from "./DownloadSpreadsheetTemplateHandler.js"; import { DeleteDistributionsConfirmHandler } from "./DeleteDistributionsConfirmHandler.js"; import { DistributionsHandler } from "./DistributionsHandler.js"; +import { DocumentationPageHandler } from "./DocumentationPagehandler.js"; export class FetchEventHandlers extends ActiveSessionContainer { constructor() { super(...arguments); @@ -42,7 +43,8 @@ export class FetchEventHandlers extends ActiveSessionContainer { new DownloadDataHandler(this.activeSession), new DownloadSpreadsheetTemplateHandler(), new DeleteDistributionsConfirmHandler(), - new DistributionsHandler() + new DistributionsHandler(), + new DocumentationPageHandler() ]; } handlersForEvent(event) { diff --git a/PWA/public/Services/FetchEventHandlers/HomepageHandler copy.js b/PWA/public/Services/FetchEventHandlers/HomepageHandler copy.js new file mode 100644 index 0000000..97c7b70 --- /dev/null +++ b/PWA/public/Services/FetchEventHandlers/HomepageHandler copy.js @@ -0,0 +1,17 @@ +import { RouteEvents } from "../../RouteEvents.js"; +import { ResponseTools } from "../ResponseTools.js"; +import { ActiveSessionContainer } from "../ActiveSession.js"; +import { DistributionResponseProvider } from "../DistributionResponseProvider.js"; +export class HomepageHandler extends ActiveSessionContainer { + canHandleEvent(event) { + return event.request.url.includes(RouteEvents.home); + } + async handleEvent(event) { + if (this.activeSession.nameOfLastViewedDistribution) { + return await new DistributionResponseProvider(this.activeSession).responseForDistribution(this.activeSession.nameOfLastViewedDistribution); + } + else { + return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); + } + } +} diff --git a/PWA/public/documentation.html b/PWA/public/documentation.html new file mode 100644 index 0000000..7464c21 --- /dev/null +++ b/PWA/public/documentation.html @@ -0,0 +1,64 @@ +
+

Installation for offline use

+

iOS

+
    +
  1. Press the share button (square with arrow pointing outward) at bottom of browser window.
  2. +
  3. Scroll down and press the "Add to Home Screen" button.
  4. +
  5. Tap the Add button on the top right.
  6. +
  7. Open the app once, to make sure it's offline contents are downloaded.
  8. +
+
+

Android

+
    +
  1. TODO: write these steps
  2. +
+
+ +

Before the distribution

+
    +
  1. + Prepare the beneficiary list in + Microsoft Excel (.xlsx). + Exports from KoboToolbox, a mobile data collection software, are natively supported. +
      +
    • The beneficiary list must contain a field/column named “code”, which contains unique values for each beneficiary. In other words, each beneficiary must have a unique code.
    • +
    • The beneficiary list can contain any number and type of fields/columns. However, for visualization purposes, it is recommended to keep only the fields/columns needed to identify beneficiaries.
    • +
    +
  2. +
  3. Click “Create a new distribution” and fill in the required details.
  4. +
  5. Click “Add beneficiary data” and upload your beneficiary list.
  6. +
  7. Click “View beneficiary data” and verify that everything looks as expected.
  8. +
+ +
+

During the distribution

+
    +
  1. Click “Start distribution”.
  2. +
  3. Select how you will insert the beneficiary codes: with a camera, a barcode scanner or manually.
  4. +
  5. Insert beneficiary code.
  6. +
  7. + Verify beneficiary identity. +
      +
    • If identity is verified and the beneficiary receives aid, click “Mark as recipient”.
    • +
    • If identity does not correspond, click “Continue distribution”. The beneficiary will not be marked as recipient.
    • +
    +
  8. +
  9. Repeat steps 3-4 until all potential beneficiaries are served.
  10. +
  11. If there are relief items left at the end of the distribution, you can check who did not show up by clicking “Go back to main menu” → “Check who is missing”.
  12. +
+ +
+

After the distribution

+
    +
  1. + If you need data on the distribution for monitoring and reporting purposes: +
      +
    • Click “Download beneficiary data” to get the beneficiary list in + Microsoft Excel (.xlsx). The spreadsheet will contain two additional fields/columns that show, for each beneficiary, if they received aid and when. +
    • +
    • Store the information safely.
    • +
    +
  2. +
  3. If you need to start a new distribution, click “Change distribution” and repeat all steps above.
  4. +
+
\ No newline at end of file diff --git a/PWA/public/index.html b/PWA/public/index.html index 1f780f3..9917e74 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - + Distributions - + Documentation
diff --git a/PWA/public/template.html b/PWA/public/template.html index 7a0f4a8..c03958d 100644 --- a/PWA/public/template.html +++ b/PWA/public/template.html @@ -55,7 +55,7 @@ Distributions - + Documentation
diff --git a/PWA/src/RouteEvents.ts b/PWA/src/RouteEvents.ts index 2c98863..cf734bf 100644 --- a/PWA/src/RouteEvents.ts +++ b/PWA/src/RouteEvents.ts @@ -16,6 +16,7 @@ export class RouteEvents { static codeinputUsingTextField = "/input.html" static codeInputNotFound = "/entry_not_found.html" static codeInputFound = "/entry.html" + static documentation = "/documentation.html" //Non page route events static postCreateDistribution = "/create_distrib" diff --git a/PWA/src/Services/CacheFilePathService.ts b/PWA/src/Services/CacheFilePathService.ts index 086f658..436440e 100644 --- a/PWA/src/Services/CacheFilePathService.ts +++ b/PWA/src/Services/CacheFilePathService.ts @@ -33,6 +33,7 @@ import { DownloadSpreadsheetTemplateHandler } from "./FetchEventHandlers/Downloa import { DeleteDistributionsConfirmHandler } from "./FetchEventHandlers/DeleteDistributionsConfirmHandler.js"; import { DistributionResponseProvider } from "./DistributionResponseProvider.js"; import { DistributionsHandler } from "./FetchEventHandlers/DistributionsHandler.js"; +import { DocumentationPageHandler } from "./FetchEventHandlers/DocumentationPagehandler.js"; // Provides all the files that have to be cached for offline use export class CacheFilePathService { @@ -69,7 +70,8 @@ export class CacheFilePathService { RouteEvents.codeInputNotFound, RouteEvents.viewData, RouteEvents.noBeneficiariesFound, - RouteEvents.confirmDistributionDeletion + RouteEvents.confirmDistributionDeletion, + RouteEvents.documentation ]; } @@ -152,7 +154,8 @@ export class CacheFilePathService { DownloadDataHandler.name, DownloadSpreadsheetTemplateHandler.name, DeleteDistributionsConfirmHandler.name, - DistributionsHandler.name + DistributionsHandler.name, + DocumentationPageHandler.name ]); } diff --git a/PWA/src/Services/FetchEventHandlers/DocumentationPagehandler.ts b/PWA/src/Services/FetchEventHandlers/DocumentationPagehandler.ts new file mode 100644 index 0000000..fd34114 --- /dev/null +++ b/PWA/src/Services/FetchEventHandlers/DocumentationPagehandler.ts @@ -0,0 +1,14 @@ +import { RouteEvents } from "../../RouteEvents.js"; +import { FetchEvent } from "../../Interfaces/FetchEvent.js"; +import { FetchEventHandler } from "../../Interfaces/FetchEventHandler.js"; +import { ResponseTools } from "../ResponseTools.js"; + +export class DocumentationPageHandler implements FetchEventHandler { + canHandleEvent(event: FetchEvent): boolean { + return event.request.url.endsWith(RouteEvents.documentation); + } + + async handleEvent(event: FetchEvent): Promise { + return await ResponseTools.wrapInHtmlTemplate(RouteEvents.documentation) + } +} \ No newline at end of file diff --git a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts index 41c46e6..fe9fff4 100644 --- a/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts +++ b/PWA/src/Services/FetchEventHandlers/FetchEventHandlers.ts @@ -21,6 +21,7 @@ import { DownloadDataHandler } from "./DownloadDataHandler.js"; import { DownloadSpreadsheetTemplateHandler } from "./DownloadSpreadsheetTemplateHandler.js"; import { DeleteDistributionsConfirmHandler } from "./DeleteDistributionsConfirmHandler.js"; import { DistributionsHandler } from "./DistributionsHandler.js"; +import { DocumentationPageHandler } from "./DocumentationPagehandler.js"; export class FetchEventHandlers extends ActiveSessionContainer implements FetchEventHandler { all: FetchEventHandler[] = [ @@ -43,7 +44,8 @@ export class FetchEventHandlers extends ActiveSessionContainer implements FetchE new DownloadDataHandler(this.activeSession), new DownloadSpreadsheetTemplateHandler(), new DeleteDistributionsConfirmHandler(), - new DistributionsHandler() + new DistributionsHandler(), + new DocumentationPageHandler() ]; handlersForEvent(event: FetchEvent): FetchEventHandler[] { From 71e27c48cff0aa3ce5302de6e463c2b81abed6e1 Mon Sep 17 00:00:00 2001 From: rcmenno <129762469+rcmenno@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:02:54 +0100 Subject: [PATCH 78/99] Improve documentation handler 0.15.2 --- PWA/package.json | 2 +- .../DocumentationPagehandler.js | 2 +- .../FetchEventHandlers/HomepageHandler copy.js | 17 ----------------- PWA/public/index.html | 2 +- .../DocumentationPagehandler.ts | 2 +- 5 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 PWA/public/Services/FetchEventHandlers/HomepageHandler copy.js diff --git a/PWA/package.json b/PWA/package.json index ef10569..98f4efb 100644 --- a/PWA/package.json +++ b/PWA/package.json @@ -1,6 +1,6 @@ { "name": "ReliefBox", - "version": "0.15.1", + "version": "0.15.2", "description": "A tool for managing the distribution of relief items during humanitarian emergencies.", "main": "index.js", "scripts": { diff --git a/PWA/public/Services/FetchEventHandlers/DocumentationPagehandler.js b/PWA/public/Services/FetchEventHandlers/DocumentationPagehandler.js index eb171d9..ec93720 100644 --- a/PWA/public/Services/FetchEventHandlers/DocumentationPagehandler.js +++ b/PWA/public/Services/FetchEventHandlers/DocumentationPagehandler.js @@ -2,7 +2,7 @@ import { RouteEvents } from "../../RouteEvents.js"; import { ResponseTools } from "../ResponseTools.js"; export class DocumentationPageHandler { canHandleEvent(event) { - return event.request.url.endsWith(RouteEvents.documentation); + return event.request.url.includes(RouteEvents.documentation); } async handleEvent(event) { return await ResponseTools.wrapInHtmlTemplate(RouteEvents.documentation); diff --git a/PWA/public/Services/FetchEventHandlers/HomepageHandler copy.js b/PWA/public/Services/FetchEventHandlers/HomepageHandler copy.js deleted file mode 100644 index 97c7b70..0000000 --- a/PWA/public/Services/FetchEventHandlers/HomepageHandler copy.js +++ /dev/null @@ -1,17 +0,0 @@ -import { RouteEvents } from "../../RouteEvents.js"; -import { ResponseTools } from "../ResponseTools.js"; -import { ActiveSessionContainer } from "../ActiveSession.js"; -import { DistributionResponseProvider } from "../DistributionResponseProvider.js"; -export class HomepageHandler extends ActiveSessionContainer { - canHandleEvent(event) { - return event.request.url.includes(RouteEvents.home); - } - async handleEvent(event) { - if (this.activeSession.nameOfLastViewedDistribution) { - return await new DistributionResponseProvider(this.activeSession).responseForDistribution(this.activeSession.nameOfLastViewedDistribution); - } - else { - return await ResponseTools.fetchFromCacheWithRemoteAsFallBack(RouteEvents.home); - } - } -} diff --git a/PWA/public/index.html b/PWA/public/index.html index 9917e74..fcff316 100644 --- a/PWA/public/index.html +++ b/PWA/public/index.html @@ -39,7 +39,7 @@ - +