cty-mui-core 1.0.27 → 1.0.29

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 (95) hide show
  1. package/components/camera.js +2 -2
  2. package/components/device-info.js +7 -3
  3. package/components/image-picker.js +11 -9
  4. package/components/video-capture.js +2 -2
  5. package/dist/cjs/{audio-recorder-BKbTidei.js → audio-recorder-DYpLmmqT.js} +1 -1
  6. package/dist/cjs/cty-camera-photo.cjs.entry.js +2 -2
  7. package/dist/cjs/cty-camera_2.cjs.entry.js +4 -4
  8. package/dist/cjs/cty-canvas-video.cjs.entry.js +1 -1
  9. package/dist/cjs/cty-keyboard.cjs.entry.js +1 -1
  10. package/dist/cjs/cty-media-capture.cjs.entry.js +2 -2
  11. package/dist/cjs/cty-record.cjs.entry.js +2 -2
  12. package/dist/cjs/cty-share-sheet.cjs.entry.js +2 -2
  13. package/dist/cjs/cty-video.cjs.entry.js +1 -1
  14. package/dist/cjs/{device-info-C7UUXx-P.js → device-info-CC9Tsjk3.js} +7 -3
  15. package/dist/cjs/{image-picker-B6UWcLwS.js → image-picker-BaPYPMtN.js} +12 -10
  16. package/dist/cjs/index.cjs.js +5 -5
  17. package/dist/cjs/{share-C5S5TwgG.js → share-DjeE75QU.js} +1 -1
  18. package/dist/cjs/{video-capture-DAMSxk8m.js → video-capture-hurwVr0S.js} +3 -3
  19. package/dist/collection/components/camera/camera.js +2 -2
  20. package/dist/collection/utils/native/image-picker.js +11 -9
  21. package/dist/collection/utils/native/utils.js +7 -3
  22. package/dist/collection/utils/native/video-capture.js +2 -2
  23. package/dist/cty-mui/cty-mui.esm.js +1 -1
  24. package/dist/cty-mui/index.esm.js +1 -1
  25. package/dist/cty-mui/{p-0bc85558.entry.js → p-031c8494.entry.js} +1 -1
  26. package/dist/cty-mui/p-16a037a8.system.entry.js +1 -0
  27. package/dist/cty-mui/{p-0f32ebdb.system.entry.js → p-3440db23.system.entry.js} +1 -1
  28. package/dist/cty-mui/{p-7fee7137.system.entry.js → p-3a5c607b.system.entry.js} +1 -1
  29. package/dist/cty-mui/{p-f2a68731.entry.js → p-3f5a1b19.entry.js} +1 -1
  30. package/dist/cty-mui/{p-f846e924.system.entry.js → p-417821f8.system.entry.js} +1 -1
  31. package/dist/cty-mui/{p-53e5d520.system.entry.js → p-4480bc91.system.entry.js} +1 -1
  32. package/dist/cty-mui/p-468wbiwD.js +1 -0
  33. package/dist/cty-mui/{p-c5ed5fc1.system.entry.js → p-539f0f1d.system.entry.js} +1 -1
  34. package/dist/cty-mui/{p-10d7700f.system.entry.js → p-53c2f016.system.entry.js} +1 -1
  35. package/dist/cty-mui/{p-35bf1c7d.system.entry.js → p-5c614543.system.entry.js} +1 -1
  36. package/dist/cty-mui/{p-e66554bd.entry.js → p-707d8d55.entry.js} +1 -1
  37. package/dist/cty-mui/p-8b366f50.entry.js +1 -0
  38. package/dist/cty-mui/p-C74UJkmU.js +1 -0
  39. package/dist/cty-mui/{p-DM51Z91U.js → p-CNbcMFk_.js} +1 -1
  40. package/dist/cty-mui/p-CWqY9Xtf.system.js +1 -0
  41. package/dist/cty-mui/{p-CSK0Pbxf.system.js → p-C_A8vR45.system.js} +1 -1
  42. package/dist/cty-mui/p-Cegbc1c7.system.js +1 -1
  43. package/dist/cty-mui/{p-sGjEgJ1z.system.js → p-DDpKwS-R.system.js} +1 -1
  44. package/dist/cty-mui/p-DEiiznWK.system.js +1 -0
  45. package/dist/cty-mui/{p-CHeCaQQD.js → p-DIfQpXZY.js} +1 -1
  46. package/dist/cty-mui/p-Ddpjv6eK.system.js +1 -0
  47. package/dist/cty-mui/{p-D2G0Jsfd.system.js → p-Rzu7ijXt.system.js} +1 -1
  48. package/dist/cty-mui/{p-637194fb.entry.js → p-c1c79c99.entry.js} +1 -1
  49. package/dist/cty-mui/{p-64f873e3.entry.js → p-ebf89aee.entry.js} +1 -1
  50. package/dist/cty-mui/{p-14f3207d.entry.js → p-f1ed94f0.entry.js} +1 -1
  51. package/dist/cty-mui/{p-9eba7513.entry.js → p-f902b58c.entry.js} +1 -1
  52. package/dist/cty-mui/p-gl1FejVx.js +1 -0
  53. package/dist/docs.json +1 -1
  54. package/dist/esm/{audio-recorder-CMG1hXEJ.js → audio-recorder-B5KKGCKW.js} +1 -1
  55. package/dist/esm/cty-camera-photo.entry.js +2 -2
  56. package/dist/esm/cty-camera_2.entry.js +4 -4
  57. package/dist/esm/cty-canvas-video.entry.js +1 -1
  58. package/dist/esm/cty-keyboard.entry.js +1 -1
  59. package/dist/esm/cty-media-capture.entry.js +2 -2
  60. package/dist/esm/cty-record.entry.js +2 -2
  61. package/dist/esm/cty-share-sheet.entry.js +2 -2
  62. package/dist/esm/cty-video.entry.js +1 -1
  63. package/dist/esm/{device-info-DpfVimRl.js → device-info-xfEbcUL0.js} +7 -3
  64. package/dist/esm/{image-picker-Cx4xtB29.js → image-picker-FafI4s7M.js} +12 -10
  65. package/dist/esm/index.js +6 -6
  66. package/dist/esm/{share-BW1ZT5H7.js → share-Cmy90gRo.js} +1 -1
  67. package/dist/esm/{video-capture-Xsjc8H75.js → video-capture-DONPzerB.js} +3 -3
  68. package/dist/esm-es5/{audio-recorder-CMG1hXEJ.js → audio-recorder-B5KKGCKW.js} +1 -1
  69. package/dist/esm-es5/cty-camera-photo.entry.js +1 -1
  70. package/dist/esm-es5/cty-camera_2.entry.js +1 -1
  71. package/dist/esm-es5/cty-canvas-video.entry.js +1 -1
  72. package/dist/esm-es5/cty-keyboard.entry.js +1 -1
  73. package/dist/esm-es5/cty-media-capture.entry.js +1 -1
  74. package/dist/esm-es5/cty-record.entry.js +1 -1
  75. package/dist/esm-es5/cty-share-sheet.entry.js +1 -1
  76. package/dist/esm-es5/cty-video.entry.js +1 -1
  77. package/dist/esm-es5/device-info-xfEbcUL0.js +1 -0
  78. package/dist/esm-es5/image-picker-FafI4s7M.js +1 -0
  79. package/dist/esm-es5/index.js +1 -1
  80. package/dist/esm-es5/{share-BW1ZT5H7.js → share-Cmy90gRo.js} +1 -1
  81. package/dist/esm-es5/video-capture-DONPzerB.js +1 -0
  82. package/dist/types/utils/native/image-picker.d.ts +1 -1
  83. package/dist/types/utils/native/utils.d.ts +1 -1
  84. package/package.json +1 -1
  85. package/dist/cty-mui/p-5e3d3c21.system.entry.js +0 -1
  86. package/dist/cty-mui/p-81dac507.entry.js +0 -1
  87. package/dist/cty-mui/p-B-x0hJFy.js +0 -1
  88. package/dist/cty-mui/p-B3EGfVtf.js +0 -1
  89. package/dist/cty-mui/p-CXtPwfcM.js +0 -1
  90. package/dist/cty-mui/p-DIlGnmah.system.js +0 -1
  91. package/dist/cty-mui/p-DSgG8qVn.system.js +0 -1
  92. package/dist/cty-mui/p-e0BrrqR8.system.js +0 -1
  93. package/dist/esm-es5/device-info-DpfVimRl.js +0 -1
  94. package/dist/esm-es5/image-picker-Cx4xtB29.js +0 -1
  95. package/dist/esm-es5/video-capture-Xsjc8H75.js +0 -1
