tempest-react-sdk 0.51.0 → 0.52.0

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 (34) hide show
  1. package/dist/auth/refresh-queue.cjs +1 -1
  2. package/dist/auth/refresh-queue.cjs.map +1 -1
  3. package/dist/auth/refresh-queue.js +6 -6
  4. package/dist/auth/refresh-queue.js.map +1 -1
  5. package/dist/components/Scheduler/Scheduler.cjs +1 -1
  6. package/dist/components/Scheduler/Scheduler.cjs.map +1 -1
  7. package/dist/components/Scheduler/Scheduler.js +1 -1
  8. package/dist/components/Scheduler/Scheduler.js.map +1 -1
  9. package/dist/components/Scheduler/Scheduler.module.cjs.map +1 -1
  10. package/dist/components/Scheduler/Scheduler.module.js.map +1 -1
  11. package/dist/http/describe-api-error.cjs +1 -1
  12. package/dist/http/describe-api-error.cjs.map +1 -1
  13. package/dist/http/describe-api-error.js +4 -2
  14. package/dist/http/describe-api-error.js.map +1 -1
  15. package/dist/http/use-describe-api-error.cjs +1 -1
  16. package/dist/http/use-describe-api-error.cjs.map +1 -1
  17. package/dist/http/use-describe-api-error.js +3 -2
  18. package/dist/http/use-describe-api-error.js.map +1 -1
  19. package/dist/offline/create-offline-database.cjs +2 -0
  20. package/dist/offline/create-offline-database.cjs.map +1 -0
  21. package/dist/offline/create-offline-database.js +29 -0
  22. package/dist/offline/create-offline-database.js.map +1 -0
  23. package/dist/offline/create-offline-store.cjs +1 -1
  24. package/dist/offline/create-offline-store.cjs.map +1 -1
  25. package/dist/offline/create-offline-store.js +29 -25
  26. package/dist/offline/create-offline-store.js.map +1 -1
  27. package/dist/tempest-react-sdk.cjs +1 -1
  28. package/dist/tempest-react-sdk.d.ts +218 -7
  29. package/dist/tempest-react-sdk.js +43 -42
  30. package/dist/utils/format.cjs +1 -1
  31. package/dist/utils/format.cjs.map +1 -1
  32. package/dist/utils/format.js +8 -3
  33. package/dist/utils/format.js.map +1 -1
  34. package/package.json +1 -1
