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.
Files changed (121) hide show
  1. package/dist/types/components/voice-input-module/voice-input-module.d.ts +9 -1
  2. package/dist/types/components.d.ts +8 -31
  3. package/dist/types/services/speech-to-text.service.d.ts +1 -1
  4. package/dist/voice-input-module/index-Lt4F-TYq.js +4334 -0
  5. package/dist/voice-input-module/index-Lt4F-TYq.js.map +1 -0
  6. package/dist/voice-input-module/index.esm.js +12 -0
  7. package/dist/voice-input-module/index.esm.js.map +1 -1
  8. package/dist/voice-input-module/loader.esm.js.map +1 -1
  9. package/dist/voice-input-module/ocr-file-uploader.entry.esm.js.map +1 -0
  10. package/dist/{components/file-uploader2.js → voice-input-module/ocr-file-uploader.entry.js} +14 -29
  11. package/dist/voice-input-module/ocr-file-uploader.entry.js.map +1 -0
  12. package/dist/voice-input-module/voice-input-module.entry.esm.js.map +1 -0
  13. package/dist/voice-input-module/voice-input-module.entry.js +4467 -0
  14. package/dist/voice-input-module/voice-input-module.entry.js.map +1 -0
  15. package/dist/voice-input-module/voice-input-module.esm.js +49 -1
  16. package/dist/voice-input-module/voice-input-module.esm.js.map +1 -1
  17. package/loader/cdn.js +1 -0
  18. package/loader/index.cjs.js +1 -0
  19. package/loader/index.d.ts +24 -0
  20. package/loader/index.es2017.js +1 -0
  21. package/loader/index.js +2 -0
  22. package/package.json +7 -3
  23. package/www/build/index-Lt4F-TYq.js +4334 -0
  24. package/www/build/index-Lt4F-TYq.js.map +1 -0
  25. package/{src/index.ts → www/build/index.esm.js} +14 -12
  26. package/www/build/index.esm.js.map +1 -0
  27. package/{dist/cjs/loader.cjs.js.map → www/build/loader.esm.js.map} +1 -1
  28. package/www/build/ocr-file-uploader.entry.esm.js.map +1 -0
  29. package/{dist/collection/components/file-uploader/file-uploader.js → www/build/ocr-file-uploader.entry.js} +18 -65
  30. package/www/build/ocr-file-uploader.entry.js.map +1 -0
  31. package/www/build/voice-input-module.entry.esm.js.map +1 -0
  32. package/www/build/voice-input-module.entry.js +4467 -0
  33. package/www/build/voice-input-module.entry.js.map +1 -0
  34. package/www/build/voice-input-module.esm.js +50 -0
  35. package/{dist/cjs/voice-input-module.cjs.js.map → www/build/voice-input-module.esm.js.map} +1 -1
  36. package/www/build/voice-input-module.js +33 -0
  37. package/www/host.config.json +15 -0
  38. package/www/index.html +1671 -0
  39. package/.editorconfig +0 -15
  40. package/.prettierrc.json +0 -13
  41. package/api-key-inject.js +0 -46
  42. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -8
  43. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
  44. package/dist/cjs/file-uploader.voice-input-module.entry.cjs.js.map +0 -1
  45. package/dist/cjs/file-uploader_2.cjs.entry.js +0 -1319
  46. package/dist/cjs/file-uploader_2.cjs.entry.js.map +0 -1
  47. package/dist/cjs/index-BTSzTkSZ.js +0 -1494
  48. package/dist/cjs/index-BTSzTkSZ.js.map +0 -1
  49. package/dist/cjs/index.cjs.js +0 -5
  50. package/dist/cjs/index.cjs.js.map +0 -1
  51. package/dist/cjs/loader.cjs.js +0 -16
  52. package/dist/cjs/voice-input-module.cjs.js +0 -28
  53. package/dist/collection/collection-manifest.json +0 -13
  54. package/dist/collection/components/file-uploader/file-uploader.css +0 -26
  55. package/dist/collection/components/file-uploader/file-uploader.js.map +0 -1
  56. package/dist/collection/components/voice-input-module/voice-input-module.css +0 -251
  57. package/dist/collection/components/voice-input-module/voice-input-module.js +0 -875
  58. package/dist/collection/components/voice-input-module/voice-input-module.js.map +0 -1
  59. package/dist/collection/index.js +0 -12
  60. package/dist/collection/index.js.map +0 -1
  61. package/dist/collection/services/audio-recorder.service.js +0 -66
  62. package/dist/collection/services/audio-recorder.service.js.map +0 -1
  63. package/dist/collection/services/llm.service.js +0 -193
  64. package/dist/collection/services/llm.service.js.map +0 -1
  65. package/dist/collection/services/speech-to-text.service.js +0 -62
  66. package/dist/collection/services/speech-to-text.service.js.map +0 -1
  67. package/dist/collection/types/form-schema.types.js +0 -2
  68. package/dist/collection/types/form-schema.types.js.map +0 -1
  69. package/dist/collection/types/service-providers.types.js +0 -2
  70. package/dist/collection/types/service-providers.types.js.map +0 -1
  71. package/dist/collection/utils/schema-converter.js +0 -422
  72. package/dist/collection/utils/schema-converter.js.map +0 -1
  73. package/dist/components/file-uploader.d.ts +0 -11
  74. package/dist/components/file-uploader.js +0 -9
  75. package/dist/components/file-uploader.js.map +0 -1
  76. package/dist/components/file-uploader2.js.map +0 -1
  77. package/dist/components/index.js +0 -4
  78. package/dist/components/index.js.map +0 -1
  79. package/dist/components/voice-input-module.js +0 -1292
  80. package/dist/components/voice-input-module.js.map +0 -1
  81. package/dist/esm/app-globals-DQuL1Twl.js +0 -6
  82. package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
  83. package/dist/esm/file-uploader.voice-input-module.entry.js.map +0 -1
  84. package/dist/esm/file-uploader_2.entry.js +0 -1316
  85. package/dist/esm/file-uploader_2.entry.js.map +0 -1
  86. package/dist/esm/index-jmc2yzBp.js +0 -1487
  87. package/dist/esm/index-jmc2yzBp.js.map +0 -1
  88. package/dist/esm/index.js +0 -4
  89. package/dist/esm/index.js.map +0 -1
  90. package/dist/esm/loader.js +0 -14
  91. package/dist/esm/loader.js.map +0 -1
  92. package/dist/esm/voice-input-module.js +0 -24
  93. package/dist/esm/voice-input-module.js.map +0 -1
  94. package/dist/index.cjs.js +0 -1
  95. package/dist/index.js +0 -1
  96. package/dist/types/components/file-uploader/file-uploader.d.ts +0 -8
  97. package/dist/voice-input-module/file-uploader.voice-input-module.entry.esm.js.map +0 -1
  98. package/dist/voice-input-module/p-7b4f33ba.entry.js +0 -2
  99. package/dist/voice-input-module/p-7b4f33ba.entry.js.map +0 -1
  100. package/dist/voice-input-module/p-DQuL1Twl.js +0 -2
  101. package/dist/voice-input-module/p-DQuL1Twl.js.map +0 -1
  102. package/dist/voice-input-module/p-jmc2yzBp.js +0 -3
  103. package/dist/voice-input-module/p-jmc2yzBp.js.map +0 -1
  104. package/env-config.js +0 -4
  105. package/inject-env.js +0 -20
  106. package/src/components/file-uploader/file-uploader.css +0 -26
  107. package/src/components/file-uploader/file-uploader.tsx +0 -100
  108. package/src/components/file-uploader/readme.md +0 -31
  109. package/src/components/voice-input-module/readme.md +0 -114
  110. package/src/components/voice-input-module/voice-input-module.css +0 -251
  111. package/src/components/voice-input-module/voice-input-module.tsx +0 -731
  112. package/src/components.d.ts +0 -158
  113. package/src/index.html +0 -663
  114. package/src/services/audio-recorder.service.ts +0 -74
  115. package/src/services/llm.service.ts +0 -221
  116. package/src/services/speech-to-text.service.ts +0 -72
  117. package/src/types/form-schema.types.ts +0 -78
  118. package/src/types/service-providers.types.ts +0 -22
  119. package/src/utils/schema-converter.ts +0 -494
  120. package/stencil.config.ts +0 -24
  121. package/tsconfig.json +0 -30