@@ -120,7 +120,7 @@ const Camera = /*@__PURE__*/ proxyCustomElement(class Camera extends HTMLElement
120
120
  async takePhoto() {
121
121
  const { quality, width, height, file } = this;
122
122
  const data = await cameraPreview.takePicture({ width, height, quality });
123
- const result = imagePicker.formatPictureResult(file, data);
123
+ const result = await imagePicker.formatPictureResult(file, data);
124
124
  this.pictures = [...this.pictures, result];
125
125
  this.ctyTakePhoto.emit(result);
126
126
  return result;
@@ -153,7 +153,7 @@ const Camera = /*@__PURE__*/ proxyCustomElement(class Camera extends HTMLElement
153
153
  }
154
154
  render() {
155
155
  const { title, closeIcon, flash, flipText, flashText, ratioText, ratios, ratioIndex, zoomIndex, zooms, confirmIcon, confirmText, pictures, showImageViewer, imageViewerIndex } = this;
156
- return (h(Host, { key: '87619df83dfd1df6b3163dd2b7c45f94a6f74db6', class: "cty-camera", onClick: (e) => e.stopPropagation() }, h("cty-nav-bar", { key: '1ffe4cdebe32d92862667663bbd3b89452c5f186', title: title, type: "clear" }, h("slot", { key: '8556b0ca01c55bbe9ced998da6a8895ee8bd5c52', name: "header-start", slot: "start" }, h("ion-button", { key: '21115e603b0876f12b6d58fbb3bdab2f80520795', class: "cty-camera__close", onClick: () => this.close() }, h("cty-icon", { key: 'd640e89531b9edbe290c99e2cacfce41fc4ed879', class: "cty-camera__close-icon", name: closeIcon })))), h("div", { key: 'a8611dac88a7f2a2615b4874f0db86de9be1151d', class: "cty-camera-widgets", part: "widgets" }, h("button", { key: '887509307c97fb0837c6503bc6428fffb7b9b0cb', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, h("cty-icon", { key: '15422b01e83849f0848e164065f2492eed796e37', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && h("span", { key: '22e490eef01255bcb0a266125743a0d1a5202c16', class: "cty-camera-widget__text" }, flipText)), h("button", { key: '1b4ce3cb9d1c07d5f31cf9baa2e8d6d110b60ec0', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, h("cty-icon", { key: '5b1a2953996507d693381321bb4e1a03c3465421', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && h("span", { key: '1a91d914956cd17599d79f0221e4b7a0563b13be', class: "cty-camera-widget__text" }, flashText)), h("button", { key: '1bea848be4d5904ca74ee0b6e1d56807fc4a0731', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, h("span", { key: 'ab10f91f90c8a8471bc94243b7bad535e1171e2f', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && h("span", { key: '502527a106025d6012d86faefa0b225b8ad8ded8', class: "cty-camera-widget__text" }, ratioText))), h("div", { key: '2863467ed92620bf06204917567d0e1600044662', class: "cty-camera-controls safe-area-bottom-padding" }, h("slot", { key: '3a14102cbadd7325f220ce105aaaf5105b21629f', name: "zooms" }, h("div", { key: '0ca55abd29fcf660bbde14873cdb74f2bbd58450', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), h("div", { key: '58bec9af89ace3ca63c91cd6768040a0b2e0a190', class: "cty-camera-controls__main flex-center" }, h("div", { key: 'caa835c546b83741659b1c36f0b3f99d7d5481c8', class: "cty-camera-controls__main-left flex-center" }), h("div", { key: '561f4f794938fdedae4ecf8b216d445e9c16708f', class: "cty-camera-controls__take-photo flex-center" }, h("button", { key: 'ebda39c88c8afcac7ad03a93779b52034e4f03ad', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), h("div", { key: 'c6f12f91a7a36a826e456929b08d240ee3cbae82', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && h("button", { key: '2bedc3ae07ed1c01a880562459d7f30cb1c10cfe', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, h("cty-icon", { key: '250431733180d4d6b403a2a5535576fdf3978ba2', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), h("span", { key: 'a4c1eac8d7b8b7b0f58b3492a51c906dd97fadd0', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), h("slot", { key: '9a58817e2c3dac0f02bd21483b92d2d751095014', name: "images" }, h("div", { key: 'e9cdadd9bb8da0b5ccff3681f484570fc5b4269e', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, h("img", { class: 'cty-camera-controls__image-img', src: item.url }), h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, h("cty-icon", { class: "cty-camera-controls__image-delete", name: closeOutline })))))))), showImageViewer && h("cty-image-viewer", { key: 'fb724686c5f0d9a24f12527ba1b50f09de85a82f', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
156
+ return (h(Host, { key: '6c0e8aee4840edae99979e2f8fa4fe1f28b91f00', class: "cty-camera", onClick: (e) => e.stopPropagation() }, h("cty-nav-bar", { key: '16ed59dc05921a634765cae7e3c8ab817a509b66', title: title, type: "clear" }, h("slot", { key: 'dbeb5240503757e7fb35741bfaacfee520e935c5', name: "header-start", slot: "start" }, h("ion-button", { key: 'e0258b6b06a50aa10d9903e6a4789d155b1a926b', class: "cty-camera__close", onClick: () => this.close() }, h("cty-icon", { key: '48c9f1c506dd13155e2545f1e4d5b8970886bb12', class: "cty-camera__close-icon", name: closeIcon })))), h("div", { key: 'a367e170321b0966ab490b9b694eaffe18fb8f6c', class: "cty-camera-widgets", part: "widgets" }, h("button", { key: '9f54e594fec181935c988f320158ce8f5754cd5c', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, h("cty-icon", { key: 'db2e97bd1ec69d82e93c9506fd8976cff560ed24', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && h("span", { key: '947fee726ab0e6c514747a2b2eadbf989f5ff91c', class: "cty-camera-widget__text" }, flipText)), h("button", { key: '01a10aae9e6745d83033ef5e4441cc3d7e199612', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, h("cty-icon", { key: 'd2bd45656aa68309b40f8977e80b15ae7ec29e17', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && h("span", { key: 'b4f9d0d5675c6a21483f4bc211b92ba4e7a8f688', class: "cty-camera-widget__text" }, flashText)), h("button", { key: 'c36f3a4a1d6d2705ea7c52acb0281f18f7570de9', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, h("span", { key: 'ac8cb010492f470ea5e776efa59d2e3b622c031b', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && h("span", { key: 'fc2792dd4c5e27b4946db17fc05ca8d1f79ab475', class: "cty-camera-widget__text" }, ratioText))), h("div", { key: '2b6cb7cb689119162cba517b5469efdcf173e481', class: "cty-camera-controls safe-area-bottom-padding" }, h("slot", { key: '93ba0e977b61d5c5fdd0bd6ab220711064af826d', name: "zooms" }, h("div", { key: '2ea4da678fda37ba175c66a72e34fccf1974a521', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), h("div", { key: '8f308406f2ceac48cd7cbfd4306a7a65aebce21f', class: "cty-camera-controls__main flex-center" }, h("div", { key: 'd3fc1707c8f6ee3d9f968f916e8a50810e580a4b', class: "cty-camera-controls__main-left flex-center" }), h("div", { key: 'fa7a8905a22006276b941693c26ac15e6b002976', class: "cty-camera-controls__take-photo flex-center" }, h("button", { key: '61536741582da9bef8bcf0fe4fba09e3fefde58e', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), h("div", { key: '74ef21c9e62c7ac604b11b53f9b6a1126fa0338b', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && h("button", { key: 'c019b93aab832fadcb3e6d5c77bc98dd8e126b16', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, h("cty-icon", { key: 'eb9ae426c45fa31202247c99ebb991bc7ceede55', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), h("span", { key: '25afa75bcbda33b8f15c432879712bdec937678c', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), h("slot", { key: '14def885116f251bd8390313d46c661dcc807282', name: "images" }, h("div", { key: '254067237e7506f87bdc762285dc3eaff6591ed6', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, h("img", { class: 'cty-camera-controls__image-img', src: item.url }), h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, h("cty-icon", { class: "cty-camera-controls__image-delete", name: closeOutline })))))))), showImageViewer && h("cty-image-viewer", { key: 'e84bcb7a5ce6cbb504dbe55e6538622d3914d334', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
157
157
  }
158
158
  get el() { return this; }
159
159
  static get style() { return cameraCss; }
@@ -2,9 +2,13 @@ import '@stencil/core/internal/client';
2
2
  import { i as isPlatform } from './platform.js';
3
3
  import { n as network } from './network.js';
4
4
 
5
- const formatLocalPreview = (path) => {
6
- var _a, _b;
7
- return (_b = (_a = window === null || window === void 0 ? void 0 : window.Ionic) === null || _a === void 0 ? void 0 : _a.WebView) === null || _b === void 0 ? void 0 : _b.convertFileSrc(path);
5
+ const formatLocalPreview = (filePath) => {
6
+ return new Promise((resolve, reject) => {
7
+ window.resolveLocalFileSystemURL(filePath, (entry) => {
8
+ resolve(entry.toURL());
9
+ }, reject);
10
+ });
11
+ // return (window as any)?.Ionic?.WebView?.convertFileSrc(path);
8
12
  };
9
13
  function testUserAgent(expression) {
10
14
  const nav = window.navigator;
@@ -112,11 +112,11 @@ class CTYImagePicker {
112
112
  get isWxSDKAvailable() {
113
113
  return !!this._wxSDK;
114
114
  }
115
- formatPictureResult(file, data) {
115
+ async formatPictureResult(file, data) {
116
116
  let safeUrl = data;
117
117
  if (file) {
118
118
  try {
119
- safeUrl = formatLocalPreview(data);
119
+ safeUrl = await formatLocalPreview(data);
120
120
  safeUrl = sanitizeDOMString(safeUrl);
121
121
  }
122
122
  catch (error) {
@@ -125,7 +125,7 @@ class CTYImagePicker {
125
125
  }
126
126
  else {
127
127
  try {
128
- safeUrl = sanitizeDOMString(`data:image/jpeg;base64,${data}`);
128
+ safeUrl = sanitizeDOMString(data);
129
129
  }
130
130
  catch (error) {
131
131
  console.error('Error bypassing sanitization:', error);
@@ -148,9 +148,9 @@ class CTYImagePicker {
148
148
  sourceType: this._cameraPlugin.PictureSourceType[camera ? 'CAMERA' : 'PHOTOLIBRARY'],
149
149
  correctOrientation: false
150
150
  };
151
- this._cameraPlugin.getPicture((data) => {
151
+ this._cameraPlugin.getPicture(async (data) => {
152
152
  if (data) {
153
- const result = this.formatPictureResult(file, data);
153
+ const result = await this.formatPictureResult(file, data);
154
154
  resolve([result]);
155
155
  }
156
156
  else {
@@ -168,14 +168,16 @@ class CTYImagePicker {
168
168
  const option = {
169
169
  quality: 85
170
170
  };
171
- this._imagePickerPlugin.getPictures((results) => {
171
+ this._imagePickerPlugin.getPictures(async (results) => {
172
172
  if (results[0] == 'O' || results[0] == 'K') {
173
173
  resolve([]);
174
174
  return;
175
175
  }
176
- const imageList = results.map((data) => {
177
- return this.formatPictureResult(file, data);
178
- });
176
+ const imageList = [];
177
+ for (const data of results) {
178
+ const result = await this.formatPictureResult(file, data);
179
+ imageList.push(result);
180
+ }
179
181
  resolve(imageList);
180
182
  }, (error) => { reject(error); }, Object.assign(option, imagePickerOptions, {
181
183
  outputType: file ? 0 : 1,
@@ -15,10 +15,10 @@ class CTYVideoCapture {
15
15
  return reject('Video capture plugin is not available.');
16
16
  }
17
17
  try {
18
- this._videoCapturePlugin.captureVideo((result) => {
18
+ this._videoCapturePlugin.captureVideo(async (result) => {
19
19
  if (Array.isArray(result) && result.length > 0) {
20
20
  const data = result[0].fullPath;
21
- const url = formatLocalPreview(sanitizeDOMString(data));
21
+ const url = await formatLocalPreview(sanitizeDOMString(data));
22
22
  resolve({ url, data });
23
23
  }
24
24
  else {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var deviceInfo = require('./device-info-C7UUXx-P.js');
3
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
4
4
 
5
5
  exports.UploadProgressTip = void 0;
6
6
  (function (UploadProgressTip) {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DCK462Hl.js');
4
- var imagePicker = require('./image-picker-B6UWcLwS.js');
5
- var deviceInfo = require('./device-info-C7UUXx-P.js');
4
+ var imagePicker = require('./image-picker-BaPYPMtN.js');
5
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
6
6
  var overlays = require('./overlays-Cfk4eti-.js');
7
7
  var lockController = require('./lock-controller-Dk7it1jt.js');
8
8
  var helpers = require('./helpers-Bdo8wX6-.js');
@@ -2,11 +2,11 @@
2
2
 
3
3
  var index = require('./index-DCK462Hl.js');
4
4
  var cameraPreview = require('./camera-preview-BHobAi2K.js');
5
- var imagePicker = require('./image-picker-B6UWcLwS.js');
5
+ var imagePicker = require('./image-picker-BaPYPMtN.js');
6
6
  var index$1 = require('./index-o2Vg_VSe.js');
7
7
  var dom = require('./dom-B8PDM5o-.js');
8
8
  var format = require('./format-BSDO5P-c.js');
9
- require('./device-info-C7UUXx-P.js');
9
+ require('./device-info-CC9Tsjk3.js');
10
10
  require('./platform-DJmEyHMN.js');
11
11
  require('./network-D7xvJurk.js');
12
12
  require('./index-6rsnyV5b.js');
@@ -115,7 +115,7 @@ const Camera = class {
115
115
  async takePhoto() {
116
116
  const { quality, width, height, file } = this;
117
117
  const data = await cameraPreview.cameraPreview.takePicture({ width, height, quality });
118
- const result = imagePicker.imagePicker.formatPictureResult(file, data);
118
+ const result = await imagePicker.imagePicker.formatPictureResult(file, data);
119
119
  this.pictures = [...this.pictures, result];
120
120
  this.ctyTakePhoto.emit(result);
121
121
  return result;
@@ -148,7 +148,7 @@ const Camera = class {
148
148
  }
149
149
  render() {
150
150
  const { title, closeIcon, flash, flipText, flashText, ratioText, ratios, ratioIndex, zoomIndex, zooms, confirmIcon, confirmText, pictures, showImageViewer, imageViewerIndex } = this;
151
- return (index.h(index.Host, { key: '87619df83dfd1df6b3163dd2b7c45f94a6f74db6', class: "cty-camera", onClick: (e) => e.stopPropagation() }, index.h("cty-nav-bar", { key: '1ffe4cdebe32d92862667663bbd3b89452c5f186', title: title, type: "clear" }, index.h("slot", { key: '8556b0ca01c55bbe9ced998da6a8895ee8bd5c52', name: "header-start", slot: "start" }, index.h("ion-button", { key: '21115e603b0876f12b6d58fbb3bdab2f80520795', class: "cty-camera__close", onClick: () => this.close() }, index.h("cty-icon", { key: 'd640e89531b9edbe290c99e2cacfce41fc4ed879', class: "cty-camera__close-icon", name: closeIcon })))), index.h("div", { key: 'a8611dac88a7f2a2615b4874f0db86de9be1151d', class: "cty-camera-widgets", part: "widgets" }, index.h("button", { key: '887509307c97fb0837c6503bc6428fffb7b9b0cb', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, index.h("cty-icon", { key: '15422b01e83849f0848e164065f2492eed796e37', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && index.h("span", { key: '22e490eef01255bcb0a266125743a0d1a5202c16', class: "cty-camera-widget__text" }, flipText)), index.h("button", { key: '1b4ce3cb9d1c07d5f31cf9baa2e8d6d110b60ec0', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, index.h("cty-icon", { key: '5b1a2953996507d693381321bb4e1a03c3465421', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && index.h("span", { key: '1a91d914956cd17599d79f0221e4b7a0563b13be', class: "cty-camera-widget__text" }, flashText)), index.h("button", { key: '1bea848be4d5904ca74ee0b6e1d56807fc4a0731', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, index.h("span", { key: 'ab10f91f90c8a8471bc94243b7bad535e1171e2f', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && index.h("span", { key: '502527a106025d6012d86faefa0b225b8ad8ded8', class: "cty-camera-widget__text" }, ratioText))), index.h("div", { key: '2863467ed92620bf06204917567d0e1600044662', class: "cty-camera-controls safe-area-bottom-padding" }, index.h("slot", { key: '3a14102cbadd7325f220ce105aaaf5105b21629f', name: "zooms" }, index.h("div", { key: '0ca55abd29fcf660bbde14873cdb74f2bbd58450', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (index.h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, index.h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), index.h("div", { key: '58bec9af89ace3ca63c91cd6768040a0b2e0a190', class: "cty-camera-controls__main flex-center" }, index.h("div", { key: 'caa835c546b83741659b1c36f0b3f99d7d5481c8', class: "cty-camera-controls__main-left flex-center" }), index.h("div", { key: '561f4f794938fdedae4ecf8b216d445e9c16708f', class: "cty-camera-controls__take-photo flex-center" }, index.h("button", { key: 'ebda39c88c8afcac7ad03a93779b52034e4f03ad', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), index.h("div", { key: 'c6f12f91a7a36a826e456929b08d240ee3cbae82', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && index.h("button", { key: '2bedc3ae07ed1c01a880562459d7f30cb1c10cfe', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, index.h("cty-icon", { key: '250431733180d4d6b403a2a5535576fdf3978ba2', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), index.h("span", { key: 'a4c1eac8d7b8b7b0f58b3492a51c906dd97fadd0', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), index.h("slot", { key: '9a58817e2c3dac0f02bd21483b92d2d751095014', name: "images" }, index.h("div", { key: 'e9cdadd9bb8da0b5ccff3681f484570fc5b4269e', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (index.h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, index.h("img", { class: 'cty-camera-controls__image-img', src: item.url }), index.h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, index.h("cty-icon", { class: "cty-camera-controls__image-delete", name: index$1.closeOutline })))))))), showImageViewer && index.h("cty-image-viewer", { key: 'fb724686c5f0d9a24f12527ba1b50f09de85a82f', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
151
+ return (index.h(index.Host, { key: '6c0e8aee4840edae99979e2f8fa4fe1f28b91f00', class: "cty-camera", onClick: (e) => e.stopPropagation() }, index.h("cty-nav-bar", { key: '16ed59dc05921a634765cae7e3c8ab817a509b66', title: title, type: "clear" }, index.h("slot", { key: 'dbeb5240503757e7fb35741bfaacfee520e935c5', name: "header-start", slot: "start" }, index.h("ion-button", { key: 'e0258b6b06a50aa10d9903e6a4789d155b1a926b', class: "cty-camera__close", onClick: () => this.close() }, index.h("cty-icon", { key: '48c9f1c506dd13155e2545f1e4d5b8970886bb12', class: "cty-camera__close-icon", name: closeIcon })))), index.h("div", { key: 'a367e170321b0966ab490b9b694eaffe18fb8f6c', class: "cty-camera-widgets", part: "widgets" }, index.h("button", { key: '9f54e594fec181935c988f320158ce8f5754cd5c', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, index.h("cty-icon", { key: 'db2e97bd1ec69d82e93c9506fd8976cff560ed24', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && index.h("span", { key: '947fee726ab0e6c514747a2b2eadbf989f5ff91c', class: "cty-camera-widget__text" }, flipText)), index.h("button", { key: '01a10aae9e6745d83033ef5e4441cc3d7e199612', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, index.h("cty-icon", { key: 'd2bd45656aa68309b40f8977e80b15ae7ec29e17', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && index.h("span", { key: 'b4f9d0d5675c6a21483f4bc211b92ba4e7a8f688', class: "cty-camera-widget__text" }, flashText)), index.h("button", { key: 'c36f3a4a1d6d2705ea7c52acb0281f18f7570de9', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, index.h("span", { key: 'ac8cb010492f470ea5e776efa59d2e3b622c031b', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && index.h("span", { key: 'fc2792dd4c5e27b4946db17fc05ca8d1f79ab475', class: "cty-camera-widget__text" }, ratioText))), index.h("div", { key: '2b6cb7cb689119162cba517b5469efdcf173e481', class: "cty-camera-controls safe-area-bottom-padding" }, index.h("slot", { key: '93ba0e977b61d5c5fdd0bd6ab220711064af826d', name: "zooms" }, index.h("div", { key: '2ea4da678fda37ba175c66a72e34fccf1974a521', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (index.h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, index.h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), index.h("div", { key: '8f308406f2ceac48cd7cbfd4306a7a65aebce21f', class: "cty-camera-controls__main flex-center" }, index.h("div", { key: 'd3fc1707c8f6ee3d9f968f916e8a50810e580a4b', class: "cty-camera-controls__main-left flex-center" }), index.h("div", { key: 'fa7a8905a22006276b941693c26ac15e6b002976', class: "cty-camera-controls__take-photo flex-center" }, index.h("button", { key: '61536741582da9bef8bcf0fe4fba09e3fefde58e', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), index.h("div", { key: '74ef21c9e62c7ac604b11b53f9b6a1126fa0338b', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && index.h("button", { key: 'c019b93aab832fadcb3e6d5c77bc98dd8e126b16', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, index.h("cty-icon", { key: 'eb9ae426c45fa31202247c99ebb991bc7ceede55', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), index.h("span", { key: '25afa75bcbda33b8f15c432879712bdec937678c', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), index.h("slot", { key: '14def885116f251bd8390313d46c661dcc807282', name: "images" }, index.h("div", { key: '254067237e7506f87bdc762285dc3eaff6591ed6', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (index.h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, index.h("img", { class: 'cty-camera-controls__image-img', src: item.url }), index.h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, index.h("cty-icon", { class: "cty-camera-controls__image-delete", name: index$1.closeOutline })))))))), showImageViewer && index.h("cty-image-viewer", { key: 'e84bcb7a5ce6cbb504dbe55e6538622d3914d334', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
152
152
  }
153
153
  get el() { return index.getElement(this); }
154
154
  };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DCK462Hl.js');
4
- var deviceInfo = require('./device-info-C7UUXx-P.js');
4
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
5
5
  var format = require('./format-BSDO5P-c.js');
6
6
  require('./platform-DJmEyHMN.js');
7
7
  require('./network-D7xvJurk.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  var index = require('./index-DCK462Hl.js');
4
4
  var keyboard = require('./keyboard-Cuk4m847.js');
5
- var deviceInfo = require('./device-info-C7UUXx-P.js');
5
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
6
6
  require('./network-D7xvJurk.js');
7
7
  require('./platform-DJmEyHMN.js');
8
8
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  var index = require('./index-DCK462Hl.js');
4
4
  var statusBar = require('./status-bar-1jhnFEuR.js');
5
- var videoCapture = require('./video-capture-DAMSxk8m.js');
5
+ var videoCapture = require('./video-capture-hurwVr0S.js');
6
6
  var index$1 = require('./index-o2Vg_VSe.js');
7
7
  require('./config-Bn2x7PFv.js');
8
8
  require('./format-BSDO5P-c.js');
9
9
  require('./index-6rsnyV5b.js');
10
- require('./device-info-C7UUXx-P.js');
10
+ require('./device-info-CC9Tsjk3.js');
11
11
  require('./platform-DJmEyHMN.js');
12
12
  require('./network-D7xvJurk.js');
13
13
 
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DCK462Hl.js');
4
- var deviceInfo = require('./device-info-C7UUXx-P.js');
5
- var audioRecorder = require('./audio-recorder-BKbTidei.js');
4
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
5
+ var audioRecorder = require('./audio-recorder-DYpLmmqT.js');
6
6
  var overlays = require('./overlays-Cfk4eti-.js');
7
7
  var lockController = require('./lock-controller-Dk7it1jt.js');
8
8
  var helpers = require('./helpers-Bdo8wX6-.js');
@@ -2,8 +2,8 @@
2
2
 
3
3
  var index = require('./index-DCK462Hl.js');
4
4
  var config = require('./config-Bn2x7PFv.js');
5
- var deviceInfo = require('./device-info-C7UUXx-P.js');
6
- var share = require('./share-C5S5TwgG.js');
5
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
6
+ var share = require('./share-DjeE75QU.js');
7
7
  var utils = require('./utils-C8Ez-9Oe.js');
8
8
  var overlays = require('./overlays-Cfk4eti-.js');
9
9
  var lockController = require('./lock-controller-Dk7it1jt.js');
@@ -5,7 +5,7 @@ var dom = require('./dom-B8PDM5o-.js');
5
5
  var statusBar = require('./status-bar-1jhnFEuR.js');
6
6
  var volumeControl = require('./volume-control-CPf0zISh.js');
7
7
  var network = require('./network-D7xvJurk.js');
8
- var deviceInfo = require('./device-info-C7UUXx-P.js');
8
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
9
9
  var config = require('./config-Bn2x7PFv.js');
10
10
  var index$1 = require('./index-o2Vg_VSe.js');
11
11
  var platform = require('./platform-DJmEyHMN.js');
@@ -4,9 +4,13 @@ require('./index-DCK462Hl.js');
4
4
  var platform = require('./platform-DJmEyHMN.js');
5
5
  var network = require('./network-D7xvJurk.js');
6
6
 
7
- const formatLocalPreview = (path) => {
8
- var _a, _b;
9
- return (_b = (_a = window === null || window === void 0 ? void 0 : window.Ionic) === null || _a === void 0 ? void 0 : _a.WebView) === null || _b === void 0 ? void 0 : _b.convertFileSrc(path);
7
+ const formatLocalPreview = (filePath) => {
8
+ return new Promise((resolve, reject) => {
9
+ window.resolveLocalFileSystemURL(filePath, (entry) => {
10
+ resolve(entry.toURL());
11
+ }, reject);
12
+ });
13
+ // return (window as any)?.Ionic?.WebView?.convertFileSrc(path);
10
14
  };
11
15
  function testUserAgent(expression) {
12
16
  const nav = window.navigator;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var deviceInfo = require('./device-info-C7UUXx-P.js');
3
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
4
4
  var index = require('./index-6rsnyV5b.js');
5
5
 
6
6
  exports.MediaSourceType = void 0;
@@ -48,11 +48,11 @@ class CTYImagePicker {
48
48
  get isWxSDKAvailable() {
49
49
  return !!this._wxSDK;
50
50
  }
51
- formatPictureResult(file, data) {
51
+ async formatPictureResult(file, data) {
52
52
  let safeUrl = data;
53
53
  if (file) {
54
54
  try {
55
- safeUrl = deviceInfo.formatLocalPreview(data);
55
+ safeUrl = await deviceInfo.formatLocalPreview(data);
56
56
  safeUrl = index.sanitizeDOMString(safeUrl);
57
57
  }
58
58
  catch (error) {
@@ -61,7 +61,7 @@ class CTYImagePicker {
61
61
  }
62
62
  else {
63
63
  try {
64
- safeUrl = index.sanitizeDOMString(`data:image/jpeg;base64,${data}`);
64
+ safeUrl = index.sanitizeDOMString(data);
65
65
  }
66
66
  catch (error) {
67
67
  console.error('Error bypassing sanitization:', error);
@@ -84,9 +84,9 @@ class CTYImagePicker {
84
84
  sourceType: this._cameraPlugin.PictureSourceType[camera ? 'CAMERA' : 'PHOTOLIBRARY'],
85
85
  correctOrientation: false
86
86
  };
87
- this._cameraPlugin.getPicture((data) => {
87
+ this._cameraPlugin.getPicture(async (data) => {
88
88
  if (data) {
89
- const result = this.formatPictureResult(file, data);
89
+ const result = await this.formatPictureResult(file, data);
90
90
  resolve([result]);
91
91
  }
92
92
  else {
@@ -104,14 +104,16 @@ class CTYImagePicker {
104
104
  const option = {
105
105
  quality: 85
106
106
  };
107
- this._imagePickerPlugin.getPictures((results) => {
107
+ this._imagePickerPlugin.getPictures(async (results) => {
108
108
  if (results[0] == 'O' || results[0] == 'K') {
109
109
  resolve([]);
110
110
  return;
111
111
  }
112
- const imageList = results.map((data) => {
113
- return this.formatPictureResult(file, data);
114
- });
112
+ const imageList = [];
113
+ for (const data of results) {
114
+ const result = await this.formatPictureResult(file, data);
115
+ imageList.push(result);
116
+ }
115
117
  resolve(imageList);
116
118
  }, (error) => { reject(error); }, Object.assign(option, imagePickerOptions, {
117
119
  outputType: file ? 0 : 1,
@@ -9,15 +9,15 @@ var dom = require('./dom-B8PDM5o-.js');
9
9
  var format = require('./format-BSDO5P-c.js');
10
10
  var utils = require('./utils-C8Ez-9Oe.js');
11
11
  var validate = require('./validate-Bad0X9vv.js');
12
- var audioRecorder = require('./audio-recorder-BKbTidei.js');
12
+ var audioRecorder = require('./audio-recorder-DYpLmmqT.js');
13
13
  var cameraPreview = require('./camera-preview-BHobAi2K.js');
14
- var deviceInfo = require('./device-info-C7UUXx-P.js');
15
- var imagePicker = require('./image-picker-B6UWcLwS.js');
14
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
15
+ var imagePicker = require('./image-picker-BaPYPMtN.js');
16
16
  var keyboard = require('./keyboard-Cuk4m847.js');
17
17
  var network = require('./network-D7xvJurk.js');
18
18
  var volumeControl = require('./volume-control-CPf0zISh.js');
19
- var share = require('./share-C5S5TwgG.js');
20
- var videoCapture = require('./video-capture-DAMSxk8m.js');
19
+ var share = require('./share-DjeE75QU.js');
20
+ var videoCapture = require('./video-capture-hurwVr0S.js');
21
21
  var ctyMuiGlobal = require('./cty-mui-global-CQI_F108.js');
22
22
  var overlays = require('./overlays-Cfk4eti-.js');
23
23
  require('./index-D3mJ1Cix.js');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var deviceInfo = require('./device-info-C7UUXx-P.js');
3
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
4
4
 
5
5
  exports.SharePlatformType = void 0;
6
6
  (function (SharePlatformType) {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-6rsnyV5b.js');
4
- var deviceInfo = require('./device-info-C7UUXx-P.js');
4
+ var deviceInfo = require('./device-info-CC9Tsjk3.js');
5
5
 
6
6
  class CTYVideoCapture {
7
7
  get _videoCapturePlugin() {
@@ -17,10 +17,10 @@ class CTYVideoCapture {
17
17
  return reject('Video capture plugin is not available.');
18
18
  }
19
19
  try {
20
- this._videoCapturePlugin.captureVideo((result) => {
20
+ this._videoCapturePlugin.captureVideo(async (result) => {
21
21
  if (Array.isArray(result) && result.length > 0) {
22
22
  const data = result[0].fullPath;
23
- const url = deviceInfo.formatLocalPreview(index.sanitizeDOMString(data));
23
+ const url = await deviceInfo.formatLocalPreview(index.sanitizeDOMString(data));
24
24
  resolve({ url, data });
25
25
  }
26
26
  else {
@@ -102,7 +102,7 @@ export class Camera {
102
102
  async takePhoto() {
103
103
  const { quality, width, height, file } = this;
104
104
  const data = await cameraPreview.takePicture({ width, height, quality });
105
- const result = imagePicker.formatPictureResult(file, data);
105
+ const result = await imagePicker.formatPictureResult(file, data);
106
106
  this.pictures = [...this.pictures, result];
107
107
  this.ctyTakePhoto.emit(result);
108
108
  return result;
@@ -135,7 +135,7 @@ export class Camera {
135
135
  }
136
136
  render() {
137
137
  const { title, closeIcon, flash, flipText, flashText, ratioText, ratios, ratioIndex, zoomIndex, zooms, confirmIcon, confirmText, pictures, showImageViewer, imageViewerIndex } = this;
138
- return (h(Host, { key: '87619df83dfd1df6b3163dd2b7c45f94a6f74db6', class: "cty-camera", onClick: (e) => e.stopPropagation() }, h("cty-nav-bar", { key: '1ffe4cdebe32d92862667663bbd3b89452c5f186', title: title, type: "clear" }, h("slot", { key: '8556b0ca01c55bbe9ced998da6a8895ee8bd5c52', name: "header-start", slot: "start" }, h("ion-button", { key: '21115e603b0876f12b6d58fbb3bdab2f80520795', class: "cty-camera__close", onClick: () => this.close() }, h("cty-icon", { key: 'd640e89531b9edbe290c99e2cacfce41fc4ed879', class: "cty-camera__close-icon", name: closeIcon })))), h("div", { key: 'a8611dac88a7f2a2615b4874f0db86de9be1151d', class: "cty-camera-widgets", part: "widgets" }, h("button", { key: '887509307c97fb0837c6503bc6428fffb7b9b0cb', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, h("cty-icon", { key: '15422b01e83849f0848e164065f2492eed796e37', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && h("span", { key: '22e490eef01255bcb0a266125743a0d1a5202c16', class: "cty-camera-widget__text" }, flipText)), h("button", { key: '1b4ce3cb9d1c07d5f31cf9baa2e8d6d110b60ec0', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, h("cty-icon", { key: '5b1a2953996507d693381321bb4e1a03c3465421', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && h("span", { key: '1a91d914956cd17599d79f0221e4b7a0563b13be', class: "cty-camera-widget__text" }, flashText)), h("button", { key: '1bea848be4d5904ca74ee0b6e1d56807fc4a0731', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, h("span", { key: 'ab10f91f90c8a8471bc94243b7bad535e1171e2f', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && h("span", { key: '502527a106025d6012d86faefa0b225b8ad8ded8', class: "cty-camera-widget__text" }, ratioText))), h("div", { key: '2863467ed92620bf06204917567d0e1600044662', class: "cty-camera-controls safe-area-bottom-padding" }, h("slot", { key: '3a14102cbadd7325f220ce105aaaf5105b21629f', name: "zooms" }, h("div", { key: '0ca55abd29fcf660bbde14873cdb74f2bbd58450', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), h("div", { key: '58bec9af89ace3ca63c91cd6768040a0b2e0a190', class: "cty-camera-controls__main flex-center" }, h("div", { key: 'caa835c546b83741659b1c36f0b3f99d7d5481c8', class: "cty-camera-controls__main-left flex-center" }), h("div", { key: '561f4f794938fdedae4ecf8b216d445e9c16708f', class: "cty-camera-controls__take-photo flex-center" }, h("button", { key: 'ebda39c88c8afcac7ad03a93779b52034e4f03ad', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), h("div", { key: 'c6f12f91a7a36a826e456929b08d240ee3cbae82', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && h("button", { key: '2bedc3ae07ed1c01a880562459d7f30cb1c10cfe', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, h("cty-icon", { key: '250431733180d4d6b403a2a5535576fdf3978ba2', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), h("span", { key: 'a4c1eac8d7b8b7b0f58b3492a51c906dd97fadd0', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), h("slot", { key: '9a58817e2c3dac0f02bd21483b92d2d751095014', name: "images" }, h("div", { key: 'e9cdadd9bb8da0b5ccff3681f484570fc5b4269e', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, h("img", { class: 'cty-camera-controls__image-img', src: item.url }), h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, h("cty-icon", { class: "cty-camera-controls__image-delete", name: closeOutline })))))))), showImageViewer && h("cty-image-viewer", { key: 'fb724686c5f0d9a24f12527ba1b50f09de85a82f', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
138
+ return (h(Host, { key: '6c0e8aee4840edae99979e2f8fa4fe1f28b91f00', class: "cty-camera", onClick: (e) => e.stopPropagation() }, h("cty-nav-bar", { key: '16ed59dc05921a634765cae7e3c8ab817a509b66', title: title, type: "clear" }, h("slot", { key: 'dbeb5240503757e7fb35741bfaacfee520e935c5', name: "header-start", slot: "start" }, h("ion-button", { key: 'e0258b6b06a50aa10d9903e6a4789d155b1a926b', class: "cty-camera__close", onClick: () => this.close() }, h("cty-icon", { key: '48c9f1c506dd13155e2545f1e4d5b8970886bb12', class: "cty-camera__close-icon", name: closeIcon })))), h("div", { key: 'a367e170321b0966ab490b9b694eaffe18fb8f6c', class: "cty-camera-widgets", part: "widgets" }, h("button", { key: '9f54e594fec181935c988f320158ce8f5754cd5c', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.flipCamera() }, h("cty-icon", { key: 'db2e97bd1ec69d82e93c9506fd8976cff560ed24', class: "cty-camera-widget__icon", name: "cty-flip" }), !!flipText && h("span", { key: '947fee726ab0e6c514747a2b2eadbf989f5ff91c', class: "cty-camera-widget__text" }, flipText)), h("button", { key: '01a10aae9e6745d83033ef5e4441cc3d7e199612', class: "cty-button-native cty-camera-widget", part: "widget", onClick: () => this.toggleFlash() }, h("cty-icon", { key: 'd2bd45656aa68309b40f8977e80b15ae7ec29e17', class: "cty-camera-widget__icon", name: flash ? 'cty-flash-on' : 'cty-flash-off' }), !!flashText && h("span", { key: 'b4f9d0d5675c6a21483f4bc211b92ba4e7a8f688', class: "cty-camera-widget__text" }, flashText)), h("button", { key: 'c36f3a4a1d6d2705ea7c52acb0281f18f7570de9', class: "cty-button-native cty-camera-widget", part: "ratio", onClick: () => this.ratioChange() }, h("span", { key: 'ac8cb010492f470ea5e776efa59d2e3b622c031b', class: "cty-camera-widget__ratio flex-center" }, ratios[ratioIndex]), !!ratioText && h("span", { key: 'fc2792dd4c5e27b4946db17fc05ca8d1f79ab475', class: "cty-camera-widget__text" }, ratioText))), h("div", { key: '2b6cb7cb689119162cba517b5469efdcf173e481', class: "cty-camera-controls safe-area-bottom-padding" }, h("slot", { key: '93ba0e977b61d5c5fdd0bd6ab220711064af826d', name: "zooms" }, h("div", { key: '2ea4da678fda37ba175c66a72e34fccf1974a521', class: "cty-camera-controls__zooms flex-center" }, zooms.map((item, idx) => (h("div", { class: { 'cty-camera-controls__zoom-item flex-center': true, 'cty-camera-controls__zoom-item__active': zoomIndex === idx }, onClick: () => this.setZoom(idx) }, h("span", { class: "cty-camera-controls__zoom-text flex-center" }, item, "X")))))), h("div", { key: '8f308406f2ceac48cd7cbfd4306a7a65aebce21f', class: "cty-camera-controls__main flex-center" }, h("div", { key: 'd3fc1707c8f6ee3d9f968f916e8a50810e580a4b', class: "cty-camera-controls__main-left flex-center" }), h("div", { key: 'fa7a8905a22006276b941693c26ac15e6b002976', class: "cty-camera-controls__take-photo flex-center" }, h("button", { key: '61536741582da9bef8bcf0fe4fba09e3fefde58e', class: "cty-button-native cty-camera-controls__take-photo-button", part: "take-photo", onClick: () => this.takePhoto() })), h("div", { key: '74ef21c9e62c7ac604b11b53f9b6a1126fa0338b', class: "cty-camera-controls__main-confirm flex-center" }, pictures.length > 0 && h("button", { key: 'c019b93aab832fadcb3e6d5c77bc98dd8e126b16', class: "cty-button-native flex-column-center", onClick: () => this.confirm() }, h("cty-icon", { key: 'eb9ae426c45fa31202247c99ebb991bc7ceede55', class: "cty-camera-controls__main-confirm-icon", name: confirmIcon }), h("span", { key: '25afa75bcbda33b8f15c432879712bdec937678c', class: "cty-camera-controls__main-confirm-text" }, confirmText)))), h("slot", { key: '14def885116f251bd8390313d46c661dcc807282', name: "images" }, h("div", { key: '254067237e7506f87bdc762285dc3eaff6591ed6', class: "cty-camera-controls__images flex-align-center" }, pictures.map((item, idx) => (h("div", { class: "cty-camera-controls__image", onClick: () => this.toImageViewer(idx) }, h("img", { class: 'cty-camera-controls__image-img', src: item.url }), h("button", { class: "cty-button-native", onClick: (e) => this.deletePicture(e, idx) }, h("cty-icon", { class: "cty-camera-controls__image-delete", name: closeOutline })))))))), showImageViewer && h("cty-image-viewer", { key: 'e84bcb7a5ce6cbb504dbe55e6538622d3914d334', images: pictures.map(item => item.url), initialSlide: imageViewerIndex, overlayIndex: 100, backdropDismiss: false, closeable: true, onCtyDismiss: (e) => this.closeImageViewer(e) })));
139
139
  }
140
140
  static get is() { return "cty-camera"; }
141
141
  static get encapsulation() { return "shadow"; }
@@ -46,11 +46,11 @@ export class CTYImagePicker {
46
46
  get isWxSDKAvailable() {
47
47
  return !!this._wxSDK;
48
48
  }
49
- formatPictureResult(file, data) {
49
+ async formatPictureResult(file, data) {
50
50
  let safeUrl = data;
51
51
  if (file) {
52
52
  try {
53
- safeUrl = formatLocalPreview(data);
53
+ safeUrl = await formatLocalPreview(data);
54
54
  safeUrl = sanitizeDOMString(safeUrl);
55
55
  }
56
56
  catch (error) {
@@ -59,7 +59,7 @@ export class CTYImagePicker {
59
59
  }
60
60
  else {
61
61
  try {
62
- safeUrl = sanitizeDOMString(`data:image/jpeg;base64,${data}`);
62
+ safeUrl = sanitizeDOMString(data);
63
63
  }
64
64
  catch (error) {
65
65
  console.error('Error bypassing sanitization:', error);
@@ -82,9 +82,9 @@ export class CTYImagePicker {
82
82
  sourceType: this._cameraPlugin.PictureSourceType[camera ? 'CAMERA' : 'PHOTOLIBRARY'],
83
83
  correctOrientation: false
84
84
  };
85
- this._cameraPlugin.getPicture((data) => {
85
+ this._cameraPlugin.getPicture(async (data) => {
86
86
  if (data) {
87
- const result = this.formatPictureResult(file, data);
87
+ const result = await this.formatPictureResult(file, data);
88
88
  resolve([result]);
89
89
  }
90
90
  else {
@@ -102,14 +102,16 @@ export class CTYImagePicker {
102
102
  const option = {
103
103
  quality: 85
104
104
  };
105
- this._imagePickerPlugin.getPictures((results) => {
105
+ this._imagePickerPlugin.getPictures(async (results) => {
106
106
  if (results[0] == 'O' || results[0] == 'K') {
107
107
  resolve([]);
108
108
  return;
109
109
  }
110
- const imageList = results.map((data) => {
111
- return this.formatPictureResult(file, data);
112
- });
110
+ const imageList = [];
111
+ for (const data of results) {
112
+ const result = await this.formatPictureResult(file, data);
113
+ imageList.push(result);
114
+ }
113
115
  resolve(imageList);
114
116
  }, (error) => { reject(error); }, Object.assign(option, imagePickerOptions, {
115
117
  outputType: file ? 0 : 1,
@@ -1,7 +1,11 @@
1
1
  import { deviceInfo } from "./device-info";
2
- export const formatLocalPreview = (path) => {
3
- var _a, _b;
4
- return (_b = (_a = window === null || window === void 0 ? void 0 : window.Ionic) === null || _a === void 0 ? void 0 : _a.WebView) === null || _b === void 0 ? void 0 : _b.convertFileSrc(path);
2
+ export const formatLocalPreview = (filePath) => {
3
+ return new Promise((resolve, reject) => {
4
+ window.resolveLocalFileSystemURL(filePath, (entry) => {
5
+ resolve(entry.toURL());
6
+ }, reject);
7
+ });
8
+ // return (window as any)?.Ionic?.WebView?.convertFileSrc(path);
5
9
  };
6
10
  export function testUserAgent(expression) {
7
11
  const nav = window.navigator;
@@ -14,10 +14,10 @@ export class CTYVideoCapture {
14
14
  return reject('Video capture plugin is not available.');
15
15
  }
16
16
  try {
17
- this._videoCapturePlugin.captureVideo((result) => {
17
+ this._videoCapturePlugin.captureVideo(async (result) => {
18
18
  if (Array.isArray(result) && result.length > 0) {
19
19
  const data = result[0].fullPath;
20
- const url = formatLocalPreview(sanitizeDOMString(data));
20
+ const url = await formatLocalPreview(sanitizeDOMString(data));
21
21
  resolve({ url, data });
22
22
  }
23
23
  else {