@@ -3320,6 +3320,60 @@ export declare interface CreateLoggerOptions {
3320
3320
  */
3321
3321
  export declare function createMediaRecorder(stream: MediaStream, options: MediaRecordingOptions): MediaRecorderHandle;
3322
3322
 
3323
+ /**
3324
+ * Build several {@link OfflineStore}s that share one IndexedDB database.
3325
+ *
3326
+ * `createOfflineStore` gives each store a database of its own, which is the
3327
+ * right shape for one isolated cache. It is the wrong shape as soon as the
3328
+ * tables belong together: chats and their messages, an entity and its drafts,
3329
+ * anything you would read or clear as a unit. Splitting those across databases
3330
+ * costs a real transaction — Dexie runs one atomically only *within* a single
3331
+ * database — and it splits the version bump for a related change across two
3332
+ * places.
3333
+ *
3334
+ * This keeps them in one database at one version, so a schema change is one
3335
+ * bump and a multi-table write can be wrapped in `db.transaction(...)`.
3336
+ *
3337
+ * Stores are reached through `store<TItem>(name)` rather than a prebuilt map.
3338
+ * That is forced rather than chosen: Dexie's `Table<T>` expands `UpdateSpec<T>`
3339
+ * over the keys of `T`, so building `{ [K in keyof TSchema]: OfflineStore<…> }`
3340
+ * — or even naming `OfflineStore<TSchema[K], string>` inside the accessor —
3341
+ * makes the checker answer TS2589 ("excessively deep"). Taking the record type
3342
+ * as a parameter keeps it a plain type argument, which resolves fine. The table
3343
+ * name is still checked against the declared schema.
3344
+ *
3345
+ * The store surface is identical to `createOfflineStore`; only ownership of the
3346
+ * database changes. `ownerField` is set per table, since a database commonly
3347
+ * mixes per-user data with shared data.
3348
+ *
3349
+ * @param config - Database name, version, and one entry per table.
3350
+ * @returns A `store(name)` accessor, the shared Dexie instance, and a
3351
+ * `destroy()` that drops the database.
3352
+ *
3353
+ * @example
3354
+ * type Chat = { id: string; service_id: string; updated_at: string };
3355
+ * type Message = { id: string; service_chat_id: string; created_at: string };
3356
+ *
3357
+ * const database = createOfflineDatabase<{ chats: Chat; messages: Message }>({
3358
+ * databaseName: "ChatDatabase",
3359
+ * version: 1,
3360
+ * tables: {
3361
+ * chats: { indexes: "&id, service_id, updated_at" },
3362
+ * messages: { indexes: "&id, service_chat_id, created_at" },
3363
+ * },
3364
+ * });
3365
+ *
3366
+ * const chats = database.store<Chat>("chats");
3367
+ * const messages = database.store<Message>("messages");
3368
+ *
3369
+ * // Both tables in one atomic transaction — impossible across two databases.
3370
+ * await database.db.transaction("rw", chats.raw, messages.raw, async () => {
3371
+ * await chats.put(chat);
3372
+ * await messages.bulkPut(pending);
3373
+ * });
3374
+ */
3375
+ export declare function createOfflineDatabase<TSchema extends OfflineSchema>(config: OfflineDatabaseConfig<TSchema>): OfflineDatabase<TSchema>;
3376
+
3323
3377
  /**
3324
3378
  * Build a typed IndexedDB-backed store using Dexie. Optionally scope every
3325
3379
  * operation by an `ownerField` (useful for multi-user SSE history, drafts,
@@ -3561,14 +3615,44 @@ export declare function createQueryKeys<TKey extends string, TEntries extends Re
3561
3615
  * at once, all of them share the same in-flight `refresh()` promise instead
3562
3616
  * of triggering N parallel refreshes.
3563
3617
  *
3618
+ * **In-flight sharing alone does not collapse a burst.** A page that fires
3619
+ * several requests at once gets several 401s back, but they do not land inside
3620
+ * one window: the stragglers arrive after the first refresh already resolved,
3621
+ * find no promise to join, and each starts another one — rotating a token that
3622
+ * is already fresh. Measured against a mock backend, five concurrent expired
3623
+ * requests took two refreshes, not one.
3624
+ *
3625
+ * Pass `getToken` to close that gap. The queue remembers the token its last
3626
+ * refresh produced, and a call that finds that same token still in place returns
3627
+ * immediately, because the refresh it was about to perform has already happened.
3628
+ * The same five requests then take exactly one refresh, and so do twenty.
3629
+ *
3630
+ * @param refresh - Performs the refresh and installs the new credentials.
3631
+ * @param options - Optional token reader that enables already-refreshed
3632
+ * detection.
3633
+ * @returns A function that refreshes at most once per rotation.
3634
+ *
3564
3635
  * @example
3565
- * const refresh = createRefreshQueue(() => AuthService.refresh());
3636
+ * const refresh = createRefreshQueue(() => AuthService.refresh(), {
3637
+ * getToken: () => useAuthStore.getState().token,
3638
+ * });
3566
3639
  *
3567
3640
  * // In every request that hits 401:
3568
3641
  * await refresh();
3569
3642
  * // ...retry the original request
3570
3643
  */
3571
- export declare function createRefreshQueue(refresh: () => Promise<void>): () => Promise<void>;
3644
+ export declare function createRefreshQueue(refresh: () => Promise<void>, options?: CreateRefreshQueueOptions): () => Promise<void>;
3645
+
3646
+ export declare interface CreateRefreshQueueOptions {
3647
+ /**
3648
+ * Reads the credential the refresh installs — typically the access token.
3649
+ *
3650
+ * Supplying it makes the queue skip a refresh whose work another caller has
3651
+ * already done. Without it, only calls that literally overlap in time are
3652
+ * collapsed.
3653
+ */
3654
+ getToken?: () => string | null | undefined;
3655
+ }
3572
3656
 
3573
3657
  /**
3574
3658
  * Chunked, resumable upload speaking the **tus 1.0.0** protocol (core plus the
@@ -4658,6 +4742,9 @@ export declare function defineRoutes(routes: TempestRouteObject[]): TempestRoute
4658
4742
  *
4659
4743
  * The funnel, in order:
4660
4744
  *
4745
+ * 0. `codes[error.code]` — the sentence you wrote for that exact backend case.
4746
+ * Checked first because nothing the funnel derives can beat it, and because a
4747
+ * request that never landed carries no `code` for it to shadow.
4661
4748
  * 1. A request that never reached the server — `status === 0`, or a non-API
4662
4749
  * error thrown while the browser reports itself offline — produces the
4663
4750
  * offline sentence. This is the step apps skip, and skipping it renders
@@ -4670,7 +4757,8 @@ export declare function defineRoutes(routes: TempestRouteObject[]): TempestRoute
4670
4757
  * names internals. The per-field messages stay on `fields`, where a form can
4671
4758
  * attach them to the inputs that failed.
4672
4759
  * 3. The backend's own `detail`, which is the most specific thing available and
4673
- * is already written for a person.
4760
+ * is already written for a person — unless `useDetail: false` says that text
4761
+ * is for developers.
4674
4762
  * 4. `fallback`, with `(HTTP <status>)` appended when a status is known, so the
4675
4763
  * screenshot in the support ticket carries the one fact a developer needs.
4676
4764
  *
@@ -4683,12 +4771,53 @@ export declare function defineRoutes(routes: TempestRouteObject[]): TempestRoute
4683
4771
  * toast(describeApiError(error, "Não foi possível salvar o pedido"));
4684
4772
  * }
4685
4773
  *
4774
+ * @example
4775
+ * catch (error) {
4776
+ * toast(
4777
+ * describeApiError(error, "Não foi possível se candidatar", {
4778
+ * codes: {
4779
+ * SERVICE_FULL: "Este serviço atingiu o limite de vagas.",
4780
+ * CANDIDATE_ALREADY_EXISTS: "Você já se candidatou a este serviço.",
4781
+ * },
4782
+ * useDetail: false,
4783
+ * }),
4784
+ * );
4785
+ * }
4786
+ *
4686
4787
  * @param error - The caught value, of any shape.
4687
4788
  * @param fallback - What to say when the error carries nothing better.
4688
- * @param strings - Overrides for the fixed sentences.
4789
+ * @param options - A `codes` catalog, `useDetail`, and overrides for the fixed
4790
+ * sentences.
4689
4791
  * @returns A sentence to show the user.
4690
4792
  */
4691
- export declare function describeApiError(error: unknown, fallback: string, strings?: Partial<ApiErrorStrings>): string;
4793
+ export declare function describeApiError(error: unknown, fallback: string, options?: DescribeApiErrorOptions): string;
4794
+
4795
+ /**
4796
+ * Everything {@link describeApiError} accepts beyond the error and the fallback.
4797
+ *
4798
+ * Extends the fixed sentences rather than sitting beside them, so a caller that
4799
+ * already passed `{ offline, validation }` keeps compiling untouched.
4800
+ */
4801
+ export declare interface DescribeApiErrorOptions extends Partial<ApiErrorStrings> {
4802
+ /**
4803
+ * Maps the backend's programmatic `code` to a sentence in your language.
4804
+ *
4805
+ * The client already surfaces `code` on `ApiError`, but without this every
4806
+ * app writes the same `switch` over it. A hit here wins over every other
4807
+ * step: it is the only sentence written for that exact case, by someone who
4808
+ * knew both the backend contract and the screen it lands on.
4809
+ */
4810
+ codes?: Readonly<Record<string, string>>;
4811
+ /**
4812
+ * Whether the backend's `detail` may be shown when no `code` matched.
4813
+ * Default `true`.
4814
+ *
4815
+ * Set it to `false` when `detail` is written for developers rather than
4816
+ * users, or when it could echo internals — the result is then always either
4817
+ * a sentence you wrote or the fallback.
4818
+ */
4819
+ useDetail?: boolean;
4820
+ }
4692
4821
 
4693
4822
  /**
4694
4823
  * One filter, in words: `"Status é Pago"`.
@@ -5667,10 +5796,40 @@ export declare function formatPercent(value: number): string;
5667
5796
  /**
5668
5797
  * Apply the Brazilian phone mask `(XX) XXXXX-XXXX` or `(XX) XXXX-XXXX`.
5669
5798
  *
5799
+ * By default the grouping is decided by **length**, which is what a field
5800
+ * accepting both landlines and mobiles needs.
5801
+ *
5802
+ * `mobile: true` is for a field that only accepts mobile numbers, and it exists
5803
+ * because the default is wrong as an as-you-type mask there. Reading anything up
5804
+ * to ten digits as a landline puts the hyphen after the fourth subscriber digit,
5805
+ * so a half-typed mobile renders `(11) 9123-4`; it only becomes `(11) 91234-5`
5806
+ * once the eleventh digit lands. The separator visibly jumps backwards while the
5807
+ * user is still typing. With `mobile`, the same input reads `(11) 91234` and the
5808
+ * hyphen never moves. It also inserts the leading `9` every Brazilian mobile
5809
+ * carries, so a ten-digit number gets corrected rather than masked as a landline.
5810
+ *
5670
5811
  * @param value - Raw digits or partially masked string.
5812
+ * @param options - Masking options.
5671
5813
  * @returns Masked phone string.
5814
+ *
5815
+ * @example
5816
+ * formatPhone("1191234"); // "(11) 9123-4"
5817
+ * formatPhone("1191234", { mobile: true }); // "(11) 91234"
5818
+ * formatPhone("1112345678", { mobile: true }); // "(11) 91234-5678" — 9 inserted
5672
5819
  */
5673
- export declare function formatPhone(value: string): string;
5820
+ export declare function formatPhone(value: string, options?: FormatPhoneOptions): string;
5821
+
5822
+ export declare interface FormatPhoneOptions {
5823
+ /**
5824
+ * Treat the number as a mobile line: insert the mandatory `9` after the area
5825
+ * code when it is missing, and group the subscriber part `5+4` from the
5826
+ * first digit typed instead of waiting for the eleventh.
5827
+ *
5828
+ * Default `false`, which keeps the length-based behaviour: `4+4` up to ten
5829
+ * digits, `5+4` at eleven.
5830
+ */
5831
+ mobile?: boolean;
5832
+ }
5674
5833
 
5675
5834
  /**
5676
5835
  * Glue between `react-hook-form` `Controller` and the SDK's controlled
@@ -8052,6 +8211,36 @@ export declare interface OAuthError {
8052
8211
  raw?: unknown;
8053
8212
  }
8054
8213
 
8214
+ export declare interface OfflineDatabase<TSchema extends OfflineSchema> {
8215
+ /**
8216
+ * The {@link OfflineStore} for one table.
8217
+ *
8218
+ * The name is checked against the declared schema; the record type is
8219
+ * supplied by the caller — `store<Chat>("chats")`. Deriving it from the
8220
+ * schema instead (`OfflineStore<TSchema[K], string>`) is what the shape
8221
+ * below documents as unavailable: Dexie's `Table<T>` expands `UpdateSpec<T>`
8222
+ * over the keys of `T`, and an unresolved indexed access there makes the
8223
+ * checker answer TS2589 no matter how the value is cast.
8224
+ *
8225
+ * Stores are created once and memoised, so repeated calls with the same
8226
+ * name return the same object.
8227
+ */
8228
+ store: <TItem>(name: keyof TSchema & string) => OfflineStore<TItem, string>;
8229
+ /** The Dexie instance shared by every store. */
8230
+ db: default_2;
8231
+ /** Delete the whole database from the browser. */
8232
+ destroy: () => Promise<void>;
8233
+ }
8234
+
8235
+ export declare interface OfflineDatabaseConfig<TSchema extends OfflineSchema> {
8236
+ /** IndexedDB database name. */
8237
+ databaseName: string;
8238
+ /** Schema version. Bump when changing any table's indexes. */
8239
+ version: number;
8240
+ /** One entry per object store, all inside this single database. */
8241
+ tables: OfflineTablesConfig<TSchema>;
8242
+ }
8243
+
8055
8244
  /**
8056
8245
  * Fixed bar that appears while the browser is offline and, by default, flashes
8057
8246
  * a brief confirmation when the connection returns. Backed by {@link useOnline}
@@ -8113,6 +8302,9 @@ export declare interface OfflineQueryPersistenceOptions {
8113
8302
  throttleMs?: number;
8114
8303
  }
8115
8304
 
8305
+ /** Maps each table name to the record type it stores. */
8306
+ export declare type OfflineSchema = Record<string, unknown>;
8307
+
8116
8308
  export declare interface OfflineStore<TItem, TKey extends string | number> {
8117
8309
  /** Insert or replace a record. */
8118
8310
  put: (item: TItem, owner?: string) => Promise<TKey>;
@@ -8273,6 +8465,25 @@ export declare interface OfflineSyncConfig<TPayload, TRemote> {
8273
8465
  broadcastChannelName?: string;
8274
8466
  }
8275
8467
 
8468
+ export declare interface OfflineTableConfig<TItem> {
8469
+ /**
8470
+ * Dexie index definition for this table. Use `&` for a unique primary key,
8471
+ * e.g. `"&id, service_id, created_at"`.
8472
+ */
8473
+ indexes: string;
8474
+ /** Property used as the primary key (default: `"id"`). */
8475
+ keyPath?: keyof TItem & string;
8476
+ /**
8477
+ * Optional owner scoping for this table. Set per table, since one database
8478
+ * commonly mixes scoped and unscoped data.
8479
+ */
8480
+ ownerField?: keyof TItem & string;
8481
+ }
8482
+
8483
+ export declare type OfflineTablesConfig<TSchema extends OfflineSchema> = {
8484
+ [K in keyof TSchema]: OfflineTableConfig<TSchema[K]>;
8485
+ };
8486
+
8276
8487
  /** A pan offset in frame pixels, measured from the centered position. */
8277
8488
  declare interface Offset {
8278
8489
  x: number;
@@ -12844,7 +13055,7 @@ export declare function useDelete<T>(resource: string, options?: UseDeleteOption
12844
13055
  /** Options for the delete mutation (mutationFn + onSuccess are provided). */
12845
13056
  export declare type UseDeleteOptions<T> = Omit<UseMutationOptions<T, Error, string | number>, "mutationFn">;
12846
13057
 
12847
- export declare function useDescribeApiError(): (error: unknown, fallback: string) => string;
13058
+ export declare function useDescribeApiError(): (error: unknown, fallback: string, options?: DescribeApiErrorOptions) => string;
12848
13059
 
12849
13060
  /**
12850
13061
  * Manage open/closed boolean state with stable `open`/`close`/`toggle` handlers.
@@ -289,45 +289,46 @@ import { createVideoRecorder as $o, isVideoRecordingSupported as es, pickVideoMi
289
289
  import { useVideoRecorder as ns } from "./capture/use-video-recorder.js";
290
290
  import { isScreenCaptureSupported as rs, useScreenCapture as is } from "./capture/use-screen-capture.js";
291
291
  import { isSpeechRecognitionSupported as as, useSpeechRecognition as os } from "./capture/use-speech-recognition.js";
292
- import { createOfflineSync as ss } from "./offline/create-offline-sync.js";
293
- import { higherVersionWins as cs, lastWriteWins as ls } from "./offline/conflict.js";
294
- import { useErrorHandler as us } from "./error-boundary/use-error-handler.js";
295
- import { FormField as ds } from "./forms/FormField.js";
296
- import { validateForm as fs } from "./forms/validate-form.js";
297
- import { zodResolver as ps } from "./forms/zod-resolver.js";
298
- import { useZodForm as ms } from "./forms/use-zod-form.js";
299
- import { formatCEP as hs, formatCNPJ as gs, unmask as _s, validateCNPJ as vs, validateCPF as ys } from "./forms/br-validators.js";
300
- import { CEPInput as bs, CNPJInput as xs, CPFInput as Ss, MoneyInput as Cs, PhoneInput as ws } from "./forms/masked-inputs.js";
301
- import { useViaCEP as Ts } from "./forms/use-viacep.js";
302
- import { Controller as Es, FormProvider as Ds, useFieldArray as Os, useForm as ks, useFormContext as As, useFormState as js, useWatch as Ms } from "./forms/index.js";
303
- import { createWebSocket as Ns } from "./ws/create-web-socket.js";
304
- import { useWebSocket as Ps } from "./ws/use-web-socket.js";
305
- import { clampLatitude as Fs, isCoordinate as Is, isValidLatitude as Ls, isValidLongitude as Rs, normalizeLongitude as zs } from "./geo/types.js";
306
- import { EARTH_RADIUS_KM as Bs, bearingDeg as Vs, haversineKm as Hs, pathLengthKm as Us, toRadians as Ws } from "./geo/distance.js";
307
- import { DEFAULT_CAR_SPEED_KMH as Gs, DEFAULT_CIRCUITY_FACTOR as Ks, DEFAULT_MODE_DURATION_FACTORS as qs, estimateTravel as Js } from "./geo/estimate.js";
308
- import { boundingBox as Ys, boundsCenter as Xs, expandBounds as Zs } from "./geo/bounds.js";
309
- import { fitProjection as Qs, projectMercator as $s, unprojectMercator as ec } from "./geo/projection.js";
310
- import { createOSRMBackend as tc } from "./geo/routing.js";
311
- import { createPositionTracker as nc } from "./geo/create-position-tracker.js";
312
- import { usePositionTracker as rc } from "./geo/use-position-tracker.js";
313
- import { TrajectoryMap as ic } from "./geo/TrajectoryMap.js";
314
- import { applyTheme as ac, readThemeToken as oc } from "./theme/apply-theme.js";
315
- import { contrastRatio as sc, createColorScale as cc, hexToOklch as lc, hexToRgb as uc, hexToRgbaString as dc, oklchToHex as fc, readableForeground as pc, relativeLuminance as mc, rgbToHex as hc } from "./theme/color.js";
316
- import { createTheme as gc, themeContrast as _c } from "./theme/create-theme.js";
317
- import { getThemePreset as vc, themePresets as yc } from "./theme/theme-presets.js";
318
- import { getInitialTheme as bc, themeInitScript as xc } from "./theme/initial-theme.js";
319
- import { consoleSink as Sc, createLogger as Cc } from "./logger/logger.js";
320
- import { TelemetryProvider as wc, useTelemetry as Tc } from "./telemetry/TelemetryProvider.js";
321
- import { consoleTelemetryAdapter as Ec } from "./telemetry/console-adapter.js";
322
- import { createSentryTelemetryAdapter as Dc } from "./telemetry/sentry-adapter.js";
323
- import { createPostHogTelemetryAdapter as Oc } from "./telemetry/posthog-adapter.js";
324
- import { FeatureFlagsProvider as kc, useFeatureFlag as Ac, useFlagValue as jc } from "./feature-flags/FeatureFlagsProvider.js";
325
- import { createInMemoryFlags as Mc } from "./feature-flags/in-memory-adapter.js";
326
- import { createGrowthBookFeatureFlagsAdapter as Nc } from "./feature-flags/growthbook-adapter.js";
327
- import { createLaunchDarklyFeatureFlagsAdapter as Pc } from "./feature-flags/launchdarkly-adapter.js";
328
- import { DIVERGING_STEP_COUNT as Fc, ORDINAL_START_STEP as Ic, SEQUENTIAL_STEP_COUNT as Lc, divergingScale as Rc, scaleSteps as zc, sequentialScale as Bc } from "./charts/scales.js";
329
- import { cachedResponseBytes as Vc } from "./perf/cache-size.js";
330
- import { readDeviceProfile as Hc } from "./perf/device.js";
331
- import { formatDurationMs as Uc } from "./perf/format.js";
332
- import { createInferenceProfiler as Wc } from "./perf/profiler.js";
333
- export { Ar as AIChat, Dr as AIChatComposer, kr as AIChatTurn, dr as ALL_BARCODE_FORMATS, Bi as API_ERROR_OFFLINE_KEY, Vi as API_ERROR_VALIDATION_KEY, er as AUDIO_MIME_CANDIDATES, Ca as AccessControlProvider, t as Accordion, n as Alert, r as AppBar, Oo as AppProviders, io as AppRouter, o as AppShell, s as AspectRatio, Qn as AudioPlayer, ur as AudioRecorder, aa as AuthGuard, c as Avatar, l as AvatarGroup, i as BREAKPOINTS, u as Badge, d as Banner, Fr as BarList, yr as BarcodeScanner, f as BottomNavigation, p as BottomSheet, m as Breadcrumbs, oo as BrowserRouter, h as Button, ja as CACHE_TIME, bs as CEPInput, xs as CNPJInput, Ss as CPFInput, Mn as Calendar, Ea as Can, g as Card, Rn as Carousel, _ as Center, Yn as Chat, Jn as ChatComposer, v as Checkbox, y as ChipInput, hn as ClickOutside, ln as CodeBlock, En as Collapsible, b as Combobox, kn as Command, gn as ConditionalWrapper, S as ConfirmDialog, I as Container, Dn as ContextMenu, Es as Controller, cn as CopyButton, Hi as DEFAULT_API_ERROR_STRINGS, fr as DEFAULT_BARCODE_FORMATS, Gs as DEFAULT_CAR_SPEED_KMH, $i as DEFAULT_CHUNK_SIZE, Ks as DEFAULT_CIRCUITY_FACTOR, qs as DEFAULT_MODE_DURATION_FACTORS, ua as DEFAULT_PUB_KEY_CRED_PARAMS, Fc as DIVERGING_STEP_COUNT, bn as DataList, zn as DataTable, w as DatePicker, Fn as DateRangePicker, xn as DescriptionList, T as Divider, E as Drawer, D as DropdownMenu, O as Dropzone, Bs as EARTH_RADIUS_KM, k as EmptyState, Do as ErrorBoundary, A as ErrorState, vn as ErrorText, kc as FeatureFlagsProvider, j as FileUpload, Br as FilterBar, Vn as FloatingActionButton, _n as For, M as Form, N as FormActions, ds as FormField, Ds as FormProvider, P as FormRow, F as FormSection, ka as GoogleSignIn, L as Grid, so as HashRouter, St as Hide, On as HoverCard, Gi as I18nProvider, yn as Image, Jt as ImageCropper, C as Input, B as InstallBanner, V as InstallButton, rt as Kanban, at as Kbd, Tn as Label, Kn as Lightbox, co as Link, Bn as ListTile, Or as Markdown, Mr as Masonry, lo as MemoryRouter, Ln as Menubar, x as Modal, ot as ModalsProvider, dn as Money, Cs as MoneyInput, Pn as MultiSelect, lt as NProgressBar, uo as NavLink, ct as Navbar, fo as Navigate, In as NavigationMenu, Hn as NavigationRail, Qt as NotificationCenter, Ic as ORDINAL_START_STEP, Ze as OfflineIndicator, po as Outlet, dt as Page, ft as Pagination, da as PasskeyError, pt as PasswordInput, ws as PhoneInput, ht as PinInput, gt as Popover, mn as Portal, _t as Progress, rn as QRCapacityError, sn as QRCode, Ia as QueryProvider, Ma as REFETCH_TIME, vt as Radio, yt as RadioGroup, bt as RangeSlider, xt as RatingStars, Wn as RefreshIndicator, un as RelativeTime, jn as Resizable, mo as Route, ro as RouteGuard, ho as Routes, Lc as SEQUENTIAL_STEP_COUNT, Na as STALE_TIME, wt as SafeArea, Xt as Scheduler, An as ScrollArea, Tt as SearchBar, Et as SegmentedControl, Dt as Select, Ct as Show, Ot as Sidebar, qn as SignaturePad, kt as Skeleton, Nn as Slider, At as Spacer, Yt as Sparkline, jt as Spinner, R as Stack, Mt as Stat, Nt as Stepper, Rt as StepperInput, zt as Switch, tt as SyncStatusBadge, Vt as Table, Ht as Tabs, Bt as Tag, wc as TelemetryProvider, Fi as TempestApiError, Ja as TempestDataProvider, Ut as Textarea, To as ThemeProvider, Un as TimePicker, Wt as Timeline, Kt as ToastProvider, Sn as Toggle, Cn as ToggleGroup, wn as ToggleGroupItem, Gt as Tooltip, Nr as Tour, ic as TrajectoryMap, jr as Transfer, fn as TreeView, pn as TruncateText, nt as UpdatePrompt, en as VirtualList, nn as VirtualTable, et as VisuallyHidden, No as WebPushClient, Po as WebPushPermissionDeniedError, Fo as WebPushUnsupportedError, Gn as Wizard, br as aiChatStrings, se as announce, Jr as applyFilters, it as applyKanbanMove, ac as applyTheme, gi as assertNever, fa as base64UrlToBytes, Vs as bearingDeg, cr as blobToWav, Ys as boundingBox, Xs as boundsCenter, Pi as buildApiUrl, Pr as buildBarListRows, Ne as buildOpenInChromeIntent, pa as bytesToBase64Url, Vc as cachedResponseBytes, ni as camelCase, ri as capitalize, ci as chunk, Pt as clamp, Fs as clampLatitude, ma as classifyPasskeyError, ce as clearAnnouncer, Go as clearCaches, e as cn, tn as compareValues, Qr as compressToString, $r as compressedStorage, ei as compressedStorageCodec, Sc as consoleSink, Ec as consoleTelemetryAdapter, sc as contrastRatio, zi as createApiClient, qo as createAudioPlayer, tr as createAudioRecorder, ia as createAuthStore, pr as createBarcodeDetector, cc as createColorScale, qa as createDataProvider, ko as createEventStream, Nc as createGrowthBookFeatureFlagsAdapter, Wi as createI18n, Mc as createInMemoryFlags, Wc as createInferenceProfiler, Xr as createJsonStorage, Pc as createLaunchDarklyFeatureFlagsAdapter, ir as createLevelMeter, ea as createLocalUploadStorage, Cc as createLogger, $n as createMediaRecorder, tc as createOSRMBackend, Ga as createOfflineStore, ss as createOfflineSync, Bo as createPartialResponse, ha as createPasskeyClient, nc as createPositionTracker, Oc as createPostHogTelemetryAdapter, Pa as createQueryKeys, la as createRefreshQueue, ta as createResumableUpload, Da as createRoleAccessControl, wo as createSelectors, Dc as createSentryTelemetryAdapter, Zo as createSfxPool, Co as createStore, Sa as createTempestAuth, gc as createTheme, $o as createVideoRecorder, Ns as createWebSocket, xi as debounce, oa as decodeJWT, ti as decompressFromString, fi as deepMerge, ao as defineRoutes, Ui as describeApiError, Ir as describeFilter, Rc as divergingScale, Mi as downloadCsv, La as emptyOffsetPage, an as encodeQR, lr as encodeWav, mt as estimatePasswordStrength, Ue as estimateStorage, Js as estimateTravel, Zs as expandBounds, Lr as filtersFromSearchParams, Yr as filtersToQueryParams, Rr as filtersToSearchParams, Qs as fitProjection, Ft as formatBytes, hs as formatCEP, gs as formatCNPJ, Vr as formatCPF, It as formatCompactNumber, Hr as formatCurrency, Ur as formatDate, Wr as formatDateForInput, Gr as formatDateTime, Uc as formatDurationMs, Kr as formatPercent, qr as formatPhone, Qi as generateIdempotencyKey, bc as getInitialTheme, mr as getSupportedBarcodeFormats, vc as getThemePreset, li as groupBy, Hs as haversineKm, lc as hexToOklch, uc as hexToRgb, dc as hexToRgbaString, cs as higherVersionWins, Ko as inspectCaches, Uo as installBackgroundSync, Lo as installNotificationClickHandler, Vo as installPrecache, Ro as installPushHandler, Ho as installRuntimeCache, zo as installSkipWaitingListener, Pe as isAndroid, Fe as isAndroidWithoutPromptApi, Ii as isApiError, Xn as isAudioOutputSelectionSupported, nr as isAudioRecordingSupported, hr as isBarcodeDetectionSupported, ga as isConditionalMediationAvailable, Is as isCoordinate, Ra as isCursorPage, _i as isDefined, pi as isEmpty, xr as isGenerating, Ie as isIOS, sa as isJWTExpired, or as isMediaCaptureSupported, vi as isNumber, za as isOffsetPage, _a as isPasskeySupported, yi as isPlainObject, va as isPlatformAuthenticatorAvailable, jo as isPushSupported, Li as isRetriableStatus, rs as isScreenCaptureSupported, ki as isShareSupported, as as isSpeechRecognitionSupported, Le as isStandalone, bi as isString, Ls as isValidLatitude, Rs as isValidLongitude, es as isVideoRecordingSupported, ii as kebabCase, Sr as lastAssistantId, ls as lastWriteWins, ca as lazyWithRetry, Xa as listQueryKey, on as matrixToPath, Si as memoizeOne, Ke as moveItem, gr as normalizeBarcode, zs as normalizeLongitude, ut as nprogress, fc as oklchToHex, mi as omit, Ci as once, Za as oneQueryKey, zr as operatorsFor, Xi as parseResponse, Us as pathLengthKm, Lt as percentOf, Oa as permissionsFromToken, Ka as persistQueryClientOffline, hi as pick, rr as pickAudioMimeType, ts as pickVideoMimeType, Jo as playAudio, ai as pluralize, $s as projectMercator, Di as randomId, ui as range, Hc as readDeviceProfile, oc as readThemeToken, pc as readableForeground, go as redirect, Wo as registerPeriodicSync, ze as registerServiceWorker, mc as relativeLuminance, Zt as relativeTime, Ua as removeById, We as requestPersistentStorage, Ri as retry, hc as rgbToHex, Cr as roleLabel, zc as scaleSteps, Bc as sequentialScale, Zn as setAudioOutput, Ai as share, ji as shareOrDownloadBlob, Fa as shouldRetryQuery, Be as skipWaiting, Ti as sleep, oi as slugify, Yo as stopAudio, Zr as storage, wr as tailSignature, _c as themeContrast, xc as themeInitScript, yc as themePresets, wi as throttle, Ni as toCsv, Ws as toRadians, si as truncate, Tr as turnTime, di as uniqueBy, _s as unmask, ec as unprojectMercator, Ve as unregisterAllServiceWorkers, na as uploadFingerprint, Zi as uploadWithProgress, Wa as upsertById, Mo as urlBase64ToUint8Array, wa as useAccessControl, le as useAnnounce, X as useAsync, Xo as useAudio, ar as useAudioRecorder, vr as useBarcodeScanner, z as useBeforeInstallPrompt, a as useBreakpoint, Ta as useCan, ke as useClickOutside, W as useClientFilter, te as useClipboard, Se as useCountdown, xe as useCounter, Qa as useCreate, Va as useCursorQuery, Ya as useDataProvider, H as useDebounce, de as useDeepMemo, $a as useDelete, Yi as useDescribeApiError, ye as useDisclosure, we as useDocumentTitle, Q as useDocumentVisibility, us as useErrorHandler, q as useEventListener, Ao as useEventStream, Te as useFavicon, Ac as useFeatureFlag, Os as useFieldArray, jc as useFlagValue, oe as useFocusTrap, ks as useForm, As as useFormContext, js as useFormState, ie as useGeolocation, _e as useHover, Ki as useI18n, re as useIdle, Re as useInstallPrompt, $ as useIntersectionObserver, pe as useInterval, Ae as useIsFirstRender, ne as useKeyboardShortcut, K as useLatestRef, eo as useList, be as useListState, J as useLocalStorage, _o as useLocation, ve as useLongPress, Me as useLongPressHandlers, Ee as useMap, vo as useMatch, Xe as useMediaDevices, Ye as useMediaPermission, G as useMediaQuery, sr as useMicrophone, st as useModals, yo as useNavigate, $t as useNotificationInbox, Aa as useOAuthCallback, je as useObjectUrl, Ha as useOfflineMutation, Qe as useOfflineSync, to as useOne, Z as useOnline, qi as useOptionalI18n, Ba as usePaginatedQuery, U as usePagination, bo as useParams, ya as usePasskeyCapabilities, ba as usePasskeyRegistration, xa as usePasskeySignIn, ra as usePoll, rc as usePositionTracker, fe as usePrevious, Io as usePushSubscription, Oe as useQueue, ee as useResizeObserver, xo as useRouteError, is as useScreenCapture, ae as useScrollLock, Je as useScrollOverflow, So as useSearchParams, He as useServiceWorkerUpdate, De as useSet, Qo as useSfxPool, qe as useSortable, os as useSpeechRecognition, ue as useStableCallback, Ge as useStorageEstimate, $e as useSyncStatus, Tc as useTelemetry, Eo as useTheme, he as useThrottle, me as useTimeout, qt as useToast, Y as useToggle, _r as useTorch, Ji as useTranslate, Ce as useTypewriter, no as useUpdate, Ts as useViaCEP, ns as useVideoRecorder, Ms as useWatch, Ps as useWebSocket, ge as useWindowSize, ms as useZodForm, vs as validateCNPJ, ys as validateCPF, fs as validateForm, Er as visibleTurns, Ei as withTimeout, Oi as writeXlsx, ps as zodResolver };
292
+ import { createOfflineDatabase as ss } from "./offline/create-offline-database.js";
293
+ import { createOfflineSync as cs } from "./offline/create-offline-sync.js";
294
+ import { higherVersionWins as ls, lastWriteWins as us } from "./offline/conflict.js";
295
+ import { useErrorHandler as ds } from "./error-boundary/use-error-handler.js";
296
+ import { FormField as fs } from "./forms/FormField.js";
297
+ import { validateForm as ps } from "./forms/validate-form.js";
298
+ import { zodResolver as ms } from "./forms/zod-resolver.js";
299
+ import { useZodForm as hs } from "./forms/use-zod-form.js";
300
+ import { formatCEP as gs, formatCNPJ as _s, unmask as vs, validateCNPJ as ys, validateCPF as bs } from "./forms/br-validators.js";
301
+ import { CEPInput as xs, CNPJInput as Ss, CPFInput as Cs, MoneyInput as ws, PhoneInput as Ts } from "./forms/masked-inputs.js";
302
+ import { useViaCEP as Es } from "./forms/use-viacep.js";
303
+ import { Controller as Ds, FormProvider as Os, useFieldArray as ks, useForm as As, useFormContext as js, useFormState as Ms, useWatch as Ns } from "./forms/index.js";
304
+ import { createWebSocket as Ps } from "./ws/create-web-socket.js";
305
+ import { useWebSocket as Fs } from "./ws/use-web-socket.js";
306
+ import { clampLatitude as Is, isCoordinate as Ls, isValidLatitude as Rs, isValidLongitude as zs, normalizeLongitude as Bs } from "./geo/types.js";
307
+ import { EARTH_RADIUS_KM as Vs, bearingDeg as Hs, haversineKm as Us, pathLengthKm as Ws, toRadians as Gs } from "./geo/distance.js";
308
+ import { DEFAULT_CAR_SPEED_KMH as Ks, DEFAULT_CIRCUITY_FACTOR as qs, DEFAULT_MODE_DURATION_FACTORS as Js, estimateTravel as Ys } from "./geo/estimate.js";
309
+ import { boundingBox as Xs, boundsCenter as Zs, expandBounds as Qs } from "./geo/bounds.js";
310
+ import { fitProjection as $s, projectMercator as ec, unprojectMercator as tc } from "./geo/projection.js";
311
+ import { createOSRMBackend as nc } from "./geo/routing.js";
312
+ import { createPositionTracker as rc } from "./geo/create-position-tracker.js";
313
+ import { usePositionTracker as ic } from "./geo/use-position-tracker.js";
314
+ import { TrajectoryMap as ac } from "./geo/TrajectoryMap.js";
315
+ import { applyTheme as oc, readThemeToken as sc } from "./theme/apply-theme.js";
316
+ import { contrastRatio as cc, createColorScale as lc, hexToOklch as uc, hexToRgb as dc, hexToRgbaString as fc, oklchToHex as pc, readableForeground as mc, relativeLuminance as hc, rgbToHex as gc } from "./theme/color.js";
317
+ import { createTheme as _c, themeContrast as vc } from "./theme/create-theme.js";
318
+ import { getThemePreset as yc, themePresets as bc } from "./theme/theme-presets.js";
319
+ import { getInitialTheme as xc, themeInitScript as Sc } from "./theme/initial-theme.js";
320
+ import { consoleSink as Cc, createLogger as wc } from "./logger/logger.js";
321
+ import { TelemetryProvider as Tc, useTelemetry as Ec } from "./telemetry/TelemetryProvider.js";
322
+ import { consoleTelemetryAdapter as Dc } from "./telemetry/console-adapter.js";
323
+ import { createSentryTelemetryAdapter as Oc } from "./telemetry/sentry-adapter.js";
324
+ import { createPostHogTelemetryAdapter as kc } from "./telemetry/posthog-adapter.js";
325
+ import { FeatureFlagsProvider as Ac, useFeatureFlag as jc, useFlagValue as Mc } from "./feature-flags/FeatureFlagsProvider.js";
326
+ import { createInMemoryFlags as Nc } from "./feature-flags/in-memory-adapter.js";
327
+ import { createGrowthBookFeatureFlagsAdapter as Pc } from "./feature-flags/growthbook-adapter.js";
328
+ import { createLaunchDarklyFeatureFlagsAdapter as Fc } from "./feature-flags/launchdarkly-adapter.js";
329
+ import { DIVERGING_STEP_COUNT as Ic, ORDINAL_START_STEP as Lc, SEQUENTIAL_STEP_COUNT as Rc, divergingScale as zc, scaleSteps as Bc, sequentialScale as Vc } from "./charts/scales.js";
330
+ import { cachedResponseBytes as Hc } from "./perf/cache-size.js";
331
+ import { readDeviceProfile as Uc } from "./perf/device.js";
332
+ import { formatDurationMs as Wc } from "./perf/format.js";
333
+ import { createInferenceProfiler as Gc } from "./perf/profiler.js";
334
+ export { Ar as AIChat, Dr as AIChatComposer, kr as AIChatTurn, dr as ALL_BARCODE_FORMATS, Bi as API_ERROR_OFFLINE_KEY, Vi as API_ERROR_VALIDATION_KEY, er as AUDIO_MIME_CANDIDATES, Ca as AccessControlProvider, t as Accordion, n as Alert, r as AppBar, Oo as AppProviders, io as AppRouter, o as AppShell, s as AspectRatio, Qn as AudioPlayer, ur as AudioRecorder, aa as AuthGuard, c as Avatar, l as AvatarGroup, i as BREAKPOINTS, u as Badge, d as Banner, Fr as BarList, yr as BarcodeScanner, f as BottomNavigation, p as BottomSheet, m as Breadcrumbs, oo as BrowserRouter, h as Button, ja as CACHE_TIME, xs as CEPInput, Ss as CNPJInput, Cs as CPFInput, Mn as Calendar, Ea as Can, g as Card, Rn as Carousel, _ as Center, Yn as Chat, Jn as ChatComposer, v as Checkbox, y as ChipInput, hn as ClickOutside, ln as CodeBlock, En as Collapsible, b as Combobox, kn as Command, gn as ConditionalWrapper, S as ConfirmDialog, I as Container, Dn as ContextMenu, Ds as Controller, cn as CopyButton, Hi as DEFAULT_API_ERROR_STRINGS, fr as DEFAULT_BARCODE_FORMATS, Ks as DEFAULT_CAR_SPEED_KMH, $i as DEFAULT_CHUNK_SIZE, qs as DEFAULT_CIRCUITY_FACTOR, Js as DEFAULT_MODE_DURATION_FACTORS, ua as DEFAULT_PUB_KEY_CRED_PARAMS, Ic as DIVERGING_STEP_COUNT, bn as DataList, zn as DataTable, w as DatePicker, Fn as DateRangePicker, xn as DescriptionList, T as Divider, E as Drawer, D as DropdownMenu, O as Dropzone, Vs as EARTH_RADIUS_KM, k as EmptyState, Do as ErrorBoundary, A as ErrorState, vn as ErrorText, Ac as FeatureFlagsProvider, j as FileUpload, Br as FilterBar, Vn as FloatingActionButton, _n as For, M as Form, N as FormActions, fs as FormField, Os as FormProvider, P as FormRow, F as FormSection, ka as GoogleSignIn, L as Grid, so as HashRouter, St as Hide, On as HoverCard, Gi as I18nProvider, yn as Image, Jt as ImageCropper, C as Input, B as InstallBanner, V as InstallButton, rt as Kanban, at as Kbd, Tn as Label, Kn as Lightbox, co as Link, Bn as ListTile, Or as Markdown, Mr as Masonry, lo as MemoryRouter, Ln as Menubar, x as Modal, ot as ModalsProvider, dn as Money, ws as MoneyInput, Pn as MultiSelect, lt as NProgressBar, uo as NavLink, ct as Navbar, fo as Navigate, In as NavigationMenu, Hn as NavigationRail, Qt as NotificationCenter, Lc as ORDINAL_START_STEP, Ze as OfflineIndicator, po as Outlet, dt as Page, ft as Pagination, da as PasskeyError, pt as PasswordInput, Ts as PhoneInput, ht as PinInput, gt as Popover, mn as Portal, _t as Progress, rn as QRCapacityError, sn as QRCode, Ia as QueryProvider, Ma as REFETCH_TIME, vt as Radio, yt as RadioGroup, bt as RangeSlider, xt as RatingStars, Wn as RefreshIndicator, un as RelativeTime, jn as Resizable, mo as Route, ro as RouteGuard, ho as Routes, Rc as SEQUENTIAL_STEP_COUNT, Na as STALE_TIME, wt as SafeArea, Xt as Scheduler, An as ScrollArea, Tt as SearchBar, Et as SegmentedControl, Dt as Select, Ct as Show, Ot as Sidebar, qn as SignaturePad, kt as Skeleton, Nn as Slider, At as Spacer, Yt as Sparkline, jt as Spinner, R as Stack, Mt as Stat, Nt as Stepper, Rt as StepperInput, zt as Switch, tt as SyncStatusBadge, Vt as Table, Ht as Tabs, Bt as Tag, Tc as TelemetryProvider, Fi as TempestApiError, Ja as TempestDataProvider, Ut as Textarea, To as ThemeProvider, Un as TimePicker, Wt as Timeline, Kt as ToastProvider, Sn as Toggle, Cn as ToggleGroup, wn as ToggleGroupItem, Gt as Tooltip, Nr as Tour, ac as TrajectoryMap, jr as Transfer, fn as TreeView, pn as TruncateText, nt as UpdatePrompt, en as VirtualList, nn as VirtualTable, et as VisuallyHidden, No as WebPushClient, Po as WebPushPermissionDeniedError, Fo as WebPushUnsupportedError, Gn as Wizard, br as aiChatStrings, se as announce, Jr as applyFilters, it as applyKanbanMove, oc as applyTheme, gi as assertNever, fa as base64UrlToBytes, Hs as bearingDeg, cr as blobToWav, Xs as boundingBox, Zs as boundsCenter, Pi as buildApiUrl, Pr as buildBarListRows, Ne as buildOpenInChromeIntent, pa as bytesToBase64Url, Hc as cachedResponseBytes, ni as camelCase, ri as capitalize, ci as chunk, Pt as clamp, Is as clampLatitude, ma as classifyPasskeyError, ce as clearAnnouncer, Go as clearCaches, e as cn, tn as compareValues, Qr as compressToString, $r as compressedStorage, ei as compressedStorageCodec, Cc as consoleSink, Dc as consoleTelemetryAdapter, cc as contrastRatio, zi as createApiClient, qo as createAudioPlayer, tr as createAudioRecorder, ia as createAuthStore, pr as createBarcodeDetector, lc as createColorScale, qa as createDataProvider, ko as createEventStream, Pc as createGrowthBookFeatureFlagsAdapter, Wi as createI18n, Nc as createInMemoryFlags, Gc as createInferenceProfiler, Xr as createJsonStorage, Fc as createLaunchDarklyFeatureFlagsAdapter, ir as createLevelMeter, ea as createLocalUploadStorage, wc as createLogger, $n as createMediaRecorder, nc as createOSRMBackend, ss as createOfflineDatabase, Ga as createOfflineStore, cs as createOfflineSync, Bo as createPartialResponse, ha as createPasskeyClient, rc as createPositionTracker, kc as createPostHogTelemetryAdapter, Pa as createQueryKeys, la as createRefreshQueue, ta as createResumableUpload, Da as createRoleAccessControl, wo as createSelectors, Oc as createSentryTelemetryAdapter, Zo as createSfxPool, Co as createStore, Sa as createTempestAuth, _c as createTheme, $o as createVideoRecorder, Ps as createWebSocket, xi as debounce, oa as decodeJWT, ti as decompressFromString, fi as deepMerge, ao as defineRoutes, Ui as describeApiError, Ir as describeFilter, zc as divergingScale, Mi as downloadCsv, La as emptyOffsetPage, an as encodeQR, lr as encodeWav, mt as estimatePasswordStrength, Ue as estimateStorage, Ys as estimateTravel, Qs as expandBounds, Lr as filtersFromSearchParams, Yr as filtersToQueryParams, Rr as filtersToSearchParams, $s as fitProjection, Ft as formatBytes, gs as formatCEP, _s as formatCNPJ, Vr as formatCPF, It as formatCompactNumber, Hr as formatCurrency, Ur as formatDate, Wr as formatDateForInput, Gr as formatDateTime, Wc as formatDurationMs, Kr as formatPercent, qr as formatPhone, Qi as generateIdempotencyKey, xc as getInitialTheme, mr as getSupportedBarcodeFormats, yc as getThemePreset, li as groupBy, Us as haversineKm, uc as hexToOklch, dc as hexToRgb, fc as hexToRgbaString, ls as higherVersionWins, Ko as inspectCaches, Uo as installBackgroundSync, Lo as installNotificationClickHandler, Vo as installPrecache, Ro as installPushHandler, Ho as installRuntimeCache, zo as installSkipWaitingListener, Pe as isAndroid, Fe as isAndroidWithoutPromptApi, Ii as isApiError, Xn as isAudioOutputSelectionSupported, nr as isAudioRecordingSupported, hr as isBarcodeDetectionSupported, ga as isConditionalMediationAvailable, Ls as isCoordinate, Ra as isCursorPage, _i as isDefined, pi as isEmpty, xr as isGenerating, Ie as isIOS, sa as isJWTExpired, or as isMediaCaptureSupported, vi as isNumber, za as isOffsetPage, _a as isPasskeySupported, yi as isPlainObject, va as isPlatformAuthenticatorAvailable, jo as isPushSupported, Li as isRetriableStatus, rs as isScreenCaptureSupported, ki as isShareSupported, as as isSpeechRecognitionSupported, Le as isStandalone, bi as isString, Rs as isValidLatitude, zs as isValidLongitude, es as isVideoRecordingSupported, ii as kebabCase, Sr as lastAssistantId, us as lastWriteWins, ca as lazyWithRetry, Xa as listQueryKey, on as matrixToPath, Si as memoizeOne, Ke as moveItem, gr as normalizeBarcode, Bs as normalizeLongitude, ut as nprogress, pc as oklchToHex, mi as omit, Ci as once, Za as oneQueryKey, zr as operatorsFor, Xi as parseResponse, Ws as pathLengthKm, Lt as percentOf, Oa as permissionsFromToken, Ka as persistQueryClientOffline, hi as pick, rr as pickAudioMimeType, ts as pickVideoMimeType, Jo as playAudio, ai as pluralize, ec as projectMercator, Di as randomId, ui as range, Uc as readDeviceProfile, sc as readThemeToken, mc as readableForeground, go as redirect, Wo as registerPeriodicSync, ze as registerServiceWorker, hc as relativeLuminance, Zt as relativeTime, Ua as removeById, We as requestPersistentStorage, Ri as retry, gc as rgbToHex, Cr as roleLabel, Bc as scaleSteps, Vc as sequentialScale, Zn as setAudioOutput, Ai as share, ji as shareOrDownloadBlob, Fa as shouldRetryQuery, Be as skipWaiting, Ti as sleep, oi as slugify, Yo as stopAudio, Zr as storage, wr as tailSignature, vc as themeContrast, Sc as themeInitScript, bc as themePresets, wi as throttle, Ni as toCsv, Gs as toRadians, si as truncate, Tr as turnTime, di as uniqueBy, vs as unmask, tc as unprojectMercator, Ve as unregisterAllServiceWorkers, na as uploadFingerprint, Zi as uploadWithProgress, Wa as upsertById, Mo as urlBase64ToUint8Array, wa as useAccessControl, le as useAnnounce, X as useAsync, Xo as useAudio, ar as useAudioRecorder, vr as useBarcodeScanner, z as useBeforeInstallPrompt, a as useBreakpoint, Ta as useCan, ke as useClickOutside, W as useClientFilter, te as useClipboard, Se as useCountdown, xe as useCounter, Qa as useCreate, Va as useCursorQuery, Ya as useDataProvider, H as useDebounce, de as useDeepMemo, $a as useDelete, Yi as useDescribeApiError, ye as useDisclosure, we as useDocumentTitle, Q as useDocumentVisibility, ds as useErrorHandler, q as useEventListener, Ao as useEventStream, Te as useFavicon, jc as useFeatureFlag, ks as useFieldArray, Mc as useFlagValue, oe as useFocusTrap, As as useForm, js as useFormContext, Ms as useFormState, ie as useGeolocation, _e as useHover, Ki as useI18n, re as useIdle, Re as useInstallPrompt, $ as useIntersectionObserver, pe as useInterval, Ae as useIsFirstRender, ne as useKeyboardShortcut, K as useLatestRef, eo as useList, be as useListState, J as useLocalStorage, _o as useLocation, ve as useLongPress, Me as useLongPressHandlers, Ee as useMap, vo as useMatch, Xe as useMediaDevices, Ye as useMediaPermission, G as useMediaQuery, sr as useMicrophone, st as useModals, yo as useNavigate, $t as useNotificationInbox, Aa as useOAuthCallback, je as useObjectUrl, Ha as useOfflineMutation, Qe as useOfflineSync, to as useOne, Z as useOnline, qi as useOptionalI18n, Ba as usePaginatedQuery, U as usePagination, bo as useParams, ya as usePasskeyCapabilities, ba as usePasskeyRegistration, xa as usePasskeySignIn, ra as usePoll, ic as usePositionTracker, fe as usePrevious, Io as usePushSubscription, Oe as useQueue, ee as useResizeObserver, xo as useRouteError, is as useScreenCapture, ae as useScrollLock, Je as useScrollOverflow, So as useSearchParams, He as useServiceWorkerUpdate, De as useSet, Qo as useSfxPool, qe as useSortable, os as useSpeechRecognition, ue as useStableCallback, Ge as useStorageEstimate, $e as useSyncStatus, Ec as useTelemetry, Eo as useTheme, he as useThrottle, me as useTimeout, qt as useToast, Y as useToggle, _r as useTorch, Ji as useTranslate, Ce as useTypewriter, no as useUpdate, Es as useViaCEP, ns as useVideoRecorder, Ns as useWatch, Fs as useWebSocket, ge as useWindowSize, hs as useZodForm, ys as validateCNPJ, bs as validateCPF, ps as validateForm, Er as visibleTurns, Ei as withTimeout, Oi as writeXlsx, ms as zodResolver };
@@ -1,2 +1,2 @@
1
- function e(e){return new Intl.NumberFormat(`pt-BR`,{style:`currency`,currency:`BRL`}).format(e)}function t(e){let t=typeof e==`string`?new Date(e):e;return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(`pt-BR`).format(t)}function n(e){if(typeof e==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let t=typeof e==`string`?new Date(e):e;if(Number.isNaN(t.getTime()))return``;let n=`${t.getMonth()+1}`.padStart(2,`0`),r=`${t.getDate()}`.padStart(2,`0`);return`${t.getFullYear()}-${n}-${r}`}function r(e){let t=typeof e==`string`?new Date(e):e;return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(`pt-BR`,{dateStyle:`short`,timeStyle:`short`}).format(t)}function i(e){let t=e.replace(/\D/g,``).slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,`($1) $2`).replace(/(\d{4})(\d)/,`$1-$2`):t.replace(/(\d{2})(\d)/,`($1) $2`).replace(/(\d{5})(\d)/,`$1-$2`)}function a(e){return e.replace(/\D/g,``).slice(0,11).replace(/(\d{3})(\d)/,`$1.$2`).replace(/(\d{3})(\d)/,`$1.$2`).replace(/(\d{3})(\d{1,2})$/,`$1-$2`)}function o(e){return new Intl.NumberFormat(`pt-BR`,{style:`percent`,minimumFractionDigits:1,maximumFractionDigits:1}).format(e)}exports.formatCPF=a,exports.formatCurrency=e,exports.formatDate=t,exports.formatDateForInput=n,exports.formatDateTime=r,exports.formatPercent=o,exports.formatPhone=i;
1
+ function e(e){return new Intl.NumberFormat(`pt-BR`,{style:`currency`,currency:`BRL`}).format(e)}function t(e){let t=typeof e==`string`?new Date(e):e;return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(`pt-BR`).format(t)}function n(e){if(typeof e==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e))return e;let t=typeof e==`string`?new Date(e):e;if(Number.isNaN(t.getTime()))return``;let n=`${t.getMonth()+1}`.padStart(2,`0`),r=`${t.getDate()}`.padStart(2,`0`);return`${t.getFullYear()}-${n}-${r}`}function r(e){let t=typeof e==`string`?new Date(e):e;return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(`pt-BR`,{dateStyle:`short`,timeStyle:`short`}).format(t)}function i(e,t={}){let n=e.replace(/\D/g,``).slice(0,11);if(!t.mobile)return n.length<=10?n.replace(/(\d{2})(\d)/,`($1) $2`).replace(/(\d{4})(\d)/,`$1-$2`):n.replace(/(\d{2})(\d)/,`($1) $2`).replace(/(\d{5})(\d)/,`$1-$2`);if(n.length<=2)return n;let r=n.slice(0,2),i=n.slice(2);i[0]!==`9`&&(i=`9${i}`),i=i.slice(0,9);let a=i.slice(0,5),o=i.slice(5);return o?`(${r}) ${a}-${o}`:`(${r}) ${a}`}function a(e){return e.replace(/\D/g,``).slice(0,11).replace(/(\d{3})(\d)/,`$1.$2`).replace(/(\d{3})(\d)/,`$1.$2`).replace(/(\d{3})(\d{1,2})$/,`$1-$2`)}function o(e){return new Intl.NumberFormat(`pt-BR`,{style:`percent`,minimumFractionDigits:1,maximumFractionDigits:1}).format(e)}exports.formatCPF=a,exports.formatCurrency=e,exports.formatDate=t,exports.formatDateForInput=n,exports.formatDateTime=r,exports.formatPercent=o,exports.formatPhone=i;
2
2
  //# sourceMappingURL=format.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.cjs","names":[],"sources":["../../src/utils/format.ts"],"sourcesContent":["/**\n * Format a number as Brazilian Real currency.\n *\n * @param value - The amount in BRL.\n * @returns A locale-formatted string, e.g. \"R$ 1.234,56\".\n */\nexport function formatCurrency(value: number): string {\n return new Intl.NumberFormat(\"pt-BR\", {\n style: \"currency\",\n currency: \"BRL\",\n }).format(value);\n}\n\n/**\n * Format an ISO date or Date instance as `dd/MM/yyyy`.\n *\n * @param value - ISO string or Date.\n * @returns Formatted date string, or empty string when input is invalid.\n */\nexport function formatDate(value: string | Date): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(\"pt-BR\").format(date);\n}\n\n/**\n * Format an ISO date or Date instance as `yyyy-MM-dd`, the value an\n * `<input type=\"date\">` accepts.\n *\n * Built from the **local** calendar parts rather than `toISOString().slice(0, 10)`,\n * which is the reflex and which is wrong: `toISOString` converts to UTC first, so\n * anything after 21:00 in UTC-3 reports the next day and the form opens on the\n * wrong date. `formatDate` cannot fill this role because a date input rejects\n * `dd/MM/yyyy` outright.\n *\n * A value that is already `yyyy-MM-dd` is returned untouched, and that shortcut\n * is load-bearing rather than an optimisation: `new Date(\"2026-05-16\")` is parsed\n * as **UTC** midnight, which in UTC-3 is the 15th at 21:00, so round-tripping the\n * exact value a backend sent would move it back a day.\n *\n * @example\n * <input type=\"date\" defaultValue={formatDateForInput(order.createdAt)} />\n *\n * @param value - ISO string or Date.\n * @returns The `yyyy-MM-dd` value, or an empty string when the input is invalid —\n * which is what a date input reads as \"no value\", unlike `\"Invalid Date\"`.\n */\nexport function formatDateForInput(value: string | Date): string {\n if (typeof value === \"string\" && /^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return value;\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\n/**\n * Format an ISO date or Date instance as `dd/MM/yyyy HH:mm`.\n *\n * @param value - ISO string or Date.\n * @returns Formatted datetime string, or empty string when input is invalid.\n */\nexport function formatDateTime(value: string | Date): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(\"pt-BR\", {\n dateStyle: \"short\",\n timeStyle: \"short\",\n }).format(date);\n}\n\n/**\n * Apply the Brazilian phone mask `(XX) XXXXX-XXXX` or `(XX) XXXX-XXXX`.\n *\n * @param value - Raw digits or partially masked string.\n * @returns Masked phone string.\n */\nexport function formatPhone(value: string): string {\n const digits = value.replace(/\\D/g, \"\").slice(0, 11);\n if (digits.length <= 10) {\n return digits.replace(/(\\d{2})(\\d)/, \"($1) $2\").replace(/(\\d{4})(\\d)/, \"$1-$2\");\n }\n return digits.replace(/(\\d{2})(\\d)/, \"($1) $2\").replace(/(\\d{5})(\\d)/, \"$1-$2\");\n}\n\n/**\n * Apply the Brazilian CPF mask `XXX.XXX.XXX-XX`.\n *\n * @param value - Raw digits or partially masked string.\n * @returns Masked CPF string.\n */\nexport function formatCPF(value: string): string {\n return value\n .replace(/\\D/g, \"\")\n .slice(0, 11)\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\n .replace(/(\\d{3})(\\d{1,2})$/, \"$1-$2\");\n}\n\n/**\n * Format a fraction (0-1) as a percentage with one decimal.\n *\n * @param value - Fraction between 0 and 1.\n * @returns Formatted percent string, e.g. \"12,5%\".\n */\nexport function formatPercent(value: number): string {\n return new Intl.NumberFormat(\"pt-BR\", {\n style: \"percent\",\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n }).format(value);\n}\n"],"mappings":"AAMA,SAAgB,EAAe,EAAuB,CAClD,OAAO,IAAI,KAAK,aAAa,QAAS,CAClC,MAAO,WACP,SAAU,KACd,CAAC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O,CAAC,CAC/B,QAAQ,cAAe,OAAO,CAAC,CAC/B,QAAQ,oBAAqB,OAAO,CAC7C,CAQA,SAAgB,EAAc,EAAuB,CACjD,OAAO,IAAI,KAAK,aAAa,QAAS,CAClC,MAAO,UACP,sBAAuB,EACvB,sBAAuB,CAC3B,CAAC,CAAC,CAAC,OAAO,CAAK,CACnB"}
1
+ {"version":3,"file":"format.cjs","names":[],"sources":["../../src/utils/format.ts"],"sourcesContent":["/**\n * Format a number as Brazilian Real currency.\n *\n * @param value - The amount in BRL.\n * @returns A locale-formatted string, e.g. \"R$ 1.234,56\".\n */\nexport function formatCurrency(value: number): string {\n return new Intl.NumberFormat(\"pt-BR\", {\n style: \"currency\",\n currency: \"BRL\",\n }).format(value);\n}\n\n/**\n * Format an ISO date or Date instance as `dd/MM/yyyy`.\n *\n * @param value - ISO string or Date.\n * @returns Formatted date string, or empty string when input is invalid.\n */\nexport function formatDate(value: string | Date): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(\"pt-BR\").format(date);\n}\n\n/**\n * Format an ISO date or Date instance as `yyyy-MM-dd`, the value an\n * `<input type=\"date\">` accepts.\n *\n * Built from the **local** calendar parts rather than `toISOString().slice(0, 10)`,\n * which is the reflex and which is wrong: `toISOString` converts to UTC first, so\n * anything after 21:00 in UTC-3 reports the next day and the form opens on the\n * wrong date. `formatDate` cannot fill this role because a date input rejects\n * `dd/MM/yyyy` outright.\n *\n * A value that is already `yyyy-MM-dd` is returned untouched, and that shortcut\n * is load-bearing rather than an optimisation: `new Date(\"2026-05-16\")` is parsed\n * as **UTC** midnight, which in UTC-3 is the 15th at 21:00, so round-tripping the\n * exact value a backend sent would move it back a day.\n *\n * @example\n * <input type=\"date\" defaultValue={formatDateForInput(order.createdAt)} />\n *\n * @param value - ISO string or Date.\n * @returns The `yyyy-MM-dd` value, or an empty string when the input is invalid —\n * which is what a date input reads as \"no value\", unlike `\"Invalid Date\"`.\n */\nexport function formatDateForInput(value: string | Date): string {\n if (typeof value === \"string\" && /^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return value;\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\n/**\n * Format an ISO date or Date instance as `dd/MM/yyyy HH:mm`.\n *\n * @param value - ISO string or Date.\n * @returns Formatted datetime string, or empty string when input is invalid.\n */\nexport function formatDateTime(value: string | Date): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(\"pt-BR\", {\n dateStyle: \"short\",\n timeStyle: \"short\",\n }).format(date);\n}\n\nexport interface FormatPhoneOptions {\n /**\n * Treat the number as a mobile line: insert the mandatory `9` after the area\n * code when it is missing, and group the subscriber part `5+4` from the\n * first digit typed instead of waiting for the eleventh.\n *\n * Default `false`, which keeps the length-based behaviour: `4+4` up to ten\n * digits, `5+4` at eleven.\n */\n mobile?: boolean;\n}\n\n/**\n * Apply the Brazilian phone mask `(XX) XXXXX-XXXX` or `(XX) XXXX-XXXX`.\n *\n * By default the grouping is decided by **length**, which is what a field\n * accepting both landlines and mobiles needs.\n *\n * `mobile: true` is for a field that only accepts mobile numbers, and it exists\n * because the default is wrong as an as-you-type mask there. Reading anything up\n * to ten digits as a landline puts the hyphen after the fourth subscriber digit,\n * so a half-typed mobile renders `(11) 9123-4`; it only becomes `(11) 91234-5`\n * once the eleventh digit lands. The separator visibly jumps backwards while the\n * user is still typing. With `mobile`, the same input reads `(11) 91234` and the\n * hyphen never moves. It also inserts the leading `9` every Brazilian mobile\n * carries, so a ten-digit number gets corrected rather than masked as a landline.\n *\n * @param value - Raw digits or partially masked string.\n * @param options - Masking options.\n * @returns Masked phone string.\n *\n * @example\n * formatPhone(\"1191234\"); // \"(11) 9123-4\"\n * formatPhone(\"1191234\", { mobile: true }); // \"(11) 91234\"\n * formatPhone(\"1112345678\", { mobile: true }); // \"(11) 91234-5678\" — 9 inserted\n */\nexport function formatPhone(value: string, options: FormatPhoneOptions = {}): string {\n const digits = value.replace(/\\D/g, \"\").slice(0, 11);\n\n if (!options.mobile) {\n if (digits.length <= 10) {\n return digits.replace(/(\\d{2})(\\d)/, \"($1) $2\").replace(/(\\d{4})(\\d)/, \"$1-$2\");\n }\n return digits.replace(/(\\d{2})(\\d)/, \"($1) $2\").replace(/(\\d{5})(\\d)/, \"$1-$2\");\n }\n\n if (digits.length <= 2) return digits;\n\n const area = digits.slice(0, 2);\n let subscriber = digits.slice(2);\n if (subscriber[0] !== \"9\") subscriber = `9${subscriber}`;\n subscriber = subscriber.slice(0, 9);\n\n const prefix = subscriber.slice(0, 5);\n const suffix = subscriber.slice(5);\n return suffix ? `(${area}) ${prefix}-${suffix}` : `(${area}) ${prefix}`;\n}\n\n/**\n * Apply the Brazilian CPF mask `XXX.XXX.XXX-XX`.\n *\n * @param value - Raw digits or partially masked string.\n * @returns Masked CPF string.\n */\nexport function formatCPF(value: string): string {\n return value\n .replace(/\\D/g, \"\")\n .slice(0, 11)\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\n .replace(/(\\d{3})(\\d{1,2})$/, \"$1-$2\");\n}\n\n/**\n * Format a fraction (0-1) as a percentage with one decimal.\n *\n * @param value - Fraction between 0 and 1.\n * @returns Formatted percent string, e.g. \"12,5%\".\n */\nexport function formatPercent(value: number): string {\n return new Intl.NumberFormat(\"pt-BR\", {\n style: \"percent\",\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n }).format(value);\n}\n"],"mappings":"AAMA,SAAgB,EAAe,EAAuB,CAClD,OAAO,IAAI,KAAK,aAAa,QAAS,CAClC,MAAO,WACP,SAAU,KACd,CAAC,CAAC,CAAC,OAAO,CAAK,CACnB,CAQA,SAAg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AAO,MAAK,EAAa,IAAI,KAC5C,EAAa,EAAW,MAAM,EAAG,CAAC,EAElC,IAAM,EAAS,EAAW,MAAM,EAAG,CAAC,EAC9B,EAAS,EAAW,MAAM,CAAC,EACjC,OAAO,EAAS,IAAI,EAAK,IAAI,EAAO,GAAG,IAAW,IAAI,EAAK,IAAI,GACnE,CAQA,SAAgB,EAAU,EAAuB,CAC7C,OAAO,EACF,QAAQ,MAAO,EAAE,CAAC,CAClB,MAAM,EAAG,EAAE,CAAC,CACZ,QAAQ,cAAe,OAAO,CAAC,CAC/B,QAAQ,cAAe,OAAO,CAAC,CAC/B,QAAQ,oBAAqB,OAAO,CAC7C,CAQA,SAAgB,EAAc,EAAuB,CACjD,OAAO,IAAI,KAAK,aAAa,QAAS,CAClC,MAAO,UACP,sBAAuB,EACvB,sBAAuB,CAC3B,CAAC,CAAC,CAAC,OAAO,CAAK,CACnB"}
@@ -23,9 +23,14 @@ function r(e) {
23
23
  timeStyle: "short"
24
24
  }).format(t);
25
25
  }
26
- function i(e) {
27
- let t = e.replace(/\D/g, "").slice(0, 11);
28
- return t.length <= 10 ? t.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2") : t.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2");
26
+ function i(e, t = {}) {
27
+ let n = e.replace(/\D/g, "").slice(0, 11);
28
+ if (!t.mobile) return n.length <= 10 ? n.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2") : n.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2");
29
+ if (n.length <= 2) return n;
30
+ let r = n.slice(0, 2), i = n.slice(2);
31
+ i[0] !== "9" && (i = `9${i}`), i = i.slice(0, 9);
32
+ let a = i.slice(0, 5), o = i.slice(5);
33
+ return o ? `(${r}) ${a}-${o}` : `(${r}) ${a}`;
29
34
  }
