@uploadista/react-native-core 0.0.20-beta.2 → 0.0.20-beta.4

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/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react0 from "react";
2
2
  import { ReactNode } from "react";
3
3
  import * as _uploadista_client_core3 from "@uploadista/client-core";
4
- import { Base64Service, ConnectionMetrics, ConnectionPoolConfig, ConnectionPoolConfig as ConnectionPoolConfig$1, DetailedConnectionMetrics, FileReaderService, FlowManager, FlowManagerCallbacks, FlowUploadOptions, FlowUploadState, FlowUploadStatus, HttpClient, IdGenerationService, ServiceContainer, ServiceContainer as ServiceContainer$1, StorageService, UploadState, UploadStatus, UploadistaClientOptions, UploadistaEvent } from "@uploadista/client-core";
4
+ import { Base64Service, ConnectionMetrics, ConnectionPoolConfig, ConnectionPoolConfig as ConnectionPoolConfig$1, DetailedConnectionMetrics, FileReaderService, FlowManager, FlowManagerCallbacks, FlowUploadOptions, FlowUploadState, FlowUploadStatus, HttpClient, IdGenerationService, InputExecutionState, ServiceContainer, ServiceContainer as ServiceContainer$1, StorageService, UploadState, UploadStatus, UploadistaClientOptions, UploadistaEvent } from "@uploadista/client-core";
5
5
  import { TypedOutput } from "@uploadista/core/flow";
6
6
  import { UploadFile } from "@uploadista/core/types";
7
7
  import * as react_jsx_runtime1 from "react/jsx-runtime";
@@ -180,29 +180,6 @@ interface UseMultiUploadOptions {
180
180
  /** Called when a file upload fails */
181
181
  onError?: (error: Error) => void;
182
182
  }
183
- /**
184
- * Options for flow upload hook
185
- */
186
- interface UseFlowUploadOptions {
187
- /** Flow ID to execute */
188
- flowId: string;
189
- /** Storage ID for the upload */
190
- storageId: string;
191
- /** Output node ID for the flow */
192
- outputNodeId?: string;
193
- /** Metadata to pass to flow */
194
- metadata?: Record<string, unknown>;
195
- /** Called when upload succeeds (receives typed outputs from all output nodes) */
196
- onSuccess?: (outputs: TypedOutput[]) => void;
197
- /** Called when the flow completes successfully (receives full flow outputs) */
198
- onFlowComplete?: (outputs: TypedOutput[]) => void;
199
- /** Called when upload fails */
200
- onError?: (error: Error) => void;
201
- /** Called when upload progress updates */
202
- onProgress?: (progress: number, bytesUploaded: number, totalBytes: number | null) => void;
203
- /** Called when a chunk completes */
204
- onChunkComplete?: (chunkSize: number, bytesAccepted: number, bytesTotal: number | null) => void;
205
- }
206
183
  /**
207
184
  * Options for camera upload hook
208
185
  */
@@ -720,56 +697,218 @@ declare function useFileUpload(options?: UseFileUploadOptions): {
720
697
  metrics: _uploadista_client_core3.UploadMetrics;
721
698
  };
722
699
  //#endregion
723
- //#region src/hooks/use-flow-upload.d.ts
700
+ //#region src/hooks/use-flow.d.ts
701
+ /**
702
+ * Input metadata discovered from the flow
703
+ */
704
+ interface FlowInputMetadata {
705
+ /** Input node ID */
706
+ nodeId: string;
707
+ /** Human-readable node name */
708
+ nodeName: string;
709
+ /** Node description explaining what input is needed */
710
+ nodeDescription: string;
711
+ /** Input type ID from inputTypeRegistry - describes how clients interact with this node */
712
+ inputTypeId?: string;
713
+ /** Whether this input is required */
714
+ required: boolean;
715
+ }
716
+ /**
717
+ * Options for the useFlow hook
718
+ */
719
+ interface UseFlowOptions {
720
+ /** Flow ID to execute */
721
+ flowId: string;
722
+ /** Storage ID for the upload */
723
+ storageId: string;
724
+ /** Output node ID for the flow */
725
+ outputNodeId?: string;
726
+ /** Metadata to pass to flow */
727
+ metadata?: Record<string, unknown>;
728
+ /** Called when upload succeeds (receives typed outputs from all output nodes) */
729
+ onSuccess?: (outputs: TypedOutput[]) => void;
730
+ /** Called when the flow completes successfully (receives full flow outputs) */
731
+ onFlowComplete?: (outputs: TypedOutput[]) => void;
732
+ /** Called when upload fails */
733
+ onError?: (error: Error) => void;
734
+ /** Called when upload progress updates */
735
+ onProgress?: (progress: number, bytesUploaded: number, totalBytes: number | null) => void;
736
+ /** Called when a chunk completes */
737
+ onChunkComplete?: (chunkSize: number, bytesAccepted: number, bytesTotal: number | null) => void;
738
+ }
739
+ /**
740
+ * Return value from the useFlow hook with upload control methods and state.
741
+ *
742
+ * @property state - Complete flow upload state with progress and outputs
743
+ * @property inputMetadata - Metadata about discovered input nodes (null until discovered)
744
+ * @property inputStates - Per-input execution state for multi-input flows
745
+ * @property inputs - Current input values set via setInput()
746
+ * @property setInput - Set an input value for a specific node (for progressive provision)
747
+ * @property execute - Execute the flow with current inputs (auto-detects types)
748
+ * @property upload - Convenience method for single-file upload (same as execute with one file input)
749
+ * @property abort - Cancel the current upload and flow execution
750
+ * @property reset - Reset state to idle (clears all data)
751
+ * @property retry - Retry the last failed upload
752
+ * @property isActive - True when upload or processing is active
753
+ * @property isUploadingFile - True only during file upload phase
754
+ * @property isProcessing - True only during flow processing phase
755
+ * @property isDiscoveringInputs - True while discovering flow inputs
756
+ * @property canRetry - True if a retry is possible
757
+ */
758
+ interface UseFlowReturn {
759
+ /**
760
+ * Current upload state
761
+ */
762
+ state: FlowUploadState;
763
+ /**
764
+ * Discovered input nodes metadata (null until discovery completes)
765
+ */
766
+ inputMetadata: FlowInputMetadata[] | null;
767
+ /**
768
+ * Per-input execution state for multi-input flows
769
+ */
770
+ inputStates: ReadonlyMap<string, InputExecutionState>;
771
+ /**
772
+ * Current inputs set via setInput()
773
+ */
774
+ inputs: Record<string, unknown>;
775
+ /**
776
+ * Set an input value for a specific node.
777
+ * For progressive input provision before calling execute().
778
+ *
779
+ * @param nodeId - The input node ID
780
+ * @param value - The input value (FilePickResult, URL string, or structured data)
781
+ */
782
+ setInput: (nodeId: string, value: FilePickResult | string | unknown) => void;
783
+ /**
784
+ * Execute the flow with current inputs.
785
+ * Automatically detects input types and routes appropriately.
786
+ * For single input, uses standard upload path.
787
+ * For multiple inputs, requires multiInputUploadFn.
788
+ */
789
+ execute: () => Promise<void>;
790
+ /**
791
+ * Upload a single file through the flow (convenience method).
792
+ * Equivalent to setInput(firstNodeId, file) + execute().
793
+ *
794
+ * @param file - FilePickResult from a picker
795
+ */
796
+ upload: (file: FilePickResult) => Promise<void>;
797
+ /**
798
+ * Abort the current upload
799
+ */
800
+ abort: () => void;
801
+ /**
802
+ * Reset the upload state and clear all inputs
803
+ */
804
+ reset: () => void;
805
+ /**
806
+ * Retry the last failed upload
807
+ */
808
+ retry: () => void;
809
+ /**
810
+ * Whether an upload or flow execution is in progress (uploading OR processing)
811
+ */
812
+ isActive: boolean;
813
+ /**
814
+ * Whether the file is currently being uploaded (chunks being sent)
815
+ */
816
+ isUploadingFile: boolean;
817
+ /**
818
+ * Whether the flow is currently processing (after upload completes)
819
+ */
820
+ isProcessing: boolean;
821
+ /**
822
+ * Whether the hook is discovering flow inputs
823
+ */
824
+ isDiscoveringInputs: boolean;
825
+ /**
826
+ * Whether a retry is possible (after error or abort with stored inputs)
827
+ */
828
+ canRetry: boolean;
829
+ }
724
830
  /**
725
- * Hook for uploading files through a flow pipeline with full state management.
726
- * Provides upload progress tracking, flow execution monitoring, error handling, and abort functionality.
831
+ * React Native hook for executing flows with single or multiple inputs.
832
+ * Automatically discovers input nodes and detects input types (File, URL, structured data).
833
+ * Supports progressive input provision via setInput() and execute().
834
+ *
835
+ * This is the unified flow hook that replaces useFlowUpload for advanced use cases.
836
+ * It provides:
837
+ * - Auto-discovery of flow input nodes
838
+ * - Automatic input type detection (FilePickResult -> upload, string -> URL, object -> data)
839
+ * - Progressive input provision via setInput()
840
+ * - Multi-input support with parallel coordination
841
+ * - Per-input state tracking
727
842
  *
728
843
  * Must be used within FlowManagerProvider (which must be within UploadistaProvider).
729
844
  * Flow events are automatically routed by the provider to the appropriate manager.
730
845
  *
731
- * @param options - Flow upload configuration
846
+ * @param options - Flow upload configuration including flow ID and event handlers
732
847
  * @returns Flow upload state and control methods
733
848
  *
734
849
  * @example
735
850
  * ```tsx
736
851
  * function MyComponent() {
737
- * const flowUpload = useFlowUpload({
852
+ * const flow = useFlow({
738
853
  * flowId: 'image-processing-flow',
739
854
  * storageId: 'my-storage',
740
- * onSuccess: (result) => console.log('Flow complete:', result),
855
+ * onSuccess: (outputs) => console.log('Flow complete:', outputs),
741
856
  * onError: (error) => console.error('Flow failed:', error),
742
- * onProgress: (progress) => console.log('Progress:', progress + '%'),
743
857
  * });
744
858
  *
745
859
  * const handlePickFile = async () => {
746
860
  * const file = await fileSystemProvider.pickDocument();
747
861
  * if (file) {
748
- * await flowUpload.upload(file);
862
+ * await flow.upload(file);
749
863
  * }
750
864
  * };
751
865
  *
752
866
  * return (
753
867
  * <View>
754
868
  * <Button title="Pick File" onPress={handlePickFile} />
755
- * {flowUpload.isUploading && <Text>Progress: {flowUpload.state.progress}%</Text>}
756
- * {flowUpload.state.jobId && <Text>Job ID: {flowUpload.state.jobId}</Text>}
757
- * {flowUpload.state.error && <Text>Error: {flowUpload.state.error.message}</Text>}
758
- * <Button title="Abort" onPress={flowUpload.abort} disabled={!flowUpload.isActive} />
869
+ * {flow.isActive && <Text>Progress: {flow.state.progress}%</Text>}
870
+ * {flow.inputMetadata && (
871
+ * <Text>Found {flow.inputMetadata.length} input nodes</Text>
872
+ * )}
873
+ * <Button title="Abort" onPress={flow.abort} disabled={!flow.isActive} />
759
874
  * </View>
760
875
  * );
761
876
  * }
762
877
  * ```
878
+ *
879
+ * @example
880
+ * ```tsx
881
+ * // Multi-input flow
882
+ * function MultiInputComponent() {
883
+ * const flow = useFlow({
884
+ * flowId: 'multi-source-flow',
885
+ * storageId: 'my-storage',
886
+ * });
887
+ *
888
+ * const handlePickPrimary = async () => {
889
+ * const file = await fileSystemProvider.pickDocument();
890
+ * if (file.status === 'success') {
891
+ * flow.setInput('primary-input', file);
892
+ * }
893
+ * };
894
+ *
895
+ * const handleSetUrl = (url: string) => {
896
+ * flow.setInput('url-input', url);
897
+ * };
898
+ *
899
+ * return (
900
+ * <View>
901
+ * <Button title="Pick Primary" onPress={handlePickPrimary} />
902
+ * <TextInput onChangeText={handleSetUrl} placeholder="Enter URL" />
903
+ * <Button title="Execute" onPress={flow.execute} />
904
+ * </View>
905
+ * );
906
+ * }
907
+ * ```
908
+ *
909
+ * @see {@link useFlowUpload} for a simpler file-only upload hook
763
910
  */
