@compdfkit_pdf_sdk/webviewer 2.8.5 β†’ 2.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,78 +1,173 @@
1
- # ComPDFKit
1
+ # PDF SDK for Web | View, Annotate, Edit & Render PDFs in the Browser
2
2
 
3
- [ComPDFKit PDF SDK](https://www.compdf.com) seamlessly operates on [Web](https://www.compdf.com/web), [Windows](https://www.compdf.com/windows), [Android](https://www.compdf.com/android), [iOS](https://www.compdf.com/ios), [Mac](https://www.compdf.com/contact-sales), and [Server](https://www.compdf.com/server), with support for cross-platform frameworks such as [React Native](https://www.compdf.com/react-native), [Flutter](https://www.compdf.com/flutter), etc.
3
+ ComPDF WebViewer is a JavaScript PDF SDK for **Web** apps that need PDF viewing, annotation, editing, forms, signatures, comparison, and security directly in the browser. For teams building broader **document workflow** products, ComPDF also works with ComPDF API for **Convert**, **OCR**, and **Generate** workflows.
4
4
 
5
- ## Introduction
6
- [ComPDFKit for Web](https://www.compdf.com/web) is a powerful JavaScript-based PDF Library that's part of the [ComPDFKit PDF SDK](https://www.compdf.com). It provides a slick out-of-the-box responsive UI that interacts with the core library to view, annotate and manipulate PDFs that can be embedded into any web project.
5
+ ## πŸš€ Why ComPDF
7
6
 
8
- ## Related
7
+ ComPDF is a practical choice for web teams that need more than a low-level PDF renderer but do not want to build a full document UI stack from scratch.
9
8
 
10
- - Download [ComPDFKit for Web](https://www.npmjs.com/package/@compdfkit_pdf_sdk/webviewer) in npm.
11
- - Go to [ComPDFKit's Web Demo](https://www.compdf.com/webviewer/demo) to experience how our WebViewer performs.
12
- - Integrate ComPDFKit Web SDK into [Salesforce](https://www.compdf.com/pdf-sdk/salesforce), [SharePoint](https://www.compdf.com/pdf-sdk/sharepoint), [Microsoft Teams](https://www.compdf.com/contact-sales), etc.
9
+ Why developers use it:
13
10
 
14
- - [How to Build a PDF Viewer with JavaScript](https://www.compdf.com/blog/build-a-pdf-viewer-with-javascript)
11
+ - **Browser rendering:** render PDFs directly in the browser with a ready-to-use UI.
12
+ - **No backend required for standalone mode:** deploy with WebAssembly and keep rendering client-side.
13
+ - **SaaS-friendly integration:** embed document workflows inside portals, dashboards, CRMs, and customer-facing apps.
14
+ - **Framework support:** use it with React, Angular, Vue, Next.js, Nuxt.js, and more.
15
+ - **Commercial flexibility:** standalone and server-backed deployment options for different product needs.
15
16
 
16
- - [ComPDFKit Standalone Deployment for Web](https://www.compdf.com/blog/compdfkit-standalone-deployment-for-web)
17
+ ## 🎬 Live Demo
17
18
 
18
- - Recognize and extract data from PDFs with our online [Extract Demo](https://www.compdf.com/pdf-extract/demo)
19
+ Try ComPDF in action:
19
20
 
20
- ## Guides
21
+ - Web Demo: [https://www.compdf.com/demo/webviewer](https://www.compdf.com/demo/webviewer)
22
+ - Sample Project (React): [https://github.com/ComPDF/compdfkit-web-example-react](https://github.com/ComPDFKit/compdfkit-web-example-react)
23
+ - Sample Project (Vanilla JS): [https://github.com/ComPDFKit/compdfkit-web-example-vanilla-javascript](https://github.com/ComPDFKit/compdfkit-web-example-vanilla-javascript)
21
24
 
22
- You can get the full documentation of ComPDFKit for Web [here](https://www.compdf.com/guides/pdf-sdk/web/overview).
25
+ ## ⚑ Quick Start
23
26
 
24
- **1) Install WebViewer**
27
+ > Requirements: Node.js latest stable, npm-compatible package manager, and a valid ComPDF web license.
25
28
 
26
- ```
27
- npm i @compdfkit_pdf_sdk/webviewer --save
29
+ ### 1. Install
30
+
31
+ ```bash
32
+ npm install @compdfkit_pdf_sdk/webviewer
28
33
  ```
29
34
 
30
- This will [install the ComPDFKit for Web package](https://www.npmjs.com/package/@compdfkit_pdf_sdk/webviewer) and add it as a project dependency.
35
+ ### 2. Copy the WebViewer assets
31
36
 
32
- **2) Copy Assets to Your Static Folder**
37
+ ```bash
38
+ cp -r ./node_modules/@compdfkit_pdf_sdk/webviewer/dist ./public/webviewer
39
+ ```
33
40
 
34
- These assets need to be served in your application. Copy the ComPDFKit for Web library's assets to the `static` directory in your project’s root folder.
41
+ ### 3. Initialize the viewer
35
42
 
36
- The folder you need to copy is `node_modules/@compdfkit_pdf_sdk/webviewer/dist`.
37
- ```
38
- cp -r ./node_modules/@compdfkit_pdf_sdk/webviewer/dist ./public/webviewer
43
+ ```js
44
+ import WebViewer from '@compdfkit_pdf_sdk/webviewer';
45
+
46
+ const viewer = document.getElementById('viewer');
47
+
48
+ WebViewer.init(
49
+ {
50
+ path: '/webviewer',
51
+ pdfUrl: '/webviewer/example/developer_guide_web.pdf',
52
+ license: '<Input your license here>',
53
+ },
54
+ viewer,
55
+ ).then((instance) => {
56
+ const docViewer = instance.docViewer;
57
+
58
+ docViewer.addEvent('documentloaded', () => {
59
+ console.log('document loaded');
60
+ });
61
+ });
39
62
  ```
40
63
 
41
- **3) Import and Initial the WebViewer**
64
+ > Standalone deployment runs in the browser, so no backend is required for rendering PDFs.
65
+
66
+ ## 🧩 Key Features
67
+
68
+ - 🌐 **Browser PDF Rendering**
69
+ Render PDFs with smooth navigation, thumbnails, and a ready-made document UI.
70
+ πŸ‘‰ Use case: SaaS dashboards, customer portals, embedded viewers
71
+
72
+ - ✍️ **Annotations, Forms & Signatures**
73
+ Review, mark up, fill, and sign documents inside the browser.
74
+ πŸ‘‰ Use case: contract workflows, onboarding, collaboration
75
+
76
+ - πŸ› οΈ **Editing & Document Operations**
77
+ Support content editing, page workflows, and document manipulation in web apps.
78
+ πŸ‘‰ Use case: online PDF editors, review platforms, content operations tools
79
+
80
+ - πŸ” **Security & Comparison**
81
+ Add secure document handling and compare PDFs in browser-based workflows.
82
+ πŸ‘‰ Use case: legal review, approval systems, quality control
83
+
84
+ - 🧱 **Framework-Friendly Integration**
85
+ Use one PDF layer across React, Angular, Vue, Next.js, and other frontend stacks.
86
+ πŸ‘‰ Use case: multi-team SaaS platforms and reusable frontend infrastructure
87
+
88
+ - πŸ”„ **Convert / OCR / Generate via ComPDF API**
89
+ Combine WebViewer with backend document processing when your product needs more than in-browser interaction.
90
+ πŸ‘‰ Use case: invoice extraction, document generation, server-side automation
91
+
92
+ ## πŸ’‘ Use Cases
93
+
94
+ - **Document Management Systems** with browser-based viewing and review
95
+ - **PDF Editors** embedded in SaaS products
96
+ - **Customer Portals** for form filling, signatures, and secure document exchange
97
+ - **Invoice Processing** UIs that preview files in browser before OCR/extraction workflows
98
+ - **No-Backend Viewer Scenarios** where client-side rendering simplifies deployment
99
+
100
+ ## πŸ§ͺ Code Snippets
101
+
102
+ ### Vanilla JavaScript example
42
103
 
43
104
  ```js
44
- import WebViewer from '@compdfkit_pdf_sdk/webviewer'
105
+ import WebViewer from '@compdfkit_pdf_sdk/webviewer';
45
106
 
46
107
  const element = document.getElementById('viewer');
47
108
 
48
- WebViewer.init({
49
- path: '/', // the path of your webviewer
50
- pdfUrl: 'URL of your PDF File' // the path of your document
51
- license: 'Input your license here'
52
- }, element).then((instance) => {
53
- // Call APIs here
54
- })
109
+ WebViewer.init(
110
+ {
111
+ path: '/webviewer',
112
+ pdfUrl: '/webviewer/example/developer_guide_web.pdf',
113
+ license: '<Input your license here>',
114
+ },
115
+ element,
116
+ ).then((instance) => {
117
+ const docViewer = instance.docViewer;
118
+
119
+ docViewer.addEvent('documentloaded', () => {
120
+ console.log('ComPDF WebViewer loaded');
121
+ });
122
+ });
55
123
  ```
56
124
 
57
- **4) Apply the License Key**
58
- Contact [ComPDFKit's sales team](https://www.compdf.com/contact-sales) to get a free 30-day license to test the project.
59
-
60
- ## Documentation
61
- [Full documentation for ComPDFKit for Web](https://www.compdf.com/guides/pdf-sdk/web/overview) can be found here.
62
-
63
- ## License
64
- ComPDFKit for Web supports flexible licensing options, please contact [our sales team](mailto:support@compdf.com) to know more. Each license is only valid for a root domain name and any of its subdomains. However, any documents, sample code, or source code distribution from the released package of ComPDFKit PDF SDK to any third party is prohibited.
125
+ ### React example
65
126
 
66
- ## Support
67
- ComPDFKit has a professional R&D team that produces comprehensive technical documentation and guides to help developers. Also, you can get an immediate response when reporting your problems to our support team.
127
+ ```js
128
+ import { useEffect, useRef } from 'react';
129
+ import ComPDFKitViewer from '@compdfkit_pdf_sdk/webviewer';
130
+
131
+ export default function WebViewerContainer() {
132
+ const containerRef = useRef(null);
133
+
134
+ useEffect(() => {
135
+ ComPDFKitViewer.init(
136
+ {
137
+ path: '/',
138
+ pdfUrl: './example/developer_guide_web.pdf',
139
+ license: '<Input your license here>',
140
+ },
141
+ containerRef.current,
142
+ ).then((core) => {
143
+ const docViewer = core.docViewer;
144
+
145
+ docViewer.addEvent('documentloaded', async () => {
146
+ console.log('document loaded');
147
+ });
148
+ });
149
+ }, []);
150
+
151
+ return (
152
+ <div
153
+ ref={containerRef}
154
+ style={{ width: '100%', height: '100vh', overflow: 'hidden' }}
155
+ />
156
+ );
157
+ }
158
+ ```
68
159
 
69
- - For detailed information, please visit our [Guides](https://www.compdf.com/guides/pdf-sdk/web/overview) page.
160
+ ## πŸ”— Documentation & Resources
70
161
 
71
- - Stay updated with the latest improvements through our [Changelog](https://www.compdf.com/pdf-sdk/changelog-web).
162
+ | Resource | Link |
163
+ | --- | --- |
164
+ | Official Docs | [https://www.compdf.com/guides/pdf-sdk/web/overview](https://www.compdf.com/guides/pdf-sdk/web/overview) |
165
+ | Viewer Guide | [https://www.compdf.com/guides/pdf-sdk/web/viewer](https://www.compdf.com/guides/pdf-sdk/web/viewer) |
166
+ | GitHub Examples | [https://github.com/ComPDFKit/compdfkit-web-example-react](https://github.com/ComPDFKit/compdfkit-web-example-react) |
167
+ | Demo | [https://www.compdf.com/demo/webviewer](https://www.compdf.com/demo/webviewer) |
72
168
 
73
- - For technical assistance, please reach out to our [Technical Support](https://www.compdf.com/support).
169
+ ## ❀️ Engagement
74
170
 
75
- - To get more details and an accurate quote, please contact our [Sales Team](https://compdf.com/contact-us).
171
+ If ComPDF helps your web product ship faster, please ⭐ **Star us on GitHub** to support the project.
76
172
 
77
- ## Note
78
- We are glad to announce that you can register a ComPDFKit API account for a [free trial](https://api.compdf.com/api/pricing) to process 1000 documents per month for free.
173
+ ComPDF is a strong fit for teams that want browser rendering, customizable UI, and a clean upgrade path from PDF viewing to full document workflows.
@@ -1,2 +1,2 @@
1
- import{c as R}from"./index.85a4dbfc.js";function G(w,d){for(var b=0;b<d.length;b++){const y=d[b];if(typeof y!="string"&&!Array.isArray(y)){for(const h in y)if(h!=="default"&&!(h in w)){const p=Object.getOwnPropertyDescriptor(y,h);p&&Object.defineProperty(w,h,p.get?p:{enumerable:!0,get:()=>y[h]})}}}return Object.freeze(Object.defineProperty(w,Symbol.toStringTag,{value:"Module"}))}var A={exports:{}};(function(w,d){var b=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof R<"u"&&R,y=function(){function p(){this.fetch=!1,this.DOMException=b.DOMException}return p.prototype=b,new p}();(function(p){(function(u){var a=typeof p<"u"&&p||typeof self<"u"&&self||typeof a<"u"&&a,f={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function U(e){return e&&DataView.prototype.isPrototypeOf(e)}if(f.arrayBuffer)var j=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],S=ArrayBuffer.isView||function(e){return e&&j.indexOf(Object.prototype.toString.call(e))>-1};function v(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function E(e){return typeof e!="string"&&(e=String(e)),e}function T(e){var t={next:function(){var r=e.shift();return{done:r===void 0,value:r}}};return f.iterable&&(t[Symbol.iterator]=function(){return t}),t}function s(e){this.map={},e instanceof s?e.forEach(function(t,r){this.append(r,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}s.prototype.append=function(e,t){e=v(e),t=E(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},s.prototype.delete=function(e){delete this.map[v(e)]},s.prototype.get=function(e){return e=v(e),this.has(e)?this.map[e]:null},s.prototype.has=function(e){return this.map.hasOwnProperty(v(e))},s.prototype.set=function(e,t){this.map[v(e)]=E(t)},s.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},s.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),T(e)},s.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),T(e)},s.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),T(e)},f.iterable&&(s.prototype[Symbol.iterator]=s.prototype.entries);function B(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function P(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function F(e){var t=new FileReader,r=P(t);return t.readAsArrayBuffer(e),r}function I(e){var t=new FileReader,r=P(t);return t.readAsText(e),r}function M(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}function D(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:f.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:f.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():f.arrayBuffer&&f.blob&&U(e)?(this._bodyArrayBuffer=D(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||S(e))?this._bodyArrayBuffer=D(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var e=B(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=B(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(F)}),this.text=function(){var e=B(this);if(e)return e;if(this._bodyBlob)return I(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(M(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(L)}),this.json=function(){return this.text().then(JSON.parse)},this}var H=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function q(e){var t=e.toUpperCase();return H.indexOf(t)>-1?t:e}function m(e,t){if(!(this instanceof m))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof m){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new s(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new s(t.headers)),this.method=q(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var i=/\?/;this.url+=(i.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})};function L(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var n=r.split("="),i=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(o))}}),t}function C(e){var t=new s,r=e.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
1
+ import{c as R}from"./index.5c031f82.js";function G(w,d){for(var b=0;b<d.length;b++){const y=d[b];if(typeof y!="string"&&!Array.isArray(y)){for(const h in y)if(h!=="default"&&!(h in w)){const p=Object.getOwnPropertyDescriptor(y,h);p&&Object.defineProperty(w,h,p.get?p:{enumerable:!0,get:()=>y[h]})}}}return Object.freeze(Object.defineProperty(w,Symbol.toStringTag,{value:"Module"}))}var A={exports:{}};(function(w,d){var b=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof R<"u"&&R,y=function(){function p(){this.fetch=!1,this.DOMException=b.DOMException}return p.prototype=b,new p}();(function(p){(function(u){var a=typeof p<"u"&&p||typeof self<"u"&&self||typeof a<"u"&&a,f={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function U(e){return e&&DataView.prototype.isPrototypeOf(e)}if(f.arrayBuffer)var j=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],S=ArrayBuffer.isView||function(e){return e&&j.indexOf(Object.prototype.toString.call(e))>-1};function v(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function E(e){return typeof e!="string"&&(e=String(e)),e}function T(e){var t={next:function(){var r=e.shift();return{done:r===void 0,value:r}}};return f.iterable&&(t[Symbol.iterator]=function(){return t}),t}function s(e){this.map={},e instanceof s?e.forEach(function(t,r){this.append(r,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}s.prototype.append=function(e,t){e=v(e),t=E(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},s.prototype.delete=function(e){delete this.map[v(e)]},s.prototype.get=function(e){return e=v(e),this.has(e)?this.map[e]:null},s.prototype.has=function(e){return this.map.hasOwnProperty(v(e))},s.prototype.set=function(e,t){this.map[v(e)]=E(t)},s.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},s.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),T(e)},s.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),T(e)},s.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),T(e)},f.iterable&&(s.prototype[Symbol.iterator]=s.prototype.entries);function B(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function P(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function F(e){var t=new FileReader,r=P(t);return t.readAsArrayBuffer(e),r}function I(e){var t=new FileReader,r=P(t);return t.readAsText(e),r}function M(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}function D(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:f.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:f.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():f.arrayBuffer&&f.blob&&U(e)?(this._bodyArrayBuffer=D(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||S(e))?this._bodyArrayBuffer=D(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var e=B(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=B(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(F)}),this.text=function(){var e=B(this);if(e)return e;if(this._bodyBlob)return I(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(M(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(L)}),this.json=function(){return this.text().then(JSON.parse)},this}var H=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function q(e){var t=e.toUpperCase();return H.indexOf(t)>-1?t:e}function m(e,t){if(!(this instanceof m))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var r=t.body;if(e instanceof m){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new s(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new s(t.headers)),this.method=q(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(t.cache==="no-store"||t.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var i=/\?/;this.url+=(i.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})};function L(e){var t=new FormData;return e.trim().split("&").forEach(function(r){if(r){var n=r.split("="),i=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(o))}}),t}function C(e){var t=new s,r=e.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
2
2
  `)===0?n.substr(1,n.length):n}).forEach(function(n){var i=n.split(":"),o=i.shift().trim();if(o){var _=i.join(":").trim();t.append(o,_)}}),t}x.call(m.prototype);function l(e,t){if(!(this instanceof l))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new s(t.headers),this.url=t.url||"",this._initBody(e)}x.call(l.prototype),l.prototype.clone=function(){return new l(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},l.error=function(){var e=new l(null,{status:0,statusText:""});return e.type="error",e};var k=[301,302,303,307,308];l.redirect=function(e,t){if(k.indexOf(t)===-1)throw new RangeError("Invalid status code");return new l(null,{status:t,headers:{location:e}})},u.DOMException=a.DOMException;try{new u.DOMException}catch{u.DOMException=function(t,r){this.message=t,this.name=r;var n=Error(t);this.stack=n.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function O(e,t){return new Promise(function(r,n){var i=new m(e,t);if(i.signal&&i.signal.aborted)return n(new u.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function _(){o.abort()}o.onload=function(){var c={status:o.status,statusText:o.statusText,headers:C(o.getAllResponseHeaders()||"")};c.url="responseURL"in o?o.responseURL:c.headers.get("X-Request-URL");var g="response"in o?o.response:o.responseText;setTimeout(function(){r(new l(g,c))},0)},o.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},o.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},o.onabort=function(){setTimeout(function(){n(new u.DOMException("Aborted","AbortError"))},0)};function N(c){try{return c===""&&a.location.href?a.location.href:c}catch{return c}}o.open(i.method,N(i.url),!0),i.credentials==="include"?o.withCredentials=!0:i.credentials==="omit"&&(o.withCredentials=!1),"responseType"in o&&(f.blob?o.responseType="blob":f.arrayBuffer&&i.headers.get("Content-Type")&&i.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(o.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof s)?Object.getOwnPropertyNames(t.headers).forEach(function(c){o.setRequestHeader(c,E(t.headers[c]))}):i.headers.forEach(function(c,g){o.setRequestHeader(g,c)}),i.signal&&(i.signal.addEventListener("abort",_),o.onreadystatechange=function(){o.readyState===4&&i.signal.removeEventListener("abort",_)}),o.send(typeof i._bodyInit>"u"?null:i._bodyInit)})}return O.polyfill=!0,a.fetch||(a.fetch=O,a.Headers=s,a.Request=m,a.Response=l),u.Headers=s,u.Request=m,u.Response=l,u.fetch=O,u})({})})(y),y.fetch.ponyfill=!0,delete y.fetch.polyfill;var h=b.fetch?b:y;d=h.fetch,d.default=h.fetch,d.fetch=h.fetch,d.Headers=h.Headers,d.Request=h.Request,d.Response=h.Response,w.exports=d})(A,A.exports);const V=A.exports,$=G({__proto__:null,default:V},[A.exports]);export{$ as b};