reneco-advanced-input-module 0.0.1 → 0.0.2
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/dist/types/components/voice-input-module/voice-input-module.d.ts +9 -1
- package/dist/types/components.d.ts +8 -31
- package/dist/types/services/speech-to-text.service.d.ts +1 -1
- package/dist/voice-input-module/index-Lt4F-TYq.js +4334 -0
- package/dist/voice-input-module/index-Lt4F-TYq.js.map +1 -0
- package/dist/voice-input-module/index.esm.js +12 -0
- package/dist/voice-input-module/index.esm.js.map +1 -1
- package/dist/voice-input-module/loader.esm.js.map +1 -1
- package/dist/voice-input-module/ocr-file-uploader.entry.esm.js.map +1 -0
- package/dist/{components/file-uploader2.js → voice-input-module/ocr-file-uploader.entry.js} +14 -29
- package/dist/voice-input-module/ocr-file-uploader.entry.js.map +1 -0
- package/dist/voice-input-module/voice-input-module.entry.esm.js.map +1 -0
- package/dist/voice-input-module/voice-input-module.entry.js +4467 -0
- package/dist/voice-input-module/voice-input-module.entry.js.map +1 -0
- package/dist/voice-input-module/voice-input-module.esm.js +49 -1
- package/dist/voice-input-module/voice-input-module.esm.js.map +1 -1
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +7 -3
- package/www/build/index-Lt4F-TYq.js +4334 -0
- package/www/build/index-Lt4F-TYq.js.map +1 -0
- package/{src/index.ts → www/build/index.esm.js} +14 -12
- package/www/build/index.esm.js.map +1 -0
- package/{dist/cjs/loader.cjs.js.map → www/build/loader.esm.js.map} +1 -1
- package/www/build/ocr-file-uploader.entry.esm.js.map +1 -0
- package/{dist/collection/components/file-uploader/file-uploader.js → www/build/ocr-file-uploader.entry.js} +18 -65
- package/www/build/ocr-file-uploader.entry.js.map +1 -0
- package/www/build/voice-input-module.entry.esm.js.map +1 -0
- package/www/build/voice-input-module.entry.js +4467 -0
- package/www/build/voice-input-module.entry.js.map +1 -0
- package/www/build/voice-input-module.esm.js +50 -0
- package/{dist/cjs/voice-input-module.cjs.js.map → www/build/voice-input-module.esm.js.map} +1 -1
- package/www/build/voice-input-module.js +33 -0
- package/www/host.config.json +15 -0
- package/www/index.html +1671 -0
- package/.editorconfig +0 -15
- package/.prettierrc.json +0 -13
- package/api-key-inject.js +0 -46
- package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -8
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
- package/dist/cjs/file-uploader.voice-input-module.entry.cjs.js.map +0 -1
- package/dist/cjs/file-uploader_2.cjs.entry.js +0 -1319
- package/dist/cjs/file-uploader_2.cjs.entry.js.map +0 -1
- package/dist/cjs/index-BTSzTkSZ.js +0 -1494
- package/dist/cjs/index-BTSzTkSZ.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -5
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -16
- package/dist/cjs/voice-input-module.cjs.js +0 -28
- package/dist/collection/collection-manifest.json +0 -13
- package/dist/collection/components/file-uploader/file-uploader.css +0 -26
- package/dist/collection/components/file-uploader/file-uploader.js.map +0 -1
- package/dist/collection/components/voice-input-module/voice-input-module.css +0 -251
- package/dist/collection/components/voice-input-module/voice-input-module.js +0 -875
- package/dist/collection/components/voice-input-module/voice-input-module.js.map +0 -1
- package/dist/collection/index.js +0 -12
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/services/audio-recorder.service.js +0 -66
- package/dist/collection/services/audio-recorder.service.js.map +0 -1
- package/dist/collection/services/llm.service.js +0 -193
- package/dist/collection/services/llm.service.js.map +0 -1
- package/dist/collection/services/speech-to-text.service.js +0 -62
- package/dist/collection/services/speech-to-text.service.js.map +0 -1
- package/dist/collection/types/form-schema.types.js +0 -2
- package/dist/collection/types/form-schema.types.js.map +0 -1
- package/dist/collection/types/service-providers.types.js +0 -2
- package/dist/collection/types/service-providers.types.js.map +0 -1
- package/dist/collection/utils/schema-converter.js +0 -422
- package/dist/collection/utils/schema-converter.js.map +0 -1
- package/dist/components/file-uploader.d.ts +0 -11
- package/dist/components/file-uploader.js +0 -9
- package/dist/components/file-uploader.js.map +0 -1
- package/dist/components/file-uploader2.js.map +0 -1
- package/dist/components/index.js +0 -4
- package/dist/components/index.js.map +0 -1
- package/dist/components/voice-input-module.js +0 -1292
- package/dist/components/voice-input-module.js.map +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js +0 -6
- package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
- package/dist/esm/file-uploader.voice-input-module.entry.js.map +0 -1
- package/dist/esm/file-uploader_2.entry.js +0 -1316
- package/dist/esm/file-uploader_2.entry.js.map +0 -1
- package/dist/esm/index-jmc2yzBp.js +0 -1487
- package/dist/esm/index-jmc2yzBp.js.map +0 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js +0 -14
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/voice-input-module.js +0 -24
- package/dist/esm/voice-input-module.js.map +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/types/components/file-uploader/file-uploader.d.ts +0 -8
- package/dist/voice-input-module/file-uploader.voice-input-module.entry.esm.js.map +0 -1
- package/dist/voice-input-module/p-7b4f33ba.entry.js +0 -2
- package/dist/voice-input-module/p-7b4f33ba.entry.js.map +0 -1
- package/dist/voice-input-module/p-DQuL1Twl.js +0 -2
- package/dist/voice-input-module/p-DQuL1Twl.js.map +0 -1
- package/dist/voice-input-module/p-jmc2yzBp.js +0 -3
- package/dist/voice-input-module/p-jmc2yzBp.js.map +0 -1
- package/env-config.js +0 -4
- package/inject-env.js +0 -20
- package/src/components/file-uploader/file-uploader.css +0 -26
- package/src/components/file-uploader/file-uploader.tsx +0 -100
- package/src/components/file-uploader/readme.md +0 -31
- package/src/components/voice-input-module/readme.md +0 -114
- package/src/components/voice-input-module/voice-input-module.css +0 -251
- package/src/components/voice-input-module/voice-input-module.tsx +0 -731
- package/src/components.d.ts +0 -158
- package/src/index.html +0 -663
- package/src/services/audio-recorder.service.ts +0 -74
- package/src/services/llm.service.ts +0 -221
- package/src/services/speech-to-text.service.ts +0 -72
- package/src/types/form-schema.types.ts +0 -78
- package/src/types/service-providers.types.ts +0 -22
- package/src/utils/schema-converter.ts +0 -494
- package/stencil.config.ts +0 -24
- package/tsconfig.json +0 -30
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview entry point for your component library
|
|
3
|
-
*
|
|
4
|
-
* This is the entry point for your component library. Use this file to export utilities,
|
|
5
|
-
* constants or data structure that accompany your components.
|
|
6
|
-
*
|
|
7
|
-
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
|
-
* to consume components of this package as outlined in the `README.md`.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// export
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview entry point for your component library
|
|
3
|
+
*
|
|
4
|
+
* This is the entry point for your component library. Use this file to export utilities,
|
|
5
|
+
* constants or data structure that accompany your components.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
|
+
* to consume components of this package as outlined in the `README.md`.
|
|
9
|
+
*/
|
|
10
|
+
// export { format } from './utils/utils';
|
|
11
|
+
// export type * from './components.d.ts';
|
|
12
|
+
//# sourceMappingURL=index.esm.js.map
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["src/index.ts"],"sourcesContent":["/**\r\n * @fileoverview entry point for your component library\r\n *\r\n * This is the entry point for your component library. Use this file to export utilities,\r\n * constants or data structure that accompany your components.\r\n *\r\n * DO NOT use this file to export your components. Instead, use the recommended approaches\r\n * to consume components of this package as outlined in the `README.md`.\r\n */\r\n\r\n// export { format } from './utils/utils';\r\n// export type * from './components.d.ts';\r\n"],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AAEH;AACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.
|
|
1
|
+
{"version":3,"file":"loader.esm.js","sources":["@lazy-external-entrypoint?app-data=conditional"],"sourcesContent":["export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\nexport const defineCustomElements = async (win, options) => {\n if (typeof window === 'undefined') return undefined;\n await globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n};\n"],"names":[],"mappings":";;;AAGY,MAAC,oBAAoB,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK;AAC5D,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,OAAO,SAAS;AACrD,EAAE,MAAM,aAAa,EAAE;AACvB,EAAE,OAAO,aAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC;AAC7D;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocr-file-uploader.entry.esm.js","sources":["node_modules/ocr-file-uploader/dist/collection/components/ocr-file-uploader/ocr-file-uploader.css?tag=ocr-file-uploader&encapsulation=shadow","node_modules/ocr-file-uploader/dist/collection/components/ocr-file-uploader/ocr-file-uploader.js"],"sourcesContent":["\r\n.upload-container {\r\n display: inline-block;\r\n cursor: pointer;\r\n width: 50px;\r\n height: 50px;\r\n}\r\n\r\n.upload-button {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n transition: transform 0.2s ease, box-shadow 0.2s ease;\r\n user-select: none;\r\n}\r\n\r\n.upload-button svg {\r\n width: 50px;\r\n height: 50px;\r\n stroke: #44ee44;\r\n}\r\n\r\n.upload-button:hover svg{\r\n transform: scale(1.05);\r\n stroke: #33dd33;\r\n}","import { h } from \"@stencil/core\";\nexport class OcrFileUploader {\n constructor() {\n this.batch = false;\n this.triggerUpload = () => {\n this.fileInput.click();\n };\n this.handleFileChange = async (event) => {\n const input = event.target;\n if (!input.files || input.files.length === 0)\n return;\n const file = input.files[0];\n // Here you can handle the file upload to your API\n console.log('Selected file:', file);\n const formData = new FormData();\n formData.append('file', file);\n if (this.batch) {\n try {\n const response = await fetch('http://127.0.0.1:5001/api/convert-to-xml', {\n method: 'POST',\n body: formData\n });\n if (!response.ok) {\n console.error(\"There has been an error!:\", response);\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n // get the file as a blob\n const blob = await response.blob();\n // create a download link\n const url = window.URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = 'result-' + Date.now().toString() + '.xlsx'; // filename\n document.body.appendChild(a);\n a.click();\n a.remove();\n window.URL.revokeObjectURL(url);\n }\n catch (err) {\n console.error(err);\n alert('Error uploading file');\n }\n }\n else {\n try {\n if (this.jsonSchema) {\n formData.append('json_schema', this.jsonSchema);\n }\n const response = await fetch('http://127.0.0.1:5001/api/convert-to-json', {\n method: 'POST',\n body: formData\n });\n if (!response.ok) {\n console.error(\"There has been an error!:\", response);\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n const data = await response.json();\n console.log('Upload successful:', data);\n if (this.callback && data[0] && data[0].content) {\n this.callback(data[0].content);\n }\n }\n catch (err) {\n console.error(err);\n alert('Error uploading file');\n }\n }\n };\n }\n render() {\n return (h(\"div\", { key: 'fecf4f7a1151d5a93092dcd7f34f61bbb5020a3a', class: \"upload-container\", onClick: this.triggerUpload }, h(\"input\", { key: '5dae519517ce2c93a5bedb54ec454aa7f0842670', type: \"file\", ref: el => (this.fileInput = el), onChange: this.handleFileChange, style: { display: 'none' } }), h(\"div\", { key: '856fae3bb684b769fbd1869d6e7ed96d4bd4706c', class: \"upload-button\" }, h(\"svg\", { key: '94b1f879d42904038a34f574607a46dcd6075fa2', viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" }, h(\"path\", { key: '020370d673d73a845aea7c15cfece3daa5214a78', d: \"M13.5 3H12H8C6.34315 3 5 4.34315 5 6V18C5 19.6569 6.34315 21 8 21H12M13.5 3L19 8.625M13.5 3V7.625C13.5 8.17728 13.9477 8.625 14.5 8.625H19M19 8.625V11.8125\", \"stroke-width\": \"2\", \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\" }), h(\"path\", { key: '3e14a32c1533e66de5da8bdcac5206196bd6302b', d: \"M17.5 21L17.5 15M17.5 15L20 17.5M17.5 15L15 17.5\", \"stroke-width\": \"2\", \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\" })))));\n }\n static get is() { return \"ocr-file-uploader\"; }\n static get encapsulation() { return \"shadow\"; }\n static get originalStyleUrls() {\n return {\n \"$\": [\"ocr-file-uploader.css\"]\n };\n }\n static get styleUrls() {\n return {\n \"$\": [\"ocr-file-uploader.css\"]\n };\n }\n static get properties() {\n return {\n \"batch\": {\n \"type\": \"boolean\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"boolean\",\n \"resolved\": \"boolean\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": false,\n \"docs\": {\n \"tags\": [],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false,\n \"reflect\": false,\n \"attribute\": \"batch\",\n \"defaultValue\": \"false\"\n },\n \"callback\": {\n \"type\": \"unknown\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"Function\",\n \"resolved\": \"Function\",\n \"references\": {\n \"Function\": {\n \"location\": \"global\",\n \"id\": \"global::Function\"\n }\n }\n },\n \"required\": false,\n \"optional\": false,\n \"docs\": {\n \"tags\": [],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false\n },\n \"jsonSchema\": {\n \"type\": \"string\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"string\",\n \"resolved\": \"string\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": false,\n \"docs\": {\n \"tags\": [],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false,\n \"reflect\": false,\n \"attribute\": \"json-schema\"\n }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google_ignoreList":[0,1]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { h } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { r as registerInstance, h } from './index-Lt4F-TYq.js';
|
|
2
|
+
|
|
3
|
+
const ocrFileUploaderCss = ".upload-container{display:inline-block;cursor:pointer;width:50px;height:50px}.upload-button{display:flex;align-items:center;justify-content:center;transition:transform 0.2s ease, box-shadow 0.2s ease;user-select:none}.upload-button svg{width:50px;height:50px;stroke:#44ee44}.upload-button:hover svg{transform:scale(1.05);stroke:#33dd33}";
|
|
4
|
+
|
|
5
|
+
const OcrFileUploader = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
4
8
|
this.batch = false;
|
|
5
9
|
this.triggerUpload = () => {
|
|
6
10
|
this.fileInput.click();
|
|
@@ -43,6 +47,9 @@ export class FileUploader {
|
|
|
43
47
|
}
|
|
44
48
|
else {
|
|
45
49
|
try {
|
|
50
|
+
if (this.jsonSchema) {
|
|
51
|
+
formData.append('json_schema', this.jsonSchema);
|
|
52
|
+
}
|
|
46
53
|
const response = await fetch('http://127.0.0.1:5001/api/convert-to-json', {
|
|
47
54
|
method: 'POST',
|
|
48
55
|
body: formData
|
|
@@ -65,66 +72,12 @@ export class FileUploader {
|
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
74
|
render() {
|
|
68
|
-
return (h("div", { key: '
|
|
69
|
-
}
|
|
70
|
-
static get is() { return "file-uploader"; }
|
|
71
|
-
static get encapsulation() { return "shadow"; }
|
|
72
|
-
static get originalStyleUrls() {
|
|
73
|
-
return {
|
|
74
|
-
"$": ["file-uploader.css"]
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
static get styleUrls() {
|
|
78
|
-
return {
|
|
79
|
-
"$": ["file-uploader.css"]
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
static get properties() {
|
|
83
|
-
return {
|
|
84
|
-
"batch": {
|
|
85
|
-
"type": "boolean",
|
|
86
|
-
"attribute": "batch",
|
|
87
|
-
"mutable": false,
|
|
88
|
-
"complexType": {
|
|
89
|
-
"original": "boolean",
|
|
90
|
-
"resolved": "boolean",
|
|
91
|
-
"references": {}
|
|
92
|
-
},
|
|
93
|
-
"required": false,
|
|
94
|
-
"optional": false,
|
|
95
|
-
"docs": {
|
|
96
|
-
"tags": [],
|
|
97
|
-
"text": ""
|
|
98
|
-
},
|
|
99
|
-
"getter": false,
|
|
100
|
-
"setter": false,
|
|
101
|
-
"reflect": false,
|
|
102
|
-
"defaultValue": "false"
|
|
103
|
-
},
|
|
104
|
-
"callback": {
|
|
105
|
-
"type": "unknown",
|
|
106
|
-
"attribute": "callback",
|
|
107
|
-
"mutable": false,
|
|
108
|
-
"complexType": {
|
|
109
|
-
"original": "Function",
|
|
110
|
-
"resolved": "Function",
|
|
111
|
-
"references": {
|
|
112
|
-
"Function": {
|
|
113
|
-
"location": "global",
|
|
114
|
-
"id": "global::Function"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"required": false,
|
|
119
|
-
"optional": false,
|
|
120
|
-
"docs": {
|
|
121
|
-
"tags": [],
|
|
122
|
-
"text": ""
|
|
123
|
-
},
|
|
124
|
-
"getter": false,
|
|
125
|
-
"setter": false
|
|
126
|
-
}
|
|
127
|
-
};
|
|
75
|
+
return (h("div", { key: 'fecf4f7a1151d5a93092dcd7f34f61bbb5020a3a', class: "upload-container", onClick: this.triggerUpload }, h("input", { key: '5dae519517ce2c93a5bedb54ec454aa7f0842670', type: "file", ref: el => (this.fileInput = el), onChange: this.handleFileChange, style: { display: 'none' } }), h("div", { key: '856fae3bb684b769fbd1869d6e7ed96d4bd4706c', class: "upload-button" }, h("svg", { key: '94b1f879d42904038a34f574607a46dcd6075fa2', viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '020370d673d73a845aea7c15cfece3daa5214a78', d: "M13.5 3H12H8C6.34315 3 5 4.34315 5 6V18C5 19.6569 6.34315 21 8 21H12M13.5 3L19 8.625M13.5 3V7.625C13.5 8.17728 13.9477 8.625 14.5 8.625H19M19 8.625V11.8125", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { key: '3e14a32c1533e66de5da8bdcac5206196bd6302b', d: "M17.5 21L17.5 15M17.5 15L20 17.5M17.5 15L15 17.5", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })))));
|
|
128
76
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
77
|
+
};
|
|
78
|
+
OcrFileUploader.style = ocrFileUploaderCss;
|
|
79
|
+
|
|
80
|
+
export { OcrFileUploader as ocr_file_uploader };
|
|
81
|
+
//# sourceMappingURL=ocr-file-uploader.entry.esm.js.map
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=ocr-file-uploader.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"ocr-file-uploader.entry.esm.js","mappings":";;AAAA,MAAM,kBAAkB,GAAG,kVAAkV;;MCChW,eAAe,GAAA,MAAA;AACxB,IAAA,WAAA,CAAA,OAAA,EAAA;;AACI,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;AAClB,QAAA,IAAI,CAAC,aAAa,GAAG,MAAK;AACtB,YAAA,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;AAC1B,SAAC;AACD,QAAA,IAAI,CAAC,gBAAgB,GAAG,OAAO,KAAK,KAAI;AACpC,YAAA,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM;YAC1B,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;gBACxC;YACJ,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;;AAE3B,YAAA,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC;AACnC,YAAA,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE;A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C,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,0CAA0C,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,0CAA0C,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,4BAA4B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,0CAA0C,EAAE,CAAC,EAAE,6JAA6J,EAAE,cAAc,EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,0CAA0C,EAAE,CAAC,EAAE,kDAAkD,EAAE,cAAc,EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;;;;;;;","names":[],"sources":["node_modules/ocr-file-uploader/dist/collection/components/ocr-file-uploader/ocr-file-uploader.css?tag=ocr-file-uploader&encapsulation=shadow","node_modules/ocr-file-uploader/dist/collection/components/ocr-file-uploader/ocr-file-uploader.js"],"sourcesContent":["\r\n.upload-container {\r\n display: inline-block;\r\n cursor: pointer;\r\n width: 50px;\r\n height: 50px;\r\n}\r\n\r\n.upload-button {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n transition: transform 0.2s ease, box-shadow 0.2s ease;\r\n user-select: none;\r\n}\r\n\r\n.upload-button svg {\r\n width: 50px;\r\n height: 50px;\r\n stroke: #44ee44;\r\n}\r\n\r\n.upload-button:hover svg{\r\n transform: scale(1.05);\r\n stroke: #33dd33;\r\n}","import { h } from \"@stencil/core\";\nexport class OcrFileUploader {\n constructor() {\n this.batch = false;\n this.triggerUpload = () => {\n this.fileInput.click();\n };\n this.handleFileChange = async (event) => {\n const input = event.target;\n if (!input.files || input.files.length === 0)\n return;\n const file = input.files[0];\n // Here you can handle the file upload to your API\n console.log('Selected file:', file);\n const formData = new FormData();\n formData.append('file', file);\n if (this.batch) {\n try {\n const response = await fetch('http://127.0.0.1:5001/api/convert-to-xml', {\n method: 'POST',\n body: formData\n });\n if (!response.ok) {\n console.error(\"There has been an error!:\", response);\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n // get the file as a blob\n const blob = await response.blob();\n // create a download link\n const url = window.URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = 'result-' + Date.now().toString() + '.xlsx'; // filename\n document.body.appendChild(a);\n a.click();\n a.remove();\n window.URL.revokeObjectURL(url);\n }\n catch (err) {\n console.error(err);\n alert('Error uploading file');\n }\n }\n else {\n try {\n if (this.jsonSchema) {\n formData.append('json_schema', this.jsonSchema);\n }\n const response = await fetch('http://127.0.0.1:5001/api/convert-to-json', {\n method: 'POST',\n body: formData\n });\n if (!response.ok) {\n console.error(\"There has been an error!:\", response);\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n const data = await response.json();\n console.log('Upload successful:', data);\n if (this.callback && data[0] && data[0].content) {\n this.callback(data[0].content);\n }\n }\n catch (err) {\n console.error(err);\n alert('Error uploading file');\n }\n }\n };\n }\n render() {\n return (h(\"div\", { key: 'fecf4f7a1151d5a93092dcd7f34f61bbb5020a3a', class: \"upload-container\", onClick: this.triggerUpload }, h(\"input\", { key: '5dae519517ce2c93a5bedb54ec454aa7f0842670', type: \"file\", ref: el => (this.fileInput = el), onChange: this.handleFileChange, style: { display: 'none' } }), h(\"div\", { key: '856fae3bb684b769fbd1869d6e7ed96d4bd4706c', class: \"upload-button\" }, h(\"svg\", { key: '94b1f879d42904038a34f574607a46dcd6075fa2', viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" }, h(\"path\", { key: '020370d673d73a845aea7c15cfece3daa5214a78', d: \"M13.5 3H12H8C6.34315 3 5 4.34315 5 6V18C5 19.6569 6.34315 21 8 21H12M13.5 3L19 8.625M13.5 3V7.625C13.5 8.17728 13.9477 8.625 14.5 8.625H19M19 8.625V11.8125\", \"stroke-width\": \"2\", \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\" }), h(\"path\", { key: '3e14a32c1533e66de5da8bdcac5206196bd6302b', d: \"M17.5 21L17.5 15M17.5 15L20 17.5M17.5 15L15 17.5\", \"stroke-width\": \"2\", \"stroke-linecap\": \"round\", \"stroke-linejoin\": \"round\" })))));\n }\n static get is() { return \"ocr-file-uploader\"; }\n static get encapsulation() { return \"shadow\"; }\n static get originalStyleUrls() {\n return {\n \"$\": [\"ocr-file-uploader.css\"]\n };\n }\n static get styleUrls() {\n return {\n \"$\": [\"ocr-file-uploader.css\"]\n };\n }\n static get properties() {\n return {\n \"batch\": {\n \"type\": \"boolean\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"boolean\",\n \"resolved\": \"boolean\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": false,\n \"docs\": {\n \"tags\": [],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false,\n \"reflect\": false,\n \"attribute\": \"batch\",\n \"defaultValue\": \"false\"\n },\n \"callback\": {\n \"type\": \"unknown\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"Function\",\n \"resolved\": \"Function\",\n \"references\": {\n \"Function\": {\n \"location\": \"global\",\n \"id\": \"global::Function\"\n }\n }\n },\n \"required\": false,\n \"optional\": false,\n \"docs\": {\n \"tags\": [],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false\n },\n \"jsonSchema\": {\n \"type\": \"string\",\n \"mutable\": false,\n \"complexType\": {\n \"original\": \"string\",\n \"resolved\": \"string\",\n \"references\": {}\n },\n \"required\": false,\n \"optional\": false,\n \"docs\": {\n \"tags\": [],\n \"text\": \"\"\n },\n \"getter\": false,\n \"setter\": false,\n \"reflect\": false,\n \"attribute\": \"json-schema\"\n }\n };\n }\n}\n"],"version":3}
|