764
- declare function useFlowUpload(options: UseFlowUploadOptions): {
765
- state: FlowUploadState;
766
- upload: (file: FilePickResult) => Promise<void>;
767
- abort: () => void;
768
- reset: () => void;
769
- retry: () => void;
770
- isActive: boolean;
771
- canRetry: boolean;
772
- };
911
+ declare function useFlow(options: UseFlowOptions): UseFlowReturn;
773
912
  //#endregion
774
913
  //#region src/hooks/use-multi-upload.d.ts
775
914
  interface UploadItemState {
@@ -1063,5 +1202,5 @@ declare function normalizeUri(uri: string): string;
1063
1202
  */
1064
1203
  declare function getMimeTypeFromUri(uri: string): string;
1065
1204
  //#endregion
1066
- export { type Base64Service, type CameraOptions, CameraUploadButton, type CameraUploadButtonProps, type ConnectionMetrics, type ConnectionPoolConfig, type DetailedConnectionMetrics, type FileInfo, type FilePickResult, type FileReaderService, type FileSystemProvider, type FileSystemProviderConfig, FileUploadButton, type FileUploadButtonProps, FlowManagerProvider, type FlowUploadState, type FlowUploadStatus, GalleryUploadButton, type GalleryUploadButtonProps, type HttpClient, type IdGenerationService, type MultiUploadState, PermissionStatus, PermissionType, type PickerOptions, type ReactNativeUploadInput, type ServiceContainer, type StorageService, type UploadItemState, UploadList, type UploadListProps, type UploadMetrics, UploadProgress, type UploadProgressProps, type UploadState, type UploadStatus, UploadistaContext, type UploadistaContextType, type UseCameraUploadOptions, type UseFileUploadOptions, type UseFlowUploadOptions, type UseGalleryUploadOptions, type UseMultiUploadOptions, formatFileSize, getDirectoryFromUri, getFileExtension, getFileNameFromUri, getFileNameWithoutExtension, getMimeTypeFromFileName, getMimeTypeFromUri, getPermissionStatus, hasPermissions, isContentUri, isDocumentFile, isFileSizeValid, isFileTypeAllowed, isFileUri, isImageFile, isVideoFile, normalizeUri, openAppSettings, pathToUri, requestCameraPermission, requestPermissions, requestPhotoLibraryPermission, requestStorageReadPermission, requestStorageWritePermission, uriToPath, useCameraUpload, useFileUpload, useFlowManagerContext, useFlowUpload, useGalleryUpload, useMultiUpload, useUploadMetrics, useUploadistaContext };
1205
+ export { type Base64Service, type CameraOptions, CameraUploadButton, type CameraUploadButtonProps, type ConnectionMetrics, type ConnectionPoolConfig, type DetailedConnectionMetrics, type FileInfo, type FilePickResult, type FileReaderService, type FileSystemProvider, type FileSystemProviderConfig, FileUploadButton, type FileUploadButtonProps, type FlowInputMetadata, FlowManagerProvider, type FlowUploadState, type FlowUploadStatus, GalleryUploadButton, type GalleryUploadButtonProps, type HttpClient, type IdGenerationService, type InputExecutionState, type MultiUploadState, PermissionStatus, PermissionType, type PickerOptions, type ReactNativeUploadInput, type ServiceContainer, type StorageService, type UploadItemState, UploadList, type UploadListProps, type UploadMetrics, UploadProgress, type UploadProgressProps, type UploadState, type UploadStatus, UploadistaContext, type UploadistaContextType, type UseCameraUploadOptions, type UseFileUploadOptions, type UseFlowOptions, type UseFlowReturn, type UseGalleryUploadOptions, type UseMultiUploadOptions, formatFileSize, getDirectoryFromUri, getFileExtension, getFileNameFromUri, getFileNameWithoutExtension, getMimeTypeFromFileName, getMimeTypeFromUri, getPermissionStatus, hasPermissions, isContentUri, isDocumentFile, isFileSizeValid, isFileTypeAllowed, isFileUri, isImageFile, isVideoFile, normalizeUri, openAppSettings, pathToUri, requestCameraPermission, requestPermissions, requestPhotoLibraryPermission, requestStorageReadPermission, requestStorageWritePermission, uriToPath, useCameraUpload, useFileUpload, useFlow, useFlowManagerContext, useGalleryUpload, useMultiUpload, useUploadMetrics, useUploadistaContext };
1067
1206
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/types.ts","../src/types/upload-input.ts","../src/components/CameraUploadButton.tsx","../src/components/FileUploadButton.tsx","../src/components/GalleryUploadButton.tsx","../src/components/UploadList.tsx","../src/components/UploadProgress.tsx","../src/contexts/flow-manager-context.tsx","../src/client/create-uploadista-client.ts","../src/hooks/use-uploadista-client.ts","../src/hooks/uploadista-context.ts","../src/hooks/use-camera-upload.ts","../src/hooks/use-file-upload.ts","../src/hooks/use-flow-upload.ts","../src/hooks/use-multi-upload.ts","../src/hooks/use-gallery-upload.ts","../src/hooks/use-upload-metrics.ts","../src/hooks/use-uploadista-context.ts","../src/utils/fileHelpers.ts","../src/utils/permissions.ts","../src/utils/uriHelpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;UAUiB,aAAA;;EAAA,YAAA,CAAA,EAAA,MAAa,EAAA;EAYb;EAcA,aAAA,CAAA,EAAA,OAAe;EAgBpB;EAQK,OAAA,CAAA,EAAA,MAAQ;AAiBzB;;;;AAasB,UApEL,aAAA,CAoEK;EAAwB;EAAR,UAAA,CAAA,EAAA,OAAA,GAAA,MAAA;EAOhB;EAAwB,OAAA,CAAA,EAAA,MAAA;EAAR;EAOf,QAAA,CAAA,EAAA,MAAA;EAAwB;EAAR,SAAA,CAAA,EAAA,MAAA;;;;;AAqBX,UAzFX,eAAA,CAyFW;EAAO;EAMlB,GAAA,EAAA,MAAA;EAUL;EAWK,IAAA,EAAA,MAAA;EAgCA;EAIT,IAAA,EAAA,MAAA;EAEI;EAED,QAAA,CAAA,EAAA,MAAA;EAAU;EAsDJ,SAAA,CAAA,EAAA,MAAA;AAcjB;;;;AAcoB,KA9NR,cAAA,GA8NQ;EAAK,MAAA,EAAA,SAAA;EAkBR,IAAA,EA/Oc,eA+Od;CAIC,GAAA;EAEL,MAAA,EAAA,WAAA;CAIO,GAAA;EAAK,MAAA,EAAA,OAAA;EAYR,KAAA,EAnQa,KAmQb;AAwBjB,CAAA;AAsBA;;;UA5SiB,QAAA;EC5DL;;;;ECYK;EAEL,IAAA,EAAA,MAAA;EAIC;EAIO,QAAA,CAAA,EAAA,MAAA;EAAK;EAWT,gBAAA,CAAA,EAAA,MAAkB;;;;;;AAMhC,UFsCe,kBAAA,CEtCf;EACA;;;;;yBF2CuB,gBAAgB,QAAQ;;AGvEjD;;;;EAUyB,SAAA,CAAA,OAAA,CAAA,E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,mBAAA,cACP,iBACZ,QAAQ;;AjB5IX;;;AAUoB,iBiBiJJ,eAAA,CAAA,CjBjJI,EAAA,IAAA;;;;;;;;;;;iBkBbJ,kBAAA;;ApBChB;AAYA;AAcA;AAgBA;AAQiB,iBoBvBD,SAAA,CpBuBS,QAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAiBzB;;;;;AAa8C,iBoBnC9B,SAAA,CpBmC8B,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;;;AAcC,iBoB/B/B,mBAAA,CpB+B+B,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;;;AAqBnB,iBoBpCZ,YAAA,CpBoCY,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;AAM5B;AAUA;AAWA;AAgCA;AAIQ,iBoB1FQ,SAAA,CpB0FR,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;;;AA0DR;AAcA;AAQa,iBoBjKG,YAAA,CpBiKH,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;;AAwBb;AAIkB,iBoBnLF,kBAAA,CpBmLE,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/types.ts","../src/types/upload-input.ts","../src/components/CameraUploadButton.tsx","../src/components/FileUploadButton.tsx","../src/components/GalleryUploadButton.tsx","../src/components/UploadList.tsx","../src/components/UploadProgress.tsx","../src/contexts/flow-manager-context.tsx","../src/client/create-uploadista-client.ts","../src/hooks/use-uploadista-client.ts","../src/hooks/uploadista-context.ts","../src/hooks/use-camera-upload.ts","../src/hooks/use-file-upload.ts","../src/hooks/use-flow.ts","../src/hooks/use-multi-upload.ts","../src/hooks/use-gallery-upload.ts","../src/hooks/use-upload-metrics.ts","../src/hooks/use-uploadista-context.ts","../src/utils/fileHelpers.ts","../src/utils/permissions.ts","../src/utils/uriHelpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;UAUiB,aAAA;;EAAA,YAAA,CAA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BpQf,cnBoQe,EAAA,CAAA,EmBnQ3B,OnBmQ2B,CAAA,OAAA,CAAA;;;;ACxW9B;;iBkBoIsB,cAAA,eACN,mBACb;;AjB1HH;;;;AAUyB,iBiBgIH,mBAAA,CjBhIG,WAAA,EiBiIV,cjBjIU,CAAA,EiBkItB,OjBlIsB,CiBkId,gBjBlIc,CAAA;AAWzB;;;;AAIE,iBiBkIc,eAAA,CAAA,CjBlId,EAAA,IAAA;;;;;;;;;;;iBkB5Bc,kBAAA;;ApBChB;AAYA;AAcA;AAgBA;AAQiB,iBoBvBD,SAAA,CpBuBS,QAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAiBzB;;;;;AAa8C,iBoBnC9B,SAAA,CpBmC8B,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;;;AAcC,iBoB/B/B,mBAAA,CpB+B+B,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;;;AAqBnB,iBoBpCZ,YAAA,CpBoCY,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;AAM5B;AAUA;AAWA;AAgCA;AAIQ,iBoB1FQ,SAAA,CpB0FR,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;;;AA0DR;AA8CA;AAIkB,iBoB7LF,YAAA,CpB6LE,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;AAkBlB;AAwBA;AAsBiB,iBoBnPD,kBAAA,CpBmPc,GAAA,EAAA,MAAA,CAAA,EAAA,MAAA"}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import e,{createContext as t,useCallback as n,useContext as r,useEffect as i,useRef as a,useState as o}from"react";import{ActivityIndicator as s,FlatList as c,Pressable as l,StyleSheet as u,Text as d,View as f}from"react-native";import{FlowManager as p,UploadManager as m}from"@uploadista/client-core";import{EventType as h}from"@uploadista/core/flow";import{UploadEventType as g}from"@uploadista/core/types";import{jsx as _,jsxs as v}from"react/jsx-runtime";const y=t(void 0);function b(e,t){let n=e instanceof ArrayBuffer?new Uint8Array(e):e;return new Blob([n],t)}function x(){let e=r(y);if(!e)throw Error(`useUploadistaClient must be used within an UploadistaProvider`);return e}const ee={status:`idle`,progress:0,bytesUploaded:0,totalBytes:null,error:null,result:null};function S(e={}){let{client:t,fileSystemProvider:r}=x(),[s,c]=o(ee),l=a(null),u=a(null);return i(()=>(l.current=new m(async(e,n)=>{let i=e;if(i.status===`success`){let e=b(await r.readFile(i.data.uri),{type:i.data.mimeType||`application/octet-stream`});return t.upload(e,n)}return Promise.resolve({abort:()=>{}})},{onStateChange:c,onProgress:e.onProgress,onChunkComplete:e.onChunkComplete,onSuccess:e.onSuccess,onError:e.onError,onAbort:e.onAbort},{metadata:e.metadata,uploadLengthDeferred:e.uploadLengthDeferred,uploadSize:e.uploadSize,onShouldRetry:e.onShouldRetry}),()=>{l.current?.cleanup()}),[t,r,e]),{state:s,upload:n(async e=>{u.current=e,await l.current?.upload(e)},[]),abort:n(()=>{l.current?.abort()},[]),reset:n(()=>{l.current?.reset(),u.current=null},[]),retry:n(()=>{u.current&&l.current?.canRetry()&&l.current.retry()},[]),isUploading:s.status===`uploading`,canRetry:l.current?.canRetry()??!1,metrics:{getInsights:()=>t.getChunkingInsights(),exportMetrics:()=>t.exportMetrics(),getNetworkMetrics:()=>t.getNetworkMetrics(),getNetworkCondition:()=>t.getNetworkCondition(),resetMetrics:()=>t.resetMetrics()}}}function C(e){let{fileSystemProvider:t}=x(),r=S({metadata:e?.metadata,onSuccess:e?.onSuccess,onError:e?.onError,onProgress:e?.onProgress}),i=n(async()=>{try{let n=await t.pickCamera(e?.cameraOptions);await r.upload(n)}catch(e){console.error(`Camera capture error:`,e)}},[t,e?.cameraOptions,r]);return{...r,captureAndUpload:i}}function w(e){let{fileSystemProvider:t}=x(),r=S({metadata:e?.metadata,onSuccess:e?.onSuccess,onError:e?.onError,onProgress:e?.onProgress}),i=n(async()=>{try{let n=await t.pickDocument({allowedTypes:e?.allowedTypes});await r.upload(n)}catch(e){throw console.error(`File selection error:`,e),e}},[t,e?.allowedTypes,r]);return{...r,pickAndUpload:i}}function te(e){let t=e;return t.eventType===h.FlowStart||t.eventType===h.FlowEnd||t.eventType===h.FlowError||t.eventType===h.NodeStart||t.eventType===h.NodeEnd||t.eventType===h.NodePause||t.eventType===h.NodeResume||t.eventType===h.NodeError}const T=t(void 0);function E({children:e}){let{client:t,subscribeToEvents:r}=x(),o=a(new Map);i(()=>r(e=>{if(te(e)){for(let t of o.current.values())t.manager.handleFlowEvent(e);return}if(`type`in e&&e.type===g.UPLOAD_PROGRESS&&`data`in e)for(let t of o.current.values())t.manager.handleUploadProgress(e.data.id,e.data.progress,e.data.total)}),[r]);let s=n((e,n,r)=>{let i=o.current.get(e);if(i)return i.refCount++,i.manager;let a=new p(t.uploadWithFlow,n,r,t.multiInputFlowUpload);return o.current.set(e,{manager:a,refCount:1,flowId:e}),a},[t]),c=n(e=>{let t=o.current.get(e);t&&(t.refCount--,t.refCount<=0&&(t.manager.cleanup(),o.current.delete(e)))},[]);return _(T.Provider,{value:{getManager:s,releaseManager:c},children:e})}function D(){let e=r(T);if(e===void 0)throw Error(`useFlowManagerContext must be used within a FlowManagerProvider. Make sure to wrap your component tree with <FlowManagerProvider>.`);return e}const ne={status:`idle`,progress:0,bytesUploaded:0,totalBytes:null,error:null,jobId:null,flowStarted:!1,currentNodeName:null,currentNodeType:null,flowOutputs:null};function re(e){let{getManager:t,releaseManager:r}=D(),{fileSystemProvider:s}=x(),[c,l]=o(ne),u=a(null),d=a(null),f=a(e);i(()=>{f.current=e}),i(()=>{let n=e.flowId;return u.current=t(n,{onStateChange:l,onProgress:(e,t,n)=>{if(f.current.onProgress){let e=n?Math.round(t/n*100):0;f.current.onProgress(e,t,n)}},onChunkComplete:(e,t,n)=>{f.current.onChunkComplete?.(e,t,n)},onFlowComplete:e=>{f.current.onFlowComplete?.(e)},onSuccess:e=>{f.current.onSuccess?.(e)},onError:e=>{f.current.onError?.(e)},onAbort:()=>{}},{flowConfig:{flowId:e.flowId,storageId:e.storageId,outputNodeId:e.outputNodeId,metadata:e.metadata},onChunkComplete:e.onChunkComplete,onSuccess:e.onSuccess,onError:e.onError}),()=>{r(n),u.current=null}},[e.flowId,e.storageId,e.outputNodeId,t,r]);let p=n(async t=>{if(t.status!==`cancelled`){if(t.status===`error`){e.onError?.(t.error);return}d.current=t;try{let e=b(await s.readFile(t.data.uri),{type:t.data.mimeType||`application/octet-stream`});await u.current?.upload(e)}catch(t){e.onError?.(t)}}},[s,e]),m=n(()=>{u.current?.reset(),d.current=null},[]);return{state:c,upload:p,abort:n(()=>{u.current?.abort()},[]),reset:m,retry:n(()=>{d.current&&(c.status===`error`||c.status===`aborted`)&&p(d.current)},[p,c.status]),isActive:c.status===`uploading`||c.status===`processing`,canRetry:(c.status===`error`||c.status===`aborted`)&&d.current!==null}}const O={items:[],totalProgress:0,totalUploaded:0,totalBytes:0,activeCount:0,completedCount:0,failedCount:0};function k(e={}){let{client:t}=x(),[r,i]=o(O),s=a(new Map),c=a(0),l=a([]),u=n(()=>`upload-${Date.now()}-${c.current++}`,[]),d=n(e=>{let t=e.reduce((e,t)=>e+t.totalBytes,0),n=e.reduce((e,t)=>e+t.bytesUploaded,0),r=t>0?Math.round(n/t*100):0,a=e.filter(e=>e.status===`uploading`).length,o=e.filter(e=>e.status===`success`).length,s=e.filter(e=>e.status===`error`).length;l.current=e,i(i=>({...i,items:e,totalProgress:r,totalUploaded:n,totalBytes:t,activeCount:a,completedCount:o,failedCount:s}))},[]),f=n(e=>{let t=e.filter(e=>e.status===`success`).map(e=>({id:u(),file:e,status:`idle`,progress:0,bytesUploaded:0,totalBytes:e.data.size,error:null,result:null})),n=[...l.current,...t];return l.current=n,i(e=>{let t=n.reduce((e,t)=>e+t.totalBytes,0);return{...e,items:n,totalBytes:t}}),t.map(e=>e.id)},[u]),p=n(async n=>{try{console.log(`Uploading item:`,n.file.data.name),d(l.current.map(e=>e.id===n.id?{...e,status:`uploading`}:e));let r=await(await fetch(n.file.data.uri)).blob(),i=n.file.data.mimeType?new Blob([r],{type:n.file.data.mimeType,lastModified:Date.now()}):r;console.log(`Uploading input:`,i);let a=await t.upload(i,{metadata:e.metadata,onProgress:(e,t,r)=>{let i=r?Math.round(t/r*100):0;d(l.current.map(e=>e.id===n.id?{...e,progress:i,bytesUploaded:t,totalBytes:r||e.totalBytes}:e))},onSuccess:t=>{d(l.current.map(e=>e.id===n.id?{...e,status:`success`,progress:100,result:t,bytesUploaded:t.size||e.totalBytes}:e)),e.onSuccess?.(t),s.current.delete(n.id)},onError:t=>{d(l.current.map(e=>e.id===n.id?{...e,status:`error`,error:t}:e)),e.onError?.(t),s.current.delete(n.id)}});s.current.set(n.id,a)}catch(t){console.error(`Error uploading item:`,t),d(l.current.map(e=>e.id===n.id?{...e,status:`error`,error:t}:e)),e.onError?.(t),s.current.delete(n.id)}},[t,e,d]),m=n(async t=>{let n=e.maxConcurrent||3,r=t?l.current.filter(e=>t.includes(e.id)&&e.status===`idle`):l.current.filter(e=>e.status===`idle`);console.log(`Items to upload:`,r.length,r);for(let e=0;e<r.length;e+=n){let t=r.slice(e,e+n);await Promise.all(t.map(e=>p(e)))}},[e.maxConcurrent,p]),h=n(e=>{let t=s.current.get(e);t&&(t.abort(),s.current.delete(e)),d(l.current.filter(t=>t.id!==e))},[d]),g=n(e=>{let t=s.current.get(e);t&&(t.abort(),s.current.delete(e)),d(l.current.map(t=>t.id===e?{...t,status:`aborted`}:t))},[d]),_=n(()=>{s.current.forEach(e=>{e.abort()}),s.current.clear(),l.current=[],i(O)},[]);return{state:r,addFiles:f,startUploads:m,removeItem:h,abortItem:g,retryItem:n(async e=>{let t=l.current.find(t=>t.id===e);if(t&&(t.status===`error`||t.status===`aborted`)){d(l.current.map(t=>t.id===e?{...t,status:`idle`,progress:0,bytesUploaded:0,error:null}:t));let t=l.current.find(t=>t.id===e);t&&await p(t)}},[p,d]),clear:_}}function A(e){let{fileSystemProvider:t}=x(),r=k({maxConcurrent:3,metadata:e?.metadata,onSuccess:e?.onSuccess,onError:e?.onError}),i=n(async()=>{let n;if(n=e?.mediaType===`video`?await t.pickVideo({allowMultiple:e?.allowMultiple??!0}):(e?.mediaType,await t.pickImage({allowMultiple:e?.allowMultiple??!0})),n.status===`cancelled`)return[];if(n.status===`error`)return console.error(`Gallery selection error:`,n.error),e?.onError?.(n.error),[];let i=r.addFiles([n]);return await r.startUploads(i),i},[t,e?.allowMultiple,e?.mediaType,e?.onError,r]);return{...r,selectAndUpload:i}}function ie(){let e=a(null),t=a(0),r=a(0),[i,s]=o({totalBytes:0,durationMs:0,avgSpeed:0,peakSpeed:0,retries:0});return{metrics:i,start:n(()=>{e.current=Date.now(),t.current=0,r.current=0},[]),update:n((t,n,i=0)=>{if(!e.current)return;let a=Date.now()-e.current,o=a>0?t/a*1e3:0;o>r.current&&(r.current=o),s({totalBytes:t,durationMs:a,avgSpeed:a>0?t/a*1e3:0,peakSpeed:r.current,retries:i})},[]),end:n(()=>{let t=i;return e.current=null,t},[i]),reset:n(()=>{e.current=null,t.current=0,r.current=0,s({totalBytes:0,durationMs:0,avgSpeed:0,peakSpeed:0,retries:0})},[])}}function j(e){if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${Math.round(e/t**r*100)/100} ${n[r]}`}function M(e){return{".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".png":`image/png`,".gif":`image/gif`,".bmp":`image/bmp`,".webp":`image/webp`,".svg":`image/svg+xml`,".mp4":`video/mp4`,".avi":`video/x-msvideo`,".mov":`video/quicktime`,".wmv":`video/x-ms-wmv`,".flv":`video/x-flv`,".mkv":`video/x-matroska`,".webm":`video/webm`,".mp3":`audio/mpeg`,".wav":`audio/wav`,".aac":`audio/aac`,".flac":`audio/flac`,".m4a":`audio/mp4`,".pdf":`application/pdf`,".doc":`application/msword`,".docx":`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,".xls":`application/vnd.ms-excel`,".xlsx":`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,".ppt":`application/vnd.ms-powerpoint`,".pptx":`application/vnd.openxmlformats-officedocument.presentationml.presentation`,".txt":`text/plain`,".csv":`text/csv`,".json":`application/json`,".xml":`application/xml`,".zip":`application/zip`}[e.toLowerCase().slice(e.lastIndexOf(`.`))]||`application/octet-stream`}function N(e,t){if(!t||t.length===0)return!0;let n=M(e);return t.some(e=>{if(e.endsWith(`/*`)){let[t]=e.split(`/`);return n.startsWith(`${t}/`)}return e===n})}function P(e,t,n){return!(t!==void 0&&e>t||n!==void 0&&e<n)}function F(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function ae(e){let t=e.lastIndexOf(`.`);return t===-1?e:e.slice(0,t)}function oe(e){let t=[`.jpg`,`.jpeg`,`.png`,`.gif`,`.bmp`,`.webp`,`.svg`],n=e.toLowerCase().slice(e.lastIndexOf(`.`));return t.includes(n)}function se(e){let t=[`.mp4`,`.avi`,`.mov`,`.wmv`,`.flv`,`.mkv`,`.webm`],n=e.toLowerCase().slice(e.lastIndexOf(`.`));return t.includes(n)}function ce(e){let t=[`.pdf`,`.doc`,`.docx`,`.xls`,`.xlsx`,`.ppt`,`.pptx`,`.txt`,`.csv`],n=e.toLowerCase().slice(e.lastIndexOf(`.`));return t.includes(n)}let I=function(e){return e.CAMERA=`CAMERA`,e.PHOTO_LIBRARY=`PHOTO_LIBRARY`,e.WRITE_STORAGE=`WRITE_STORAGE`,e.READ_STORAGE=`READ_STORAGE`,e}({}),L=function(e){return e.GRANTED=`granted`,e.DENIED=`denied`,e.NOT_DETERMINED=`not_determined`,e.RESTRICTED=`restricted`,e}({});async function R(){try{return console.log(`Camera permission requested (handled by file system provider)`),!0}catch(e){return console.error(`Failed to request camera permission:`,e),!1}}async function z(){try{return console.log(`Photo library permission requested (handled by file system provider)`),!0}catch(e){return console.error(`Failed to request photo library permission:`,e),!1}}async function B(){try{return console.log(`Storage read permission requested (handled by file system provider)`),!0}catch(e){return console.error(`Failed to request storage read permission:`,e),!1}}async function V(){try{return console.log(`Storage write permission requested (handled by file system provider)`),!0}catch(e){return console.error(`Failed to request storage write permission:`,e),!1}}async function H(e){try{return(await Promise.all(e.map(async e=>{switch(e){case I.CAMERA:return R();case I.PHOTO_LIBRARY:return z();case I.READ_STORAGE:return B();case I.WRITE_STORAGE:return V();default:return!1}}))).every(e=>e)}catch(e){return console.error(`Failed to request permissions:`,e),!1}}async function U(e){try{return!0}catch(e){return console.error(`Failed to check permissions:`,e),!1}}async function W(e){try{return L.GRANTED}catch(e){return console.error(`Failed to get permission status:`,e),L.DENIED}}function le(){try{console.log(`Opening app settings (requires react-native-app-settings or platform implementation)`)}catch(e){console.error(`Failed to open app settings:`,e)}}function G(e){try{if(e.startsWith(`file://`))return e.replace(`file://`,``).split(`/`).pop()||`file`;if(e.startsWith(`content://`)){let t=e.split(`/`);return t[t.length-1]||`file`}let t=e.split(`/`);return t[t.length-1]||`file`}catch{return`file`}}function ue(e){return e.startsWith(`file://`)||e.startsWith(`content://`)?e:`file://${e}`}function K(e){return e.startsWith(`file://`)?e.replace(`file://`,``):(e.startsWith(`content://`),e)}function de(e){try{let t=K(e).split(`/`);return t.pop(),t.join(`/`)}catch{return``}}function fe(e){return e.startsWith(`content://`)}function pe(e){return e.startsWith(`file://`)}function me(e){return e.replace(/([^:]\/)\/+/g,`$1`)}function he(e){let t=G(e);return{".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".png":`image/png`,".gif":`image/gif`,".bmp":`image/bmp`,".webp":`image/webp`,".mp4":`video/mp4`,".mov":`video/quicktime`,".avi":`video/x-msvideo`,".mp3":`audio/mpeg`,".wav":`audio/wav`,".aac":`audio/aac`,".pdf":`application/pdf`,".txt":`text/plain`,".json":`application/json`}[t.toLowerCase().slice(t.lastIndexOf(`.`))]||`application/octet-stream`}function q({state:e,label:t}){let n=()=>{switch(e.status){case`uploading`:return`#007AFF`;case`success`:return`#34C759`;case`error`:case`aborted`:return`#FF3B30`;default:return`#999999`}};return v(f,{style:[J.wrapper,{borderLeftColor:n()}],children:[e.status===`uploading`&&_(s,{size:`small`,color:n(),style:J.spinner}),(()=>{switch(e.status){case`idle`:return _(f,{style:J.container,children:_(d,{style:J.label,children:t||`Ready to upload`})});case`uploading`:return v(f,{style:J.container,children:[v(f,{style:J.headerRow,children:[_(d,{style:J.label,children:t||`Uploading`}),v(d,{style:J.percentage,children:[e.progress,`%`]})]}),_(f,{style:J.progressBarContainer,children:_(f,{style:[J.progressBar,{width:`${e.progress}%`,backgroundColor:n()}]})}),_(f,{style:J.detailsRow,children:v(d,{style:J.detail,children:[j(e.bytesUploaded),` /`,` `,j(e.totalBytes||0)]})})]});case`success`:return v(f,{style:J.container,children:[v(f,{style:J.headerRow,children:[_(d,{style:[J.label,{color:n()}],children:t||`Upload complete`}),_(d,{style:[J.percentage,{color:n()}],children:`✓`})]}),_(d,{style:[J.detail,{color:n()}],children:j(e.totalBytes||0)})]});case`error`:return v(f,{style:J.container,children:[v(f,{style:J.headerRow,children:[_(d,{style:[J.label,{color:n()}],children:t||`Upload failed`}),_(d,{style:[J.percentage,{color:n()}],children:`✕`})]}),e.error&&_(d,{style:[J.detail,{color:n()}],children:e.error.message})]});case`aborted`:return _(f,{style:J.container,children:_(d,{style:[J.label,{color:n()}],children:t||`Upload cancelled`})});default:return null}})()]})}const J=u.create({wrapper:{flexDirection:`row`,alignItems:`flex-start`,paddingVertical:8,paddingHorizontal:12,borderLeftWidth:4,backgroundColor:`#f5f5f5`,borderRadius:4,gap:8},spinner:{marginTop:4},container:{flex:1,gap:4},headerRow:{flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`},label:{fontSize:14,fontWeight:`600`,color:`#333333`,flex:1},percentage:{fontSize:14,fontWeight:`600`,color:`#007AFF`,minWidth:36,textAlign:`right`},progressBarContainer:{height:4,backgroundColor:`#e0e0e0`,borderRadius:2,overflow:`hidden`},progressBar:{height:`100%`,borderRadius:2},detailsRow:{flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`},detail:{fontSize:12,color:`#666666`}});function ge({options:e,label:t=`Take Photo`,children:n,onSuccess:r,onError:a,onCancel:o,showProgress:c=!0}){let{state:u,captureAndUpload:p}=C(e),m=async()=>{try{await p()}catch(e){e instanceof Error&&(e.message.includes(`cancelled`)||e.message.includes(`aborted`)?o?.():a?.(e))}},h=u.status===`uploading`,g=h||u.status===`aborted`;return i(()=>{u.status===`success`&&u.result&&r?.(u.result)},[u.status,u.result,r]),i(()=>{u.status===`error`&&u.error&&a?.(u.error)},[u.status,u.error,a]),v(f,{style:Y.container,children:[v(l,{style:[Y.button,g&&Y.buttonDisabled],onPress:m,disabled:g,children:[h&&_(s,{size:`small`,color:`#FFFFFF`,style:Y.spinner}),_(d,{style:Y.buttonText,children:n||t})]}),c&&u.status!==`idle`&&_(f,{style:Y.progressContainer,children:_(q,{state:u,label:`Camera upload`})})]})}const Y=u.create({container:{gap:8},button:{flexDirection:`row`,alignItems:`center`,justifyContent:`center`,paddingVertical:12,paddingHorizontal:16,backgroundColor:`#007AFF`,borderRadius:8,gap:8},buttonDisabled:{opacity:.6},buttonText:{fontSize:16,fontWeight:`600`,color:`#FFFFFF`},spinner:{marginRight:4},progressContainer:{marginTop:4}});function _e({options:e,label:t=`Choose File`,children:n,onSuccess:r,onError:a,onCancel:o,showProgress:c=!0}){let{state:u,pickAndUpload:p}=w(e),m=async()=>{try{await p()}catch(e){e instanceof Error&&(e.message.includes(`cancelled`)||e.message.includes(`aborted`)?o?.():a?.(e))}},h=u.status===`uploading`,g=h||u.status===`aborted`;return i(()=>{u.status===`success`&&u.result&&r?.(u.result)},[u.status,u.result,r]),i(()=>{u.status===`error`&&u.error&&a?.(u.error)},[u.status,u.error,a]),v(f,{style:X.container,children:[v(l,{style:[X.button,g&&X.buttonDisabled],onPress:m,disabled:g,children:[h&&_(s,{size:`small`,color:`#FFFFFF`,style:X.spinner}),_(d,{style:X.buttonText,children:n||t})]}),c&&u.status!==`idle`&&_(f,{style:X.progressContainer,children:_(q,{state:u,label:`File upload`})})]})}const X=u.create({container:{gap:8},button:{flexDirection:`row`,alignItems:`center`,justifyContent:`center`,paddingVertical:12,paddingHorizontal:16,backgroundColor:`#FF9500`,borderRadius:8,gap:8},buttonDisabled:{opacity:.6},buttonText:{fontSize:16,fontWeight:`600`,color:`#FFFFFF`},spinner:{marginRight:4},progressContainer:{marginTop:4}});function Z({options:t,label:n=`Select from Gallery`,children:r,onSuccess:i,onError:a,onCancel:o,showProgress:u=!0}){let{state:p,selectAndUpload:m}=A(t),h=async()=>{try{await m()}catch(e){e instanceof Error&&(e.message.includes(`cancelled`)||e.message.includes(`aborted`)?o?.():a?.(e))}},g=p.items.some(e=>e.status===`uploading`),y=p.items.length>0,b=y&&p.items.every(e=>e.status!==`uploading`&&e.status!==`idle`);return e.useEffect(()=>{if(b){let e=p.items.filter(e=>e.status===`success`).map(e=>e.result);e.length>0&&i?.(e)}},[b,p.items,i]),e.useEffect(()=>{let e=p.items.filter(e=>e.status===`error`)[0]?.error;e&&a?.(e)},[p.items,a]),v(f,{style:Q.container,children:[v(l,{style:[Q.button,g&&Q.buttonDisabled],onPress:h,disabled:g,children:[g&&_(s,{size:`small`,color:`#FFFFFF`,style:Q.spinner}),v(d,{style:Q.buttonText,children:[r||n,y&&` (${p.items.length})`]})]}),y&&v(f,{style:Q.statsContainer,children:[v(d,{style:Q.statsText,children:[`Progress: `,p.items.filter(e=>e.status===`success`).length,`/`,p.items.length,` uploaded`]}),v(d,{style:Q.statsText,children:[`Overall: `,p.totalProgress,`%`]})]}),u&&y&&_(c,{scrollEnabled:!1,data:p.items,renderItem:({item:e})=>_(f,{style:Q.itemContainer,children:_(q,{state:{status:e.status,progress:e.progress,bytesUploaded:e.bytesUploaded,totalBytes:e.totalBytes,error:e.error,result:e.result},label:e.file.data.name})},e.id),keyExtractor:e=>e.id,style:Q.listContainer,contentContainerStyle:Q.listContent,ItemSeparatorComponent:()=>_(f,{style:Q.separator})})]})}const Q=u.create({container:{gap:8},button:{flexDirection:`row`,alignItems:`center`,justifyContent:`center`,paddingVertical:12,paddingHorizontal:16,backgroundColor:`#34C759`,borderRadius:8,gap:8},buttonDisabled:{opacity:.6},buttonText:{fontSize:16,fontWeight:`600`,color:`#FFFFFF`},spinner:{marginRight:4},statsContainer:{paddingVertical:8,paddingHorizontal:12,backgroundColor:`#f5f5f5`,borderRadius:4,gap:4},statsText:{fontSize:12,color:`#666666`},listContainer:{maxHeight:400},listContent:{gap:8},itemContainer:{paddingHorizontal:0},separator:{height:4}});function ve({items:e,onRemove:t,onItemPress:n,showRemoveButton:r=!0}){return e.length===0?_(f,{style:$.emptyContainer,children:_(d,{style:$.emptyText,children:`No uploads`})}):v(f,{style:$.container,children:[v(f,{style:$.headerRow,children:[v(d,{style:$.headerText,children:[`Uploads (`,e.length,`)`]}),v(d,{style:$.headerSubtext,children:[e.filter(e=>e.progress.state===`success`).length,` complete`]})]}),_(c,{scrollEnabled:!1,data:e,renderItem:({item:e})=>v(l,{style:[$.itemContainer,{borderLeftColor:ye(e.progress.state)}],onPress:()=>n?.(e),children:[v(f,{style:$.itemContent,children:[e.file.status===`success`&&v(f,{style:$.itemHeader,children:[_(d,{style:$.fileName,numberOfLines:1,children:e.file.data.name}),_(d,{style:$.fileSize,children:be(e.file.data.size)})]}),e.file.status===`error`&&_(d,{style:$.errorText,children:e.progress.error?.message}),_(f,{style:$.progressWrapper,children:_(q,{state:{status:e.progress.state===`pending`?`idle`:e.progress.state===`cancelled`?`aborted`:e.progress.state,progress:e.progress.progress,bytesUploaded:e.progress.uploadedBytes,totalBytes:e.progress.totalBytes,error:e.progress.error||null,result:e.result??null}})})]}),r&&e.progress.state!==`uploading`&&e.progress.state!==`pending`&&_(l,{style:$.removeButton,onPress:()=>t?.(e.id),hitSlop:{top:8,right:8,bottom:8,left:8},children:_(d,{style:$.removeButtonText,children:`✕`})})]}),keyExtractor:e=>e.id,ItemSeparatorComponent:()=>_(f,{style:$.separator}),contentContainerStyle:$.listContent})]})}function ye(e){switch(e){case`success`:return`#34C759`;case`error`:case`cancelled`:return`#FF3B30`;case`uploading`:case`pending`:return`#007AFF`;default:return`#999999`}}function be(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${Math.round(e/t**r*10)/10} ${n[r]}`}const $=u.create({container:{gap:8},headerRow:{flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,paddingHorizontal:12,paddingVertical:8,backgroundColor:`#f9f9f9`,borderRadius:4},headerText:{fontSize:16,fontWeight:`600`,color:`#333333`},errorText:{fontSize:14,color:`#FF3B30`},headerSubtext:{fontSize:14,color:`#666666`},listContent:{gap:8},itemContainer:{flexDirection:`row`,alignItems:`center`,paddingVertical:8,paddingHorizontal:12,borderLeftWidth:4,backgroundColor:`#f5f5f5`,borderRadius:4,gap:8},itemContent:{flex:1,gap:6},itemHeader:{flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`},fileName:{fontSize:14,fontWeight:`500`,color:`#333333`,flex:1},fileSize:{fontSize:12,color:`#999999`,marginLeft:8},progressWrapper:{marginTop:2},removeButton:{width:32,height:32,justifyContent:`center`,alignItems:`center`,borderRadius:16,backgroundColor:`#FFE5E5`},removeButtonText:{fontSize:16,fontWeight:`600`,color:`#FF3B30`},separator:{height:4},emptyContainer:{paddingVertical:24,paddingHorizontal:12,backgroundColor:`#f5f5f5`,borderRadius:4,alignItems:`center`,justifyContent:`center`},emptyText:{fontSize:14,color:`#999999`,fontStyle:`italic`}});export{ge as CameraUploadButton,_e as FileUploadButton,E as FlowManagerProvider,Z as GalleryUploadButton,L as PermissionStatus,I as PermissionType,ve as UploadList,q as UploadProgress,y as UploadistaContext,j as formatFileSize,de as getDirectoryFromUri,F as getFileExtension,G as getFileNameFromUri,ae as getFileNameWithoutExtension,M as getMimeTypeFromFileName,he as getMimeTypeFromUri,W as getPermissionStatus,U as hasPermissions,fe as isContentUri,ce as isDocumentFile,P as isFileSizeValid,N as isFileTypeAllowed,pe as isFileUri,oe as isImageFile,se as isVideoFile,me as normalizeUri,le as openAppSettings,ue as pathToUri,R as requestCameraPermission,H as requestPermissions,z as requestPhotoLibraryPermission,B as requestStorageReadPermission,V as requestStorageWritePermission,K as uriToPath,C as useCameraUpload,w as useFileUpload,D as useFlowManagerContext,re as useFlowUpload,A as useGalleryUpload,k as useMultiUpload,ie as useUploadMetrics,x as useUploadistaContext};
1
+ import e,{createContext as t,useCallback as n,useContext as r,useEffect as i,useRef as a,useState as o}from"react";import{ActivityIndicator as s,FlatList as c,Pressable as l,StyleSheet as u,Text as d,View as f}from"react-native";import{FlowManager as p,UploadManager as m}from"@uploadista/client-core";import{EventType as h}from"@uploadista/core/flow";import{UploadEventType as g}from"@uploadista/core/types";import{jsx as _,jsxs as v}from"react/jsx-runtime";const y=t(void 0);function b(e,t){let n=e instanceof ArrayBuffer?new Uint8Array(e):e;return new Blob([n],t)}function x(){let e=r(y);if(!e)throw Error(`useUploadistaClient must be used within an UploadistaProvider`);return e}const S={status:`idle`,progress:0,bytesUploaded:0,totalBytes:null,error:null,result:null};function C(e={}){let{client:t,fileSystemProvider:r}=x(),[s,c]=o(S),l=a(null),u=a(null);return i(()=>(l.current=new m(async(e,n)=>{let i=e;if(i.status===`success`){let e=b(await r.readFile(i.data.uri),{type:i.data.mimeType||`application/octet-stream`});return t.upload(e,n)}return Promise.resolve({abort:()=>{}})},{onStateChange:c,onProgress:e.onProgress,onChunkComplete:e.onChunkComplete,onSuccess:e.onSuccess,onError:e.onError,onAbort:e.onAbort},{metadata:e.metadata,uploadLengthDeferred:e.uploadLengthDeferred,uploadSize:e.uploadSize,onShouldRetry:e.onShouldRetry}),()=>{l.current?.cleanup()}),[t,r,e]),{state:s,upload:n(async e=>{u.current=e,await l.current?.upload(e)},[]),abort:n(()=>{l.current?.abort()},[]),reset:n(()=>{l.current?.reset(),u.current=null},[]),retry:n(()=>{u.current&&l.current?.canRetry()&&l.current.retry()},[]),isUploading:s.status===`uploading`,canRetry:l.current?.canRetry()??!1,metrics:{getInsights:()=>t.getChunkingInsights(),exportMetrics:()=>t.exportMetrics(),getNetworkMetrics:()=>t.getNetworkMetrics(),getNetworkCondition:()=>t.getNetworkCondition(),resetMetrics:()=>t.resetMetrics()}}}function w(e){let{fileSystemProvider:t}=x(),r=C({metadata:e?.metadata,onSuccess:e?.onSuccess,onError:e?.onError,onProgress:e?.onProgress}),i=n(async()=>{try{let n=await t.pickCamera(e?.cameraOptions);await r.upload(n)}catch(e){console.error(`Camera capture error:`,e)}},[t,e?.cameraOptions,r]);return{...r,captureAndUpload:i}}function T(e){let{fileSystemProvider:t}=x(),r=C({metadata:e?.metadata,onSuccess:e?.onSuccess,onError:e?.onError,onProgress:e?.onProgress}),i=n(async()=>{try{let n=await t.pickDocument({allowedTypes:e?.allowedTypes});await r.upload(n)}catch(e){throw console.error(`File selection error:`,e),e}},[t,e?.allowedTypes,r]);return{...r,pickAndUpload:i}}function E(e){let t=e;return t.eventType===h.FlowStart||t.eventType===h.FlowEnd||t.eventType===h.FlowError||t.eventType===h.NodeStart||t.eventType===h.NodeEnd||t.eventType===h.NodePause||t.eventType===h.NodeResume||t.eventType===h.NodeError}const D=t(void 0);function ee({children:e}){let{client:t,subscribeToEvents:r}=x(),o=a(new Map);i(()=>r(e=>{if(E(e)){for(let t of o.current.values())t.manager.handleFlowEvent(e);return}if(`type`in e&&e.type===g.UPLOAD_PROGRESS&&`data`in e)for(let t of o.current.values())t.manager.handleUploadProgress(e.data.id,e.data.progress,e.data.total)}),[r]);let s=n((e,n,r)=>{let i=o.current.get(e);if(i)return i.refCount++,i.manager;let a=new p(t.uploadWithFlow,n,r,t.multiInputFlowUpload);return o.current.set(e,{manager:a,refCount:1,flowId:e}),a},[t]),c=n(e=>{let t=o.current.get(e);t&&(t.refCount--,t.refCount<=0&&(t.manager.cleanup(),o.current.delete(e)))},[]);return _(D.Provider,{value:{getManager:s,releaseManager:c},children:e})}function O(){let e=r(D);if(e===void 0)throw Error(`useFlowManagerContext must be used within a FlowManagerProvider. Make sure to wrap your component tree with <FlowManagerProvider>.`);return e}const k={status:`idle`,progress:0,bytesUploaded:0,totalBytes:null,error:null,jobId:null,flowStarted:!1,currentNodeName:null,currentNodeType:null,flowOutputs:null};function te(e){let{client:t,fileSystemProvider:r}=x(),{getManager:s,releaseManager:c}=O(),[l,u]=o(k),[d,f]=o(null),[p,m]=o(!1),[h,g]=o({}),[_,v]=o(new Map),y=a(null),S=a(null),C=a(e);i(()=>{C.current=e}),i(()=>{(async()=>{m(!0);try{let{flow:n}=await t.getFlow(e.flowId);f(n.nodes.filter(e=>e.type===`input`).map(e=>({nodeId:e.id,nodeName:e.name,nodeDescription:e.description,inputTypeId:e.inputTypeId,required:!0})))}catch(e){console.error(`Failed to discover flow inputs:`,e)}finally{m(!1)}})()},[t,e.flowId]),i(()=>{let t=e.flowId;y.current=s(t,{onStateChange:e=>{u(e)},onProgress:(e,t,n)=>{if(C.current.onProgress){let e=n?Math.round(t/n*100):0;C.current.onProgress(e,t,n)}},onChunkComplete:(e,t,n)=>{C.current.onChunkComplete?.(e,t,n)},onFlowComplete:e=>{C.current.onFlowComplete?.(e)},onSuccess:e=>{C.current.onSuccess?.(e)},onError:e=>{C.current.onError?.(e)},onAbort:()=>{}},{flowConfig:{flowId:e.flowId,storageId:e.storageId,outputNodeId:e.outputNodeId,metadata:e.metadata},onChunkComplete:e.onChunkComplete,onSuccess:e.onSuccess,onError:e.onError});let n=setInterval(()=>{if(y.current){let e=y.current.getInputStates();e.size>0&&v(new Map(e))}},100);return()=>{clearInterval(n),c(t),y.current=null}},[e.flowId,e.storageId,e.outputNodeId,s,c]);let w=n((e,t)=>{g(n=>({...n,[e]:t}))},[]),T=n(async e=>{if(e.status===`cancelled`)return null;if(e.status===`error`)throw e.error;return b(await r.readFile(e.data.uri),{type:e.data.mimeType||`application/octet-stream`})},[r]),E=n(async()=>{if(!y.current)throw Error(`FlowManager not initialized`);if(Object.keys(h).length===0)throw Error(`No inputs provided. Use setInput() to provide inputs before calling execute()`);S.current={...h};let e={};for(let[t,n]of Object.entries(h))if(n&&typeof n==`object`&&`status`in n&&(n.status===`success`||n.status===`cancelled`||n.status===`error`)){let r=await T(n);r&&(e[t]=r)}else e[t]=n;if(Object.keys(e).length===0)throw Error(`No valid inputs after processing. All files may have been cancelled.`);await y.current.executeFlow(e)},[h,T]);return{state:l,inputMetadata:d,inputStates:_,inputs:h,setInput:w,execute:E,upload:n(async t=>{if(t.status!==`cancelled`){if(t.status===`error`){e.onError?.(t.error);return}if(!y.current)throw Error(`FlowManager not initialized`);if(d&&d.length>0){let e=d[0];e&&(S.current={[e.nodeId]:t})}try{let e=b(await r.readFile(t.data.uri),{type:t.data.mimeType||`application/octet-stream`});if(d&&d.length>0){let n=d[0];if(!n)throw Error(`No input nodes found`);g({[n.nodeId]:t}),await y.current.executeFlow({[n.nodeId]:e})}else await y.current.upload(e)}catch(t){e.onError?.(t)}}},[d,r,e]),abort:n(()=>{y.current?.abort()},[]),reset:n(()=>{y.current?.reset(),g({}),v(new Map),S.current=null},[]),retry:n(()=>{S.current&&(l.status===`error`||l.status===`aborted`)&&(g(S.current),E())},[E,l.status]),isActive:l.status===`uploading`||l.status===`processing`,isUploadingFile:l.status===`uploading`,isProcessing:l.status===`processing`,isDiscoveringInputs:p,canRetry:(l.status===`error`||l.status===`aborted`)&&S.current!==null}}const A={items:[],totalProgress:0,totalUploaded:0,totalBytes:0,activeCount:0,completedCount:0,failedCount:0};function j(e={}){let{client:t}=x(),[r,i]=o(A),s=a(new Map),c=a(0),l=a([]),u=n(()=>`upload-${Date.now()}-${c.current++}`,[]),d=n(e=>{let t=e.reduce((e,t)=>e+t.totalBytes,0),n=e.reduce((e,t)=>e+t.bytesUploaded,0),r=t>0?Math.round(n/t*100):0,a=e.filter(e=>e.status===`uploading`).length,o=e.filter(e=>e.status===`success`).length,s=e.filter(e=>e.status===`error`).length;l.current=e,i(i=>({...i,items:e,totalProgress:r,totalUploaded:n,totalBytes:t,activeCount:a,completedCount:o,failedCount:s}))},[]),f=n(e=>{let t=e.filter(e=>e.status===`success`).map(e=>({id:u(),file:e,status:`idle`,progress:0,bytesUploaded:0,totalBytes:e.data.size,error:null,result:null})),n=[...l.current,...t];return l.current=n,i(e=>{let t=n.reduce((e,t)=>e+t.totalBytes,0);return{...e,items:n,totalBytes:t}}),t.map(e=>e.id)},[u]),p=n(async n=>{try{console.log(`Uploading item:`,n.file.data.name),d(l.current.map(e=>e.id===n.id?{...e,status:`uploading`}:e));let r=await(await fetch(n.file.data.uri)).blob(),i=n.file.data.mimeType?new Blob([r],{type:n.file.data.mimeType,lastModified:Date.now()}):r;console.log(`Uploading input:`,i);let a=await t.upload(i,{metadata:e.metadata,onProgress:(e,t,r)=>{let i=r?Math.round(t/r*100):0;d(l.current.map(e=>e.id===n.id?{...e,progress:i,bytesUploaded:t,totalBytes:r||e.totalBytes}:e))},onSuccess:t=>{d(l.current.map(e=>e.id===n.id?{...e,status:`success`,progress:100,result:t,bytesUploaded:t.size||e.totalBytes}:e)),e.onSuccess?.(t),s.current.delete(n.id)},onError:t=>{d(l.current.map(e=>e.id===n.id?{...e,status:`error`,error:t}:e)),e.onError?.(t),s.current.delete(n.id)}});s.current.set(n.id,a)}catch(t){console.error(`Error uploading item:`,t),d(l.current.map(e=>e.id===n.id?{...e,status:`error`,error:t}:e)),e.onError?.(t),s.current.delete(n.id)}},[t,e,d]),m=n(async t=>{let n=e.maxConcurrent||3,r=t?l.current.filter(e=>t.includes(e.id)&&e.status===`idle`):l.current.filter(e=>e.status===`idle`);console.log(`Items to upload:`,r.length,r);for(let e=0;e<r.length;e+=n){let t=r.slice(e,e+n);await Promise.all(t.map(e=>p(e)))}},[e.maxConcurrent,p]),h=n(e=>{let t=s.current.get(e);t&&(t.abort(),s.current.delete(e)),d(l.current.filter(t=>t.id!==e))},[d]),g=n(e=>{let t=s.current.get(e);t&&(t.abort(),s.current.delete(e)),d(l.current.map(t=>t.id===e?{...t,status:`aborted`}:t))},[d]),_=n(()=>{s.current.forEach(e=>{e.abort()}),s.current.clear(),l.current=[],i(A)},[]);return{state:r,addFiles:f,startUploads:m,removeItem:h,abortItem:g,retryItem:n(async e=>{let t=l.current.find(t=>t.id===e);if(t&&(t.status===`error`||t.status===`aborted`)){d(l.current.map(t=>t.id===e?{...t,status:`idle`,progress:0,bytesUploaded:0,error:null}:t));let t=l.current.find(t=>t.id===e);t&&await p(t)}},[p,d]),clear:_}}function M(e){let{fileSystemProvider:t}=x(),r=j({maxConcurrent:3,metadata:e?.metadata,onSuccess:e?.onSuccess,onError:e?.onError}),i=n(async()=>{let n;if(n=e?.mediaType===`video`?await t.pickVideo({allowMultiple:e?.allowMultiple??!0}):(e?.mediaType,await t.pickImage({allowMultiple:e?.allowMultiple??!0})),n.status===`cancelled`)return[];if(n.status===`error`)return console.error(`Gallery selection error:`,n.error),e?.onError?.(n.error),[];let i=r.addFiles([n]);return await r.startUploads(i),i},[t,e?.allowMultiple,e?.mediaType,e?.onError,r]);return{...r,selectAndUpload:i}}function ne(){let e=a(null),t=a(0),r=a(0),[i,s]=o({totalBytes:0,durationMs:0,avgSpeed:0,peakSpeed:0,retries:0});return{metrics:i,start:n(()=>{e.current=Date.now(),t.current=0,r.current=0},[]),update:n((t,n,i=0)=>{if(!e.current)return;let a=Date.now()-e.current,o=a>0?t/a*1e3:0;o>r.current&&(r.current=o),s({totalBytes:t,durationMs:a,avgSpeed:a>0?t/a*1e3:0,peakSpeed:r.current,retries:i})},[]),end:n(()=>{let t=i;return e.current=null,t},[i]),reset:n(()=>{e.current=null,t.current=0,r.current=0,s({totalBytes:0,durationMs:0,avgSpeed:0,peakSpeed:0,retries:0})},[])}}function N(e){if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${Math.round(e/t**r*100)/100} ${n[r]}`}function P(e){return{".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".png":`image/png`,".gif":`image/gif`,".bmp":`image/bmp`,".webp":`image/webp`,".svg":`image/svg+xml`,".mp4":`video/mp4`,".avi":`video/x-msvideo`,".mov":`video/quicktime`,".wmv":`video/x-ms-wmv`,".flv":`video/x-flv`,".mkv":`video/x-matroska`,".webm":`video/webm`,".mp3":`audio/mpeg`,".wav":`audio/wav`,".aac":`audio/aac`,".flac":`audio/flac`,".m4a":`audio/mp4`,".pdf":`application/pdf`,".doc":`application/msword`,".docx":`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,".xls":`application/vnd.ms-excel`,".xlsx":`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,".ppt":`application/vnd.ms-powerpoint`,".pptx":`application/vnd.openxmlformats-officedocument.presentationml.presentation`,".txt":`text/plain`,".csv":`text/csv`,".json":`application/json`,".xml":`application/xml`,".zip":`application/zip`}[e.toLowerCase().slice(e.lastIndexOf(`.`))]||`application/octet-stream`}function F(e,t){if(!t||t.length===0)return!0;let n=P(e);return t.some(e=>{if(e.endsWith(`/*`)){let[t]=e.split(`/`);return n.startsWith(`${t}/`)}return e===n})}function re(e,t,n){return!(t!==void 0&&e>t||n!==void 0&&e<n)}function ie(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()}function ae(e){let t=e.lastIndexOf(`.`);return t===-1?e:e.slice(0,t)}function oe(e){let t=[`.jpg`,`.jpeg`,`.png`,`.gif`,`.bmp`,`.webp`,`.svg`],n=e.toLowerCase().slice(e.lastIndexOf(`.`));return t.includes(n)}function se(e){let t=[`.mp4`,`.avi`,`.mov`,`.wmv`,`.flv`,`.mkv`,`.webm`],n=e.toLowerCase().slice(e.lastIndexOf(`.`));return t.includes(n)}function I(e){let t=[`.pdf`,`.doc`,`.docx`,`.xls`,`.xlsx`,`.ppt`,`.pptx`,`.txt`,`.csv`],n=e.toLowerCase().slice(e.lastIndexOf(`.`));return t.includes(n)}let L=function(e){return e.CAMERA=`CAMERA`,e.PHOTO_LIBRARY=`PHOTO_LIBRARY`,e.WRITE_STORAGE=`WRITE_STORAGE`,e.READ_STORAGE=`READ_STORAGE`,e}({}),R=function(e){return e.GRANTED=`granted`,e.DENIED=`denied`,e.NOT_DETERMINED=`not_determined`,e.RESTRICTED=`restricted`,e}({});async function z(){try{return console.log(`Camera permission requested (handled by file system provider)`),!0}catch(e){return console.error(`Failed to request camera permission:`,e),!1}}async function B(){try{return console.log(`Photo library permission requested (handled by file system provider)`),!0}catch(e){return console.error(`Failed to request photo library permission:`,e),!1}}async function V(){try{return console.log(`Storage read permission requested (handled by file system provider)`),!0}catch(e){return console.error(`Failed to request storage read permission:`,e),!1}}async function H(){try{return console.log(`Storage write permission requested (handled by file system provider)`),!0}catch(e){return console.error(`Failed to request storage write permission:`,e),!1}}async function U(e){try{return(await Promise.all(e.map(async e=>{switch(e){case L.CAMERA:return z();case L.PHOTO_LIBRARY:return B();case L.READ_STORAGE:return V();case L.WRITE_STORAGE:return H();default:return!1}}))).every(e=>e)}catch(e){return console.error(`Failed to request permissions:`,e),!1}}async function W(e){try{return!0}catch(e){return console.error(`Failed to check permissions:`,e),!1}}async function G(e){try{return R.GRANTED}catch(e){return console.error(`Failed to get permission status:`,e),R.DENIED}}function ce(){try{console.log(`Opening app settings (requires react-native-app-settings or platform implementation)`)}catch(e){console.error(`Failed to open app settings:`,e)}}function K(e){try{if(e.startsWith(`file://`))return e.replace(`file://`,``).split(`/`).pop()||`file`;if(e.startsWith(`content://`)){let t=e.split(`/`);return t[t.length-1]||`file`}let t=e.split(`/`);return t[t.length-1]||`file`}catch{return`file`}}function le(e){return e.startsWith(`file://`)||e.startsWith(`content://`)?e:`file://${e}`}function q(e){return e.startsWith(`file://`)?e.replace(`file://`,``):(e.startsWith(`content://`),e)}function ue(e){try{let t=q(e).split(`/`);return t.pop(),t.join(`/`)}catch{return``}}function de(e){return e.startsWith(`content://`)}function fe(e){return e.startsWith(`file://`)}function pe(e){return e.replace(/([^:]\/)\/+/g,`$1`)}function me(e){let t=K(e);return{".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".png":`image/png`,".gif":`image/gif`,".bmp":`image/bmp`,".webp":`image/webp`,".mp4":`video/mp4`,".mov":`video/quicktime`,".avi":`video/x-msvideo`,".mp3":`audio/mpeg`,".wav":`audio/wav`,".aac":`audio/aac`,".pdf":`application/pdf`,".txt":`text/plain`,".json":`application/json`}[t.toLowerCase().slice(t.lastIndexOf(`.`))]||`application/octet-stream`}function J({state:e,label:t}){let n=()=>{switch(e.status){case`uploading`:return`#007AFF`;case`success`:return`#34C759`;case`error`:case`aborted`:return`#FF3B30`;default:return`#999999`}};return v(f,{style:[Y.wrapper,{borderLeftColor:n()}],children:[e.status===`uploading`&&_(s,{size:`small`,color:n(),style:Y.spinner}),(()=>{switch(e.status){case`idle`:return _(f,{style:Y.container,children:_(d,{style:Y.label,children:t||`Ready to upload`})});case`uploading`:return v(f,{style:Y.container,children:[v(f,{style:Y.headerRow,children:[_(d,{style:Y.label,children:t||`Uploading`}),v(d,{style:Y.percentage,children:[e.progress,`%`]})]}),_(f,{style:Y.progressBarContainer,children:_(f,{style:[Y.progressBar,{width:`${e.progress}%`,backgroundColor:n()}]})}),_(f,{style:Y.detailsRow,children:v(d,{style:Y.detail,children:[N(e.bytesUploaded),` /`,` `,N(e.totalBytes||0)]})})]});case`success`:return v(f,{style:Y.container,children:[v(f,{style:Y.headerRow,children:[_(d,{style:[Y.label,{color:n()}],children:t||`Upload complete`}),_(d,{style:[Y.percentage,{color:n()}],children:`✓`})]}),_(d,{style:[Y.detail,{color:n()}],children:N(e.totalBytes||0)})]});case`error`:return v(f,{style:Y.container,children:[v(f,{style:Y.headerRow,children:[_(d,{style:[Y.label,{color:n()}],children:t||`Upload failed`}),_(d,{style:[Y.percentage,{color:n()}],children:`✕`})]}),e.error&&_(d,{style:[Y.detail,{color:n()}],children:e.error.message})]});case`aborted`:return _(f,{style:Y.container,children:_(d,{style:[Y.label,{color:n()}],children:t||`Upload cancelled`})});default:return null}})()]})}const Y=u.create({wrapper:{flexDirection:`row`,alignItems:`flex-start`,paddingVertical:8,paddingHorizontal:12,borderLeftWidth:4,backgroundColor:`#f5f5f5`,borderRadius:4,gap:8},spinner:{marginTop:4},container:{flex:1,gap:4},headerRow:{flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`},label:{fontSize:14,fontWeight:`600`,color:`#333333`,flex:1},percentage:{fontSize:14,fontWeight:`600`,color:`#007AFF`,minWidth:36,textAlign:`right`},progressBarContainer:{height:4,backgroundColor:`#e0e0e0`,borderRadius:2,overflow:`hidden`},progressBar:{height:`100%`,borderRadius:2},detailsRow:{flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`},detail:{fontSize:12,color:`#666666`}});function he({options:e,label:t=`Take Photo`,children:n,onSuccess:r,onError:a,onCancel:o,showProgress:c=!0}){let{state:u,captureAndUpload:p}=w(e),m=async()=>{try{await p()}catch(e){e instanceof Error&&(e.message.includes(`cancelled`)||e.message.includes(`aborted`)?o?.():a?.(e))}},h=u.status===`uploading`,g=h||u.status===`aborted`;return i(()=>{u.status===`success`&&u.result&&r?.(u.result)},[u.status,u.result,r]),i(()=>{u.status===`error`&&u.error&&a?.(u.error)},[u.status,u.error,a]),v(f,{style:X.container,children:[v(l,{style:[X.button,g&&X.buttonDisabled],onPress:m,disabled:g,children:[h&&_(s,{size:`small`,color:`#FFFFFF`,style:X.spinner}),_(d,{style:X.buttonText,children:n||t})]}),c&&u.status!==`idle`&&_(f,{style:X.progressContainer,children:_(J,{state:u,label:`Camera upload`})})]})}const X=u.create({container:{gap:8},button:{flexDirection:`row`,alignItems:`center`,justifyContent:`center`,paddingVertical:12,paddingHorizontal:16,backgroundColor:`#007AFF`,borderRadius:8,gap:8},buttonDisabled:{opacity:.6},buttonText:{fontSize:16,fontWeight:`600`,color:`#FFFFFF`},spinner:{marginRight:4},progressContainer:{marginTop:4}});function ge({options:e,label:t=`Choose File`,children:n,onSuccess:r,onError:a,onCancel:o,showProgress:c=!0}){let{state:u,pickAndUpload:p}=T(e),m=async()=>{try{await p()}catch(e){e instanceof Error&&(e.message.includes(`cancelled`)||e.message.includes(`aborted`)?o?.():a?.(e))}},h=u.status===`uploading`,g=h||u.status===`aborted`;return i(()=>{u.status===`success`&&u.result&&r?.(u.result)},[u.status,u.result,r]),i(()=>{u.status===`error`&&u.error&&a?.(u.error)},[u.status,u.error,a]),v(f,{style:Z.container,children:[v(l,{style:[Z.button,g&&Z.buttonDisabled],onPress:m,disabled:g,children:[h&&_(s,{size:`small`,color:`#FFFFFF`,style:Z.spinner}),_(d,{style:Z.buttonText,children:n||t})]}),c&&u.status!==`idle`&&_(f,{style:Z.progressContainer,children:_(J,{state:u,label:`File upload`})})]})}const Z=u.create({container:{gap:8},button:{flexDirection:`row`,alignItems:`center`,justifyContent:`center`,paddingVertical:12,paddingHorizontal:16,backgroundColor:`#FF9500`,borderRadius:8,gap:8},buttonDisabled:{opacity:.6},buttonText:{fontSize:16,fontWeight:`600`,color:`#FFFFFF`},spinner:{marginRight:4},progressContainer:{marginTop:4}});function _e({options:t,label:n=`Select from Gallery`,children:r,onSuccess:i,onError:a,onCancel:o,showProgress:u=!0}){let{state:p,selectAndUpload:m}=M(t),h=async()=>{try{await m()}catch(e){e instanceof Error&&(e.message.includes(`cancelled`)||e.message.includes(`aborted`)?o?.():a?.(e))}},g=p.items.some(e=>e.status===`uploading`),y=p.items.length>0,b=y&&p.items.every(e=>e.status!==`uploading`&&e.status!==`idle`);return e.useEffect(()=>{if(b){let e=p.items.filter(e=>e.status===`success`).map(e=>e.result);e.length>0&&i?.(e)}},[b,p.items,i]),e.useEffect(()=>{let e=p.items.filter(e=>e.status===`error`)[0]?.error;e&&a?.(e)},[p.items,a]),v(f,{style:Q.container,children:[v(l,{style:[Q.button,g&&Q.buttonDisabled],onPress:h,disabled:g,children:[g&&_(s,{size:`small`,color:`#FFFFFF`,style:Q.spinner}),v(d,{style:Q.buttonText,children:[r||n,y&&` (${p.items.length})`]})]}),y&&v(f,{style:Q.statsContainer,children:[v(d,{style:Q.statsText,children:[`Progress: `,p.items.filter(e=>e.status===`success`).length,`/`,p.items.length,` uploaded`]}),v(d,{style:Q.statsText,children:[`Overall: `,p.totalProgress,`%`]})]}),u&&y&&_(c,{scrollEnabled:!1,data:p.items,renderItem:({item:e})=>_(f,{style:Q.itemContainer,children:_(J,{state:{status:e.status,progress:e.progress,bytesUploaded:e.bytesUploaded,totalBytes:e.totalBytes,error:e.error,result:e.result},label:e.file.data.name})},e.id),keyExtractor:e=>e.id,style:Q.listContainer,contentContainerStyle:Q.listContent,ItemSeparatorComponent:()=>_(f,{style:Q.separator})})]})}const Q=u.create({container:{gap:8},button:{flexDirection:`row`,alignItems:`center`,justifyContent:`center`,paddingVertical:12,paddingHorizontal:16,backgroundColor:`#34C759`,borderRadius:8,gap:8},buttonDisabled:{opacity:.6},buttonText:{fontSize:16,fontWeight:`600`,color:`#FFFFFF`},spinner:{marginRight:4},statsContainer:{paddingVertical:8,paddingHorizontal:12,backgroundColor:`#f5f5f5`,borderRadius:4,gap:4},statsText:{fontSize:12,color:`#666666`},listContainer:{maxHeight:400},listContent:{gap:8},itemContainer:{paddingHorizontal:0},separator:{height:4}});function ve({items:e,onRemove:t,onItemPress:n,showRemoveButton:r=!0}){return e.length===0?_(f,{style:$.emptyContainer,children:_(d,{style:$.emptyText,children:`No uploads`})}):v(f,{style:$.container,children:[v(f,{style:$.headerRow,children:[v(d,{style:$.headerText,children:[`Uploads (`,e.length,`)`]}),v(d,{style:$.headerSubtext,children:[e.filter(e=>e.progress.state===`success`).length,` complete`]})]}),_(c,{scrollEnabled:!1,data:e,renderItem:({item:e})=>v(l,{style:[$.itemContainer,{borderLeftColor:ye(e.progress.state)}],onPress:()=>n?.(e),children:[v(f,{style:$.itemContent,children:[e.file.status===`success`&&v(f,{style:$.itemHeader,children:[_(d,{style:$.fileName,numberOfLines:1,children:e.file.data.name}),_(d,{style:$.fileSize,children:be(e.file.data.size)})]}),e.file.status===`error`&&_(d,{style:$.errorText,children:e.progress.error?.message}),_(f,{style:$.progressWrapper,children:_(J,{state:{status:e.progress.state===`pending`?`idle`:e.progress.state===`cancelled`?`aborted`:e.progress.state,progress:e.progress.progress,bytesUploaded:e.progress.uploadedBytes,totalBytes:e.progress.totalBytes,error:e.progress.error||null,result:e.result??null}})})]}),r&&e.progress.state!==`uploading`&&e.progress.state!==`pending`&&_(l,{style:$.removeButton,onPress:()=>t?.(e.id),hitSlop:{top:8,right:8,bottom:8,left:8},children:_(d,{style:$.removeButtonText,children:`✕`})})]}),keyExtractor:e=>e.id,ItemSeparatorComponent:()=>_(f,{style:$.separator}),contentContainerStyle:$.listContent})]})}function ye(e){switch(e){case`success`:return`#34C759`;case`error`:case`cancelled`:return`#FF3B30`;case`uploading`:case`pending`:return`#007AFF`;default:return`#999999`}}function be(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${Math.round(e/t**r*10)/10} ${n[r]}`}const $=u.create({container:{gap:8},headerRow:{flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,paddingHorizontal:12,paddingVertical:8,backgroundColor:`#f9f9f9`,borderRadius:4},headerText:{fontSize:16,fontWeight:`600`,color:`#333333`},errorText:{fontSize:14,color:`#FF3B30`},headerSubtext:{fontSize:14,color:`#666666`},listContent:{gap:8},itemContainer:{flexDirection:`row`,alignItems:`center`,paddingVertical:8,paddingHorizontal:12,borderLeftWidth:4,backgroundColor:`#f5f5f5`,borderRadius:4,gap:8},itemContent:{flex:1,gap:6},itemHeader:{flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`},fileName:{fontSize:14,fontWeight:`500`,color:`#333333`,flex:1},fileSize:{fontSize:12,color:`#999999`,marginLeft:8},progressWrapper:{marginTop:2},removeButton:{width:32,height:32,justifyContent:`center`,alignItems:`center`,borderRadius:16,backgroundColor:`#FFE5E5`},removeButtonText:{fontSize:16,fontWeight:`600`,color:`#FF3B30`},separator:{height:4},emptyContainer:{paddingVertical:24,paddingHorizontal:12,backgroundColor:`#f5f5f5`,borderRadius:4,alignItems:`center`,justifyContent:`center`},emptyText:{fontSize:14,color:`#999999`,fontStyle:`italic`}});export{he as CameraUploadButton,ge as FileUploadButton,ee as FlowManagerProvider,_e as GalleryUploadButton,R as PermissionStatus,L as PermissionType,ve as UploadList,J as UploadProgress,y as UploadistaContext,N as formatFileSize,ue as getDirectoryFromUri,ie as getFileExtension,K as getFileNameFromUri,ae as getFileNameWithoutExtension,P as getMimeTypeFromFileName,me as getMimeTypeFromUri,G as getPermissionStatus,W as hasPermissions,de as isContentUri,I as isDocumentFile,re as isFileSizeValid,F as isFileTypeAllowed,fe as isFileUri,oe as isImageFile,se as isVideoFile,pe as normalizeUri,ce as openAppSettings,le as pathToUri,z as requestCameraPermission,U as requestPermissions,B as requestPhotoLibraryPermission,V as requestStorageReadPermission,H as requestStorageWritePermission,q as uriToPath,w as useCameraUpload,T as useFileUpload,te as useFlow,O as useFlowManagerContext,M as useGalleryUpload,j as useMultiUpload,ne as useUploadMetrics,x as useUploadistaContext};
2
2
  //# sourceMappingURL=index.mjs.map