reneco-advanced-input-module 0.0.1-beta.2 → 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 +4 -1
- package/dist/types/components.d.ts +4 -27
- 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/ocr-file-uploader2.js → voice-input-module/ocr-file-uploader.entry.js} +13 -28
- 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/package.json +2 -2
- package/www/build/index-Lt4F-TYq.js +4334 -0
- package/www/build/index-Lt4F-TYq.js.map +1 -0
- package/www/build/index.esm.js +12 -0
- package/www/build/index.esm.js.map +1 -1
- package/www/build/loader.esm.js.map +1 -1
- package/www/build/ocr-file-uploader.entry.esm.js.map +1 -0
- package/{dist/collection/components/ocr-file-uploader/ocr-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 +49 -1
- package/www/build/voice-input-module.esm.js.map +1 -1
- package/www/index.html +976 -227
- package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -8
- package/dist/cjs/app-globals-V2Kpy_OQ.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/loader.cjs.js.map +0 -1
- package/dist/cjs/ocr-file-uploader.voice-input-module.entry.cjs.js.map +0 -1
- package/dist/cjs/ocr-file-uploader_2.cjs.entry.js +0 -1340
- package/dist/cjs/ocr-file-uploader_2.cjs.entry.js.map +0 -1
- package/dist/cjs/voice-input-module.cjs.js +0 -28
- package/dist/cjs/voice-input-module.cjs.js.map +0 -1
- package/dist/collection/collection-manifest.json +0 -13
- package/dist/collection/components/ocr-file-uploader/ocr-file-uploader.css +0 -26
- package/dist/collection/components/ocr-file-uploader/ocr-file-uploader.js.map +0 -1
- package/dist/collection/components/voice-input-module/voice-input-module.css +0 -286
- package/dist/collection/components/voice-input-module/voice-input-module.js +0 -897
- 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 -60
- 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/index.js +0 -4
- package/dist/components/index.js.map +0 -1
- package/dist/components/ocr-file-uploader.d.ts +0 -11
- package/dist/components/ocr-file-uploader.js +0 -9
- package/dist/components/ocr-file-uploader.js.map +0 -1
- package/dist/components/ocr-file-uploader2.js.map +0 -1
- package/dist/components/voice-input-module.js +0 -1313
- 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/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/ocr-file-uploader.voice-input-module.entry.js.map +0 -1
- package/dist/esm/ocr-file-uploader_2.entry.js +0 -1337
- package/dist/esm/ocr-file-uploader_2.entry.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/ocr-file-uploader/ocr-file-uploader.d.ts +0 -8
- package/dist/voice-input-module/ocr-file-uploader.voice-input-module.entry.esm.js.map +0 -1
- package/dist/voice-input-module/p-52e59129.entry.js +0 -2
- package/dist/voice-input-module/p-52e59129.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/www/build/ocr-file-uploader.voice-input-module.entry.esm.js.map +0 -1
- package/www/build/p-52e59129.entry.js +0 -2
- package/www/build/p-52e59129.entry.js.map +0 -1
- package/www/build/p-DQuL1Twl.js +0 -2
- package/www/build/p-DQuL1Twl.js.map +0 -1
- package/www/build/p-jmc2yzBp.js +0 -3
- package/www/build/p-jmc2yzBp.js.map +0 -1
|
@@ -1,2 +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
|
+
// export { format } from './utils/utils';
|
|
11
|
+
// export type * from './components.d.ts';
|
|
12
|
+
//# sourceMappingURL=index.esm.js.map
|
|
1
13
|
|
|
2
14
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
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.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":"
|
|
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 }\n };\n }\n}\n"],"names":[],"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,MAA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kB,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,0CAA0C,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,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;;;;;;;","x_google_ignoreList":[0,1]}
|
package/dist/{components/ocr-file-uploader2.js → voice-input-module/ocr-file-uploader.entry.js}
RENAMED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as registerInstance, h } from './index-Lt4F-TYq.js';
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
-
const OcrFileUploader =
|
|
6
|
-
constructor() {
|
|
7
|
-
|
|
8
|
-
this.__registerHost();
|
|
9
|
-
this.__attachShadow();
|
|
5
|
+
const OcrFileUploader = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
10
8
|
this.batch = false;
|
|
11
9
|
this.triggerUpload = () => {
|
|
12
10
|
this.fileInput.click();
|
|
@@ -49,6 +47,9 @@ const OcrFileUploader = /*@__PURE__*/ proxyCustomElement(class OcrFileUploader e
|
|
|
49
47
|
}
|
|
50
48
|
else {
|
|
51
49
|
try {
|
|
50
|
+
if (this.jsonSchema) {
|
|
51
|
+
formData.append('json_schema', this.jsonSchema);
|
|
52
|
+
}
|
|
52
53
|
const response = await fetch('http://127.0.0.1:5001/api/convert-to-json', {
|
|
53
54
|
method: 'POST',
|
|
54
55
|
body: formData
|
|
@@ -71,28 +72,12 @@ const OcrFileUploader = /*@__PURE__*/ proxyCustomElement(class OcrFileUploader e
|
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
74
|
render() {
|
|
74
|
-
return (h("div", { key: '
|
|
75
|
-
}
|
|
76
|
-
static get style() { return ocrFileUploaderCss; }
|
|
77
|
-
}, [257, "ocr-file-uploader", {
|
|
78
|
-
"batch": [4],
|
|
79
|
-
"callback": [16]
|
|
80
|
-
}]);
|
|
81
|
-
function defineCustomElement() {
|
|
82
|
-
if (typeof customElements === "undefined") {
|
|
83
|
-
return;
|
|
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" })))));
|
|
84
76
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
case "ocr-file-uploader":
|
|
88
|
-
if (!customElements.get(tagName)) {
|
|
89
|
-
customElements.define(tagName, OcrFileUploader);
|
|
90
|
-
}
|
|
91
|
-
break;
|
|
92
|
-
} });
|
|
93
|
-
}
|
|
77
|
+
};
|
|
78
|
+
OcrFileUploader.style = ocrFileUploaderCss;
|
|
94
79
|
|
|
95
|
-
export { OcrFileUploader as
|
|
96
|
-
//# sourceMappingURL=ocr-file-
|
|
80
|
+
export { OcrFileUploader as ocr_file_uploader };
|
|
81
|
+
//# sourceMappingURL=ocr-file-uploader.entry.esm.js.map
|
|
97
82
|
|
|
98
|
-
//# sourceMappingURL=ocr-file-
|
|
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;AAC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QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,0CAA0C,EAAE,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,0CAA0C,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,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}
|