@lerx/promise-modal 0.0.1 → 0.0.3

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 (35) hide show
  1. package/dist/{types → @aileron/types}/function.d.ts +4 -4
  2. package/dist/@aileron/types/index.d.ts +4 -0
  3. package/dist/@aileron/types/object.d.ts +11 -0
  4. package/dist/{types/units.d.ts → @aileron/types/unit.d.ts} +4 -6
  5. package/dist/@aileron/types/utility.d.ts +39 -0
  6. package/dist/app/ModalManager.d.ts.map +1 -1
  7. package/dist/app/constant.d.ts +3 -2
  8. package/dist/app/constant.d.ts.map +1 -1
  9. package/dist/core/handle/alert.d.ts +1 -1
  10. package/dist/core/handle/alert.d.ts.map +1 -1
  11. package/dist/core/node/ModalNode/AbstractBaseNode.d.ts +1 -0
  12. package/dist/core/node/ModalNode/AbstractBaseNode.d.ts.map +1 -1
  13. package/dist/hooks/useDestroyAfter.d.ts +1 -0
  14. package/dist/hooks/useDestroyAfter.d.ts.map +1 -1
  15. package/dist/index.cjs.js +2 -2
  16. package/dist/index.cjs.js.map +1 -1
  17. package/dist/index.esm.js +2 -2
  18. package/dist/index.esm.js.map +1 -1
  19. package/dist/providers/ModalContext/ModalContext.d.ts +2 -1
  20. package/dist/providers/ModalContext/ModalContext.d.ts.map +1 -1
  21. package/dist/providers/ModalContext/ModalContextProvider.d.ts +1 -0
  22. package/dist/providers/ModalContext/ModalContextProvider.d.ts.map +1 -1
  23. package/dist/providers/ModalContext/useModalContext.d.ts +4 -4
  24. package/dist/providers/ModalContext/useModalContext.d.ts.map +1 -1
  25. package/dist/providers/ModalDataContext/ModalDataContext.d.ts +1 -0
  26. package/dist/providers/ModalDataContext/ModalDataContext.d.ts.map +1 -1
  27. package/dist/providers/ModalDataContext/ModalDataContextProvider.d.ts.map +1 -1
  28. package/dist/types/modal.d.ts +1 -0
  29. package/dist/types/modal.d.ts.map +1 -1
  30. package/dist/types/prompt.d.ts +1 -0
  31. package/dist/types/prompt.d.ts.map +1 -1
  32. package/package.json +8 -10
  33. package/dist/types/object.d.ts +0 -14
  34. package/dist/types/styles.d.ts +0 -4
  35. package/dist/types/utility.d.ts +0 -45
