@lerx/promise-modal 0.0.50 → 0.0.52

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.
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/BootstrapProvider/helpers/bootstrap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,gDAAgD,CAAC;AAIxD,UAAU,cAAe,SAAQ,iCAAiC;IAChE,WAAW,EAAE,EAAE,CAAC,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,+JAWnB,cAAc,gCAkBd,CAAC"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/BootstrapProvider/helpers/bootstrap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,gDAAgD,CAAC;AAIxD,UAAU,cAAe,SAAQ,iCAAiC;IAChE,WAAW,EAAE,EAAE,CAAC,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,GAAI,4JAWvB,cAAc,gCAkBd,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export declare const useInitialize: () => {
2
- readonly anchorRef: import("react").MutableRefObject<HTMLElement | null>;
2
+ readonly anchorRef: import("react").RefObject<HTMLElement | null>;
3
3
  readonly handleInitialize: (root?: HTMLElement) => void;
4
4
  };
5
5
  //# sourceMappingURL=useInitialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBootstrap.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/BootstrapProvider/useBootstrap.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAErD,eAAO,MAAM,YAAY,mLAWtB,sBAAsB,GAAG;IAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;CAAE;;0BAgB1C,WAAW;CAsBxB,CAAC"}
1
+ {"version":3,"file":"useBootstrap.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/BootstrapProvider/useBootstrap.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAErD,eAAO,MAAM,YAAY,GAAI,gLAW1B,sBAAsB,GAAG;IAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;CAAO;;0BAgB/C,WAAW;CAsBxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/components/Background/Background.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,eAAe,gCAGzB,eAAe,mDAgDjB,CAAC"}
1
+ {"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/components/Background/Background.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,eAAe,GAAI,6BAG7B,eAAe,mDAgDjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackContent.d.ts","sourceRoot":"","sources":["../../../src/components/FallbackComponents/FallbackContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,eAAO,MAAM,eAAe,iBAAkB,iBAAiB,4CAE9D,CAAC"}
1
+ {"version":3,"file":"FallbackContent.d.ts","sourceRoot":"","sources":["../../../src/components/FallbackComponents/FallbackContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,eAAO,MAAM,eAAe,GAAI,cAAc,iBAAiB,4CAE9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackFooter.d.ts","sourceRoot":"","sources":["../../../src/components/FallbackComponents/FallbackFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,eAAO,MAAM,cAAc,2FAQxB,oBAAoB,4CActB,CAAC"}
1
+ {"version":3,"file":"FallbackFooter.d.ts","sourceRoot":"","sources":["../../../src/components/FallbackComponents/FallbackFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,eAAO,MAAM,cAAc,GAAI,wFAQ5B,oBAAoB,4CActB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackSubtitle.d.ts","sourceRoot":"","sources":["../../../src/components/FallbackComponents/FallbackSubtitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,eAAO,MAAM,gBAAgB,iBAAkB,iBAAiB,4CAE/D,CAAC"}
1
+ {"version":3,"file":"FallbackSubtitle.d.ts","sourceRoot":"","sources":["../../../src/components/FallbackComponents/FallbackSubtitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,eAAO,MAAM,gBAAgB,GAAI,cAAc,iBAAiB,4CAE/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackTitle.d.ts","sourceRoot":"","sources":["../../../src/components/FallbackComponents/FallbackTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,eAAO,MAAM,aAAa,iBAAkB,iBAAiB,4CAE5D,CAAC"}
1
+ {"version":3,"file":"FallbackTitle.d.ts","sourceRoot":"","sources":["../../../src/components/FallbackComponents/FallbackTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,eAAO,MAAM,aAAa,GAAI,cAAc,iBAAiB,4CAE5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Foreground.d.ts","sourceRoot":"","sources":["../../../src/components/Foreground/Foreground.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,eAAO,MAAM,eAAe,gCAGzB,eAAe,mDAmDjB,CAAC"}
1
+ {"version":3,"file":"Foreground.d.ts","sourceRoot":"","sources":["../../../src/components/Foreground/Foreground.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,eAAO,MAAM,eAAe,GAAI,6BAG7B,eAAe,mDAmDjB,CAAC"}
@@ -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,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,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,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,2JAYpB,UAAU,CAAC,CAAC,CAAC,kBAsBf,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,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,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,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,GAAG,GAAG,EAAE,mJAY5B,UAAU,CAAC,CAAC,CAAC,kBAsBf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/core/handle/confirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,UAAU,YAAY,CAAC,CAAC;IACtB,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,mBAAmB,CAAC,CAAC;IACzD,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,mBAAmB,GAAG,aAAa,GAAG,KAAK,CAAC;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED,eAAO,MAAM,OAAO,GAAI,CAAC,2JAYtB,YAAY,CAAC,CAAC,CAAC,qBAsBjB,CAAC"}
1
+ {"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/core/handle/confirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,UAAU,YAAY,CAAC,CAAC;IACtB,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,mBAAmB,CAAC,CAAC;IACzD,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,mBAAmB,GAAG,aAAa,GAAG,KAAK,CAAC;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED,eAAO,MAAM,OAAO,GAAI,CAAC,GAAG,GAAG,EAAE,mJAY9B,YAAY,CAAC,CAAC,CAAC,qBAsBjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/core/handle/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAE/B,UAAU,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,KAAK,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;IACjD,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,aAAa,GAAG,KAAK,CAAC;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,iMAexB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,eAyBnB,CAAC"}
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/core/handle/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAE/B,UAAU,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,KAAK,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;IACjD,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,aAAa,GAAG,KAAK,CAAC;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,yLAehC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,eAyBnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"nodeFactory.d.ts","sourceRoot":"","sources":["../../../src/core/node/nodeFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,qDAW1D,CAAC"}
1
+ {"version":3,"file":"nodeFactory.d.ts","sourceRoot":"","sources":["../../../src/core/node/nodeFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjE,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,EAAE,OAAO,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,qDAW1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useActiveModalCount.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveModalCount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,eAAO,MAAM,mBAAmB,cACpB,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,eACnC,MAAM,GAAG,MAAM,WAW5B,CAAC"}
1
+ {"version":3,"file":"useActiveModalCount.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveModalCount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,eAAO,MAAM,mBAAmB,GAC9B,WAAU,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAAmB,EACjE,aAAY,MAAM,GAAG,MAAU,WAWhC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDestroyAfter.d.ts","sourceRoot":"","sources":["../../src/hooks/useDestroyAfter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,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,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,eAAO,MAAM,eAAe,GAC1B,SAAS,SAAS,CAAC,IAAI,CAAC,EACxB,UAAU,QAAQ,GAAG,MAAM,SAuB5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useModalAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useModalAnimation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,EAAE,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,YACnB,OAAO,WACP,qBAAqB,SAc/B,CAAC"}
1
+ {"version":3,"file":"useModalAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useModalAnimation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,EAAE,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,GAC5B,SAAS,OAAO,EAChB,SAAS,qBAAqB,SAc/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSubscribeModal.d.ts","sourceRoot":"","sources":["../../src/hooks/useSubscribeModal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,eAAO,MAAM,iBAAiB,WAAY,SAAS,WAQlD,CAAC"}
1
+ {"version":3,"file":"useSubscribeModal.d.ts","sourceRoot":"","sources":["../../src/hooks/useSubscribeModal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,eAAO,MAAM,iBAAiB,GAAI,QAAQ,SAAS,WAQlD,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e,n,o,t,r,s,i,a,l,c,u=require("react/jsx-runtime"),d=require("react"),m=require("@winglet/common-utils"),p=require("@winglet/react-utils"),C=require("@emotion/css"),f=require("react-dom");
1
+ "use strict";var e,n,o,t,r,i,s,a,l,c,u=require("react/jsx-runtime"),d=require("react"),m=require("@winglet/common-utils"),p=require("@winglet/react-utils"),C=require("@emotion/css"),f=require("react-dom");
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 h(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 g(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}"function"==typeof SuppressedError&&SuppressedError;class b{static activate(){return!h(e,e,"f",n)&&g(e,e,!0,"f",n)}static anchor(n){if(h(e,e,"f",o)){const n=document.getElementById(h(e,e,"f",o).id);if(n)return n}const{tag:t="div",prefix:r="promise-modal",root:s=document.body}=n||{},i=document.createElement(t);return i.setAttribute("id",`${r}-${m.getRandomString(36)}`),s.appendChild(i),g(e,e,i,"f",o),i}static get prerender(){return h(e,e,"f",t)}static set openHandler(n){g(e,e,n,"f",r),g(e,e,[],"f",t)}static get unanchored(){return!h(e,e,"f",o)}static reset(){g(e,e,!1,"f",n),g(e,e,null,"f",o),g(e,e,[],"f",t),g(e,e,(n=>h(e,e,"f",t).push(n)),"f",r)}static open(n){h(e,e,"f",r).call(e,n)}}e=b,n={value:!1},o={value:null},t={value:[]},r={value:n=>h(e,e,"f",t).push(n)};class y{get alive(){return h(this,s,"f")}get visible(){return h(this,i,"f")}constructor({id:e,initiator:n,title:o,subtitle:t,background:r,dimmed:c=!0,manualDestroy:u=!1,closeOnBackdropClick:d=!0,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),l.set(this,new Set),this.id=e,this.initiator=n,this.title=o,this.subtitle=t,this.background=r,this.dimmed=c,this.manualDestroy=u,this.closeOnBackdropClick=d,this.ForegroundComponent=p,this.BackgroundComponent=C,g(this,s,!0,"f"),g(this,i,!0,"f"),g(this,a,m,"f")}subscribe(e){return h(this,l,"f").add(e),()=>{h(this,l,"f").delete(e)}}publish(){for(const e of h(this,l,"f"))e()}resolve(e){h(this,a,"f").call(this,e)}onDestroy(){const e=!0===h(this,s,"f");g(this,s,!1,"f"),this.manualDestroy&&e&&this.publish()}onShow(){const e=!1===h(this,i,"f");g(this,i,!0,"f"),e&&this.publish()}onHide(){const e=!0===h(this,i,"f");g(this,i,!1,"f"),e&&this.publish()}}s=new WeakMap,i=new WeakMap,a=new WeakMap,l=new WeakMap;class v extends y{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:s,content:i,footer:a,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){super({id:e,initiator:n,title:r,subtitle:s,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}),this.type=o,this.subtype=t,this.content=i,this.footer=a}onClose(){this.resolve(null)}onConfirm(){this.resolve(null)}}class x extends y{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:s,content:i,footer:a,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){super({id:e,initiator:n,title:r,subtitle:s,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}),this.type=o,this.subtype=t,this.content=i,this.footer=a}onClose(){this.resolve(!1)}onConfirm(){this.resolve(!0)}}class k extends y{constructor({id:e,initiator:n,type:o,title:t,subtitle:r,content:s,defaultValue:i,Input:a,disabled:l,returnOnCancel:u,footer:d,background:m,dimmed:p,manualDestroy:C,closeOnBackdropClick:f,resolve:h,ForegroundComponent:b,BackgroundComponent:y}){super({id:e,initiator:n,title:t,subtitle:r,background:m,dimmed:p,manualDestroy:C,closeOnBackdropClick:f,resolve:h,ForegroundComponent:b,BackgroundComponent:y}),c.set(this,void 0),this.type=o,this.content=s,this.Input=a,this.defaultValue=i,g(this,c,i,"f"),this.disabled=l,this.returnOnCancel=u,this.footer=d}onChange(e){g(this,c,e,"f")}onConfirm(){this.resolve(h(this,c,"f")??null)}onClose(){this.returnOnCancel?this.resolve(h(this,c,"f")??null):this.resolve(null)}}c=new WeakMap;const j=e=>{switch(e.type){case"alert":return new v(e);case"confirm":return new x(e);case"prompt":return new k(e)}throw new Error(`Unknown modal: ${e.type}`,{modal:e})},w=d.createContext({}),D=d.memo((({usePathname:e,children:n})=>{const o=d.useRef(new Map),[t,r]=d.useState([]),s=p.useReference(t),{pathname:i}=e(),a=d.useRef(i),l=d.useRef(0),c=q(),C=d.useMemo((()=>m.convertMsFromDuration(c.duration)),[c]);p.useOnMountLayout((()=>{const{manualDestroy:e,closeOnBackdropClick:n}=c;for(const t of b.prerender){const s=j({...t,id:l.current++,initiator:a.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:n});o.current.set(s.id,s),r((e=>[...e,s.id]))}return b.openHandler=t=>{const s=j({...t,id:l.current++,initiator:a.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:n});o.current.set(s.id,s),r((e=>{const n=[];for(const t of e)o.current.get(t)?.alive?n.push(t):o.current.delete(t);return[...n,s.id]}))},()=>{b.reset()}})),d.useLayoutEffect((()=>{for(const e of s.current){const n=o.current.get(e);n?.alive&&(n.initiator===i?n.onShow():n.onHide())}a.current=i}),[s,i]);const f=d.useCallback((e=>o.current.get(e)),[]),h=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onDestroy(),g.current?.())}),[]),g=d.useRef(),y=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onHide(),g.current?.(),n.manualDestroy||setTimeout((()=>{n.onDestroy()}),C))}),[C]),v=d.useCallback(((e,n)=>{const t=o.current.get(e);t&&"prompt"===t.type&&t.onChange(n)}),[]),x=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onConfirm(),y(e))}),[y]),k=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onClose(),y(e))}),[y]),D=d.useCallback((e=>({modal:f(e),onConfirm:()=>x(e),onClose:()=>k(e),onChange:n=>v(e,n),onDestroy:()=>h(e)})),[f,x,k,v,h]),B=d.useMemo((()=>({modalIds:t,getModalNode:f,onChange:v,onConfirm:x,onClose:k,onDestroy:h,getModal:D,setUpdater:e=>{g.current=e}})),[t,D,f,v,x,k,h]);return u.jsx(w.Provider,{value:B,children:n})})),B=()=>d.useContext(w),O=e=>{const{getModal:n}=B();return d.useMemo((()=>n(e)),[e,n])};function F(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const M=C.css("production"===process.env.NODE_ENV?{name:"131j9g2",styles:"margin:unset"}:{name:"1w3kbco-fallback",styles:"margin:unset;label:fallback;",toString:F}),S=C.css("production"===process.env.NODE_ENV?{name:"1kuk3a3",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black"}:{name:"16dbbea-frame",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black;label:frame;",toString:F}),E=({children:e})=>u.jsx("h2",{className:M,children:e}),N=({children:e})=>u.jsx("h3",{className:M,children:e}),I=({children:e})=>u.jsx("div",{className:M,children:e}),P=({confirmLabel:e,hideConfirm:n=!1,cancelLabel:o,hideCancel:t=!1,disabled:r,onConfirm:s,onCancel:i})=>u.jsxs("div",{children:[!n&&u.jsx("button",{onClick:s,disabled:r,children:e||"확인"}),!t&&"function"==typeof i&&u.jsx("button",{onClick:i,children:o||"취소"})]}),T=e=>e?.visible,V=(e=T,n=0)=>{const{modalIds:o,getModalNode:t}=B();return d.useMemo((()=>{let n=0;for(const r of o)e(t(r))&&n++;return n}),[t,o,n])},z=d.forwardRef((({id:e,onChangeOrder:n,children:o},t)=>{const r=V(),[s,i]=d.useMemo((()=>{const n=r>1;return[n?Math.floor(e/5)%3*100:0,n?e%5*35:0]}),[r,e]);return u.jsx("div",{ref:t,className:S,onClick:n,style:{marginBottom:`calc(25vh + ${s}px)`,marginLeft:`${s}px`,transform:`translate(${i}px, ${i}px)`},children:o})})),R=d.createContext({}),H=d.memo((({ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:s,options:i,children:a})=>{const l=d.useMemo((()=>({BackgroundComponent:n,ForegroundComponent:e||z,TitleComponent:o||E,SubtitleComponent:t||N,ContentComponent:d.memo(r||I),FooterComponent:d.memo(s||P),options:{duration:"300ms",backdrop:"rgba(0, 0, 0, 0.5)",closeOnBackdropClick:!0,manualDestroy:!1,...i}})),[e,n,r,s,t,o,i]);return u.jsx(R.Provider,{value:l,children:a})})),L=()=>d.useContext(R),q=()=>d.useContext(R).options,A=d.createContext({}),_=({context:e,children:n})=>{const o=d.useMemo((()=>({context:e||{}})),[e]);return u.jsx(A.Provider,{value:o,children:n})},$=()=>d.useContext(A),W=()=>{const[e,n]=d.useState(window.location.pathname);return d.useLayoutEffect((()=>{let o;const t=()=>{o&&cancelAnimationFrame(o),e!==window.location.pathname?n(window.location.pathname):o=requestAnimationFrame(t)};return o=requestAnimationFrame(t),()=>{o&&cancelAnimationFrame(o)}}),[e]),{pathname:e}};function Y(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const U=C.css("production"===process.env.NODE_ENV?{name:"u7uu4v",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;}"}:{name:"coymdj-background",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;};label:background;",toString:Y}),G=C.css("production"===process.env.NODE_ENV?{name:"n07k1x",styles:"pointer-events:all"}:{name:"1hektcs-active",styles:"pointer-events:all;label:active;",toString:Y}),J=C.css("production"===process.env.NODE_ENV?{name:"1wnowod",styles:"display:flex;align-items:center;justify-content:center"}:{name:"xppew7-visible",styles:"display:flex;align-items:center;justify-content:center;label:visible;",toString:Y}),K=({modalId:e,onChangeOrder:n})=>{const{BackgroundComponent:o}=L(),{context:t}=$(),{modal:r,onClose:s,onChange:i,onConfirm:a,onDestroy:l}=O(e),c=d.useCallback((e=>{r&&r.closeOnBackdropClick&&r.visible&&s(),e.stopPropagation()}),[r,s]),m=d.useMemo((()=>r?.BackgroundComponent||o),[o,r]);return r?u.jsx("div",{className:C.cx(U,{[J]:r.manualDestroy?r.alive:r.visible,[G]:r.closeOnBackdropClick&&r.visible}),onClick:c,children:m&&u.jsx(m,{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:i,onConfirm:a,onClose:s,onDestroy:l,onChangeOrder:n,context:t})}):null};function Q(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const X=C.css("production"===process.env.NODE_ENV?{name:"12g0hx0",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1"}:{name:"1hcczik-foreground",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1;label:foreground;",toString:Q}),Z=C.css("production"===process.env.NODE_ENV?{name:"1g95xyq",styles:">*{pointer-events:all;}"}:{name:"123csva-active",styles:">*{pointer-events:all;};label:active;",toString:Q}),ee=C.css("production"===process.env.NODE_ENV?{name:"1fmljv2",styles:"display:flex!important;justify-content:center;align-items:center"}:{name:"1p4unab-visible",styles:"display:flex!important;justify-content:center;align-items:center;label:visible;",toString:Q}),ne=d.memo((({modal:e,handlers:n})=>{const{title:o,subtitle:t,content:r,footer:s}=d.useMemo((()=>e),[e]),{context:i}=$(),{onConfirm:a}=d.useMemo((()=>n),[n]),l=p.useHandle(a),{TitleComponent:c,SubtitleComponent:C,ContentComponent:f,FooterComponent:h}=L();return u.jsxs(d.Fragment,{children:[o&&(m.isString(o)?u.jsx(c,{context:i,children:o}):o),t&&(m.isString(t)?u.jsx(C,{context:i,children:t}):t),r&&(m.isString(r)?u.jsx(f,{context:i,children:r}):p.renderComponent(r,{onConfirm:l})),!1!==s&&("function"==typeof s?s({onConfirm:l,context:i}):u.jsx(h,{onConfirm:l,confirmLabel:s?.confirm,hideConfirm:s?.hideConfirm,context:i}))]})})),oe=d.memo((({modal:e,handlers:n})=>{const{title:o,subtitle:t,content:r,footer:s}=d.useMemo((()=>e),[e]),{context:i}=$(),{onConfirm:a,onClose:l}=d.useMemo((()=>n),[n]),c=p.useHandle(a),C=p.useHandle(l),{TitleComponent:f,SubtitleComponent:h,ContentComponent:g,FooterComponent:b}=L();return u.jsxs(d.Fragment,{children:[o&&(m.isString(o)?u.jsx(f,{context:i,children:o}):o),t&&(m.isString(t)?u.jsx(h,{context:i,children:t}):t),r&&(m.isString(r)?u.jsx(g,{context:i,children:r}):p.renderComponent(r,{onConfirm:c,onCancel:C,context:i})),!1!==s&&("function"==typeof s?s({onConfirm:c,onCancel:C,context:i}):u.jsx(b,{onConfirm:c,onCancel:C,confirmLabel:s?.confirm,cancelLabel:s?.cancel,hideConfirm:s?.hideConfirm,hideCancel:s?.hideCancel,context:i}))]})})),te=d.memo((({modal:e,handlers:n})=>{const{Input:o,defaultValue:t,disabled:r,title:s,subtitle:i,content:a,footer:l}=d.useMemo((()=>({...e,Input:d.memo(p.withErrorBoundary(e.Input))})),[e]),{context:c}=$(),[C,f]=d.useState(t),{onChange:h,onClose:g,onConfirm:b}=d.useMemo((()=>n),[n]),y=p.useHandle(g),v=p.useHandle((e=>{const n=m.isFunction(e)?e(C):e;f(n),h(n)})),x=d.useCallback((()=>{setTimeout((()=>{b()}))}),[b]),k=d.useMemo((()=>!!C&&!!r?.(C)),[r,C]),{TitleComponent:j,SubtitleComponent:w,ContentComponent:D,FooterComponent:B}=L();return u.jsxs(d.Fragment,{children:[s&&(m.isString(s)?u.jsx(j,{context:c,children:s}):s),i&&(m.isString(i)?u.jsx(w,{context:c,children:i}):i),a&&(m.isString(a)?u.jsx(D,{context:c,children:a}):p.renderComponent(a,{onConfirm:x,onCancel:y,context:c})),o&&u.jsx(o,{defaultValue:t,value:C,onChange:v,onConfirm:x,onCancel:y,context:c}),!1!==l&&("function"==typeof l?l({value:C,disabled:k,onChange:v,onConfirm:x,onCancel:y,context:c}):u.jsx(B,{disabled:k,onConfirm:x,onCancel:y,confirmLabel:l?.confirm,cancelLabel:l?.cancel,hideConfirm:l?.hideConfirm,hideCancel:l?.hideCancel,context:c}))]})})),re=({modalId:e,onChangeOrder:n})=>{const{ForegroundComponent:o}=L(),{context:t}=$(),{modal:r,onChange:s,onConfirm:i,onClose:a,onDestroy:l}=O(e),c=d.useMemo((()=>r?.ForegroundComponent||o),[o,r]);return r?u.jsx("div",{className:C.cx(X,{[ee]:r.manualDestroy?r.alive:r.visible,[Z]:r.visible}),children:u.jsxs(c,{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:s,onConfirm:i,onClose:a,onDestroy:l,onChangeOrder:n,context:t,children:["alert"===r.type&&u.jsx(ne,{modal:r,handlers:{onConfirm:i}}),"confirm"===r.type&&u.jsx(oe,{modal:r,handlers:{onConfirm:i,onClose:a}}),"prompt"===r.type&&u.jsx(te,{modal:r,handlers:{onChange:s,onConfirm:i,onClose:a}})]})}):null},se=e=>{const[n,o]=p.useVersion();return d.useEffect((()=>{if(e)return e.subscribe(o)}),[e]),n},ie=C.css("production"===process.env.NODE_ENV?{name:"13dmkf4",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden"}:{name:"yjeu12-presenter",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden;label:presenter;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),{increment:ae}=m.counterFactory(1),le=d.memo((({modalId:e})=>{const n=d.useRef(null),{modal:o}=O(e);se(o);const t=p.useHandle((()=>{n.current&&(n.current.style.zIndex=`${ae()}`)}));return u.jsxs("div",{ref:n,className:ie,children:[u.jsx(K,{modalId:e,onChangeOrder:t}),u.jsx(re,{modalId:e,onChangeOrder:t})]})})),ce=C.css("production"===process.env.NODE_ENV?{name:"2hpasy",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out"}:{name:"lhj8co-anchor",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out;label:anchor;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),ue=e=>e?.visible&&e.dimmed,de=d.memo(p.withErrorBoundary((()=>{const[e,n]=p.useVersion(),{modalIds:o,setUpdater:t}=B();d.useEffect((()=>{t(n)}),[t,n]);const r=q(),s=V(ue,e);return u.jsx("div",{className:ce,style:{transitionDuration:r.duration,backgroundColor:s?r.backdrop:"transparent"},children:m.map(o,(e=>u.jsx(le,{modalId:e},e)))})}))),me=({ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:s,usePathname:i,options:a,context:l,anchor:c})=>f.createPortal(u.jsx(_,{context:l,children:u.jsx(H,{ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:s,options:a,children:u.jsx(D,{usePathname:i,children:u.jsx(de,{})})})}),c),pe=()=>{const e=d.useRef(b.activate()),n=d.useRef(null),[,o]=p.useVersion(),t=d.useCallback((t=>{e.current?(n.current=b.anchor({root:t}),o()):m.printError("ModalProvider is already initialized",["ModalProvider can only be initialized once.","Nesting ModalProvider will be ignored..."],{info:"Something is wrong with the ModalProvider initialization..."})}),[o]);return{anchorRef:n,handleInitialize:t}},Ce=d.forwardRef((({usePathname:e,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:s,FooterComponent:i,options:a,context:l,children:c},m)=>{const C=d.useMemo((()=>e||W),[e]),{anchorRef:f,handleInitialize:h}=pe();return d.useImperativeHandle(m,(()=>({initialize:h})),[h]),p.useOnMount((()=>(null===m&&h(),()=>{f.current&&f.current.remove()}))),u.jsxs(d.Fragment,{children:[c,f.current&&me({ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:s,FooterComponent:i,usePathname:C,options:a,context:l,anchor:f.current})]})}));exports.ModalProvider=Ce,exports.alert=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:s,dimmed:i,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})=>new Promise(((d,m)=>{try{b.open({type:"alert",subtype:e,resolve:()=>d(),title:n,subtitle:o,content:t,background:r,footer:s,dimmed:i,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})}catch(e){m(e)}})),exports.confirm=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:s,dimmed:i,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})=>new Promise(((d,m)=>{try{b.open({type:"confirm",subtype:e,resolve:e=>d(e??!1),title:n,subtitle:o,content:t,background:r,footer:s,dimmed:i,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})}catch(e){m(e)}})),exports.prompt=({defaultValue:e,title:n,subtitle:o,content:t,Input:r,disabled:s,returnOnCancel:i,background:a,footer:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})=>new Promise(((C,f)=>{try{b.open({type:"prompt",resolve:e=>C(e),title:n,subtitle:o,content:t,Input:r,defaultValue:e,disabled:s,returnOnCancel:i,background:a,footer:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})}catch(e){f(e)}})),exports.useActiveModalCount=V,exports.useDestroyAfter=(e,n)=>{const{modal:o,onDestroy:t}=O(e),r=se(o),s=d.useRef({modal:o,onDestroy:t,milliseconds:m.isString(n)?m.convertMsFromDuration(n):n});d.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)}}),[r])},exports.useInitializeModal=({usePathname:e,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:s,FooterComponent:i,options:a,context:l,mode:c="auto"}={})=>{const u=d.useMemo((()=>e||W),[e]),{anchorRef:m,handleInitialize:C}=pe();p.useOnMount((()=>("auto"===c&&C(),()=>{m.current&&m.current.remove()})));const f=d.useCallback((e=>{"manual"===c&&C(e)}),[c,C]);return{portal:m.current&&me({usePathname:u,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:s,FooterComponent:i,options:a,context:l,anchor:m.current}),initialize:f}},exports.useModalAnimation=(e,n)=>{const o=d.useRef(n);o.current=n,d.useLayoutEffect((()=>{if(!o.current)return;let n;return n=e?requestAnimationFrame((()=>o.current.onVisible?.())):requestAnimationFrame((()=>o.current.onHidden?.())),()=>{n&&cancelAnimationFrame(n)}}),[e])},exports.useModalBackdrop=()=>q().backdrop,exports.useModalDuration=()=>{const e=q();return{duration:e.duration,milliseconds:m.convertMsFromDuration(e.duration)}},exports.useModalOptions=q,exports.useSubscribeModal=se;
17
+ function h(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 g(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}"function"==typeof SuppressedError&&SuppressedError;class b{static activate(){return!h(e,e,"f",n)&&g(e,e,!0,"f",n)}static anchor(n){if(h(e,e,"f",o)){const n=document.getElementById(h(e,e,"f",o).id);if(n)return n}const{tag:t="div",prefix:r="promise-modal",root:i=document.body}=n||{},s=document.createElement(t);return s.setAttribute("id",`${r}-${m.getRandomString(36)}`),i.appendChild(s),g(e,e,s,"f",o),s}static get prerender(){return h(e,e,"f",t)}static set openHandler(n){g(e,e,n,"f",r),g(e,e,[],"f",t)}static get unanchored(){return!h(e,e,"f",o)}static reset(){g(e,e,!1,"f",n),g(e,e,null,"f",o),g(e,e,[],"f",t),g(e,e,(n=>h(e,e,"f",t).push(n)),"f",r)}static open(n){h(e,e,"f",r).call(e,n)}}e=b,n={value:!1},o={value:null},t={value:[]},r={value:n=>h(e,e,"f",t).push(n)};class y{get alive(){return h(this,i,"f")}get visible(){return h(this,s,"f")}constructor({id:e,initiator:n,title:o,subtitle:t,background:r,dimmed:c=!0,manualDestroy:u=!1,closeOnBackdropClick:d=!0,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){i.set(this,void 0),s.set(this,void 0),a.set(this,void 0),l.set(this,new Set),this.id=e,this.initiator=n,this.title=o,this.subtitle=t,this.background=r,this.dimmed=c,this.manualDestroy=u,this.closeOnBackdropClick=d,this.ForegroundComponent=p,this.BackgroundComponent=C,g(this,i,!0,"f"),g(this,s,!0,"f"),g(this,a,m,"f")}subscribe(e){return h(this,l,"f").add(e),()=>{h(this,l,"f").delete(e)}}publish(){for(const e of h(this,l,"f"))e()}resolve(e){h(this,a,"f").call(this,e)}onDestroy(){const e=!0===h(this,i,"f");g(this,i,!1,"f"),this.manualDestroy&&e&&this.publish()}onShow(){const e=!1===h(this,s,"f");g(this,s,!0,"f"),e&&this.publish()}onHide(){const e=!0===h(this,s,"f");g(this,s,!1,"f"),e&&this.publish()}}i=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap;class v extends y{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:i,content:s,footer:a,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){super({id:e,initiator:n,title:r,subtitle:i,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}),this.type=o,this.subtype=t,this.content=s,this.footer=a}onClose(){this.resolve(null)}onConfirm(){this.resolve(null)}}class x extends y{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:i,content:s,footer:a,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){super({id:e,initiator:n,title:r,subtitle:i,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}),this.type=o,this.subtype=t,this.content=s,this.footer=a}onClose(){this.resolve(!1)}onConfirm(){this.resolve(!0)}}class k extends y{constructor({id:e,initiator:n,type:o,title:t,subtitle:r,content:i,defaultValue:s,Input:a,disabled:l,returnOnCancel:u,footer:d,background:m,dimmed:p,manualDestroy:C,closeOnBackdropClick:f,resolve:h,ForegroundComponent:b,BackgroundComponent:y}){super({id:e,initiator:n,title:t,subtitle:r,background:m,dimmed:p,manualDestroy:C,closeOnBackdropClick:f,resolve:h,ForegroundComponent:b,BackgroundComponent:y}),c.set(this,void 0),this.type=o,this.content=i,this.Input=a,this.defaultValue=s,g(this,c,s,"f"),this.disabled=l,this.returnOnCancel=u,this.footer=d}onChange(e){g(this,c,e,"f")}onConfirm(){this.resolve(h(this,c,"f")??null)}onClose(){this.returnOnCancel?this.resolve(h(this,c,"f")??null):this.resolve(null)}}c=new WeakMap;const j=e=>{switch(e.type){case"alert":return new v(e);case"confirm":return new x(e);case"prompt":return new k(e)}throw new Error(`Unknown modal: ${e.type}`,{modal:e})},w=d.createContext({}),D=d.memo((({usePathname:e,children:n})=>{const o=d.useRef(new Map),[t,r]=d.useState([]),i=p.useReference(t),{pathname:s}=e(),a=d.useRef(s),l=d.useRef(0),c=q(),C=d.useMemo((()=>m.convertMsFromDuration(c.duration)),[c]);p.useOnMountLayout((()=>{const{manualDestroy:e,closeOnBackdropClick:n}=c;for(const t of b.prerender){const i=j({...t,id:l.current++,initiator:a.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:n});o.current.set(i.id,i),r((e=>[...e,i.id]))}return b.openHandler=t=>{const i=j({...t,id:l.current++,initiator:a.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:n});o.current.set(i.id,i),r((e=>{const n=[];for(const t of e)o.current.get(t)?.alive?n.push(t):o.current.delete(t);return[...n,i.id]}))},()=>{b.reset()}})),d.useLayoutEffect((()=>{for(const e of i.current){const n=o.current.get(e);n?.alive&&(n.initiator===s?n.onShow():n.onHide())}a.current=s}),[s]);const f=d.useCallback((e=>o.current.get(e)),[]),h=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onDestroy(),g.current?.())}),[]),g=d.useRef(void 0),y=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onHide(),g.current?.(),n.manualDestroy||setTimeout((()=>{n.onDestroy()}),C))}),[C]),v=d.useCallback(((e,n)=>{const t=o.current.get(e);t&&"prompt"===t.type&&t.onChange(n)}),[]),x=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onConfirm(),y(e))}),[y]),k=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onClose(),y(e))}),[y]),D=d.useCallback((e=>({modal:f(e),onConfirm:()=>x(e),onClose:()=>k(e),onChange:n=>v(e,n),onDestroy:()=>h(e)})),[f,x,k,v,h]),B=d.useMemo((()=>({modalIds:t,getModalNode:f,onChange:v,onConfirm:x,onClose:k,onDestroy:h,getModal:D,setUpdater:e=>{g.current=e}})),[t,D,f,v,x,k,h]);return u.jsx(w.Provider,{value:B,children:n})})),B=()=>d.useContext(w),O=e=>{const{getModal:n}=B();return d.useMemo((()=>n(e)),[e,n])};function F(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const M=C.css("production"===process.env.NODE_ENV?{name:"131j9g2",styles:"margin:unset"}:{name:"1w3kbco-fallback",styles:"margin:unset;label:fallback;",toString:F}),S=C.css("production"===process.env.NODE_ENV?{name:"1kuk3a3",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black"}:{name:"16dbbea-frame",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black;label:frame;",toString:F}),E=({children:e})=>u.jsx("h2",{className:M,children:e}),N=({children:e})=>u.jsx("h3",{className:M,children:e}),I=({children:e})=>u.jsx("div",{className:M,children:e}),P=({confirmLabel:e,hideConfirm:n=!1,cancelLabel:o,hideCancel:t=!1,disabled:r,onConfirm:i,onCancel:s})=>u.jsxs("div",{children:[!n&&u.jsx("button",{onClick:i,disabled:r,children:e||"확인"}),!t&&"function"==typeof s&&u.jsx("button",{onClick:s,children:o||"취소"})]}),T=e=>e?.visible,V=(e=T,n=0)=>{const{modalIds:o,getModalNode:t}=B();return d.useMemo((()=>{let n=0;for(const r of o)e(t(r))&&n++;return n}),[t,o,n])},z=d.forwardRef((({id:e,onChangeOrder:n,children:o},t)=>{const r=V(),[i,s]=d.useMemo((()=>{const n=r>1;return[n?Math.floor(e/5)%3*100:0,n?e%5*35:0]}),[r,e]);return u.jsx("div",{ref:t,className:S,onClick:n,style:{marginBottom:`calc(25vh + ${i}px)`,marginLeft:`${i}px`,transform:`translate(${s}px, ${s}px)`},children:o})})),R=d.createContext({}),H=d.memo((({ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:i,options:s,children:a})=>{const l=d.useMemo((()=>({BackgroundComponent:n,ForegroundComponent:e||z,TitleComponent:o||E,SubtitleComponent:t||N,ContentComponent:d.memo(r||I),FooterComponent:d.memo(i||P),options:{duration:"300ms",backdrop:"rgba(0, 0, 0, 0.5)",closeOnBackdropClick:!0,manualDestroy:!1,...s}})),[e,n,r,i,t,o,s]);return u.jsx(R.Provider,{value:l,children:a})})),L=()=>d.useContext(R),q=()=>d.useContext(R).options,A=d.createContext({}),_=({context:e,children:n})=>{const o=d.useMemo((()=>({context:e||{}})),[e]);return u.jsx(A.Provider,{value:o,children:n})},$=()=>d.useContext(A),W=()=>{const[e,n]=d.useState(window.location.pathname);return d.useLayoutEffect((()=>{let o;const t=()=>{o&&cancelAnimationFrame(o),e!==window.location.pathname?n(window.location.pathname):o=requestAnimationFrame(t)};return o=requestAnimationFrame(t),()=>{o&&cancelAnimationFrame(o)}}),[e]),{pathname:e}};function Y(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const U=C.css("production"===process.env.NODE_ENV?{name:"u7uu4v",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;}"}:{name:"coymdj-background",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;};label:background;",toString:Y}),G=C.css("production"===process.env.NODE_ENV?{name:"n07k1x",styles:"pointer-events:all"}:{name:"1hektcs-active",styles:"pointer-events:all;label:active;",toString:Y}),J=C.css("production"===process.env.NODE_ENV?{name:"1wnowod",styles:"display:flex;align-items:center;justify-content:center"}:{name:"xppew7-visible",styles:"display:flex;align-items:center;justify-content:center;label:visible;",toString:Y}),K=({modalId:e,onChangeOrder:n})=>{const{BackgroundComponent:o}=L(),{context:t}=$(),{modal:r,onClose:i,onChange:s,onConfirm:a,onDestroy:l}=O(e),c=d.useCallback((e=>{r&&r.closeOnBackdropClick&&r.visible&&i(),e.stopPropagation()}),[r,i]),m=d.useMemo((()=>r?.BackgroundComponent||o),[o,r]);return r?u.jsx("div",{className:C.cx(U,{[J]:r.manualDestroy?r.alive:r.visible,[G]:r.closeOnBackdropClick&&r.visible}),onClick:c,children:m&&u.jsx(m,{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:s,onConfirm:a,onClose:i,onDestroy:l,onChangeOrder:n,context:t})}):null};function Q(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const X=C.css("production"===process.env.NODE_ENV?{name:"12g0hx0",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1"}:{name:"1hcczik-foreground",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1;label:foreground;",toString:Q}),Z=C.css("production"===process.env.NODE_ENV?{name:"1g95xyq",styles:">*{pointer-events:all;}"}:{name:"123csva-active",styles:">*{pointer-events:all;};label:active;",toString:Q}),ee=C.css("production"===process.env.NODE_ENV?{name:"1fmljv2",styles:"display:flex!important;justify-content:center;align-items:center"}:{name:"1p4unab-visible",styles:"display:flex!important;justify-content:center;align-items:center;label:visible;",toString:Q}),ne=d.memo((({modal:e,handlers:n})=>{const{title:o,subtitle:t,content:r,footer:i}=d.useMemo((()=>e),[e]),{context:s}=$(),{onConfirm:a}=d.useMemo((()=>n),[n]),l=p.useHandle(a),{TitleComponent:c,SubtitleComponent:C,ContentComponent:f,FooterComponent:h}=L();return u.jsxs(d.Fragment,{children:[o&&(m.isString(o)?u.jsx(c,{context:s,children:o}):o),t&&(m.isString(t)?u.jsx(C,{context:s,children:t}):t),r&&(m.isString(r)?u.jsx(f,{context:s,children:r}):p.renderComponent(r,{onConfirm:l})),!1!==i&&("function"==typeof i?i({onConfirm:l,context:s}):u.jsx(h,{onConfirm:l,confirmLabel:i?.confirm,hideConfirm:i?.hideConfirm,context:s}))]})})),oe=d.memo((({modal:e,handlers:n})=>{const{title:o,subtitle:t,content:r,footer:i}=d.useMemo((()=>e),[e]),{context:s}=$(),{onConfirm:a,onClose:l}=d.useMemo((()=>n),[n]),c=p.useHandle(a),C=p.useHandle(l),{TitleComponent:f,SubtitleComponent:h,ContentComponent:g,FooterComponent:b}=L();return u.jsxs(d.Fragment,{children:[o&&(m.isString(o)?u.jsx(f,{context:s,children:o}):o),t&&(m.isString(t)?u.jsx(h,{context:s,children:t}):t),r&&(m.isString(r)?u.jsx(g,{context:s,children:r}):p.renderComponent(r,{onConfirm:c,onCancel:C,context:s})),!1!==i&&("function"==typeof i?i({onConfirm:c,onCancel:C,context:s}):u.jsx(b,{onConfirm:c,onCancel:C,confirmLabel:i?.confirm,cancelLabel:i?.cancel,hideConfirm:i?.hideConfirm,hideCancel:i?.hideCancel,context:s}))]})})),te=d.memo((({modal:e,handlers:n})=>{const{Input:o,defaultValue:t,disabled:r,title:i,subtitle:s,content:a,footer:l}=d.useMemo((()=>({...e,Input:d.memo(p.withErrorBoundary(e.Input))})),[e]),{context:c}=$(),[C,f]=d.useState(t),{onChange:h,onClose:g,onConfirm:b}=d.useMemo((()=>n),[n]),y=p.useHandle(g),v=p.useHandle((e=>{const n=m.isFunction(e)?e(C):e;f(n),h(n)})),x=d.useCallback((()=>{setTimeout((()=>{b()}))}),[b]),k=d.useMemo((()=>!!C&&!!r?.(C)),[r,C]),{TitleComponent:j,SubtitleComponent:w,ContentComponent:D,FooterComponent:B}=L();return u.jsxs(d.Fragment,{children:[i&&(m.isString(i)?u.jsx(j,{context:c,children:i}):i),s&&(m.isString(s)?u.jsx(w,{context:c,children:s}):s),a&&(m.isString(a)?u.jsx(D,{context:c,children:a}):p.renderComponent(a,{onConfirm:x,onCancel:y,context:c})),o&&u.jsx(o,{defaultValue:t,value:C,onChange:v,onConfirm:x,onCancel:y,context:c}),!1!==l&&("function"==typeof l?l({value:C,disabled:k,onChange:v,onConfirm:x,onCancel:y,context:c}):u.jsx(B,{disabled:k,onConfirm:x,onCancel:y,confirmLabel:l?.confirm,cancelLabel:l?.cancel,hideConfirm:l?.hideConfirm,hideCancel:l?.hideCancel,context:c}))]})})),re=({modalId:e,onChangeOrder:n})=>{const{ForegroundComponent:o}=L(),{context:t}=$(),{modal:r,onChange:i,onConfirm:s,onClose:a,onDestroy:l}=O(e),c=d.useMemo((()=>r?.ForegroundComponent||o),[o,r]);return r?u.jsx("div",{className:C.cx(X,{[ee]:r.manualDestroy?r.alive:r.visible,[Z]:r.visible}),children:u.jsxs(c,{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:i,onConfirm:s,onClose:a,onDestroy:l,onChangeOrder:n,context:t,children:["alert"===r.type&&u.jsx(ne,{modal:r,handlers:{onConfirm:s}}),"confirm"===r.type&&u.jsx(oe,{modal:r,handlers:{onConfirm:s,onClose:a}}),"prompt"===r.type&&u.jsx(te,{modal:r,handlers:{onChange:i,onConfirm:s,onClose:a}})]})}):null},ie=e=>{const[n,o]=p.useVersion();return d.useEffect((()=>{if(e)return e.subscribe(o)}),[e]),n},se=C.css("production"===process.env.NODE_ENV?{name:"13dmkf4",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden"}:{name:"yjeu12-presenter",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden;label:presenter;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),{increment:ae}=m.counterFactory(1),le=d.memo((({modalId:e})=>{const n=d.useRef(null),{modal:o}=O(e);ie(o);const t=p.useHandle((()=>{n.current&&(n.current.style.zIndex=`${ae()}`)}));return u.jsxs("div",{ref:n,className:se,children:[u.jsx(K,{modalId:e,onChangeOrder:t}),u.jsx(re,{modalId:e,onChangeOrder:t})]})})),ce=C.css("production"===process.env.NODE_ENV?{name:"2hpasy",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out"}:{name:"lhj8co-anchor",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out;label:anchor;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),ue=e=>e?.visible&&e.dimmed,de=d.memo(p.withErrorBoundary((()=>{const[e,n]=p.useVersion(),{modalIds:o,setUpdater:t}=B();d.useEffect((()=>{t(n)}),[t,n]);const r=q(),i=V(ue,e);return u.jsx("div",{className:ce,style:{transitionDuration:r.duration,backgroundColor:i?r.backdrop:"transparent"},children:m.map(o,(e=>u.jsx(le,{modalId:e},e)))})}))),me=({ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:i,usePathname:s,options:a,context:l,anchor:c})=>f.createPortal(u.jsx(_,{context:l,children:u.jsx(H,{ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:i,options:a,children:u.jsx(D,{usePathname:s,children:u.jsx(de,{})})})}),c),pe=()=>{const e=d.useRef(b.activate()),n=d.useRef(null),[,o]=p.useVersion(),t=d.useCallback((t=>{e.current?(n.current=b.anchor({root:t}),o()):m.printError("ModalProvider is already initialized",["ModalProvider can only be initialized once.","Nesting ModalProvider will be ignored..."],{info:"Something is wrong with the ModalProvider initialization..."})}),[o]);return{anchorRef:n,handleInitialize:t}},Ce=d.forwardRef((({usePathname:e,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:i,FooterComponent:s,options:a,context:l,children:c},m)=>{const C=d.useMemo((()=>e||W),[e]),{anchorRef:f,handleInitialize:h}=pe();return d.useImperativeHandle(m,(()=>({initialize:h})),[h]),p.useOnMount((()=>(null===m&&h(),()=>{f.current&&f.current.remove()}))),u.jsxs(d.Fragment,{children:[c,f.current&&me({ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:i,FooterComponent:s,usePathname:C,options:a,context:l,anchor:f.current})]})}));exports.ModalProvider=Ce,exports.alert=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:i,dimmed:s,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})=>new Promise(((d,m)=>{try{b.open({type:"alert",subtype:e,resolve:()=>d(),title:n,subtitle:o,content:t,background:r,footer:i,dimmed:s,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})}catch(e){m(e)}})),exports.confirm=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:i,dimmed:s,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})=>new Promise(((d,m)=>{try{b.open({type:"confirm",subtype:e,resolve:e=>d(e??!1),title:n,subtitle:o,content:t,background:r,footer:i,dimmed:s,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})}catch(e){m(e)}})),exports.prompt=({defaultValue:e,title:n,subtitle:o,content:t,Input:r,disabled:i,returnOnCancel:s,background:a,footer:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})=>new Promise(((C,f)=>{try{b.open({type:"prompt",resolve:e=>C(e),title:n,subtitle:o,content:t,Input:r,defaultValue:e,disabled:i,returnOnCancel:s,background:a,footer:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})}catch(e){f(e)}})),exports.useActiveModalCount=V,exports.useDestroyAfter=(e,n)=>{const{modal:o,onDestroy:t}=O(e),r=ie(o),i=d.useRef({modal:o,onDestroy:t,milliseconds:m.isString(n)?m.convertMsFromDuration(n):n});d.useEffect((()=>{const{modal:e,onDestroy:n,milliseconds:o}=i.current;if(!e||e.visible||!e.alive)return;const t=setTimeout((()=>{n()}),o);return()=>{t&&clearTimeout(t)}}),[r])},exports.useInitializeModal=({usePathname:e,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:i,FooterComponent:s,options:a,context:l,mode:c="auto"}={})=>{const u=d.useMemo((()=>e||W),[e]),{anchorRef:m,handleInitialize:C}=pe();p.useOnMount((()=>("auto"===c&&C(),()=>{m.current&&m.current.remove()})));const f=d.useCallback((e=>{"manual"===c&&C(e)}),[c,C]);return{portal:m.current&&me({usePathname:u,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:i,FooterComponent:s,options:a,context:l,anchor:m.current}),initialize:f}},exports.useModalAnimation=(e,n)=>{const o=d.useRef(n);o.current=n,d.useLayoutEffect((()=>{if(!o.current)return;let n;return n=e?requestAnimationFrame((()=>o.current.onVisible?.())):requestAnimationFrame((()=>o.current.onHidden?.())),()=>{n&&cancelAnimationFrame(n)}}),[e])},exports.useModalBackdrop=()=>q().backdrop,exports.useModalDuration=()=>{const e=q();return{duration:e.duration,milliseconds:m.convertMsFromDuration(e.duration)}},exports.useModalOptions=q,exports.useSubscribeModal=ie;
18
18
  //# sourceMappingURL=index.cjs.js.map