30
35
  function a(e) {
31
36
  return e.replace(/\D/g, "").slice(0, 11).replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2");
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","names":[],"sources":["../../src/utils/format.ts"],"sourcesContent":["/**\n * Format a number as Brazilian Real currency.\n *\n * @param value - The amount in BRL.\n * @returns A locale-formatted string, e.g. \"R$ 1.234,56\".\n */\nexport function formatCurrency(value: number): string {\n return new Intl.NumberFormat(\"pt-BR\", {\n style: \"currency\",\n currency: \"BRL\",\n }).format(value);\n}\n\n/**\n * Format an ISO date or Date instance as `dd/MM/yyyy`.\n *\n * @param value - ISO string or Date.\n * @returns Formatted date string, or empty string when input is invalid.\n */\nexport function formatDate(value: string | Date): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(\"pt-BR\").format(date);\n}\n\n/**\n * Format an ISO date or Date instance as `yyyy-MM-dd`, the value an\n * `<input type=\"date\">` accepts.\n *\n * Built from the **local** calendar parts rather than `toISOString().slice(0, 10)`,\n * which is the reflex and which is wrong: `toISOString` converts to UTC first, so\n * anything after 21:00 in UTC-3 reports the next day and the form opens on the\n * wrong date. `formatDate` cannot fill this role because a date input rejects\n * `dd/MM/yyyy` outright.\n *\n * A value that is already `yyyy-MM-dd` is returned untouched, and that shortcut\n * is load-bearing rather than an optimisation: `new Date(\"2026-05-16\")` is parsed\n * as **UTC** midnight, which in UTC-3 is the 15th at 21:00, so round-tripping the\n * exact value a backend sent would move it back a day.\n *\n * @example\n * <input type=\"date\" defaultValue={formatDateForInput(order.createdAt)} />\n *\n * @param value - ISO string or Date.\n * @returns The `yyyy-MM-dd` value, or an empty string when the input is invalid —\n * which is what a date input reads as \"no value\", unlike `\"Invalid Date\"`.\n */\nexport function formatDateForInput(value: string | Date): string {\n if (typeof value === \"string\" && /^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return value;\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\n/**\n * Format an ISO date or Date instance as `dd/MM/yyyy HH:mm`.\n *\n * @param value - ISO string or Date.\n * @returns Formatted datetime string, or empty string when input is invalid.\n */\nexport function formatDateTime(value: string | Date): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(\"pt-BR\", {\n dateStyle: \"short\",\n timeStyle: \"short\",\n }).format(date);\n}\n\n/**\n * Apply the Brazilian phone mask `(XX) XXXXX-XXXX` or `(XX) XXXX-XXXX`.\n *\n * @param value - Raw digits or partially masked string.\n * @returns Masked phone string.\n */\nexport function formatPhone(value: string): string {\n const digits = value.replace(/\\D/g, \"\").slice(0, 11);\n if (digits.length <= 10) {\n return digits.replace(/(\\d{2})(\\d)/, \"($1) $2\").replace(/(\\d{4})(\\d)/, \"$1-$2\");\n }\n return digits.replace(/(\\d{2})(\\d)/, \"($1) $2\").replace(/(\\d{5})(\\d)/, \"$1-$2\");\n}\n\n/**\n * Apply the Brazilian CPF mask `XXX.XXX.XXX-XX`.\n *\n * @param value - Raw digits or partially masked string.\n * @returns Masked CPF string.\n */\nexport function formatCPF(value: string): string {\n return value\n .replace(/\\D/g, \"\")\n .slice(0, 11)\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\n .replace(/(\\d{3})(\\d{1,2})$/, \"$1-$2\");\n}\n\n/**\n * Format a fraction (0-1) as a percentage with one decimal.\n *\n * @param value - Fraction between 0 and 1.\n * @returns Formatted percent string, e.g. \"12,5%\".\n */\nexport function formatPercent(value: number): string {\n return new Intl.NumberFormat(\"pt-BR\", {\n style: \"percent\",\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n }).format(value);\n}\n"],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AAuB;CAC7C,OAAO,EACF,QAAQ,OAAO,EAAE,CAAC,CAClB,MAAM,GAAG,EAAE,CAAC,CACZ,QAAQ,eAAe,OAAO,CAAC,CAC/B,QAAQ,eAAe,OAAO,CAAC,CAC/B,QAAQ,qBAAqB,OAAO;AAC7C;AAQA,SAAgB,EAAc,GAAuB;CACjD,OAAO,IAAI,KAAK,aAAa,SAAS;EAClC,OAAO;EACP,uBAAuB;EACvB,uBAAuB;CAC3B,CAAC,CAAC,CAAC,OAAO,CAAK;AACnB"}
1
+ {"version":3,"file":"format.js","names":[],"sources":["../../src/utils/format.ts"],"sourcesContent":["/**\n * Format a number as Brazilian Real currency.\n *\n * @param value - The amount in BRL.\n * @returns A locale-formatted string, e.g. \"R$ 1.234,56\".\n */\nexport function formatCurrency(value: number): string {\n return new Intl.NumberFormat(\"pt-BR\", {\n style: \"currency\",\n currency: \"BRL\",\n }).format(value);\n}\n\n/**\n * Format an ISO date or Date instance as `dd/MM/yyyy`.\n *\n * @param value - ISO string or Date.\n * @returns Formatted date string, or empty string when input is invalid.\n */\nexport function formatDate(value: string | Date): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(\"pt-BR\").format(date);\n}\n\n/**\n * Format an ISO date or Date instance as `yyyy-MM-dd`, the value an\n * `<input type=\"date\">` accepts.\n *\n * Built from the **local** calendar parts rather than `toISOString().slice(0, 10)`,\n * which is the reflex and which is wrong: `toISOString` converts to UTC first, so\n * anything after 21:00 in UTC-3 reports the next day and the form opens on the\n * wrong date. `formatDate` cannot fill this role because a date input rejects\n * `dd/MM/yyyy` outright.\n *\n * A value that is already `yyyy-MM-dd` is returned untouched, and that shortcut\n * is load-bearing rather than an optimisation: `new Date(\"2026-05-16\")` is parsed\n * as **UTC** midnight, which in UTC-3 is the 15th at 21:00, so round-tripping the\n * exact value a backend sent would move it back a day.\n *\n * @example\n * <input type=\"date\" defaultValue={formatDateForInput(order.createdAt)} />\n *\n * @param value - ISO string or Date.\n * @returns The `yyyy-MM-dd` value, or an empty string when the input is invalid —\n * which is what a date input reads as \"no value\", unlike `\"Invalid Date\"`.\n */\nexport function formatDateForInput(value: string | Date): string {\n if (typeof value === \"string\" && /^\\d{4}-\\d{2}-\\d{2}$/.test(value)) return value;\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\n/**\n * Format an ISO date or Date instance as `dd/MM/yyyy HH:mm`.\n *\n * @param value - ISO string or Date.\n * @returns Formatted datetime string, or empty string when input is invalid.\n */\nexport function formatDateTime(value: string | Date): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(\"pt-BR\", {\n dateStyle: \"short\",\n timeStyle: \"short\",\n }).format(date);\n}\n\nexport interface FormatPhoneOptions {\n /**\n * Treat the number as a mobile line: insert the mandatory `9` after the area\n * code when it is missing, and group the subscriber part `5+4` from the\n * first digit typed instead of waiting for the eleventh.\n *\n * Default `false`, which keeps the length-based behaviour: `4+4` up to ten\n * digits, `5+4` at eleven.\n */\n mobile?: boolean;\n}\n\n/**\n * Apply the Brazilian phone mask `(XX) XXXXX-XXXX` or `(XX) XXXX-XXXX`.\n *\n * By default the grouping is decided by **length**, which is what a field\n * accepting both landlines and mobiles needs.\n *\n * `mobile: true` is for a field that only accepts mobile numbers, and it exists\n * because the default is wrong as an as-you-type mask there. Reading anything up\n * to ten digits as a landline puts the hyphen after the fourth subscriber digit,\n * so a half-typed mobile renders `(11) 9123-4`; it only becomes `(11) 91234-5`\n * once the eleventh digit lands. The separator visibly jumps backwards while the\n * user is still typing. With `mobile`, the same input reads `(11) 91234` and the\n * hyphen never moves. It also inserts the leading `9` every Brazilian mobile\n * carries, so a ten-digit number gets corrected rather than masked as a landline.\n *\n * @param value - Raw digits or partially masked string.\n * @param options - Masking options.\n * @returns Masked phone string.\n *\n * @example\n * formatPhone(\"1191234\"); // \"(11) 9123-4\"\n * formatPhone(\"1191234\", { mobile: true }); // \"(11) 91234\"\n * formatPhone(\"1112345678\", { mobile: true }); // \"(11) 91234-5678\" — 9 inserted\n */\nexport function formatPhone(value: string, options: FormatPhoneOptions = {}): string {\n const digits = value.replace(/\\D/g, \"\").slice(0, 11);\n\n if (!options.mobile) {\n if (digits.length <= 10) {\n return digits.replace(/(\\d{2})(\\d)/, \"($1) $2\").replace(/(\\d{4})(\\d)/, \"$1-$2\");\n }\n return digits.replace(/(\\d{2})(\\d)/, \"($1) $2\").replace(/(\\d{5})(\\d)/, \"$1-$2\");\n }\n\n if (digits.length <= 2) return digits;\n\n const area = digits.slice(0, 2);\n let subscriber = digits.slice(2);\n if (subscriber[0] !== \"9\") subscriber = `9${subscriber}`;\n subscriber = subscriber.slice(0, 9);\n\n const prefix = subscriber.slice(0, 5);\n const suffix = subscriber.slice(5);\n return suffix ? `(${area}) ${prefix}-${suffix}` : `(${area}) ${prefix}`;\n}\n\n/**\n * Apply the Brazilian CPF mask `XXX.XXX.XXX-XX`.\n *\n * @param value - Raw digits or partially masked string.\n * @returns Masked CPF string.\n */\nexport function formatCPF(value: string): string {\n return value\n .replace(/\\D/g, \"\")\n .slice(0, 11)\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\n .replace(/(\\d{3})(\\d)/, \"$1.$2\")\n .replace(/(\\d{3})(\\d{1,2})$/, \"$1-$2\");\n}\n\n/**\n * Format a fraction (0-1) as a percentage with one decimal.\n *\n * @param value - Fraction between 0 and 1.\n * @returns Formatted percent string, e.g. \"12,5%\".\n */\nexport function formatPercent(value: number): string {\n return new Intl.NumberFormat(\"pt-BR\", {\n style: \"percent\",\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n }).format(value);\n}\n"],"mappings":";AAMA,SAAgB,EAAe,GAAuB;CAClD,OAAO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AAG,OAAO;CAE/B,IAAM,IAAO,EAAO,MAAM,GAAG,CAAC,GAC1B,IAAa,EAAO,MAAM,CAAC;CAE/B,AADI,EAAW,OAAO,QAAK,IAAa,IAAI,MAC5C,IAAa,EAAW,MAAM,GAAG,CAAC;CAElC,IAAM,IAAS,EAAW,MAAM,GAAG,CAAC,GAC9B,IAAS,EAAW,MAAM,CAAC;CACjC,OAAO,IAAS,IAAI,EAAK,IAAI,EAAO,GAAG,MAAW,IAAI,EAAK,IAAI;AACnE;AAQA,SAAgB,EAAU,GAAuB;CAC7C,OAAO,EACF,QAAQ,OAAO,EAAE,CAAC,CAClB,MAAM,GAAG,EAAE,CAAC,CACZ,QAAQ,eAAe,OAAO,CAAC,CAC/B,QAAQ,eAAe,OAAO,CAAC,CAC/B,QAAQ,qBAAqB,OAAO;AAC7C;AAQA,SAAgB,EAAc,GAAuB;CACjD,OAAO,IAAI,KAAK,aAAa,SAAS;EAClC,OAAO;EACP,uBAAuB;EACvB,uBAAuB;CAC3B,CAAC,CAAC,CAAC,OAAO,CAAK;AACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tempest-react-sdk",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "description": "SDK público da Tempest com componentes, hooks e integrações para projetos React.",
5
5
  "type": "module",
6
6
  "license": "MIT",