@@ -1,16 +1,16 @@
1
- declare interface Fn<Params extends Array<any> = [], Return = void> {
1
+ export interface Fn<Params extends Array<any> = [], Return = void> {
2
2
  (...props: Params): Return;
3
3
  }
4
4
 
5
- declare interface AsyncFn<Params extends Array<any>, Return = void> {
5
+ export interface AsyncFn<Params extends Array<any>, Return = void> {
6
6
  (...props: Params): Promise<Return>;
7
7
  }
8
8
 
9
- declare type SetStateFn<S = unknown> = (
9
+ export type SetStateFn<S = unknown> = (
10
10
  value: S | ((prevState: S) => S),
11
11
  ) => void;
12
12
 
13
- declare type Parameter<
13
+ export type Parameter<
14
14
  F extends Fn<[any]> | SetStateFn<any> | undefined,
15
15
  I extends number = 0,
16
16
  > = Parameters<NonNullable<F>>[I];
@@ -0,0 +1,4 @@
1
+ export * from './function';
2
+ export * from './object';
3
+ export * from './utility';
4
+ export * from './unit';
@@ -0,0 +1,11 @@
1
+ export type Dictionary<T = any> = Record<string, T>;
2
+
3
+ export type StringDictionary = Dictionary<string>;
4
+
5
+ export type DeepRequired<T> = {
6
+ [P in keyof T]-?: NonNullable<T[P]> extends object
7
+ ? NonNullable<T[P]> extends any[]
8
+ ? DeepRequired<NonNullable<T[P]>[number]>[]
9
+ : DeepRequired<NonNullable<T[P]>>
10
+ : T[P];
11
+ };
@@ -1,4 +1,4 @@
1
- declare type DomSize =
1
+ export type DomSize =
2
2
  | number
3
3
  | `${number}%`
4
4
  | `${number}px`
@@ -8,14 +8,12 @@ declare type DomSize =
8
8
  | `${number}vw`
9
9
  | `calc(${string})`;
10
10
 
11
- declare type Color =
11
+ export type Color =
12
12
  | `#${string}`
13
13
  | `rgb(${number}, ${number}, ${number})`
14
14
  | `rgba(${number}, ${number}, ${number}, ${number})`
15
15
  | `var(--${string})`;
16
16
 
17
- declare type Duration = `${number}ms` | `${number}s`;
17
+ export type Time = `${number}ms` | `${number}s`;
18
18
 
19
- declare type Params<T extends Array<string>> = Record<T[number], string>;
20
-
21
- declare type Roll<T> = { [K in keyof T]: T[K] };
19
+ export type Duration = `${number}ms`;
@@ -0,0 +1,39 @@
1
+ export type Nullish<T> = T | null | undefined;
2
+
3
+ /** T에서 key in K를 추출하고, 이를 Required로 설정 */
4
+ export type PickRequired<T, K extends keyof T> = Required<Pick<T, K>>;
5
+
6
+ /** T에서 key in K를 추출하고, 이를 Partial로 설정 */
7
+ export type PickPartial<T, K extends keyof T> = Partial<Pick<T, K>>;
8
+
9
+ /** T에서 key in K를 제거하고, 나머지를 Required로 설정 */
10
+ export type OmitRequired<T, K extends keyof T> = Required<Omit<T, K>>;
11
+
12
+ /** T에서 key in K를 제거하고, 나머지를 Partial로 설정 */
13
+ export type OmitPartial<T, K extends keyof T> = Partial<Omit<T, K>>;
14
+
15
+ /** T에서 key in K는 Required로 설정하고, 나머지는 Partial로 설정 */
16
+ export type PickAndPartial<T, K extends keyof T> = PickRequired<T, K> &
17
+ OmitPartial<T, K>;
18
+
19
+ /** T에서 K를 Required로 설정하고, 나머지는 유지 */
20
+ export type RequiredBy<T, K extends keyof T> = PickRequired<T, K> & T;
21
+
22
+ /** T에서 K를 Partial로 설정하고, 나머지는 유지 */
23
+ export type PartialBy<T, K extends keyof T> = PickPartial<T, K> & Omit<T, K>;
24
+
25
+ export type Roll<T> = { [K in keyof T]: T[K] };
26
+
27
+ export type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
28
+
29
+ export type ExpandRecursively<T> = T extends object
30
+ ? T extends infer O
31
+ ? { [K in keyof O]: ExpandRecursively<O[K]> }
32
+ : never
33
+ : T;
34
+
35
+ export type WithKey<T> = T & { key: string };
36
+
37
+ export type ElementOf<T extends any[]> = T[number];
38
+
39
+ export type Params<T extends Array<string>> = Record<T[number], string>;
@@ -1 +1 @@
1
- {"version":3,"file":"ModalManager.d.ts","sourceRoot":"","sources":["../../src/app/ModalManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,eAAO,MAAM,YAAY;;;gBAOX,KAAK;oBAGD,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;iBAGzB,MAAM,mBAA2B,WAAW;CAW1D,CAAC"}
1
+ {"version":3,"file":"ModalManager.d.ts","sourceRoot":"","sources":["../../src/app/ModalManager.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,eAAO,MAAM,YAAY;;;gBAOX,KAAK;oBAGD,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;iBAGzB,MAAM,mBAA2B,WAAW;CAW1D,CAAC"}
@@ -1,3 +1,4 @@
1
- export declare const DEFAULT_ANIMATION_DURATION = "300ms";
2
- export declare const DEFAULT_BACKDROP_COLOR = "rgba(0, 0, 0, 0.5)";
1
+ import type { Color, Duration } from '../@aileron/types';
2
+ export declare const DEFAULT_ANIMATION_DURATION: Duration;
3
+ export declare const DEFAULT_BACKDROP_COLOR: Color;
3
4
  //# sourceMappingURL=constant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/app/constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,UAAU,CAAC;AAElD,eAAO,MAAM,sBAAsB,uBAAuB,CAAC"}
1
+ {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/app/constant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,0BAA0B,EAAE,QAAkB,CAAC;AAE5D,eAAO,MAAM,sBAAsB,EAAE,KAA4B,CAAC"}
@@ -2,7 +2,7 @@ import type { ComponentType, ReactNode } from 'react';
2
2
  import type { AlertContentProps, AlertFooterRender, FooterOptions, ModalBackground } from '../../types';
3
3
  interface AlertProps<B> {
4
4
  subtype?: 'info' | 'success' | 'warning' | 'error';
5
- title: string;
5
+ title?: ReactNode;
6
6
  subtitle?: ReactNode;
7
7
  content?: ReactNode | ComponentType<AlertContentProps>;
8
8
  background?: ModalBackground<B>;
@@ -1 +1 @@
1
- {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/core/handle/alert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,UAAU,UAAU,CAAC,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACvD,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,EACH,iBAAiB,GACjB,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,aAAa,CAAC,GAC9C,KAAK,CAAC;IACV,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,yGASpB,UAAU,CAAC,CAAC,CAAC,kBAmBf,CAAC"}
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/core/handle/alert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,UAAU,UAAU,CAAC,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACnD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACvD,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,EACH,iBAAiB,GACjB,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,aAAa,CAAC,GAC9C,KAAK,CAAC;IACV,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,yGASpB,UAAU,CAAC,CAAC,CAAC,kBAmBf,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { Fn } from '../../../@aileron/types';
2
3
  import type { BaseModal, ManagedEntity, ModalBackground } from '../../../types';
3
4
  type BaseNodeProps<T, B> = BaseModal<T, B> & ManagedEntity;
4
5
  export declare abstract class BaseNode<T, B> {
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractBaseNode.d.ts","sourceRoot":"","sources":["../../../../src/core/node/ModalNode/AbstractBaseNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,KAAK,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,CAAC;AAE3D,8BAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC;;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAEzC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAGvC,IAAI,KAAK,YAER;IAED,IAAI,OAAO,YAEV;gBAKW,EACV,EAAE,EACF,SAAS,EACT,KAAK,EACL,QAAQ,EACR,UAAU,EACV,aAAqB,EACrB,oBAA2B,EAC3B,OAAO,GACR,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC;IActB,SAAS,CAAC,QAAQ,EAAE,EAAE;IAMtB,OAAO;IAGP,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI;IAGlC,SAAS;IAKT,MAAM;IAKN,MAAM;IAKN,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,QAAQ,CAAC,SAAS,IAAI,IAAI;CAC3B"}
1
+ {"version":3,"file":"AbstractBaseNode.d.ts","sourceRoot":"","sources":["../../../../src/core/node/ModalNode/AbstractBaseNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,KAAK,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,CAAC;AAE3D,8BAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC;;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAEzC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IAGvC,IAAI,KAAK,YAER;IAED,IAAI,OAAO,YAEV;gBAKW,EACV,EAAE,EACF,SAAS,EACT,KAAK,EACL,QAAQ,EACR,UAAU,EACV,aAAqB,EACrB,oBAA2B,EAC3B,OAAO,GACR,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC;IActB,SAAS,CAAC,QAAQ,EAAE,EAAE;IAMtB,OAAO;IAGP,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI;IAGlC,SAAS;IAKT,MAAM;IAKN,MAAM;IAKN,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,QAAQ,CAAC,SAAS,IAAI,IAAI;CAC3B"}
@@ -1,3 +1,4 @@
1
+ import type { Duration } from '../@aileron/types';
1
2
  import type { ModalNode } from '../core';
2
3
  export declare const useDestroyAfter: (modalId: ModalNode["id"], duration: Duration | number) => void;
3
4
  //# sourceMappingURL=useDestroyAfter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDestroyAfter.d.ts","sourceRoot":"","sources":["../../src/hooks/useDestroyAfter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMtD,eAAO,MAAM,eAAe,YACjB,SAAS,CAAC,IAAI,CAAC,YACd,QAAQ,GAAG,MAAM,SAuB5B,CAAC"}
1
+ {"version":3,"file":"useDestroyAfter.d.ts","sourceRoot":"","sources":["../../src/hooks/useDestroyAfter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMtD,eAAO,MAAM,eAAe,YACjB,SAAS,CAAC,IAAI,CAAC,YACd,QAAQ,GAAG,MAAM,SAuB5B,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react/jsx-runtime"),o=require("react"),t=require("react-dom"),n=require("clsx"),r=require("/Users/Vincent/Workspace/aileron/node_modules/style-inject/dist/style-inject.es.js");"function"==typeof SuppressedError&&SuppressedError;const i=e=>{const t=o.useRef(e);return t.current=e,t},l=e=>{const t=i(e);return o.useCallback(((...e)=>"function"!=typeof t.current?null:t.current(...e)),[t])},s=e=>{o.useEffect(e,[])},a=()=>{const[e,t]=o.useState(0);return[e,o.useCallback((()=>{t((e=>e+1))}),[])]},c=(e,t)=>e?o.isValidElement(e)?e:(e=>(e=>"function"==typeof e&&!(e.prototype&&e.prototype.isReactComponent))(e)||(e=>"object"==typeof e&&null!==e&&e.$$typeof===Symbol.for("react.memo"))(e)||(e=>!("function"!=typeof e||!e.prototype||!e.prototype.isReactComponent))(e))(e)?o.createElement(e,t):null:null,u=()=>{},d=e=>"string"==typeof e;"function"==typeof SuppressedError&&SuppressedError;const m={current:[]},b={current:e=>{m.current.push(e)}},p={current:null},f={get prerender(){return m.current},clearPrerender(){m.current=[]},open(e){b.current(e)},setupOpen(e){b.current=e},anchor(e,o="modal-anchor"){if(p.current){const e=document.getElementById(p.current.id);if(e)return e}const t=document.createElement(e);return t.setAttribute("id",`${o}-${`${Math.random()}`.slice(2)}`),document.body.appendChild(t),p.current=t,t}},C="300ms",h="rgba(0, 0, 0, 0.5)";var y="Background-module__active___Zi50h",g="Background-module__visible___tAN9F";r(".Background-module__root___zat-I{display:none;inset:0;pointer-events:none;position:fixed;z-index:-999}.Background-module__root___zat-I.Background-module__active___Zi50h{pointer-events:all!important}.Background-module__root___zat-I.Background-module__visible___tAN9F{align-items:center;display:flex;justify-content:center}.Background-module__root___zat-I>*{pointer-events:none}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkJhY2tncm91bmQubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxpQ0FDRSxZQUFhLENBRWIsT0FBUSxDQUVSLG1CQUFvQixDQUhwQixjQUFlLENBRWYsWUFFRixDQUVBLG1FQUNFLDRCQUNGLENBRUEsb0VBRUUsa0JBQW1CLENBRG5CLFlBQWEsQ0FFYixzQkFDRixDQUVBLG1DQUNFLG1CQUNGIiwiZmlsZSI6IkJhY2tncm91bmQubW9kdWxlLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5yb290IHtcbiAgZGlzcGxheTogbm9uZTtcbiAgcG9zaXRpb246IGZpeGVkO1xuICBpbnNldDogMDtcbiAgei1pbmRleDogLTk5OTtcbiAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG59XG5cbi5yb290LmFjdGl2ZSB7XG4gIHBvaW50ZXItZXZlbnRzOiBhbGwgIWltcG9ydGFudDtcbn1cblxuLnJvb3QudmlzaWJsZSB7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xufVxuXG4ucm9vdCA+ICoge1xuICBwb2ludGVyLWV2ZW50czogbm9uZTtcbn1cbiJdfQ== */");const v=({modalId:t,onChangeOrder:r})=>{const{BackgroundComponent:i}=re(),{modal:l,onClose:s,onChange:a,onConfirm:c,onDestroy:u}=P(t),d=o.useCallback((e=>{l&&l.closeOnBackdropClick&&l.visible&&s(),e.stopPropagation()}),[l,s]);if(!l)return null;const m=l.manualDestroy?l.alive:l.visible;return e.jsx("div",{className:n("Background-module__root___zat-I",{[g]:m,[y]:l.closeOnBackdropClick&&m}),onClick:d,children:i&&e.jsx(i,{id:l.id,type:l.type,alive:l.alive,visible:l.visible,initiator:l.initiator,manualDestroy:l.manualDestroy,closeOnBackdropClick:l.closeOnBackdropClick,background:l.background,onChange:a,onConfirm:c,onClose:s,onDestroy:u,onChangeOrder:r})})};var k="Foreground-module__active___f-kK8";r(".Foreground-module__root___Go3o8{display:none;inset:0;pointer-events:none;position:fixed;z-index:1}.Foreground-module__root___Go3o8.Foreground-module__active___f-kK8{align-items:center;display:flex!important;justify-content:center}.Foreground-module__root___Go3o8.Foreground-module__active___f-kK8>*{pointer-events:all!important}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkZvcmVncm91bmQubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxpQ0FFRSxZQUFhLENBRWIsT0FBUSxDQUhSLG1CQUFvQixDQUVwQixjQUFlLENBRWYsU0FDRixDQUVBLG1FQUdFLGtCQUFtQixDQUZuQixzQkFBd0IsQ0FDeEIsc0JBRUYsQ0FFQSxxRUFDRSw0QkFDRiIsImZpbGUiOiJGb3JlZ3JvdW5kLm1vZHVsZS5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIucm9vdCB7XG4gIHBvaW50ZXItZXZlbnRzOiBub25lO1xuICBkaXNwbGF5OiBub25lO1xuICBwb3NpdGlvbjogZml4ZWQ7XG4gIGluc2V0OiAwO1xuICB6LWluZGV4OiAxO1xufVxuXG4ucm9vdC5hY3RpdmUge1xuICBkaXNwbGF5OiBmbGV4ICFpbXBvcnRhbnQ7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICBhbGlnbi1pdGVtczogY2VudGVyO1xufVxuXG4ucm9vdC5hY3RpdmUgPiAqIHtcbiAgcG9pbnRlci1ldmVudHM6IGFsbCAhaW1wb3J0YW50O1xufVxuIl19 */");const x=o.memo((({modal:t,handlers:n})=>{const{title:r,subtitle:i,content:s,footer:a}=o.useMemo((()=>t),[t]),{onConfirm:u}=o.useMemo((()=>n),[n]),m=l(u),{TitleComponent:b,SubtitleComponent:p,ContentComponent:f,FooterComponent:C}=re();return e.jsxs(o.Fragment,{children:[r&&(d(r)?e.jsx(b,{children:r}):r),i&&(d(i)?e.jsx(p,{children:i}):i),s&&(d(s)?e.jsx(f,{children:s}):c(s,{onConfirm:m})),!1!==a&&("function"==typeof a?a({onConfirm:m}):e.jsx(C,{onConfirm:m,confirmLabel:a?.confirm,hideConfirm:a?.hideConfirm}))]})})),I=o.memo((({modal:t,handlers:n})=>{const{title:r,subtitle:i,content:s,footer:a}=o.useMemo((()=>t),[t]),{onConfirm:u,onClose:m}=o.useMemo((()=>n),[n]),b=l(u),p=l(m),{TitleComponent:f,SubtitleComponent:C,ContentComponent:h,FooterComponent:y}=re();return e.jsxs(o.Fragment,{children:[r&&(d(r)?e.jsx(f,{children:r}):r),i&&(d(i)?e.jsx(C,{children:i}):i),s&&(d(s)?e.jsx(h,{children:s}):c(s,{onConfirm:b,onCancel:p})),!1!==a&&("function"==typeof a?a({onConfirm:b,onCancel:p}):e.jsx(y,{onConfirm:b,onCancel:p,confirmLabel:a?.confirm,cancelLabel:a?.cancel,hideConfirm:a?.hideConfirm,hideCancel:a?.hideCancel}))]})})),B=o.memo((({modal:t,handlers:n})=>{const{Input:r,defaultValue:i,disabled:s,title:a,subtitle:u,content:m,footer:b}=o.useMemo((()=>({...t,Input:o.memo(t.Input)})),[t]),[p,f]=o.useState(i),{onChange:C,onClose:h,onConfirm:y}=o.useMemo((()=>n),[n]),g=l(h),v=l((e=>{const o="function"==typeof e?e(p):e;f(o),C(o)})),k=o.useCallback((()=>{setTimeout((()=>{y()}))}),[y]),x=o.useMemo((()=>!!p&&!!s?.(p)),[s,p]),{TitleComponent:I,SubtitleComponent:B,ContentComponent:_,FooterComponent:F}=re();return e.jsxs(o.Fragment,{children:[a&&(d(a)?e.jsx(I,{children:a}):a),u&&(d(u)?e.jsx(B,{children:u}):u),m&&(d(m)?e.jsx(_,{children:m}):c(m,{onConfirm:k,onCancel:g})),r&&e.jsx(r,{defaultValue:i,value:p,onChange:v,onConfirm:k}),!1!==b&&("function"==typeof b?b({onConfirm:k,onCancel:g,onChange:v,value:p,disabled:x}):e.jsx(F,{onConfirm:k,onCancel:g,disabled:x,confirmLabel:b?.confirm,cancelLabel:b?.cancel,hideConfirm:b?.hideConfirm,hideCancel:b?.hideCancel}))]})})),_=({modalId:o,onChangeOrder:t})=>{const{ForegroundComponent:r}=re(),{modal:i,onChange:l,onConfirm:s,onClose:a,onDestroy:c}=P(o);return i?e.jsx("div",{className:n("Foreground-module__root___Go3o8",{[k]:i.manualDestroy?i.alive:i.visible}),children:e.jsxs(r,{id:i.id,type:i.type,alive:i.alive,visible:i.visible,initiator:i.initiator,manualDestroy:i.manualDestroy,closeOnBackdropClick:i.closeOnBackdropClick,background:i.background,onChange:l,onConfirm:s,onClose:a,onDestroy:c,onChangeOrder:t,children:["alert"===i.type&&e.jsx(x,{modal:i,handlers:{onConfirm:s}}),"confirm"===i.type&&e.jsx(I,{modal:i,handlers:{onConfirm:s,onClose:a}}),"prompt"===i.type&&e.jsx(B,{modal:i,handlers:{onChange:l,onConfirm:s,onClose:a}})]})}):null},F=e=>{const[o,t]=a();return s((()=>{if(e)return e.subscribe(t)})),o};r(".Presenter-module__modal___HyHFW{inset:0;overflow:hidden;pointer-events:none;position:fixed}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlByZXNlbnRlci5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGlDQUVFLE9BQVEsQ0FFUixlQUFnQixDQURoQixtQkFBb0IsQ0FGcEIsY0FJRiIsImZpbGUiOiJQcmVzZW50ZXIubW9kdWxlLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5tb2RhbCB7XG4gIHBvc2l0aW9uOiBmaXhlZDtcbiAgaW5zZXQ6IDA7XG4gIHBvaW50ZXItZXZlbnRzOiBub25lO1xuICBvdmVyZmxvdzogaGlkZGVuO1xufVxuIl19 */");let j=1;const Q=o.memo((({modalId:t})=>{const n=o.useRef(null),{modal:r}=P(t);F(r);const i=l((()=>{n.current&&(n.current.style.zIndex=""+j++)}));return e.jsxs("div",{ref:n,className:"Presenter-module__modal___HyHFW",children:[e.jsx(v,{modalId:t,onChangeOrder:i}),e.jsx(_,{modalId:t,onChangeOrder:i})]})})),G=(e=0)=>{const{modalIds:t,getModalNode:n}=E();return o.useMemo((()=>{let e=0;for(const o of t)n(o)?.visible&&e++;return e}),[n,t,e])};
1
+ "use strict";var e=require("react/jsx-runtime"),n=require("react"),o=require("react-dom"),t=require("@winglet/react-utils"),r=require("@winglet/common-utils"),i=require("clsx"),l=require("/Users/Vincent/Workspace/altovion/node_modules/style-inject/dist/style-inject.es.js");const s={current:[]},a={current:e=>{s.current.push(e)}},c={current:null},u={get prerender(){return s.current},clearPrerender(){s.current=[]},open(e){a.current(e)},setupOpen(e){a.current=e},anchor(e,n="modal-anchor"){if(c.current){const e=document.getElementById(c.current.id);if(e)return e}const o=document.createElement(e);return o.setAttribute("id",`${n}-${r.getRandomNumber()}`),document.body.appendChild(o),c.current=o,o}},d="300ms",m="rgba(0, 0, 0, 0.5)";var b="Background-module__active___Zi50h",p="Background-module__visible___tAN9F";l(".Background-module__root___zat-I{display:none;inset:0;pointer-events:none;position:fixed;z-index:-999}.Background-module__root___zat-I.Background-module__active___Zi50h{pointer-events:all!important}.Background-module__root___zat-I.Background-module__visible___tAN9F{align-items:center;display:flex;justify-content:center}.Background-module__root___zat-I>*{pointer-events:none}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkJhY2tncm91bmQubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxpQ0FDRSxZQUFhLENBRWIsT0FBUSxDQUVSLG1CQUFvQixDQUhwQixjQUFlLENBRWYsWUFFRixDQUVBLG1FQUNFLDRCQUNGLENBRUEsb0VBRUUsa0JBQW1CLENBRG5CLFlBQWEsQ0FFYixzQkFDRixDQUVBLG1DQUNFLG1CQUNGIiwiZmlsZSI6IkJhY2tncm91bmQubW9kdWxlLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5yb290IHtcbiAgZGlzcGxheTogbm9uZTtcbiAgcG9zaXRpb246IGZpeGVkO1xuICBpbnNldDogMDtcbiAgei1pbmRleDogLTk5OTtcbiAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG59XG5cbi5yb290LmFjdGl2ZSB7XG4gIHBvaW50ZXItZXZlbnRzOiBhbGwgIWltcG9ydGFudDtcbn1cblxuLnJvb3QudmlzaWJsZSB7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xufVxuXG4ucm9vdCA+ICoge1xuICBwb2ludGVyLWV2ZW50czogbm9uZTtcbn1cbiJdfQ== */");const f=({modalId:o,onChangeOrder:t})=>{const{BackgroundComponent:r}=K(),{modal:l,onClose:s,onChange:a,onConfirm:c,onDestroy:u}=M(o),d=n.useCallback((e=>{l&&l.closeOnBackdropClick&&l.visible&&s(),e.stopPropagation()}),[l,s]);if(!l)return null;const m=l.manualDestroy?l.alive:l.visible;return e.jsx("div",{className:i("Background-module__root___zat-I",{[p]:m,[b]:l.closeOnBackdropClick&&m}),onClick:d,children:r&&e.jsx(r,{id:l.id,type:l.type,alive:l.alive,visible:l.visible,initiator:l.initiator,manualDestroy:l.manualDestroy,closeOnBackdropClick:l.closeOnBackdropClick,background:l.background,onChange:a,onConfirm:c,onClose:s,onDestroy:u,onChangeOrder:t})})};var C="Foreground-module__active___f-kK8";l(".Foreground-module__root___Go3o8{display:none;inset:0;pointer-events:none;position:fixed;z-index:1}.Foreground-module__root___Go3o8.Foreground-module__active___f-kK8{align-items:center;display:flex!important;justify-content:center}.Foreground-module__root___Go3o8.Foreground-module__active___f-kK8>*{pointer-events:all!important}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkZvcmVncm91bmQubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxpQ0FFRSxZQUFhLENBRWIsT0FBUSxDQUhSLG1CQUFvQixDQUVwQixjQUFlLENBRWYsU0FDRixDQUVBLG1FQUdFLGtCQUFtQixDQUZuQixzQkFBd0IsQ0FDeEIsc0JBRUYsQ0FFQSxxRUFDRSw0QkFDRiIsImZpbGUiOiJGb3JlZ3JvdW5kLm1vZHVsZS5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIucm9vdCB7XG4gIHBvaW50ZXItZXZlbnRzOiBub25lO1xuICBkaXNwbGF5OiBub25lO1xuICBwb3NpdGlvbjogZml4ZWQ7XG4gIGluc2V0OiAwO1xuICB6LWluZGV4OiAxO1xufVxuXG4ucm9vdC5hY3RpdmUge1xuICBkaXNwbGF5OiBmbGV4ICFpbXBvcnRhbnQ7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICBhbGlnbi1pdGVtczogY2VudGVyO1xufVxuXG4ucm9vdC5hY3RpdmUgPiAqIHtcbiAgcG9pbnRlci1ldmVudHM6IGFsbCAhaW1wb3J0YW50O1xufVxuIl19 */");const h=n.memo((({modal:o,handlers:i})=>{const{title:l,subtitle:s,content:a,footer:c}=n.useMemo((()=>o),[o]),{onConfirm:u}=n.useMemo((()=>i),[i]),d=t.useHandle(u),{TitleComponent:m,SubtitleComponent:b,ContentComponent:p,FooterComponent:f}=K();return e.jsxs(n.Fragment,{children:[l&&(r.isString(l)?e.jsx(m,{children:l}):l),s&&(r.isString(s)?e.jsx(b,{children:s}):s),a&&(r.isString(a)?e.jsx(p,{children:a}):t.renderComponent(a,{onConfirm:d})),!1!==c&&("function"==typeof c?c({onConfirm:d}):e.jsx(f,{onConfirm:d,confirmLabel:c?.confirm,hideConfirm:c?.hideConfirm}))]})})),g=n.memo((({modal:o,handlers:i})=>{const{title:l,subtitle:s,content:a,footer:c}=n.useMemo((()=>o),[o]),{onConfirm:u,onClose:d}=n.useMemo((()=>i),[i]),m=t.useHandle(u),b=t.useHandle(d),{TitleComponent:p,SubtitleComponent:f,ContentComponent:C,FooterComponent:h}=K();return e.jsxs(n.Fragment,{children:[l&&(r.isString(l)?e.jsx(p,{children:l}):l),s&&(r.isString(s)?e.jsx(f,{children:s}):s),a&&(r.isString(a)?e.jsx(C,{children:a}):t.renderComponent(a,{onConfirm:m,onCancel:b})),!1!==c&&("function"==typeof c?c({onConfirm:m,onCancel:b}):e.jsx(h,{onConfirm:m,onCancel:b,confirmLabel:c?.confirm,cancelLabel:c?.cancel,hideConfirm:c?.hideConfirm,hideCancel:c?.hideCancel}))]})})),y=n.memo((({modal:o,handlers:i})=>{const{Input:l,defaultValue:s,disabled:a,title:c,subtitle:u,content:d,footer:m}=n.useMemo((()=>({...o,Input:n.memo(o.Input)})),[o]),[b,p]=n.useState(s),{onChange:f,onClose:C,onConfirm:h}=n.useMemo((()=>i),[i]),g=t.useHandle(C),y=t.useHandle((e=>{const n=r.isFunction(e)?e(b):e;p(n),f(n)})),v=n.useCallback((()=>{setTimeout((()=>{h()}))}),[h]),k=n.useMemo((()=>!!b&&!!a?.(b)),[a,b]),{TitleComponent:x,SubtitleComponent:I,ContentComponent:B,FooterComponent:F}=K();return e.jsxs(n.Fragment,{children:[c&&(r.isString(c)?e.jsx(x,{children:c}):c),u&&(r.isString(u)?e.jsx(I,{children:u}):u),d&&(r.isString(d)?e.jsx(B,{children:d}):t.renderComponent(d,{onConfirm:v,onCancel:g})),l&&e.jsx(l,{defaultValue:s,value:b,onChange:y,onConfirm:v}),!1!==m&&("function"==typeof m?m({onConfirm:v,onCancel:g,onChange:y,value:b,disabled:k}):e.jsx(F,{onConfirm:v,onCancel:g,disabled:k,confirmLabel:m?.confirm,cancelLabel:m?.cancel,hideConfirm:m?.hideConfirm,hideCancel:m?.hideCancel}))]})})),v=({modalId:n,onChangeOrder:o})=>{const{ForegroundComponent:t}=K(),{modal:r,onChange:l,onConfirm:s,onClose:a,onDestroy:c}=M(n);return r?e.jsx("div",{className:i("Foreground-module__root___Go3o8",{[C]:r.manualDestroy?r.alive:r.visible}),children:e.jsxs(t,{id:r.id,type:r.type,alive:r.alive,visible:r.visible,initiator:r.initiator,manualDestroy:r.manualDestroy,closeOnBackdropClick:r.closeOnBackdropClick,background:r.background,onChange:l,onConfirm:s,onClose:a,onDestroy:c,onChangeOrder:o,children:["alert"===r.type&&e.jsx(h,{modal:r,handlers:{onConfirm:s}}),"confirm"===r.type&&e.jsx(g,{modal:r,handlers:{onConfirm:s,onClose:a}}),"prompt"===r.type&&e.jsx(y,{modal:r,handlers:{onChange:l,onConfirm:s,onClose:a}})]})}):null},k=e=>{const[n,o]=t.useTick();return t.useOnMount((()=>{if(e)return e.subscribe(o)})),n};l(".Presenter-module__modal___HyHFW{inset:0;overflow:hidden;pointer-events:none;position:fixed}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlByZXNlbnRlci5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGlDQUVFLE9BQVEsQ0FFUixlQUFnQixDQURoQixtQkFBb0IsQ0FGcEIsY0FJRiIsImZpbGUiOiJQcmVzZW50ZXIubW9kdWxlLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5tb2RhbCB7XG4gIHBvc2l0aW9uOiBmaXhlZDtcbiAgaW5zZXQ6IDA7XG4gIHBvaW50ZXItZXZlbnRzOiBub25lO1xuICBvdmVyZmxvdzogaGlkZGVuO1xufVxuIl19 */");let x=1;const I=n.memo((({modalId:o})=>{const r=n.useRef(null),{modal:i}=M(o);k(i);const l=t.useHandle((()=>{r.current&&(r.current.style.zIndex=""+x++)}));return e.jsxs("div",{ref:r,className:"Presenter-module__modal___HyHFW",children:[e.jsx(f,{modalId:o,onChangeOrder:l}),e.jsx(v,{modalId:o,onChangeOrder:l})]})})),B=(e=0)=>{const{modalIds:o,getModalNode:t}=N();return n.useMemo((()=>{let e=0;for(const n of o)t(n)?.visible&&e++;return e}),[t,o,e])};
2
2
  /******************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -14,5 +14,5 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
16
  /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
17
- function O(e,o,t,n){if("a"===t&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof o?e!==o||!n:!o.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?n:"a"===t?n.call(e):n?n.value:o.get(e)}function D(e,o,t,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof o?e!==o||!r:!o.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,t):r?r.value=t:o.set(e,t),t}var w,V,Z,U,W;"function"==typeof SuppressedError&&SuppressedError;class R{get alive(){return O(this,w,"f")}get visible(){return O(this,V,"f")}constructor({id:e,initiator:o,title:t,subtitle:n,background:r,manualDestroy:i=!1,closeOnBackdropClick:l=!0,resolve:s}){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initiator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtitle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualDestroy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeOnBackdropClick",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),w.set(this,void 0),V.set(this,void 0),Z.set(this,void 0),U.set(this,[]),this.id=e,this.initiator=o,this.title=t,this.subtitle=n,this.background=r,this.manualDestroy=i,this.closeOnBackdropClick=l,D(this,w,!0,"f"),D(this,V,!0,"f"),D(this,Z,s,"f")}subscribe(e){return O(this,U,"f").push(e),()=>{D(this,U,O(this,U,"f").filter((o=>o!==e)),"f")}}publish(){for(const e of O(this,U,"f"))e()}resolve(e){O(this,Z,"f").call(this,e)}onDestroy(){const e=!0===O(this,w,"f");D(this,w,!1,"f"),this.manualDestroy&&e&&this.publish()}onShow(){const e=!1===O(this,V,"f");D(this,V,!0,"f"),e&&this.publish()}onHide(){const e=!0===O(this,V,"f");D(this,V,!1,"f"),e&&this.publish()}}w=new WeakMap,V=new WeakMap,Z=new WeakMap,U=new WeakMap;class L extends R{constructor({id:e,initiator:o,type:t,subtype:n,title:r,subtitle:i,content:l,footer:s,background:a,manualDestroy:c,closeOnBackdropClick:u,resolve:d}){super({id:e,initiator:o,title:r,subtitle:i,background:a,manualDestroy:c,closeOnBackdropClick:u,resolve:d}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=t,this.subtype=n,this.content=l,this.footer=s}onClose(){this.resolve(null)}onConfirm(){this.resolve(null)}}class z extends R{constructor({id:e,initiator:o,type:t,subtype:n,title:r,subtitle:i,content:l,footer:s,background:a,manualDestroy:c,closeOnBackdropClick:u,resolve:d}){super({id:e,initiator:o,title:r,subtitle:i,background:a,manualDestroy:c,closeOnBackdropClick:u,resolve:d}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=t,this.subtype=n,this.content=l,this.footer=s}onClose(){this.resolve(!1)}onConfirm(){this.resolve(!0)}}class X extends R{constructor({id:e,initiator:o,type:t,title:n,subtitle:r,content:i,defaultValue:l,Input:s,disabled:a,returnOnCancel:c,footer:u,background:d,manualDestroy:m,closeOnBackdropClick:b,resolve:p}){super({id:e,initiator:o,title:n,subtitle:r,background:d,manualDestroy:m,closeOnBackdropClick:b,resolve:p}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"Input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnOnCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),W.set(this,void 0),this.type=t,this.content=i,this.Input=s,this.defaultValue=l,D(this,W,l,"f"),this.disabled=a,this.returnOnCancel=c,this.footer=u}onChange(e){D(this,W,e,"f")}onConfirm(){this.resolve(O(this,W,"f")??null)}onClose(){this.returnOnCancel?this.resolve(O(this,W,"f")??null):this.resolve(null)}}W=new WeakMap;const N=e=>{switch(e.type){case"alert":return new L(e);case"confirm":return new z(e);case"prompt":return new X(e)}throw new Error(`Unknown modal: ${e.type}`,{modal:e})},M=/^\s*(\d+)\s*(ms|s|m|h)\s*$/,J=e=>{const[,o,t]=e.match(M)||[];if(!o||!t)return 0;const n=parseInt(o);return"ms"===t?n:"s"===t?1e3*n:"m"===t?60*n*1e3:"h"===t?60*n*60*1e3:0},S=o.createContext({modalIds:[],getModalNode:u,onChange:u,onConfirm:u,onClose:u,onDestroy:u,setUpdater:u,getModal:()=>({modal:void 0,onConfirm:u,onClose:u,onChange:u,onDestroy:u})}),Y=o.memo((({pathname:t,children:n})=>{const r=o.useRef(new Map),[l,s]=o.useState([]),a=i(l),c=o.useRef(t),u=o.useRef(0),d=ie(),m=o.useMemo((()=>J(d.duration)),[d]);var b;b=()=>{const{manualDestroy:e,closeOnBackdropClick:o}=d;for(const t of f.prerender){const n=N({...t,id:u.current++,initiator:c.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:o});r.current.set(n.id,n),s((e=>[...e,n.id]))}f.setupOpen((t=>{const n=N({...t,id:u.current++,initiator:c.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:o});r.current.set(n.id,n),s((e=>[...e.filter((e=>{const o=!r.current.get(e)?.alive;return o&&r.current.delete(e),!o})),n.id]))})),f.clearPrerender()},o.useLayoutEffect(b,[]),o.useLayoutEffect((()=>{for(const e of a.current){const o=r.current.get(e);o?.alive&&(o.initiator===t?o.onShow():o.onHide())}c.current=t}),[a,t]);const p=o.useCallback((e=>r.current.get(e)),[]),C=o.useCallback((e=>{const o=r.current.get(e);o&&(o.onDestroy(),h.current?.())}),[]),h=o.useRef(),y=o.useCallback((e=>{const o=r.current.get(e);o&&(o.onHide(),h.current?.(),o.manualDestroy||setTimeout((()=>{o.onDestroy()}),m))}),[m]),g=o.useCallback(((e,o)=>{const t=r.current.get(e);t&&"prompt"===t.type&&t.onChange(o)}),[]),v=o.useCallback((e=>{const o=r.current.get(e);o&&(o.onConfirm(),y(e))}),[y]),k=o.useCallback((e=>{const o=r.current.get(e);o&&(o.onClose(),y(e))}),[y]),x=o.useCallback((e=>({modal:p(e),onConfirm:()=>v(e),onClose:()=>k(e),onChange:o=>g(e,o),onDestroy:()=>C(e)})),[p,v,k,g,C]),I=o.useMemo((()=>({modalIds:l,getModalNode:p,onChange:g,onConfirm:v,onClose:k,onDestroy:C,getModal:x,setUpdater:e=>{h.current=e}})),[l,x,p,g,v,k,C]);return e.jsx(S.Provider,{value:I,children:n})})),E=()=>o.useContext(S),P=e=>{const{getModal:t}=E();return o.useMemo((()=>t(e)),[e,t])};r(".Anchor-module__root___7N-Qo{align-items:center;display:flex;inset:0;justify-content:center;pointer-events:none;position:fixed;transition:background-color ease-in-out;z-index:1000}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFuY2hvci5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZCQUVFLGtCQUFtQixDQURuQixZQUFhLENBSWIsT0FBUSxDQUZSLHNCQUF1QixDQUd2QixtQkFBb0IsQ0FGcEIsY0FBZSxDQUlmLHVDQUF3QyxDQUR4QyxZQUVGIiwiZmlsZSI6IkFuY2hvci5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLnJvb3Qge1xuICBkaXNwbGF5OiBmbGV4O1xuICBhbGlnbi1pdGVtczogY2VudGVyO1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgcG9zaXRpb246IGZpeGVkO1xuICBpbnNldDogMDtcbiAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gIHotaW5kZXg6IDEwMDA7XG4gIHRyYW5zaXRpb246IGJhY2tncm91bmQtY29sb3IgZWFzZS1pbi1vdXQ7XG59XG4iXX0= */");const A=o.memo((()=>{const[t,n]=a(),{modalIds:r,setUpdater:i}=E();o.useEffect((()=>{i(n)}),[i,n]);const{options:l}=re(),s=G(t);return e.jsx("div",{className:"Anchor-module__root___7N-Qo",style:{transitionDuration:l.duration,backgroundColor:s?l.backdrop:"transparent"},children:r.map((o=>e.jsx(Q,{modalId:o},o)))})}));var H="styles-module__fallback___g8MEI";r(".styles-module__fallback___g8MEI{margin:unset}.styles-module__frame___1mKAZ{align-items:center;background-color:#fff;border:1px solid #000;display:flex;flex-direction:column;gap:10px;justify-content:center;padding:20px 80px}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGlDQUNFLFlBQ0YsQ0FFQSw4QkFJRSxrQkFBbUIsQ0FDbkIscUJBQXVCLENBR3ZCLHFCQUF1QixDQVB2QixZQUFhLENBQ2IscUJBQXNCLENBS3RCLFFBQVMsQ0FKVCxzQkFBdUIsQ0FHdkIsaUJBR0YiLCJmaWxlIjoic3R5bGVzLm1vZHVsZS5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIuZmFsbGJhY2sge1xuICBtYXJnaW46IHVuc2V0O1xufVxuXG4uZnJhbWUge1xuICBkaXNwbGF5OiBmbGV4O1xuICBmbGV4LWRpcmVjdGlvbjogY29sdW1uO1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgYmFja2dyb3VuZC1jb2xvcjogd2hpdGU7XG4gIHBhZGRpbmc6IDIwcHggODBweDtcbiAgZ2FwOiAxMHB4O1xuICBib3JkZXI6IDFweCBzb2xpZCBibGFjaztcbn1cbiJdfQ== */");const T=({children:o})=>e.jsx("h2",{className:H,children:o}),$=({children:o})=>e.jsx("h3",{className:H,children:o}),q=({children:o})=>e.jsx("div",{className:H,children:o}),K=({confirmLabel:o,hideConfirm:t=!1,cancelLabel:n,hideCancel:r=!1,disabled:i,onConfirm:l,onCancel:s})=>e.jsxs("div",{children:[!t&&e.jsx("button",{onClick:l,disabled:i,children:o||"확인"}),!r&&"function"==typeof s&&e.jsx("button",{onClick:s,children:n||"취소"})]}),ee=o.forwardRef((({id:t,onChangeOrder:n,children:r},i)=>{const l=G(),[s,a]=o.useMemo((()=>{const e=l>1;return[e?Math.floor(t/5)%3*100:0,e?t%5*35:0]}),[l,t]);return e.jsx("div",{ref:i,className:"styles-module__frame___1mKAZ",onClick:n,style:{marginBottom:`calc(25vh + ${s}px)`,marginLeft:`${s}px`,transform:`translate(${a}px, ${a}px)`},children:r})})),oe=()=>{const[e,t]=o.useState(window.location.pathname);return o.useLayoutEffect((()=>{let o;const n=()=>{o&&cancelAnimationFrame(o),e!==window.location.pathname?t(window.location.pathname):o=requestAnimationFrame(n)};return o=requestAnimationFrame(n),()=>{o&&cancelAnimationFrame(o)}}),[e]),{pathname:e}},te=o.createContext({ForegroundComponent:ee,TitleComponent:T,SubtitleComponent:$,ContentComponent:q,FooterComponent:K,options:{duration:C,backdrop:h,manualDestroy:!1,closeOnBackdropClick:!0}}),ne=o.memo((({ForegroundComponent:n,BackgroundComponent:r,TitleComponent:i,SubtitleComponent:l,ContentComponent:c,FooterComponent:u,options:d,usePathname:m,children:b})=>{const{pathname:p}=(m||oe)(),[,y]=a(),g=o.useRef(null);s((()=>(g.current=f.anchor("div"),y(),()=>{g.current&&g.current.remove()})));const v=o.useMemo((()=>({BackgroundComponent:r,ForegroundComponent:n||ee,TitleComponent:i||T,SubtitleComponent:l||$,ContentComponent:o.memo(c||q),FooterComponent:o.memo(u||K),options:{duration:C,backdrop:h,closeOnBackdropClick:!0,manualDestroy:!1,...d}})),[n,r,c,u,l,i,d]);return e.jsxs(te.Provider,{value:v,children:[b,g.current&&t.createPortal(e.jsx(Y,{pathname:p,children:e.jsx(A,{})}),g.current)]})})),re=()=>o.useContext(te),ie=()=>{const{options:e}=o.useContext(te);return e};exports.ModalProvider=ne,exports.alert=({subtype:e,title:o,subtitle:t,content:n,background:r,footer:i,manualDestroy:l,closeOnBackdropClick:s})=>new Promise(((a,c)=>{try{f.open({type:"alert",subtype:e,resolve:()=>a(),title:o,subtitle:t,content:n,background:r,footer:i,manualDestroy:l,closeOnBackdropClick:s})}catch(e){c(e)}})),exports.confirm=({subtype:e,title:o,subtitle:t,content:n,background:r,footer:i,manualDestroy:l,closeOnBackdropClick:s})=>new Promise(((a,c)=>{try{f.open({type:"confirm",subtype:e,resolve:e=>a(e??!1),title:o,subtitle:t,content:n,background:r,footer:i,manualDestroy:l,closeOnBackdropClick:s})}catch(e){c(e)}})),exports.prompt=({defaultValue:e,title:o,subtitle:t,content:n,Input:r,disabled:i,returnOnCancel:l,background:s,footer:a,manualDestroy:c,closeOnBackdropClick:u})=>new Promise(((d,m)=>{try{f.open({type:"prompt",resolve:e=>d(e),title:o,subtitle:t,content:n,Input:({defaultValue:e,onChange:o,onConfirm:t})=>r({defaultValue:e,onChange:o,onConfirm:t}),defaultValue:e,disabled:i,returnOnCancel:l,background:s,footer:a,manualDestroy:c,closeOnBackdropClick:u})}catch(e){m(e)}})),exports.useDestroyAfter=(e,t)=>{const{modal:n,onDestroy:r}=P(e),i=F(n),l=o.useRef({modal:n,onDestroy:r,milliseconds:d(t)?J(t):t});o.useEffect((()=>{const{modal:e,onDestroy:o,milliseconds:t}=l.current;if(!e||e.visible||!e.alive)return;const n=setTimeout((()=>{o()}),t);return()=>{n&&clearTimeout(n)}}),[i])},exports.useModalBackdrop=()=>{const{backdrop:e}=ie();return e},exports.useModalDuration=()=>{const{duration:e}=ie();return{duration:e,milliseconds:J(e)}},exports.useModalOptions=ie,exports.useSubscribeModal=F;
17
+ function F(e,n,o,t){if("a"===o&&!t)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?e!==n||!t:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?t:"a"===o?t.call(e):t?t.value:n.get(e)}function _(e,n,o,t,r){if("m"===t)throw new TypeError("Private method is not writable");if("a"===t&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?e!==n||!r:!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===t?r.call(e,o):r?r.value=o:n.set(e,o),o}var j,Q,G,O,w;"function"==typeof SuppressedError&&SuppressedError;class D{get alive(){return F(this,j,"f")}get visible(){return F(this,Q,"f")}constructor({id:e,initiator:n,title:o,subtitle:t,background:r,manualDestroy:i=!1,closeOnBackdropClick:l=!0,resolve:s}){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initiator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtitle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualDestroy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeOnBackdropClick",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),j.set(this,void 0),Q.set(this,void 0),G.set(this,void 0),O.set(this,[]),this.id=e,this.initiator=n,this.title=o,this.subtitle=t,this.background=r,this.manualDestroy=i,this.closeOnBackdropClick=l,_(this,j,!0,"f"),_(this,Q,!0,"f"),_(this,G,s,"f")}subscribe(e){return F(this,O,"f").push(e),()=>{_(this,O,F(this,O,"f").filter((n=>n!==e)),"f")}}publish(){for(const e of F(this,O,"f"))e()}resolve(e){F(this,G,"f").call(this,e)}onDestroy(){const e=!0===F(this,j,"f");_(this,j,!1,"f"),this.manualDestroy&&e&&this.publish()}onShow(){const e=!1===F(this,Q,"f");_(this,Q,!0,"f"),e&&this.publish()}onHide(){const e=!0===F(this,Q,"f");_(this,Q,!1,"f"),e&&this.publish()}}j=new WeakMap,Q=new WeakMap,G=new WeakMap,O=new WeakMap;class V extends D{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:i,content:l,footer:s,background:a,manualDestroy:c,closeOnBackdropClick:u,resolve:d}){super({id:e,initiator:n,title:r,subtitle:i,background:a,manualDestroy:c,closeOnBackdropClick:u,resolve:d}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=o,this.subtype=t,this.content=l,this.footer=s}onClose(){this.resolve(null)}onConfirm(){this.resolve(null)}}class Z extends D{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:i,content:l,footer:s,background:a,manualDestroy:c,closeOnBackdropClick:u,resolve:d}){super({id:e,initiator:n,title:r,subtitle:i,background:a,manualDestroy:c,closeOnBackdropClick:u,resolve:d}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=o,this.subtype=t,this.content=l,this.footer=s}onClose(){this.resolve(!1)}onConfirm(){this.resolve(!0)}}class U extends D{constructor({id:e,initiator:n,type:o,title:t,subtitle:r,content:i,defaultValue:l,Input:s,disabled:a,returnOnCancel:c,footer:u,background:d,manualDestroy:m,closeOnBackdropClick:b,resolve:p}){super({id:e,initiator:n,title:t,subtitle:r,background:d,manualDestroy:m,closeOnBackdropClick:b,resolve:p}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"Input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnOnCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),w.set(this,void 0),this.type=o,this.content=i,this.Input=s,this.defaultValue=l,_(this,w,l,"f"),this.disabled=a,this.returnOnCancel=c,this.footer=u}onChange(e){_(this,w,e,"f")}onConfirm(){this.resolve(F(this,w,"f")??null)}onClose(){this.returnOnCancel?this.resolve(F(this,w,"f")??null):this.resolve(null)}}w=new WeakMap;const W=e=>{switch(e.type){case"alert":return new V(e);case"confirm":return new Z(e);case"prompt":return new U(e)}throw new Error(`Unknown modal: ${e.type}`,{modal:e})},R=/^\s*(\d+)\s*(ms|s|m|h)\s*$/,L=e=>{const[,n,o]=e.match(R)||[];if(!n||!o)return 0;const t=parseInt(n);return"ms"===o?t:"s"===o?1e3*t:"m"===o?60*t*1e3:"h"===o?60*t*60*1e3:0},z=n.createContext({modalIds:[],getModalNode:r.undefinedFunction,onChange:r.undefinedFunction,onConfirm:r.undefinedFunction,onClose:r.undefinedFunction,onDestroy:r.undefinedFunction,setUpdater:r.undefinedFunction,getModal:()=>({modal:void 0,onConfirm:r.undefinedFunction,onClose:r.undefinedFunction,onChange:r.undefinedFunction,onDestroy:r.undefinedFunction})}),X=n.memo((({pathname:o,children:r})=>{const i=n.useRef(new Map),[l,s]=n.useState([]),a=t.useReference(l),c=n.useRef(o),d=n.useRef(0),m=ee(),b=n.useMemo((()=>L(m.duration)),[m]);t.useOnMountLayout((()=>{const{manualDestroy:e,closeOnBackdropClick:n}=m;for(const o of u.prerender){const t=W({...o,id:d.current++,initiator:c.current,manualDestroy:void 0!==o.manualDestroy?o.manualDestroy:e,closeOnBackdropClick:void 0!==o.closeOnBackdropClick?o.closeOnBackdropClick:n});i.current.set(t.id,t),s((e=>[...e,t.id]))}u.setupOpen((o=>{const t=W({...o,id:d.current++,initiator:c.current,manualDestroy:void 0!==o.manualDestroy?o.manualDestroy:e,closeOnBackdropClick:void 0!==o.closeOnBackdropClick?o.closeOnBackdropClick:n});i.current.set(t.id,t),s((e=>[...e.filter((e=>{const n=!i.current.get(e)?.alive;return n&&i.current.delete(e),!n})),t.id]))})),u.clearPrerender()})),n.useLayoutEffect((()=>{for(const e of a.current){const n=i.current.get(e);n?.alive&&(n.initiator===o?n.onShow():n.onHide())}c.current=o}),[a,o]);const p=n.useCallback((e=>i.current.get(e)),[]),f=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onDestroy(),C.current?.())}),[]),C=n.useRef(),h=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onHide(),C.current?.(),n.manualDestroy||setTimeout((()=>{n.onDestroy()}),b))}),[b]),g=n.useCallback(((e,n)=>{const o=i.current.get(e);o&&"prompt"===o.type&&o.onChange(n)}),[]),y=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onConfirm(),h(e))}),[h]),v=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onClose(),h(e))}),[h]),k=n.useCallback((e=>({modal:p(e),onConfirm:()=>y(e),onClose:()=>v(e),onChange:n=>g(e,n),onDestroy:()=>f(e)})),[p,y,v,g,f]),x=n.useMemo((()=>({modalIds:l,getModalNode:p,onChange:g,onConfirm:y,onClose:v,onDestroy:f,getModal:k,setUpdater:e=>{C.current=e}})),[l,k,p,g,y,v,f]);return e.jsx(z.Provider,{value:x,children:r})})),N=()=>n.useContext(z),M=e=>{const{getModal:o}=N();return n.useMemo((()=>o(e)),[e,o])};l(".Anchor-module__root___7N-Qo{align-items:center;display:flex;inset:0;justify-content:center;pointer-events:none;position:fixed;transition:background-color ease-in-out;z-index:1000}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFuY2hvci5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZCQUVFLGtCQUFtQixDQURuQixZQUFhLENBSWIsT0FBUSxDQUZSLHNCQUF1QixDQUd2QixtQkFBb0IsQ0FGcEIsY0FBZSxDQUlmLHVDQUF3QyxDQUR4QyxZQUVGIiwiZmlsZSI6IkFuY2hvci5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLnJvb3Qge1xuICBkaXNwbGF5OiBmbGV4O1xuICBhbGlnbi1pdGVtczogY2VudGVyO1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgcG9zaXRpb246IGZpeGVkO1xuICBpbnNldDogMDtcbiAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gIHotaW5kZXg6IDEwMDA7XG4gIHRyYW5zaXRpb246IGJhY2tncm91bmQtY29sb3IgZWFzZS1pbi1vdXQ7XG59XG4iXX0= */");const J=n.memo((()=>{const[o,r]=t.useTick(),{modalIds:i,setUpdater:l}=N();n.useEffect((()=>{l(r)}),[l,r]);const{options:s}=K(),a=B(o);return e.jsx("div",{className:"Anchor-module__root___7N-Qo",style:{transitionDuration:s.duration,backgroundColor:a?s.backdrop:"transparent"},children:i.map((n=>e.jsx(I,{modalId:n},n)))})}));var S="styles-module__fallback___g8MEI";l(".styles-module__fallback___g8MEI{margin:unset}.styles-module__frame___1mKAZ{align-items:center;background-color:#fff;border:1px solid #000;display:flex;flex-direction:column;gap:10px;justify-content:center;padding:20px 80px}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGlDQUNFLFlBQ0YsQ0FFQSw4QkFJRSxrQkFBbUIsQ0FDbkIscUJBQXVCLENBR3ZCLHFCQUF1QixDQVB2QixZQUFhLENBQ2IscUJBQXNCLENBS3RCLFFBQVMsQ0FKVCxzQkFBdUIsQ0FHdkIsaUJBR0YiLCJmaWxlIjoic3R5bGVzLm1vZHVsZS5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIuZmFsbGJhY2sge1xuICBtYXJnaW46IHVuc2V0O1xufVxuXG4uZnJhbWUge1xuICBkaXNwbGF5OiBmbGV4O1xuICBmbGV4LWRpcmVjdGlvbjogY29sdW1uO1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgYmFja2dyb3VuZC1jb2xvcjogd2hpdGU7XG4gIHBhZGRpbmc6IDIwcHggODBweDtcbiAgZ2FwOiAxMHB4O1xuICBib3JkZXI6IDFweCBzb2xpZCBibGFjaztcbn1cbiJdfQ== */");const Y=({children:n})=>e.jsx("h2",{className:S,children:n}),P=({children:n})=>e.jsx("h3",{className:S,children:n}),H=({children:n})=>e.jsx("div",{className:S,children:n}),E=({confirmLabel:n,hideConfirm:o=!1,cancelLabel:t,hideCancel:r=!1,disabled:i,onConfirm:l,onCancel:s})=>e.jsxs("div",{children:[!o&&e.jsx("button",{onClick:l,disabled:i,children:n||"확인"}),!r&&"function"==typeof s&&e.jsx("button",{onClick:s,children:t||"취소"})]}),A=n.forwardRef((({id:o,onChangeOrder:t,children:r},i)=>{const l=B(),[s,a]=n.useMemo((()=>{const e=l>1;return[e?Math.floor(o/5)%3*100:0,e?o%5*35:0]}),[l,o]);return e.jsx("div",{ref:i,className:"styles-module__frame___1mKAZ",onClick:t,style:{marginBottom:`calc(25vh + ${s}px)`,marginLeft:`${s}px`,transform:`translate(${a}px, ${a}px)`},children:r})})),T=()=>{const[e,o]=n.useState(window.location.pathname);return n.useLayoutEffect((()=>{let n;const t=()=>{n&&cancelAnimationFrame(n),e!==window.location.pathname?o(window.location.pathname):n=requestAnimationFrame(t)};return n=requestAnimationFrame(t),()=>{n&&cancelAnimationFrame(n)}}),[e]),{pathname:e}},q=n.createContext({ForegroundComponent:A,TitleComponent:Y,SubtitleComponent:P,ContentComponent:H,FooterComponent:E,options:{duration:d,backdrop:m,manualDestroy:!1,closeOnBackdropClick:!0}}),$=n.memo((({ForegroundComponent:r,BackgroundComponent:i,TitleComponent:l,SubtitleComponent:s,ContentComponent:a,FooterComponent:c,options:b,usePathname:p,children:f})=>{const{pathname:C}=(p||T)(),[,h]=t.useTick(),g=n.useRef(null);t.useOnMount((()=>(g.current=u.anchor("div"),h(),()=>{g.current&&g.current.remove()})));const y=n.useMemo((()=>({BackgroundComponent:i,ForegroundComponent:r||A,TitleComponent:l||Y,SubtitleComponent:s||P,ContentComponent:n.memo(a||H),FooterComponent:n.memo(c||E),options:{duration:d,backdrop:m,closeOnBackdropClick:!0,manualDestroy:!1,...b}})),[r,i,a,c,s,l,b]);return e.jsxs(q.Provider,{value:y,children:[f,g.current&&o.createPortal(e.jsx(X,{pathname:C,children:e.jsx(J,{})}),g.current)]})})),K=()=>n.useContext(q),ee=()=>{const{options:e}=n.useContext(q);return e};exports.ModalProvider=$,exports.alert=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:i,manualDestroy:l,closeOnBackdropClick:s})=>new Promise(((a,c)=>{try{u.open({type:"alert",subtype:e,resolve:()=>a(),title:n,subtitle:o,content:t,background:r,footer:i,manualDestroy:l,closeOnBackdropClick:s})}catch(e){c(e)}})),exports.confirm=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:i,manualDestroy:l,closeOnBackdropClick:s})=>new Promise(((a,c)=>{try{u.open({type:"confirm",subtype:e,resolve:e=>a(e??!1),title:n,subtitle:o,content:t,background:r,footer:i,manualDestroy:l,closeOnBackdropClick:s})}catch(e){c(e)}})),exports.prompt=({defaultValue:e,title:n,subtitle:o,content:t,Input:r,disabled:i,returnOnCancel:l,background:s,footer:a,manualDestroy:c,closeOnBackdropClick:d})=>new Promise(((m,b)=>{try{u.open({type:"prompt",resolve:e=>m(e),title:n,subtitle:o,content:t,Input:({defaultValue:e,onChange:n,onConfirm:o})=>r({defaultValue:e,onChange:n,onConfirm:o}),defaultValue:e,disabled:i,returnOnCancel:l,background:s,footer:a,manualDestroy:c,closeOnBackdropClick:d})}catch(e){b(e)}})),exports.useDestroyAfter=(e,o)=>{const{modal:t,onDestroy:i}=M(e),l=k(t),s=n.useRef({modal:t,onDestroy:i,milliseconds:r.isString(o)?L(o):o});n.useEffect((()=>{const{modal:e,onDestroy:n,milliseconds:o}=s.current;if(!e||e.visible||!e.alive)return;const t=setTimeout((()=>{n()}),o);return()=>{t&&clearTimeout(t)}}),[l])},exports.useModalBackdrop=()=>{const{backdrop:e}=ee();return e},exports.useModalDuration=()=>{const{duration:e}=ee();return{duration:e,milliseconds:L(e)}},exports.useModalOptions=ee,exports.useSubscribeModal=k;
18
18
  //# sourceMappingURL=index.cjs.js.map