@@ -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":";;;;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;;;;"}
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,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;AAC/B,YAAA,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;AAC7B,YAAA,IAAI,IAAI,CAAC,KAAK,EAAE;AACZ,gBAAA,IAAI;AACA,oBAAA,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,0CAA0C,EAAE;A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AAK,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]}
@@ -1,12 +1,10 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
1
+ import { r as registerInstance, h } from './index-Lt4F-TYq.js';
2
2
 
3
- const fileUploaderCss = ".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}";
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 FileUploader = /*@__PURE__*/ proxyCustomElement(class FileUploader extends HTMLElement {
6
- constructor() {
7
- super();
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 FileUploader = /*@__PURE__*/ proxyCustomElement(class FileUploader extends
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 FileUploader = /*@__PURE__*/ proxyCustomElement(class FileUploader extends
71
72
  };
72
73
  }
73
74
  render() {
74
- return (h("div", { key: '1f7afd7bce2dfa48fc8a0d05c40c6f12497af499', class: "upload-container", onClick: this.triggerUpload }, h("input", { key: 'd33effe28d1492066348ee234102d3f54607602f', type: "file", ref: el => (this.fileInput = el), onChange: this.handleFileChange, style: { display: 'none' } }), h("div", { key: '0031ca27ec1f0a36425920d2507f50eecdbcebea', class: "upload-button" }, h("svg", { key: '521b55b8e9ab9e04c35ff1fd5ea141d73d7e187f', viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { key: '67ca01d5b2967fdf994c84edc5dadab90bd2387f', 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: '09e80b7a02e45d09cb7575398061dbc954a24d47', d: "M17.5 21L17.5 15M17.5 15L20 17.5M17.5 15L15 17.5", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })))));
75
- }
76
- static get style() { return fileUploaderCss; }
77
- }, [257, "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
- const components = ["file-uploader"];
86
- components.forEach(tagName => { switch (tagName) {
87
- case "file-uploader":
88
- if (!customElements.get(tagName)) {
89
- customElements.define(tagName, FileUploader);
90
- }
91
- break;
92
- } });
93
- }
77
+ };
78
+ OcrFileUploader.style = ocrFileUploaderCss;
94
79
 
95
- export { FileUploader as F, defineCustomElement as d };
96
- //# sourceMappingURL=file-uploader2.js.map
80
+ export { OcrFileUploader as ocr_file_uploader };
81
+ //# sourceMappingURL=ocr-file-uploader.entry.esm.js.map
97
82
 
98
- //# sourceMappingURL=file-uploader2.js.map
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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AE,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}